mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-15 01:03:03 +08:00
refactor(): minor updates for next stencil version (#20787)
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
import * as d from './proxies';
|
import * as d from './proxies';
|
||||||
|
|
||||||
export const DIRECTIVES = [
|
export const DIRECTIVES = [
|
||||||
d.IonApp,
|
d.IonApp,
|
||||||
d.IonAvatar,
|
d.IonAvatar,
|
||||||
d.IonBackButton,
|
d.IonBackButton,
|
||||||
d.IonBackdrop,
|
d.IonBackdrop,
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable */
|
||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
import { fromEvent } from 'rxjs';
|
import { fromEvent } from 'rxjs';
|
||||||
|
|
||||||
@ -31,7 +32,6 @@ export const proxyOutputs = (instance: any, el: any, events: string[]) => {
|
|||||||
events.forEach(eventName => instance[eventName] = fromEvent(el, eventName));
|
events.forEach(eventName => instance[eventName] = fromEvent(el, eventName));
|
||||||
}
|
}
|
||||||
|
|
||||||
// tslint:disable-next-line: only-arrow-functions
|
|
||||||
export function ProxyCmp(opts: { inputs?: any; methods?: any }) {
|
export function ProxyCmp(opts: { inputs?: any; methods?: any }) {
|
||||||
const decorator = function(cls: any){
|
const decorator = function(cls: any){
|
||||||
if (opts.inputs) {
|
if (opts.inputs) {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -34,9 +34,9 @@
|
|||||||
"tslib": "^1.10.0"
|
"tslib": "^1.10.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@stencil/core": "1.8.11",
|
"@stencil/core": "1.11.2",
|
||||||
"@stencil/sass": "1.0.1",
|
"@stencil/sass": "1.1.1",
|
||||||
"@types/jest": "24.0.21",
|
"@types/jest": "24.9.0",
|
||||||
"@types/node": "12.12.3",
|
"@types/node": "12.12.3",
|
||||||
"@types/puppeteer": "1.19.1",
|
"@types/puppeteer": "1.19.1",
|
||||||
"@types/swiper": "4.4.4",
|
"@types/swiper": "4.4.4",
|
||||||
@ -49,7 +49,7 @@
|
|||||||
"np": "^5.0.3",
|
"np": "^5.0.3",
|
||||||
"pixelmatch": "4.0.2",
|
"pixelmatch": "4.0.2",
|
||||||
"puppeteer": "1.20.0",
|
"puppeteer": "1.20.0",
|
||||||
"rollup": "1.19.4",
|
"rollup": "1.32.0",
|
||||||
"rollup-plugin-node-resolve": "5.2.0",
|
"rollup-plugin-node-resolve": "5.2.0",
|
||||||
"rollup-plugin-virtual": "^1.0.1",
|
"rollup-plugin-virtual": "^1.0.1",
|
||||||
"sass": "^1.22.9",
|
"sass": "^1.22.9",
|
||||||
|
3401
core/src/components.d.ts
vendored
3401
core/src/components.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@ -25,7 +25,6 @@ export class ActionSheet implements ComponentInterface, OverlayInterface {
|
|||||||
|
|
||||||
presented = false;
|
presented = false;
|
||||||
animation?: any;
|
animation?: any;
|
||||||
mode = getIonMode(this);
|
|
||||||
|
|
||||||
@Element() el!: HTMLIonActionSheetElement;
|
@Element() el!: HTMLIonActionSheetElement;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Component, ComponentInterface, Element, Event, EventEmitter, Host, Method, Prop, Watch, h } from '@stencil/core';
|
import { Component, ComponentInterface, Element, Event, EventEmitter, Host, Method, Prop, Watch, forceUpdate, h } from '@stencil/core';
|
||||||
|
|
||||||
import { getIonMode } from '../../global/ionic-global';
|
import { getIonMode } from '../../global/ionic-global';
|
||||||
import { AlertButton, AlertInput, AnimationBuilder, CssClassMap, OverlayEventDetail, OverlayInterface } from '../../interface';
|
import { AlertButton, AlertInput, AnimationBuilder, CssClassMap, OverlayEventDetail, OverlayInterface } from '../../interface';
|
||||||
@ -30,7 +30,6 @@ export class Alert implements ComponentInterface, OverlayInterface {
|
|||||||
private processedButtons: AlertButton[] = [];
|
private processedButtons: AlertButton[] = [];
|
||||||
|
|
||||||
presented = false;
|
presented = false;
|
||||||
mode = getIonMode(this);
|
|
||||||
|
|
||||||
@Element() el!: HTMLIonAlertElement;
|
@Element() el!: HTMLIonAlertElement;
|
||||||
|
|
||||||
@ -215,13 +214,13 @@ export class Alert implements ComponentInterface, OverlayInterface {
|
|||||||
}
|
}
|
||||||
this.activeId = selectedInput.id;
|
this.activeId = selectedInput.id;
|
||||||
safeCall(selectedInput.handler, selectedInput);
|
safeCall(selectedInput.handler, selectedInput);
|
||||||
this.el.forceUpdate();
|
forceUpdate(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private cbClick(selectedInput: AlertInput) {
|
private cbClick(selectedInput: AlertInput) {
|
||||||
selectedInput.checked = !selectedInput.checked;
|
selectedInput.checked = !selectedInput.checked;
|
||||||
safeCall(selectedInput.handler, selectedInput);
|
safeCall(selectedInput.handler, selectedInput);
|
||||||
this.el.forceUpdate();
|
forceUpdate(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private buttonClick(button: AlertButton) {
|
private buttonClick(button: AlertButton) {
|
||||||
|
@ -19,7 +19,6 @@ import { createColorClasses, hostContext, openURL } from '../../utils/theme';
|
|||||||
})
|
})
|
||||||
export class BackButton implements ComponentInterface, ButtonInterface {
|
export class BackButton implements ComponentInterface, ButtonInterface {
|
||||||
|
|
||||||
mode = getIonMode(this);
|
|
||||||
@Element() el!: HTMLElement;
|
@Element() el!: HTMLElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -61,7 +60,7 @@ export class BackButton implements ComponentInterface, ButtonInterface {
|
|||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.mode === 'ios') {
|
if (getIonMode(this) === 'ios') {
|
||||||
// default ios back button icon
|
// default ios back button icon
|
||||||
return config.get('backButtonIcon', 'chevron-back');
|
return config.get('backButtonIcon', 'chevron-back');
|
||||||
}
|
}
|
||||||
@ -71,7 +70,7 @@ export class BackButton implements ComponentInterface, ButtonInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get backButtonText() {
|
get backButtonText() {
|
||||||
const defaultBackButtonText = this.mode === 'ios' ? 'Back' : null;
|
const defaultBackButtonText = getIonMode(this) === 'ios' ? 'Back' : null;
|
||||||
return this.text != null ? this.text : config.get('backButtonText', defaultBackButtonText);
|
return this.text != null ? this.text : config.get('backButtonText', defaultBackButtonText);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,8 +99,9 @@ export class BackButton implements ComponentInterface, ButtonInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { color, defaultHref, disabled, type, mode, hasIconOnly, backButtonIcon, backButtonText } = this;
|
const { color, defaultHref, disabled, type, hasIconOnly, backButtonIcon, backButtonText } = this;
|
||||||
const showBackButton = defaultHref !== undefined;
|
const showBackButton = defaultHref !== undefined;
|
||||||
|
const mode = getIonMode(this);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Host
|
<Host
|
||||||
|
@ -1,18 +1,28 @@
|
|||||||
|
import { newSpecPage } from '@stencil/core/testing';
|
||||||
import { BackButton } from "../back-button";
|
import { BackButton } from "../back-button";
|
||||||
import { config } from "../../../global/config";
|
import { config } from "../../../global/config";
|
||||||
|
import { setMode } from '@stencil/core';
|
||||||
|
|
||||||
|
|
||||||
describe('back button', () => {
|
describe('back button', () => {
|
||||||
let bb: BackButton;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
config.reset({});
|
config.reset({});
|
||||||
bb = new BackButton();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const newBackButton = async (mode: string = 'md'): Promise<BackButton> => {
|
||||||
|
setMode(() => mode);
|
||||||
|
const { rootInstance } = await newSpecPage({
|
||||||
|
components: [BackButton],
|
||||||
|
html: `<ion-back-button></ion-back-button>`
|
||||||
|
})
|
||||||
|
return rootInstance;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
describe('backButtonIcon', () => {
|
describe('backButtonIcon', () => {
|
||||||
|
|
||||||
it('set custom icon on the instance, override config', () => {
|
it('set custom icon on the instance, override config', async () => {
|
||||||
|
const bb = await newBackButton();
|
||||||
bb.icon = 'custom-icon-instance';
|
bb.icon = 'custom-icon-instance';
|
||||||
config.reset({
|
config.reset({
|
||||||
backButtonIcon: 'custom-icon-config'
|
backButtonIcon: 'custom-icon-config'
|
||||||
@ -20,24 +30,27 @@ describe('back button', () => {
|
|||||||
expect(bb.backButtonIcon).toBe('custom-icon-instance');
|
expect(bb.backButtonIcon).toBe('custom-icon-instance');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('set custom icon in the config', () => {
|
it('set custom icon in the config', async () => {
|
||||||
|
const bb = await newBackButton();
|
||||||
config.reset({
|
config.reset({
|
||||||
backButtonIcon: 'custom-icon-config'
|
backButtonIcon: 'custom-icon-config'
|
||||||
});
|
});
|
||||||
expect(bb.backButtonIcon).toBe('custom-icon-config');
|
expect(bb.backButtonIcon).toBe('custom-icon-config');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('set custom icon on the instance', () => {
|
it('set custom icon on the instance', async () => {
|
||||||
|
const bb = await newBackButton();
|
||||||
bb.icon = 'custom-icon-instance';
|
bb.icon = 'custom-icon-instance';
|
||||||
expect(bb.backButtonIcon).toBe('custom-icon-instance');
|
expect(bb.backButtonIcon).toBe('custom-icon-instance');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('default icon for ios mode', () => {
|
it('default icon for ios mode', async () => {
|
||||||
bb.mode = 'ios';
|
const bb = await newBackButton('ios');
|
||||||
expect(bb.backButtonIcon).toBe('chevron-back');
|
expect(bb.backButtonIcon).toBe('chevron-back');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('default icon', () => {
|
it('default icon', async () => {
|
||||||
|
const bb = await newBackButton();
|
||||||
expect(bb.backButtonIcon).toBe('arrow-back-sharp');
|
expect(bb.backButtonIcon).toBe('arrow-back-sharp');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -45,12 +58,13 @@ describe('back button', () => {
|
|||||||
|
|
||||||
describe('backButtonText', () => {
|
describe('backButtonText', () => {
|
||||||
|
|
||||||
it('default text for ios mode', () => {
|
it('default text for ios mode', async () => {
|
||||||
bb.mode = 'ios';
|
const bb = await newBackButton('ios');
|
||||||
expect(bb.backButtonText).toBe('Back');
|
expect(bb.backButtonText).toBe('Back');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('default text', () => {
|
it('default text', async () => {
|
||||||
|
const bb = await newBackButton();
|
||||||
expect(bb.backButtonText).toBe(null);
|
expect(bb.backButtonText).toBe(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ import { createColorClasses, hostContext, openURL } from '../../utils/theme';
|
|||||||
* @slot start - Content is placed to the left of the button text in LTR, and to the right in RTL.
|
* @slot start - Content is placed to the left of the button text in LTR, and to the right in RTL.
|
||||||
* @slot end - Content is placed to the right of the button text in LTR, and to the left in RTL.
|
* @slot end - Content is placed to the right of the button text in LTR, and to the left in RTL.
|
||||||
*
|
*
|
||||||
* @part button - The native button or anchor tag that is rendered.
|
* @TODOpart button - The native button or anchor tag that is rendered.
|
||||||
* @part button-inner - The span inside of the native button or anchor.
|
* @TODOpart button-inner - The span inside of the native button or anchor.
|
||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
tag: 'ion-button',
|
tag: 'ion-button',
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Component, ComponentInterface, Element, Host, Listen, Prop, h } from '@stencil/core';
|
import { Component, ComponentInterface, Host, Listen, Prop, forceUpdate, h } from '@stencil/core';
|
||||||
|
|
||||||
import { getIonMode } from '../../global/ionic-global';
|
import { getIonMode } from '../../global/ionic-global';
|
||||||
import { matchBreakpoint } from '../../utils/media';
|
import { matchBreakpoint } from '../../utils/media';
|
||||||
@ -14,8 +14,6 @@ const BREAKPOINTS = ['', 'xs', 'sm', 'md', 'lg', 'xl'];
|
|||||||
})
|
})
|
||||||
export class Col implements ComponentInterface {
|
export class Col implements ComponentInterface {
|
||||||
|
|
||||||
@Element() el!: HTMLIonColElement;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The amount to offset the column, in terms of how many columns it should shift to the end
|
* The amount to offset the column, in terms of how many columns it should shift to the end
|
||||||
* of the total available.
|
* of the total available.
|
||||||
@ -158,7 +156,7 @@ export class Col implements ComponentInterface {
|
|||||||
|
|
||||||
@Listen('resize', { target: 'window' })
|
@Listen('resize', { target: 'window' })
|
||||||
onResize() {
|
onResize() {
|
||||||
this.el.forceUpdate();
|
forceUpdate(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop through all of the breakpoints to see if the media query
|
// Loop through all of the breakpoints to see if the media query
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Component, ComponentInterface, Element, Event, EventEmitter, Host, Listen, Method, Prop, h, readTask } from '@stencil/core';
|
import { Component, ComponentInterface, Element, Event, EventEmitter, Host, Listen, Method, Prop, forceUpdate, h, readTask } from '@stencil/core';
|
||||||
|
|
||||||
import { config } from '../../global/config';
|
import { config } from '../../global/config';
|
||||||
import { getIonMode } from '../../global/ionic-global';
|
import { getIonMode } from '../../global/ionic-global';
|
||||||
@ -24,7 +24,6 @@ export class Content implements ComponentInterface {
|
|||||||
private cTop = -1;
|
private cTop = -1;
|
||||||
private cBottom = -1;
|
private cBottom = -1;
|
||||||
private scrollEl!: HTMLElement;
|
private scrollEl!: HTMLElement;
|
||||||
private mode = getIonMode(this);
|
|
||||||
|
|
||||||
// Detail is used in a hot loop in the scroll event, by allocating it here
|
// Detail is used in a hot loop in the scroll event, by allocating it here
|
||||||
// V8 will be able to inline any read/write to it since it's a monomorphic class.
|
// V8 will be able to inline any read/write to it since it's a monomorphic class.
|
||||||
@ -120,7 +119,8 @@ export class Content implements ComponentInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private shouldForceOverscroll() {
|
private shouldForceOverscroll() {
|
||||||
const { forceOverscroll, mode } = this;
|
const { forceOverscroll } = this;
|
||||||
|
const mode = getIonMode(this);
|
||||||
return forceOverscroll === undefined
|
return forceOverscroll === undefined
|
||||||
? mode === 'ios' && isPlatform('ios')
|
? mode === 'ios' && isPlatform('ios')
|
||||||
: forceOverscroll;
|
: forceOverscroll;
|
||||||
@ -131,7 +131,7 @@ export class Content implements ComponentInterface {
|
|||||||
readTask(this.readDimensions.bind(this));
|
readTask(this.readDimensions.bind(this));
|
||||||
} else if (this.cTop !== 0 || this.cBottom !== 0) {
|
} else if (this.cTop !== 0 || this.cBottom !== 0) {
|
||||||
this.cTop = this.cBottom = 0;
|
this.cTop = this.cBottom = 0;
|
||||||
this.el.forceUpdate();
|
forceUpdate(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ export class Content implements ComponentInterface {
|
|||||||
if (dirty) {
|
if (dirty) {
|
||||||
this.cTop = top;
|
this.cTop = top;
|
||||||
this.cBottom = bottom;
|
this.cBottom = bottom;
|
||||||
this.el.forceUpdate();
|
forceUpdate(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Component, ComponentInterface, Element, Host, Listen, Prop, State, h } from '@stencil/core';
|
import { Component, ComponentInterface, Element, Host, Listen, Prop, State, forceUpdate, h } from '@stencil/core';
|
||||||
|
|
||||||
import { getIonMode } from '../../global/ionic-global';
|
import { getIonMode } from '../../global/ionic-global';
|
||||||
import { Color, CssClassMap, RouterDirection, StyleEventDetail } from '../../interface';
|
import { Color, CssClassMap, RouterDirection, StyleEventDetail } from '../../interface';
|
||||||
@ -123,7 +123,7 @@ export class Item implements ComponentInterface, AnchorInterface, ButtonInterfac
|
|||||||
}
|
}
|
||||||
if (hasStyleChange) {
|
if (hasStyleChange) {
|
||||||
this.itemStyles.set(tagName, newStyles);
|
this.itemStyles.set(tagName, newStyles);
|
||||||
this.el.forceUpdate();
|
forceUpdate(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@ export class Loading implements ComponentInterface, OverlayInterface {
|
|||||||
private durationTimeout: any;
|
private durationTimeout: any;
|
||||||
|
|
||||||
presented = false;
|
presented = false;
|
||||||
mode = getIonMode(this);
|
|
||||||
|
|
||||||
@Element() el!: HTMLIonLoadingElement;
|
@Element() el!: HTMLIonLoadingElement;
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ import { Animation, Side } from '../../interface';
|
|||||||
|
|
||||||
export interface MenuI {
|
export interface MenuI {
|
||||||
el: HTMLIonMenuElement;
|
el: HTMLIonMenuElement;
|
||||||
mode: string;
|
|
||||||
side: Side;
|
side: Side;
|
||||||
menuId?: string;
|
menuId?: string;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
|
@ -28,11 +28,6 @@ export class Menu implements ComponentInterface, MenuI {
|
|||||||
private gesture?: Gesture;
|
private gesture?: Gesture;
|
||||||
private blocker = GESTURE_CONTROLLER.createBlocker({ disableScroll: true });
|
private blocker = GESTURE_CONTROLLER.createBlocker({ disableScroll: true });
|
||||||
|
|
||||||
mode = getIonMode(this);
|
|
||||||
|
|
||||||
private easing: string = this.mode === 'ios' ? iosEasing : mdEasing;
|
|
||||||
private easingReverse: string = this.mode === 'ios' ? iosEasingReverse : mdEasingReverse;
|
|
||||||
|
|
||||||
isAnimating = false;
|
isAnimating = false;
|
||||||
width!: number; // TODO
|
width!: number; // TODO
|
||||||
_isOpen = false;
|
_isOpen = false;
|
||||||
@ -335,9 +330,12 @@ AFTER:
|
|||||||
|
|
||||||
private async startAnimation(shouldOpen: boolean, animated: boolean): Promise<void> {
|
private async startAnimation(shouldOpen: boolean, animated: boolean): Promise<void> {
|
||||||
const isReversed = !shouldOpen;
|
const isReversed = !shouldOpen;
|
||||||
|
const mode = getIonMode(this);
|
||||||
|
const easing = mode === 'ios' ? iosEasing : mdEasing;
|
||||||
|
const easingReverse = mode === 'ios' ? iosEasingReverse : mdEasingReverse;
|
||||||
const ani = (this.animation as Animation)!
|
const ani = (this.animation as Animation)!
|
||||||
.direction((isReversed) ? 'reverse' : 'normal')
|
.direction((isReversed) ? 'reverse' : 'normal')
|
||||||
.easing((isReversed) ? this.easingReverse : this.easing)
|
.easing((isReversed) ? easingReverse : easing)
|
||||||
.onFinish(() => {
|
.onFinish(() => {
|
||||||
if (ani.getDirection() === 'reverse') {
|
if (ani.getDirection() === 'reverse') {
|
||||||
ani.direction('normal');
|
ani.direction('normal');
|
||||||
@ -554,7 +552,8 @@ AFTER:
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { isEndSide, type, disabled, mode, isPaneVisible } = this;
|
const { isEndSide, type, disabled, isPaneVisible } = this;
|
||||||
|
const mode = getIonMode(this);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Host
|
<Host
|
||||||
|
@ -35,7 +35,6 @@ export class Modal implements ComponentInterface, OverlayInterface {
|
|||||||
private gestureAnimationDismissing = false;
|
private gestureAnimationDismissing = false;
|
||||||
presented = false;
|
presented = false;
|
||||||
animation?: Animation;
|
animation?: Animation;
|
||||||
mode = getIonMode(this);
|
|
||||||
|
|
||||||
@Element() el!: HTMLIonModalElement;
|
@Element() el!: HTMLIonModalElement;
|
||||||
|
|
||||||
|
@ -22,8 +22,6 @@ import { iosLeaveAnimation } from './animations/ios.leave';
|
|||||||
export class Picker implements ComponentInterface, OverlayInterface {
|
export class Picker implements ComponentInterface, OverlayInterface {
|
||||||
private durationTimeout: any;
|
private durationTimeout: any;
|
||||||
|
|
||||||
mode = getIonMode(this);
|
|
||||||
|
|
||||||
@Element() el!: HTMLIonPickerElement;
|
@Element() el!: HTMLIonPickerElement;
|
||||||
|
|
||||||
@State() presented = false;
|
@State() presented = false;
|
||||||
|
@ -28,7 +28,6 @@ export class Popover implements ComponentInterface, OverlayInterface {
|
|||||||
private usersElement?: HTMLElement;
|
private usersElement?: HTMLElement;
|
||||||
|
|
||||||
presented = false;
|
presented = false;
|
||||||
mode = getIonMode(this);
|
|
||||||
|
|
||||||
@Element() el!: HTMLIonPopoverElement;
|
@Element() el!: HTMLIonPopoverElement;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as pd from '@stencil/core/dist/testing/puppeteer/puppeteer-declarations';
|
import * as pd from '@stencil/core/testing';
|
||||||
|
|
||||||
import { dragElementBy, queryDeep } from '../../../utils/test/utils';
|
import { dragElementBy, queryDeep } from '../../../utils/test/utils';
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ import { ComponentProps } from '../../../interface';
|
|||||||
|
|
||||||
export interface HTMLStencilElement extends HTMLElement {
|
export interface HTMLStencilElement extends HTMLElement {
|
||||||
componentOnReady(): Promise<this>;
|
componentOnReady(): Promise<this>;
|
||||||
forceUpdate(): void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NavOutlet {
|
export interface NavOutlet {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Component, ComponentInterface, Element, Event, EventEmitter, Host, Method, Prop, State, Watch, h } from '@stencil/core';
|
import { Component, ComponentInterface, Element, Event, EventEmitter, Host, Method, Prop, State, Watch, forceUpdate, h } from '@stencil/core';
|
||||||
|
|
||||||
import { config } from '../../global/config';
|
import { config } from '../../global/config';
|
||||||
import { getIonMode } from '../../global/ionic-global';
|
import { getIonMode } from '../../global/ionic-global';
|
||||||
@ -179,7 +179,7 @@ export class Searchbar implements ComponentInterface {
|
|||||||
protected showCancelButtonChanged() {
|
protected showCancelButtonChanged() {
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
this.positionElements();
|
this.positionElements();
|
||||||
this.el.forceUpdate();
|
forceUpdate(this);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,10 +12,10 @@ import { SelectCompareFn } from './select-interface';
|
|||||||
/**
|
/**
|
||||||
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
|
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
|
||||||
*
|
*
|
||||||
* @part placeholder - The text displayed in the select when there is no value.
|
* @TODOpart placeholder - The text displayed in the select when there is no value.
|
||||||
* @part text - The displayed value of the select.
|
* @TODOpart text - The displayed value of the select.
|
||||||
* @part icon - The select icon container.
|
* @TODOpart icon - The select icon container.
|
||||||
* @part icon-inner - The select icon.
|
* @TODOpart icon-inner - The select icon.
|
||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
tag: 'ion-select',
|
tag: 'ion-select',
|
||||||
|
@ -27,7 +27,6 @@ export class Toast implements ComponentInterface, OverlayInterface {
|
|||||||
private durationTimeout: any;
|
private durationTimeout: any;
|
||||||
|
|
||||||
presented = false;
|
presented = false;
|
||||||
mode = getIonMode(this);
|
|
||||||
|
|
||||||
@Element() el!: HTMLIonToastElement;
|
@Element() el!: HTMLIonToastElement;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Component, ComponentInterface, Element, Host, Listen, Prop, h } from '@stencil/core';
|
import { Component, ComponentInterface, Element, Host, Listen, Prop, forceUpdate, h } from '@stencil/core';
|
||||||
|
|
||||||
import { getIonMode } from '../../global/ionic-global';
|
import { getIonMode } from '../../global/ionic-global';
|
||||||
import { Color, CssClassMap, StyleEventDetail } from '../../interface';
|
import { Color, CssClassMap, StyleEventDetail } from '../../interface';
|
||||||
@ -76,7 +76,7 @@ export class Toolbar implements ComponentInterface {
|
|||||||
|
|
||||||
if (hasStyleChange) {
|
if (hasStyleChange) {
|
||||||
this.childrenStyles.set(tagName, newStyles);
|
this.childrenStyles.set(tagName, newStyles);
|
||||||
this.el.forceUpdate();
|
forceUpdate(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Component, ComponentInterface, Element, FunctionalComponent, Host, Listen, Method, Prop, State, Watch, h, readTask, writeTask } from '@stencil/core';
|
import { Component, ComponentInterface, Element, FunctionalComponent, Host, Listen, Method, Prop, State, Watch, forceUpdate, h, readTask, writeTask } from '@stencil/core';
|
||||||
|
|
||||||
import { Cell, DomRenderFn, FooterHeightFn, HeaderFn, HeaderHeightFn, ItemHeightFn, ItemRenderFn, VirtualNode } from '../../interface';
|
import { Cell, DomRenderFn, FooterHeightFn, HeaderFn, HeaderHeightFn, ItemHeightFn, ItemRenderFn, VirtualNode } from '../../interface';
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ export class VirtualScroll implements ComponentInterface {
|
|||||||
} else if (this.domRender) {
|
} else if (this.domRender) {
|
||||||
this.domRender(this.virtualDom);
|
this.domRender(this.virtualDom);
|
||||||
} else if (this.renderItem) {
|
} else if (this.renderItem) {
|
||||||
this.el.forceUpdate();
|
forceUpdate(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { getIonMode } from '../../../global/ionic-global';
|
||||||
import { Animation, MenuI } from '../../../interface';
|
import { Animation, MenuI } from '../../../interface';
|
||||||
import { createAnimation } from '../../animation/animation';
|
import { createAnimation } from '../../animation/animation';
|
||||||
|
|
||||||
@ -30,7 +31,8 @@ export const menuOverlayAnimation = (menu: MenuI): Animation => {
|
|||||||
.addElement(menu.menuInnerEl!)
|
.addElement(menu.menuInnerEl!)
|
||||||
.fromTo('transform', `translateX(${closedX})`, `translateX(${openedX})`);
|
.fromTo('transform', `translateX(${closedX})`, `translateX(${openedX})`);
|
||||||
|
|
||||||
const isIos = menu.mode === 'ios';
|
const mode = getIonMode(menu);
|
||||||
|
const isIos = mode === 'ios';
|
||||||
const opacity = isIos ? 0.2 : 0.25;
|
const opacity = isIos ? 0.2 : 0.25;
|
||||||
|
|
||||||
backdropAnimation
|
backdropAnimation
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { getIonMode } from '../../../global/ionic-global';
|
||||||
import { Animation, MenuI } from '../../../interface';
|
import { Animation, MenuI } from '../../../interface';
|
||||||
import { createAnimation } from '../../animation/animation';
|
import { createAnimation } from '../../animation/animation';
|
||||||
|
|
||||||
@ -12,6 +13,7 @@ export const menuPushAnimation = (menu: MenuI): Animation => {
|
|||||||
let contentOpenedX: string;
|
let contentOpenedX: string;
|
||||||
let menuClosedX: string;
|
let menuClosedX: string;
|
||||||
|
|
||||||
|
const mode = getIonMode(menu);
|
||||||
const width = menu.width;
|
const width = menu.width;
|
||||||
|
|
||||||
if (menu.isEndSide) {
|
if (menu.isEndSide) {
|
||||||
@ -35,5 +37,5 @@ export const menuPushAnimation = (menu: MenuI): Animation => {
|
|||||||
.addElement(menu.backdropEl!)
|
.addElement(menu.backdropEl!)
|
||||||
.fromTo('opacity', 0.01, 0.32);
|
.fromTo('opacity', 0.01, 0.32);
|
||||||
|
|
||||||
return baseAnimation(menu.mode === 'ios').addAnimation([menuAnimation, contentAnimation, backdropAnimation]);
|
return baseAnimation(mode === 'ios').addAnimation([menuAnimation, contentAnimation, backdropAnimation]);
|
||||||
};
|
};
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { getIonMode } from '../../../global/ionic-global';
|
||||||
import { Animation, MenuI } from '../../../interface';
|
import { Animation, MenuI } from '../../../interface';
|
||||||
import { createAnimation } from '../../animation/animation';
|
import { createAnimation } from '../../animation/animation';
|
||||||
|
|
||||||
@ -9,11 +10,11 @@ import { baseAnimation } from './base';
|
|||||||
* The menu itself, which is under the content, does not move.
|
* The menu itself, which is under the content, does not move.
|
||||||
*/
|
*/
|
||||||
export const menuRevealAnimation = (menu: MenuI): Animation => {
|
export const menuRevealAnimation = (menu: MenuI): Animation => {
|
||||||
|
const mode = getIonMode(menu);
|
||||||
const openedX = (menu.width * (menu.isEndSide ? -1 : 1)) + 'px';
|
const openedX = (menu.width * (menu.isEndSide ? -1 : 1)) + 'px';
|
||||||
|
|
||||||
const contentOpen = createAnimation()
|
const contentOpen = createAnimation()
|
||||||
.addElement(menu.contentEl!) // REVIEW
|
.addElement(menu.contentEl!) // REVIEW
|
||||||
.fromTo('transform', 'translateX(0px)', `translateX(${openedX})`);
|
.fromTo('transform', 'translateX(0px)', `translateX(${openedX})`);
|
||||||
|
|
||||||
return baseAnimation(menu.mode === 'ios').addAnimation(contentOpen);
|
return baseAnimation(mode === 'ios').addAnimation(contentOpen);
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { EventEmitter } from '@stencil/core';
|
import { EventEmitter } from '@stencil/core';
|
||||||
import { HTMLStencilElement } from '@stencil/core/internal';
|
|
||||||
|
|
||||||
import { AnimationBuilder, Mode } from '../interface';
|
import { AnimationBuilder, HTMLStencilElement } from '../interface';
|
||||||
|
|
||||||
export interface OverlayEventDetail<T = any> {
|
export interface OverlayEventDetail<T = any> {
|
||||||
data?: T;
|
data?: T;
|
||||||
@ -9,7 +8,6 @@ export interface OverlayEventDetail<T = any> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface OverlayInterface {
|
export interface OverlayInterface {
|
||||||
mode: Mode;
|
|
||||||
el: HTMLElement;
|
el: HTMLElement;
|
||||||
animated: boolean;
|
animated: boolean;
|
||||||
keyboardClose: boolean;
|
keyboardClose: boolean;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { config } from '../global/config';
|
import { config } from '../global/config';
|
||||||
|
import { getIonMode } from '../global/ionic-global';
|
||||||
import { ActionSheetOptions, AlertOptions, Animation, AnimationBuilder, BackButtonEvent, HTMLIonOverlayElement, IonicConfig, LoadingOptions, ModalOptions, OverlayInterface, PickerOptions, PopoverOptions, ToastOptions } from '../interface';
|
import { ActionSheetOptions, AlertOptions, Animation, AnimationBuilder, BackButtonEvent, HTMLIonOverlayElement, IonicConfig, LoadingOptions, ModalOptions, OverlayInterface, PickerOptions, PopoverOptions, ToastOptions } from '../interface';
|
||||||
|
|
||||||
import { OVERLAY_BACK_BUTTON_PRIORITY } from './hardware-back-button';
|
import { OVERLAY_BACK_BUTTON_PRIORITY } from './hardware-back-button';
|
||||||
@ -128,10 +129,11 @@ export const present = async (
|
|||||||
overlay.presented = true;
|
overlay.presented = true;
|
||||||
overlay.willPresent.emit();
|
overlay.willPresent.emit();
|
||||||
|
|
||||||
|
const mode = getIonMode(overlay);
|
||||||
// get the user's animation fn if one was provided
|
// get the user's animation fn if one was provided
|
||||||
const animationBuilder = (overlay.enterAnimation)
|
const animationBuilder = (overlay.enterAnimation)
|
||||||
? overlay.enterAnimation
|
? overlay.enterAnimation
|
||||||
: config.get(name, overlay.mode === 'ios' ? iosEnterAnimation : mdEnterAnimation);
|
: config.get(name, mode === 'ios' ? iosEnterAnimation : mdEnterAnimation);
|
||||||
|
|
||||||
const completed = await overlayAnimation(overlay, animationBuilder, overlay.el, opts);
|
const completed = await overlayAnimation(overlay, animationBuilder, overlay.el, opts);
|
||||||
if (completed) {
|
if (completed) {
|
||||||
@ -155,10 +157,10 @@ export const dismiss = async (
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
overlay.willDismiss.emit({ data, role });
|
overlay.willDismiss.emit({ data, role });
|
||||||
|
const mode = getIonMode(overlay);
|
||||||
const animationBuilder = (overlay.leaveAnimation)
|
const animationBuilder = (overlay.leaveAnimation)
|
||||||
? overlay.leaveAnimation
|
? overlay.leaveAnimation
|
||||||
: config.get(name, overlay.mode === 'ios' ? iosLeaveAnimation : mdLeaveAnimation);
|
: config.get(name, mode === 'ios' ? iosLeaveAnimation : mdLeaveAnimation);
|
||||||
|
|
||||||
// If dismissed via gesture, no need to play leaving animation again
|
// If dismissed via gesture, no need to play leaving animation again
|
||||||
if (role !== 'gesture') {
|
if (role !== 'gesture') {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { writeTask } from '@stencil/core';
|
import { Build, writeTask } from '@stencil/core';
|
||||||
|
|
||||||
import { LIFECYCLE_DID_ENTER, LIFECYCLE_DID_LEAVE, LIFECYCLE_WILL_ENTER, LIFECYCLE_WILL_LEAVE } from '../../components/nav/constants';
|
import { LIFECYCLE_DID_ENTER, LIFECYCLE_DID_LEAVE, LIFECYCLE_WILL_ENTER, LIFECYCLE_WILL_LEAVE } from '../../components/nav/constants';
|
||||||
import { Animation, AnimationBuilder, NavDirection, NavOptions } from '../../interface';
|
import { Animation, AnimationBuilder, NavDirection, NavOptions } from '../../interface';
|
||||||
@ -44,7 +44,7 @@ const beforeTransition = (opts: TransitionOptions) => {
|
|||||||
const runTransition = async (opts: TransitionOptions): Promise<TransitionResult> => {
|
const runTransition = async (opts: TransitionOptions): Promise<TransitionResult> => {
|
||||||
const animationBuilder = await getAnimationBuilder(opts);
|
const animationBuilder = await getAnimationBuilder(opts);
|
||||||
|
|
||||||
const ani = (animationBuilder)
|
const ani = (animationBuilder && Build.isBrowser)
|
||||||
? animation(animationBuilder, opts)
|
? animation(animationBuilder, opts)
|
||||||
: noAnimation(opts); // fast path for no animation
|
: noAnimation(opts); // fast path for no animation
|
||||||
|
|
||||||
|
@ -67,8 +67,7 @@ export const config: Config = {
|
|||||||
esmLoaderPath: '../loader'
|
esmLoaderPath: '../loader'
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// type: 'experimental-dist-module',
|
// type: 'dist-custom-elements-bundle',
|
||||||
// externalRuntime: true,
|
|
||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
type: 'docs-readme',
|
type: 'docs-readme',
|
||||||
@ -83,7 +82,7 @@ export const config: Config = {
|
|||||||
},
|
},
|
||||||
apiSpecGenerator({
|
apiSpecGenerator({
|
||||||
file: 'api.txt'
|
file: 'api.txt'
|
||||||
}),
|
}) as any,
|
||||||
// {
|
// {
|
||||||
// type: 'stats',
|
// type: 'stats',
|
||||||
// file: 'stats.json'
|
// file: 'stats.json'
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
"declaration": true,
|
"declaration": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"assumeChangesOnlyAffectDirectDependencies": true,
|
||||||
"jsx": "react",
|
"jsx": "react",
|
||||||
"jsxFactory": "h",
|
"jsxFactory": "h",
|
||||||
"lib": [
|
"lib": [
|
||||||
@ -25,11 +26,10 @@
|
|||||||
"target": "es2017"
|
"target": "es2017"
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*.ts",
|
"src",
|
||||||
"src/**/*.tsx",
|
|
||||||
"stencil.config.ts"
|
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules"
|
"node_modules",
|
||||||
|
"**/test"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
12
docs/core.d.ts
vendored
12
docs/core.d.ts
vendored
@ -27,8 +27,10 @@ export interface JsonDocsComponent {
|
|||||||
props: JsonDocsProp[];
|
props: JsonDocsProp[];
|
||||||
methods: JsonDocsMethod[];
|
methods: JsonDocsMethod[];
|
||||||
events: JsonDocsEvent[];
|
events: JsonDocsEvent[];
|
||||||
|
listeners: JsonDocsListener[];
|
||||||
styles: JsonDocsStyle[];
|
styles: JsonDocsStyle[];
|
||||||
slots: JsonDocsSlot[];
|
slots: JsonDocsSlot[];
|
||||||
|
parts: JsonDocsPart[];
|
||||||
dependents: string[];
|
dependents: string[];
|
||||||
dependencies: string[];
|
dependencies: string[];
|
||||||
dependencyGraph: JsonDocsDependencyGraph;
|
dependencyGraph: JsonDocsDependencyGraph;
|
||||||
@ -95,10 +97,20 @@ export interface JsonDocsStyle {
|
|||||||
docs: string;
|
docs: string;
|
||||||
annotation: string;
|
annotation: string;
|
||||||
}
|
}
|
||||||
|
export interface JsonDocsListener {
|
||||||
|
event: string;
|
||||||
|
target?: string;
|
||||||
|
capture: boolean;
|
||||||
|
passive: boolean;
|
||||||
|
}
|
||||||
export interface JsonDocsSlot {
|
export interface JsonDocsSlot {
|
||||||
name: string;
|
name: string;
|
||||||
docs: string;
|
docs: string;
|
||||||
}
|
}
|
||||||
|
export interface JsonDocsPart {
|
||||||
|
name: string;
|
||||||
|
docs: string;
|
||||||
|
}
|
||||||
export interface StyleDoc {
|
export interface StyleDoc {
|
||||||
name: string;
|
name: string;
|
||||||
docs: string;
|
docs: string;
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
"@testing-library/jest-dom": "^4.2.4",
|
"@testing-library/jest-dom": "^4.2.4",
|
||||||
"@testing-library/react": "^9.3.2",
|
"@testing-library/react": "^9.3.2",
|
||||||
"@testing-library/user-event": "^7.1.2",
|
"@testing-library/user-event": "^7.1.2",
|
||||||
"@types/jest": "^24.0.23",
|
"@types/jest": "^24.9.0",
|
||||||
"@types/node": "^12.12.14",
|
"@types/node": "^12.12.14",
|
||||||
"@types/react": "^16.9.2",
|
"@types/react": "^16.9.2",
|
||||||
"@types/react-dom": "^16.9.0",
|
"@types/react-dom": "^16.9.0",
|
||||||
|
@ -48,12 +48,12 @@
|
|||||||
"react-dom": "^16.8.6"
|
"react-dom": "^16.8.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^23.3.9",
|
"@types/jest": "^24.9.0",
|
||||||
"@types/node": "^12.12.14",
|
"@types/node": "^12.12.14",
|
||||||
"@types/react": "^16.9.2",
|
"@types/react": "^16.9.2",
|
||||||
"@types/react-dom": "^16.9.0",
|
"@types/react-dom": "^16.9.0",
|
||||||
"fs-extra": "^8.1.0",
|
"fs-extra": "^8.1.0",
|
||||||
"jest": "^24.8.0",
|
"jest": "^24.9.0",
|
||||||
"jest-dom": "^3.4.0",
|
"jest-dom": "^3.4.0",
|
||||||
"np": "^5.0.1",
|
"np": "^5.0.1",
|
||||||
"react": "^16.9.0",
|
"react": "^16.9.0",
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ionic/react": "0.0.9",
|
"@ionic/react": "0.0.9",
|
||||||
"@types/jest": "24.0.17",
|
"@types/jest": "24.9.0",
|
||||||
"@types/node": "12.7.0",
|
"@types/node": "12.7.0",
|
||||||
"@types/react": "16.8.24",
|
"@types/react": "16.8.24",
|
||||||
"@types/react-dom": "16.8.5",
|
"@types/react-dom": "16.8.5",
|
||||||
|
Reference in New Issue
Block a user