@aurelia-mdc-web/ripple
Advanced tools
Comparing version 1.0.0-alpha.15 to 1.0.0-alpha.16
@@ -8,4 +8,9 @@ define(["require", "exports", "tslib", "@aurelia-mdc-web/base", "@material/ripple", "@material/dom/ponyfill", "@material/dom/events", "aurelia-framework", "aurelia-typed-observable-plugin"], function (require, exports, tslib_1, base_1, ripple_1, ponyfill_1, events_1, aurelia_framework_1, aurelia_typed_observable_plugin_1) { | ||
function MdcRipple() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this.inputBindingPromise = new Promise(function (r) { return _this.inputBindingPromiseResolver = r; }); | ||
return _this; | ||
} | ||
MdcRipple.prototype.inputChanged = function () { | ||
this.inputBindingPromiseResolver(); | ||
}; | ||
MdcRipple.prototype.unboundedChanged = function () { | ||
@@ -25,2 +30,29 @@ var _a; | ||
}; | ||
MdcRipple.prototype.initialise = function () { | ||
var _a, _b, _c; | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var inputBinding; | ||
return tslib_1.__generator(this, function (_d) { | ||
switch (_d.label) { | ||
case 0: | ||
if (!this.noClass) { | ||
((_a = this.surface) !== null && _a !== void 0 ? _a : this.root).classList.add('mdc-ripple-surface'); | ||
if (this.primary) { | ||
((_b = this.surface) !== null && _b !== void 0 ? _b : this.root).classList.add('mdc-ripple-surface--primary'); | ||
} | ||
if (this.accent) { | ||
((_c = this.surface) !== null && _c !== void 0 ? _c : this.root).classList.add('mdc-ripple-surface--accent'); | ||
} | ||
} | ||
inputBinding = this.root.au['mdc-ripple'].boundProperties.find(function (x) { return x.binding.targetProperty === 'input'; }); | ||
if (!inputBinding) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, this.inputBindingPromise]; | ||
case 1: | ||
_d.sent(); | ||
_d.label = 2; | ||
case 2: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
MdcRipple.prototype.activate = function () { | ||
@@ -82,2 +114,14 @@ var _a; | ||
], MdcRipple.prototype, "activeSurface", void 0); | ||
tslib_1.__decorate([ | ||
aurelia_typed_observable_plugin_1.bindable.booleanAttr, | ||
tslib_1.__metadata("design:type", Boolean) | ||
], MdcRipple.prototype, "noClass", void 0); | ||
tslib_1.__decorate([ | ||
aurelia_typed_observable_plugin_1.bindable.booleanAttr, | ||
tslib_1.__metadata("design:type", Boolean) | ||
], MdcRipple.prototype, "primary", void 0); | ||
tslib_1.__decorate([ | ||
aurelia_typed_observable_plugin_1.bindable.booleanAttr, | ||
tslib_1.__metadata("design:type", Boolean) | ||
], MdcRipple.prototype, "accent", void 0); | ||
MdcRipple = tslib_1.__decorate([ | ||
@@ -84,0 +128,0 @@ aurelia_framework_1.inject(Element), |
@@ -14,4 +14,9 @@ "use strict"; | ||
function MdcRipple() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this.inputBindingPromise = new Promise(function (r) { return _this.inputBindingPromiseResolver = r; }); | ||
return _this; | ||
} | ||
MdcRipple.prototype.inputChanged = function () { | ||
this.inputBindingPromiseResolver(); | ||
}; | ||
MdcRipple.prototype.unboundedChanged = function () { | ||
@@ -31,2 +36,29 @@ var _a; | ||
}; | ||
MdcRipple.prototype.initialise = function () { | ||
var _a, _b, _c; | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var inputBinding; | ||
return tslib_1.__generator(this, function (_d) { | ||
switch (_d.label) { | ||
case 0: | ||
if (!this.noClass) { | ||
((_a = this.surface) !== null && _a !== void 0 ? _a : this.root).classList.add('mdc-ripple-surface'); | ||
if (this.primary) { | ||
((_b = this.surface) !== null && _b !== void 0 ? _b : this.root).classList.add('mdc-ripple-surface--primary'); | ||
} | ||
if (this.accent) { | ||
((_c = this.surface) !== null && _c !== void 0 ? _c : this.root).classList.add('mdc-ripple-surface--accent'); | ||
} | ||
} | ||
inputBinding = this.root.au['mdc-ripple'].boundProperties.find(function (x) { return x.binding.targetProperty === 'input'; }); | ||
if (!inputBinding) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, this.inputBindingPromise]; | ||
case 1: | ||
_d.sent(); | ||
_d.label = 2; | ||
case 2: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
MdcRipple.prototype.activate = function () { | ||
@@ -88,2 +120,14 @@ var _a; | ||
], MdcRipple.prototype, "activeSurface", void 0); | ||
tslib_1.__decorate([ | ||
aurelia_typed_observable_plugin_1.bindable.booleanAttr, | ||
tslib_1.__metadata("design:type", Boolean) | ||
], MdcRipple.prototype, "noClass", void 0); | ||
tslib_1.__decorate([ | ||
aurelia_typed_observable_plugin_1.bindable.booleanAttr, | ||
tslib_1.__metadata("design:type", Boolean) | ||
], MdcRipple.prototype, "primary", void 0); | ||
tslib_1.__decorate([ | ||
aurelia_typed_observable_plugin_1.bindable.booleanAttr, | ||
tslib_1.__metadata("design:type", Boolean) | ||
], MdcRipple.prototype, "accent", void 0); | ||
MdcRipple = tslib_1.__decorate([ | ||
@@ -90,0 +134,0 @@ aurelia_framework_1.inject(Element), |
@@ -9,2 +9,9 @@ import { __awaiter, __decorate, __metadata } from "tslib"; | ||
let MdcRipple = class MdcRipple extends MdcComponent { | ||
constructor() { | ||
super(...arguments); | ||
this.inputBindingPromise = new Promise(r => this.inputBindingPromiseResolver = r); | ||
} | ||
inputChanged() { | ||
this.inputBindingPromiseResolver(); | ||
} | ||
unboundedChanged() { | ||
@@ -17,2 +24,20 @@ var _a; | ||
} | ||
initialise() { | ||
var _a, _b, _c; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (!this.noClass) { | ||
((_a = this.surface) !== null && _a !== void 0 ? _a : this.root).classList.add('mdc-ripple-surface'); | ||
if (this.primary) { | ||
((_b = this.surface) !== null && _b !== void 0 ? _b : this.root).classList.add('mdc-ripple-surface--primary'); | ||
} | ||
if (this.accent) { | ||
((_c = this.surface) !== null && _c !== void 0 ? _c : this.root).classList.add('mdc-ripple-surface--accent'); | ||
} | ||
} | ||
const inputBinding = this.root.au['mdc-ripple'].boundProperties.find(x => x.binding.targetProperty === 'input'); | ||
if (inputBinding) { | ||
yield this.inputBindingPromise; | ||
} | ||
}); | ||
} | ||
activate() { | ||
@@ -74,2 +99,14 @@ var _a; | ||
], MdcRipple.prototype, "activeSurface", void 0); | ||
__decorate([ | ||
bindable.booleanAttr, | ||
__metadata("design:type", Boolean) | ||
], MdcRipple.prototype, "noClass", void 0); | ||
__decorate([ | ||
bindable.booleanAttr, | ||
__metadata("design:type", Boolean) | ||
], MdcRipple.prototype, "primary", void 0); | ||
__decorate([ | ||
bindable.booleanAttr, | ||
__metadata("design:type", Boolean) | ||
], MdcRipple.prototype, "accent", void 0); | ||
MdcRipple = __decorate([ | ||
@@ -76,0 +113,0 @@ inject(Element), |
@@ -11,4 +11,9 @@ import { __awaiter, __decorate, __extends, __generator, __metadata } from "tslib"; | ||
function MdcRipple() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this.inputBindingPromise = new Promise(function (r) { return _this.inputBindingPromiseResolver = r; }); | ||
return _this; | ||
} | ||
MdcRipple.prototype.inputChanged = function () { | ||
this.inputBindingPromiseResolver(); | ||
}; | ||
MdcRipple.prototype.unboundedChanged = function () { | ||
@@ -28,2 +33,29 @@ var _a; | ||
}; | ||
MdcRipple.prototype.initialise = function () { | ||
var _a, _b, _c; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var inputBinding; | ||
return __generator(this, function (_d) { | ||
switch (_d.label) { | ||
case 0: | ||
if (!this.noClass) { | ||
((_a = this.surface) !== null && _a !== void 0 ? _a : this.root).classList.add('mdc-ripple-surface'); | ||
if (this.primary) { | ||
((_b = this.surface) !== null && _b !== void 0 ? _b : this.root).classList.add('mdc-ripple-surface--primary'); | ||
} | ||
if (this.accent) { | ||
((_c = this.surface) !== null && _c !== void 0 ? _c : this.root).classList.add('mdc-ripple-surface--accent'); | ||
} | ||
} | ||
inputBinding = this.root.au['mdc-ripple'].boundProperties.find(function (x) { return x.binding.targetProperty === 'input'; }); | ||
if (!inputBinding) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, this.inputBindingPromise]; | ||
case 1: | ||
_d.sent(); | ||
_d.label = 2; | ||
case 2: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
MdcRipple.prototype.activate = function () { | ||
@@ -85,2 +117,14 @@ var _a; | ||
], MdcRipple.prototype, "activeSurface", void 0); | ||
__decorate([ | ||
bindable.booleanAttr, | ||
__metadata("design:type", Boolean) | ||
], MdcRipple.prototype, "noClass", void 0); | ||
__decorate([ | ||
bindable.booleanAttr, | ||
__metadata("design:type", Boolean) | ||
], MdcRipple.prototype, "primary", void 0); | ||
__decorate([ | ||
bindable.booleanAttr, | ||
__metadata("design:type", Boolean) | ||
], MdcRipple.prototype, "accent", void 0); | ||
MdcRipple = __decorate([ | ||
@@ -87,0 +131,0 @@ inject(Element), |
import { MdcComponent } from '@aurelia-mdc-web/base'; | ||
import { MDCRippleFoundation, MDCRippleAdapter } from '@material/ripple'; | ||
import { Binding, BehaviorPropertyObserver } from 'aurelia-framework'; | ||
export declare class MdcRipple extends MdcComponent<MDCRippleFoundation> { | ||
inputBindingPromiseResolver: () => void; | ||
inputBindingPromise: Promise<unknown>; | ||
input?: HTMLInputElement; | ||
inputChanged(): void; | ||
surface?: HTMLElement; | ||
@@ -10,2 +14,6 @@ disabled: boolean; | ||
activeSurface: boolean; | ||
noClass: boolean; | ||
primary: boolean; | ||
accent: boolean; | ||
initialise(): Promise<void>; | ||
activate(): void; | ||
@@ -21,4 +29,10 @@ deactivate(): void; | ||
viewModel: MdcRipple; | ||
boundProperties: { | ||
binding: Binding & { | ||
targetProperty: string; | ||
}; | ||
observer: BehaviorPropertyObserver; | ||
}[]; | ||
}; | ||
}; | ||
} |
{ | ||
"name": "@aurelia-mdc-web/ripple", | ||
"version": "1.0.0-alpha.15", | ||
"version": "1.0.0-alpha.16", | ||
"publishConfig": { | ||
@@ -57,3 +57,3 @@ "access": "public" | ||
"dependencies": { | ||
"@aurelia-mdc-web/base": "^1.0.0-alpha.15", | ||
"@aurelia-mdc-web/base": "^1.0.0-alpha.16", | ||
"@material/ripple": "^7.0.0" | ||
@@ -69,3 +69,3 @@ }, | ||
}, | ||
"gitHead": "edbf70ef48399ae9c4301f9a1512b9b74230e56b" | ||
"gitHead": "8ae74ec81529310e127c7c633e064ef28aab8691" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
51924
591