@dflex/core-instance
Advanced tools
Comparing version 2.13.0 to 2.14.0
@@ -22,5 +22,4 @@ /** | ||
detach(): void; | ||
initialize(ref: HTMLElement | null): void; | ||
initTranslate(): void; | ||
} | ||
export default AbstractCoreInstance; |
@@ -32,3 +32,6 @@ "use strict"; | ||
AbstractCoreInstance.prototype.attach = function (incomingRef) { | ||
// Cleanup. | ||
this.ref = null; | ||
if (!incomingRef) { | ||
// TODO: Is this always running when document is valid? Or it's buggy? | ||
var ref = document.getElementById(this.id); | ||
@@ -43,10 +46,9 @@ if (!ref) { | ||
this.ref = incomingRef; | ||
this.isInitialized = true; | ||
}; | ||
AbstractCoreInstance.prototype.detach = function () { | ||
this.isInitialized = false; | ||
this.isPaused = true; | ||
this.ref = null; | ||
}; | ||
AbstractCoreInstance.prototype.initialize = function (ref) { | ||
this.attach(ref); | ||
this.isInitialized = true; | ||
}; | ||
AbstractCoreInstance.prototype.initTranslate = function () { | ||
@@ -56,5 +58,13 @@ /** | ||
* stored to navigate correctly. | ||
* | ||
* If it's already initiated we don't need to do it again. | ||
* Reason: You may detach ref set flag to false and then attach it again. Do | ||
* you want to start from zero or maintain the last position. | ||
* | ||
* Continuity is fundamental in DFlex, please keep that in your mind. | ||
*/ | ||
this.translateY = 0; | ||
this.translateX = 0; | ||
if (typeof this.translateY !== "number") | ||
this.translateY = 0; | ||
if (typeof this.translateX !== "number") | ||
this.translateX = 0; | ||
this.isPaused = false; | ||
@@ -61,0 +71,0 @@ }; |
@@ -17,2 +17,3 @@ /** | ||
keys: Keys; | ||
depth: number; | ||
isVisible: boolean; | ||
@@ -19,0 +20,0 @@ hasToTransform: boolean; |
@@ -44,6 +44,7 @@ "use strict"; | ||
var _this = this; | ||
var order = elementWithPointer.order, keys = elementWithPointer.keys, scrollX = elementWithPointer.scrollX, scrollY = elementWithPointer.scrollY, element = __rest(elementWithPointer, ["order", "keys", "scrollX", "scrollY"]); | ||
var order = elementWithPointer.order, keys = elementWithPointer.keys, depth = elementWithPointer.depth, scrollX = elementWithPointer.scrollX, scrollY = elementWithPointer.scrollY, element = __rest(elementWithPointer, ["order", "keys", "depth", "scrollX", "scrollY"]); | ||
_this = _super.call(this, element) || this; | ||
_this.order = order; | ||
_this.keys = keys; | ||
_this.depth = depth; | ||
_this.isVisible = element.isInitialized && !element.isPaused; | ||
@@ -67,3 +68,5 @@ if (element.isInitialized) { | ||
CoreInstance.prototype.initIndicators = function (scrollX, scrollY) { | ||
this.prevTranslateY = []; | ||
if (!Array.isArray(this.prevTranslateY)) { | ||
this.prevTranslateY = []; | ||
} | ||
var _a = this.ref.getBoundingClientRect(), height = _a.height, width = _a.width, left = _a.left, top = _a.top; | ||
@@ -87,6 +90,5 @@ /** | ||
if (!this.isInitialized) | ||
this.initialize(null); | ||
this.attach(null); | ||
this.initTranslate(); | ||
this.initIndicators(scrollX, scrollY); | ||
this.isPaused = false; | ||
}; | ||
@@ -93,0 +95,0 @@ CoreInstance.prototype.changeVisibility = function (isVisible) { |
@@ -27,3 +27,2 @@ /** | ||
translateX?: number; | ||
initialize(ref: HTMLElement | null): void; | ||
initTranslate(): void; | ||
@@ -60,2 +59,3 @@ attach(ref: HTMLElement | null): void; | ||
keys: Keys; | ||
depth: number; | ||
scrollX: number; | ||
@@ -82,2 +82,3 @@ scrollY: number; | ||
keys: Keys; | ||
depth: number; | ||
animatedFrame: number | null; | ||
@@ -84,0 +85,0 @@ resume(scrollX: number, scrollY: number): void; |
{ | ||
"name": "@dflex/core-instance", | ||
"version": "2.13.0", | ||
"version": "2.14.0", | ||
"main": "dist/index.js", | ||
@@ -38,3 +38,3 @@ "types": "dist/index.d.ts", | ||
}, | ||
"gitHead": "21e3bbb53c079ddee5dca45d250c37e9e7718499" | ||
"gitHead": "67ac10e9252dc2473bd3fc3c7ae52c1d9e3124bc" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57988
526