@inappstory/slide-api 0.1.34 → 0.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +30 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +30 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6301,7 +6301,11 @@ class Slider {
|
|
|
6301
6301
|
this.slidesFirstRenders[index].called = true;
|
|
6302
6302
|
showSlidePromise = new Promise(resolve => {
|
|
6303
6303
|
this.slidesFirstRenders[index].firstRenderCall(resolve);
|
|
6304
|
-
})
|
|
6304
|
+
})
|
|
6305
|
+
.then(data => data)
|
|
6306
|
+
.catch(reason => {
|
|
6307
|
+
throw new Error(reason);
|
|
6308
|
+
});
|
|
6305
6309
|
}
|
|
6306
6310
|
else {
|
|
6307
6311
|
showSlidePromise = this.config.onBeforeShowSlide(this.slides[index].element, index);
|
|
@@ -7380,22 +7384,27 @@ class TimerRenderer {
|
|
|
7380
7384
|
render(time) {
|
|
7381
7385
|
const container = document.createElement("div");
|
|
7382
7386
|
container.classList.add("narrative-element-timer__container");
|
|
7383
|
-
const days = this.createGroup("d");
|
|
7384
|
-
const hours = this.createGroup("h");
|
|
7385
|
-
const minutes = this.createGroup("m");
|
|
7386
|
-
const seconds = this.createGroup("s");
|
|
7387
7387
|
if (time.days > 0) {
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7388
|
+
this.renderByFormat(container, "d:h:m");
|
|
7389
|
+
}
|
|
7390
|
+
else if (time.hours > 0) {
|
|
7391
|
+
this.renderByFormat(container, "h:m:s");
|
|
7392
|
+
}
|
|
7393
|
+
else {
|
|
7394
|
+
this.renderByFormat(container, "m:s");
|
|
7395
|
+
}
|
|
7396
7396
|
this.setTime(time);
|
|
7397
7397
|
return container;
|
|
7398
7398
|
}
|
|
7399
|
+
renderByFormat(container, format) {
|
|
7400
|
+
const parts = format.split(":");
|
|
7401
|
+
for (let i = 0; i < parts.length; i++) {
|
|
7402
|
+
container.appendChild(this.createGroup(parts[i]));
|
|
7403
|
+
if (i < parts.length - 1) {
|
|
7404
|
+
container.appendChild(this.createDelimiter());
|
|
7405
|
+
}
|
|
7406
|
+
}
|
|
7407
|
+
}
|
|
7399
7408
|
pad(num) {
|
|
7400
7409
|
return num.toString().padStart(2, "0");
|
|
7401
7410
|
}
|
|
@@ -7424,20 +7433,28 @@ class TimerRenderer {
|
|
|
7424
7433
|
}
|
|
7425
7434
|
setDays(days) {
|
|
7426
7435
|
const padded = this.pad(days);
|
|
7436
|
+
if (!this.digits["d1"] || !this.digits["d2"])
|
|
7437
|
+
return;
|
|
7427
7438
|
this.digits["d1"].textContent = padded[0];
|
|
7428
7439
|
this.digits["d2"].textContent = padded[1];
|
|
7429
7440
|
}
|
|
7430
7441
|
setHours(hours) {
|
|
7442
|
+
if (!this.digits["h1"] || !this.digits["h2"])
|
|
7443
|
+
return;
|
|
7431
7444
|
const padded = this.pad(hours);
|
|
7432
7445
|
this.digits["h1"].textContent = padded[0];
|
|
7433
7446
|
this.digits["h2"].textContent = padded[1];
|
|
7434
7447
|
}
|
|
7435
7448
|
setMinutes(minutes) {
|
|
7449
|
+
if (!this.digits["m1"] || !this.digits["m2"])
|
|
7450
|
+
return;
|
|
7436
7451
|
const padded = this.pad(minutes);
|
|
7437
7452
|
this.digits["m1"].textContent = padded[0];
|
|
7438
7453
|
this.digits["m2"].textContent = padded[1];
|
|
7439
7454
|
}
|
|
7440
7455
|
setSeconds(seconds) {
|
|
7456
|
+
if (!this.digits["s1"] || !this.digits["s2"])
|
|
7457
|
+
return;
|
|
7441
7458
|
const padded = this.pad(seconds);
|
|
7442
7459
|
this.digits["s1"].textContent = padded[0];
|
|
7443
7460
|
this.digits["s2"].textContent = padded[1];
|