@pitaya-components/app
Advanced tools
Comparing version
@@ -29,2 +29,3 @@ "use strict"; | ||
aurelia_typed_observable_plugin_1.usePropertyTypeForObservable(true); | ||
const ANIMATOR_ENTERED_CLASS = "au-entered"; | ||
const scrollHistory = new Map(); | ||
@@ -38,3 +39,2 @@ let PiView = class PiView { | ||
this._config = _config; | ||
this._isOnline = navigator.onLine; | ||
this._scopedOnlineMethod = this._onOnline.bind(this); | ||
@@ -93,3 +93,11 @@ this._scopedOfflineMethod = this._onOffline.bind(this); | ||
_setAnimationListener() { | ||
this._rootElement.addEventListener("animationend", this._onAnimationEnd.bind(this)); | ||
const instance = this; | ||
const observer = new MutationObserver(() => { | ||
if (!instance._rootElement.classList.contains(ANIMATOR_ENTERED_CLASS)) { | ||
return; | ||
} | ||
observer.disconnect(); | ||
instance._onAnimationEnd.call(instance); | ||
}); | ||
observer.observe(this._rootElement, { attributeFilter: ["class"] }); | ||
} | ||
@@ -104,8 +112,4 @@ _setOnBeforeDetachedListener(owningView) { | ||
} | ||
_onAnimationEnd(event) { | ||
_onAnimationEnd() { | ||
var _a; | ||
if (event.target !== this._rootElement) { | ||
return; | ||
} | ||
this._rootElement.removeEventListener("animationend", this._onAnimationEnd.bind(this)); | ||
this._animationReady = true; | ||
@@ -119,3 +123,2 @@ (_a = this._appController) === null || _a === void 0 ? void 0 : _a.cleanUpAnimation(); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this._isOnline = true; | ||
this.onOnline && this.onOnline({ component: this }); | ||
@@ -126,3 +129,2 @@ }); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this._isOnline = false; | ||
this.onOffline && this.onOffline({ component: this }); | ||
@@ -129,0 +131,0 @@ }); |
@@ -15,3 +15,5 @@ "use strict"; | ||
initialized = true; | ||
frameworkConfig.plugin(aurelia_framework_1.PLATFORM.moduleName("aurelia-animator-css")) | ||
frameworkConfig.plugin(aurelia_framework_1.PLATFORM.moduleName("aurelia-animator-css"), (animator) => { | ||
animator.useAnimationDoneClasses = true; | ||
}) | ||
.plugin(aurelia_framework_1.PLATFORM.moduleName("aurelia-fetch-client")) | ||
@@ -18,0 +20,0 @@ .plugin(aurelia_framework_1.PLATFORM.moduleName("aurelia-typed-observable-plugin")) |
@@ -27,2 +27,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
usePropertyTypeForObservable(true); | ||
const ANIMATOR_ENTERED_CLASS = "au-entered"; | ||
const scrollHistory = new Map(); | ||
@@ -36,3 +37,2 @@ let PiView = class PiView { | ||
this._config = _config; | ||
this._isOnline = navigator.onLine; | ||
this._scopedOnlineMethod = this._onOnline.bind(this); | ||
@@ -91,3 +91,11 @@ this._scopedOfflineMethod = this._onOffline.bind(this); | ||
_setAnimationListener() { | ||
this._rootElement.addEventListener("animationend", this._onAnimationEnd.bind(this)); | ||
const instance = this; | ||
const observer = new MutationObserver(() => { | ||
if (!instance._rootElement.classList.contains(ANIMATOR_ENTERED_CLASS)) { | ||
return; | ||
} | ||
observer.disconnect(); | ||
instance._onAnimationEnd.call(instance); | ||
}); | ||
observer.observe(this._rootElement, { attributeFilter: ["class"] }); | ||
} | ||
@@ -102,8 +110,4 @@ _setOnBeforeDetachedListener(owningView) { | ||
} | ||
_onAnimationEnd(event) { | ||
_onAnimationEnd() { | ||
var _a; | ||
if (event.target !== this._rootElement) { | ||
return; | ||
} | ||
this._rootElement.removeEventListener("animationend", this._onAnimationEnd.bind(this)); | ||
this._animationReady = true; | ||
@@ -117,3 +121,2 @@ (_a = this._appController) === null || _a === void 0 ? void 0 : _a.cleanUpAnimation(); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this._isOnline = true; | ||
this.onOnline && this.onOnline({ component: this }); | ||
@@ -124,3 +127,2 @@ }); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this._isOnline = false; | ||
this.onOffline && this.onOffline({ component: this }); | ||
@@ -127,0 +129,0 @@ }); |
@@ -10,3 +10,5 @@ import { Container, PLATFORM } from "aurelia-framework"; | ||
initialized = true; | ||
frameworkConfig.plugin(PLATFORM.moduleName("aurelia-animator-css")) | ||
frameworkConfig.plugin(PLATFORM.moduleName("aurelia-animator-css"), (animator) => { | ||
animator.useAnimationDoneClasses = true; | ||
}) | ||
.plugin(PLATFORM.moduleName("aurelia-fetch-client")) | ||
@@ -13,0 +15,0 @@ .plugin(PLATFORM.moduleName("aurelia-typed-observable-plugin")) |
{ | ||
"name": "@pitaya-components/app", | ||
"version": "0.0.22", | ||
"version": "0.0.23", | ||
"description": "Aurelia plugin which helps building faster views and provides additional utility functionality.", | ||
@@ -57,3 +57,6 @@ "repository": { | ||
"@pitaya-components/typography": "~0.0.1", | ||
"@pitaya-components/grid": "~0.0.1" | ||
"@pitaya-components/grid": "~0.0.1", | ||
"@pitaya-components/drawer": "~0.0.1", | ||
"@pitaya-components/image-placeholder": "~0.0.1", | ||
"@pitaya-components/list": "~0.0.1" | ||
}, | ||
@@ -60,0 +63,0 @@ "browserslist": [ |
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
130355
0.41%1818
0.44%38
8.57%