Skip to content

Commit

Permalink
refactor(): minor updates for next stencil version (#20787)
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Mar 24, 2020
1 parent 7a4ddde commit 976e68d
Show file tree
Hide file tree
Showing 38 changed files with 6,889 additions and 6,926 deletions.
2 changes: 1 addition & 1 deletion angular/src/directives/proxies-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import * as d from './proxies';

export const DIRECTIVES = [
d.IonApp,
d.IonApp,
d.IonAvatar,
d.IonBackButton,
d.IonBackdrop,
Expand Down
44 changes: 22 additions & 22 deletions angular/src/directives/proxies-utils.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
/* eslint-disable */
/* tslint:disable */
import { fromEvent } from 'rxjs';

export const proxyInputs = (Cmp: any, inputs: string[]) => {
const Prototype = Cmp.prototype;
inputs.forEach(item => {
Object.defineProperty(Prototype, item, {
get() {
return this.el[item];
},
set(val: any) {
this.z.runOutsideAngular(() => (this.el[item] = val));
}
});
Object.defineProperty(Prototype, item, {
get() {
return this.el[item];
},
set(val: any) {
this.z.runOutsideAngular(() => (this.el[item] = val));
}
});
});
};

export const proxyMethods = (Cmp: any, methods: string[]) => {
const Prototype = Cmp.prototype;
methods.forEach(methodName => {
Prototype[methodName] = function () {
const args = arguments;
return this.z.runOutsideAngular(() =>
this.el[methodName].apply(this.el, args)
);
};
Prototype[methodName] = function () {
const args = arguments;
return this.z.runOutsideAngular(() =>
this.el[methodName].apply(this.el, args)
);
};
});
};

export const proxyOutputs = (instance: any, el: any, events: string[]) => {
events.forEach(eventName => instance[eventName] = fromEvent(el, eventName));
}

// tslint:disable-next-line: only-arrow-functions
export function ProxyCmp(opts: { inputs?: any; methods?: any }) {
const decorator = function(cls: any){
if (opts.inputs) {
proxyInputs(cls, opts.inputs);
}
if (opts.methods) {
proxyMethods(cls, opts.methods);
}
return cls;
if (opts.inputs) {
proxyInputs(cls, opts.inputs);
}
if (opts.methods) {
proxyMethods(cls, opts.methods);
}
return cls;
};
return decorator;
}
1,621 changes: 807 additions & 814 deletions angular/src/directives/proxies.ts

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
"tslib": "^1.10.0"
},
"devDependencies": {
"@stencil/core": "1.8.11",
"@stencil/sass": "1.0.1",
"@types/jest": "24.0.21",
"@stencil/core": "1.11.2",
"@stencil/sass": "1.1.1",
"@types/jest": "24.9.0",
"@types/node": "12.12.3",
"@types/puppeteer": "1.19.1",
"@types/swiper": "4.4.4",
Expand All @@ -49,7 +49,7 @@
"np": "^5.0.3",
"pixelmatch": "4.0.2",
"puppeteer": "1.20.0",
"rollup": "1.19.4",
"rollup": "1.32.0",
"rollup-plugin-node-resolve": "5.2.0",
"rollup-plugin-virtual": "^1.0.1",
"sass": "^1.22.9",
Expand Down

0 comments on commit 976e68d

Please sign in to comment.