@xibosignage/xibo-layout-renderer 1.0.18 → 1.0.19
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/src/Types/Layout/Layout.types.d.ts +1 -0
- package/dist/xibo-layout-renderer.cjs.js +110 -77
- package/dist/xibo-layout-renderer.cjs.js.map +1 -1
- package/dist/xibo-layout-renderer.d.ts +1 -0
- package/dist/xibo-layout-renderer.esm.js +110 -77
- package/dist/xibo-layout-renderer.esm.js.map +1 -1
- package/dist/xibo-layout-renderer.js +110 -77
- package/dist/xibo-layout-renderer.min.js +7 -7
- package/dist/xibo-layout-renderer.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -665,7 +665,8 @@ var initialLayout = {
|
|
|
665
665
|
xlr: {},
|
|
666
666
|
finishAllRegions: function finishAllRegions() {
|
|
667
667
|
return Promise.resolve([]);
|
|
668
|
-
}
|
|
668
|
+
},
|
|
669
|
+
inLoop: true
|
|
669
670
|
};
|
|
670
671
|
|
|
671
672
|
function nextId(options) {
|
|
@@ -74141,7 +74142,7 @@ function Layout(data, options, xlr, layout) {
|
|
|
74141
74142
|
});
|
|
74142
74143
|
emitter.on('end', /*#__PURE__*/function () {
|
|
74143
74144
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(layout) {
|
|
74144
|
-
var $layout;
|
|
74145
|
+
var $layout, _$layout$parentElemen;
|
|
74145
74146
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
74146
74147
|
while (1) switch (_context.prev = _context.next) {
|
|
74147
74148
|
case 0:
|
|
@@ -74153,7 +74154,7 @@ function Layout(data, options, xlr, layout) {
|
|
|
74153
74154
|
$layout: $layout
|
|
74154
74155
|
});
|
|
74155
74156
|
if ($layout !== null) {
|
|
74156
|
-
$layout.
|
|
74157
|
+
(_$layout$parentElemen = $layout.parentElement) === null || _$layout$parentElemen === void 0 || _$layout$parentElemen.removeChild($layout);
|
|
74157
74158
|
}
|
|
74158
74159
|
// Check if stats are enabled for the layout
|
|
74159
74160
|
if (layout.enableStat) {
|
|
@@ -74164,7 +74165,7 @@ function Layout(data, options, xlr, layout) {
|
|
|
74164
74165
|
type: 'layout'
|
|
74165
74166
|
});
|
|
74166
74167
|
}
|
|
74167
|
-
if (xlr.config.platform !== 'CMS') {
|
|
74168
|
+
if (xlr.config.platform !== 'CMS' && layout.inLoop) {
|
|
74168
74169
|
// Transition next layout to current layout and prepare next layout if exist
|
|
74169
74170
|
xlr.prepareLayouts().then(function (parent) {
|
|
74170
74171
|
xlr.playSchedules(parent);
|
|
@@ -74323,43 +74324,46 @@ function Layout(data, options, xlr, layout) {
|
|
|
74323
74324
|
self.end();
|
|
74324
74325
|
}
|
|
74325
74326
|
};
|
|
74326
|
-
layoutObject.regionEnded = function () {
|
|
74327
|
-
var self
|
|
74328
|
-
|
|
74329
|
-
|
|
74330
|
-
|
|
74331
|
-
|
|
74332
|
-
|
|
74333
|
-
|
|
74334
|
-
|
|
74335
|
-
|
|
74336
|
-
|
|
74337
|
-
|
|
74338
|
-
|
|
74339
|
-
|
|
74340
|
-
|
|
74341
|
-
|
|
74342
|
-
|
|
74343
|
-
|
|
74344
|
-
|
|
74345
|
-
|
|
74346
|
-
|
|
74347
|
-
|
|
74348
|
-
|
|
74349
|
-
|
|
74350
|
-
|
|
74351
|
-
|
|
74352
|
-
}
|
|
74327
|
+
layoutObject.regionEnded = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
74328
|
+
var self, i, $end, $preview;
|
|
74329
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
74330
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
74331
|
+
case 0:
|
|
74332
|
+
self = layoutObject;
|
|
74333
|
+
self.allEnded = true;
|
|
74334
|
+
for (i = 0; i < self.regions.length; i++) {
|
|
74335
|
+
if (!self.regions[i].ended) {
|
|
74336
|
+
self.allEnded = false;
|
|
74337
|
+
}
|
|
74338
|
+
}
|
|
74339
|
+
if (!self.allEnded) {
|
|
74340
|
+
_context2.next = 9;
|
|
74341
|
+
break;
|
|
74342
|
+
}
|
|
74343
|
+
_context2.next = 6;
|
|
74344
|
+
return self.stopAllMedia();
|
|
74345
|
+
case 6:
|
|
74346
|
+
console.debug('starting to end layout . . .');
|
|
74347
|
+
if (xlr.config.platform === 'CMS') {
|
|
74348
|
+
$end = document.getElementById('play_ended');
|
|
74349
|
+
$preview = document.getElementById('screen_container');
|
|
74350
|
+
if ($preview) {
|
|
74351
|
+
while ($preview.firstChild) {
|
|
74352
|
+
$preview.removeChild($preview.firstChild);
|
|
74353
74353
|
}
|
|
74354
|
-
|
|
74355
|
-
|
|
74356
|
-
|
|
74357
|
-
|
|
74354
|
+
$preview.style.display = 'none';
|
|
74355
|
+
}
|
|
74356
|
+
if ($end) {
|
|
74357
|
+
$end.style.display = 'block';
|
|
74358
|
+
}
|
|
74358
74359
|
}
|
|
74359
|
-
|
|
74360
|
-
|
|
74361
|
-
|
|
74362
|
-
|
|
74360
|
+
self.emitter.emit('end', self);
|
|
74361
|
+
case 9:
|
|
74362
|
+
case "end":
|
|
74363
|
+
return _context2.stop();
|
|
74364
|
+
}
|
|
74365
|
+
}, _callee2);
|
|
74366
|
+
}));
|
|
74363
74367
|
layoutObject.end = function () {
|
|
74364
74368
|
console.debug('Executing Layout::end and Calling Region::end ', layoutObject);
|
|
74365
74369
|
/* Ask the layout to gracefully stop running now */
|
|
@@ -74609,7 +74613,7 @@ function XiboLayoutRenderer(inputLayouts, options) {
|
|
|
74609
74613
|
xlrObject.updateLayouts = /*#__PURE__*/function () {
|
|
74610
74614
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(inputLayouts) {
|
|
74611
74615
|
var _this2 = this;
|
|
74612
|
-
var xlr, _this$
|
|
74616
|
+
var _this$currentLayout, xlr, _this$currentLayout2, _this$nextLayout, currLayoutIndex, nxtLayoutIndex, tempOldNxtLayout, newNxtLayoutIndex, tempNxtLayout, hasOldNxtLayout, oldNxtLayoutIndex, _this$nextLayout2, tempNewNxtLayout;
|
|
74613
74617
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
74614
74618
|
while (1) switch (_context2.prev = _context2.next) {
|
|
74615
74619
|
case 0:
|
|
@@ -74631,39 +74635,49 @@ function XiboLayoutRenderer(inputLayouts, options) {
|
|
|
74631
74635
|
* Case 0: When inputLayouts length = 0
|
|
74632
74636
|
*/
|
|
74633
74637
|
if (!(inputLayouts.length === 0)) {
|
|
74634
|
-
_context2.next =
|
|
74638
|
+
_context2.next = 10;
|
|
74635
74639
|
break;
|
|
74636
74640
|
}
|
|
74637
74641
|
this.layouts = [];
|
|
74642
|
+
if (this.currentLayout) {
|
|
74643
|
+
this.currentLayout.inLoop = false;
|
|
74644
|
+
}
|
|
74638
74645
|
this.currentLayout = undefined;
|
|
74639
74646
|
this.nextLayout = undefined;
|
|
74640
74647
|
this.currentLayoutIndex = 0;
|
|
74641
74648
|
this.prepareLayouts().then(function (xlr) {
|
|
74642
74649
|
_this2.playSchedules(xlr);
|
|
74643
74650
|
});
|
|
74644
|
-
_context2.next =
|
|
74651
|
+
_context2.next = 65;
|
|
74645
74652
|
break;
|
|
74646
|
-
case
|
|
74653
|
+
case 10:
|
|
74647
74654
|
if (!(inputLayouts.filter(function (inputLayout) {
|
|
74648
74655
|
var _this2$currentLayout;
|
|
74649
74656
|
return inputLayout.layoutId === ((_this2$currentLayout = _this2.currentLayout) === null || _this2$currentLayout === void 0 ? void 0 : _this2$currentLayout.layoutId);
|
|
74650
74657
|
}).length === 0)) {
|
|
74651
|
-
_context2.next =
|
|
74658
|
+
_context2.next = 24;
|
|
74652
74659
|
break;
|
|
74653
74660
|
}
|
|
74654
74661
|
// Unset currentLayout, nextLayout and layouts
|
|
74655
74662
|
this.layouts = [];
|
|
74663
|
+
if (this.currentLayout) {
|
|
74664
|
+
this.currentLayout.inLoop = false;
|
|
74665
|
+
}
|
|
74666
|
+
// Clean up currentLayout
|
|
74667
|
+
_context2.next = 15;
|
|
74668
|
+
return (_this$currentLayout = this.currentLayout) === null || _this$currentLayout === void 0 ? void 0 : _this$currentLayout.finishAllRegions();
|
|
74669
|
+
case 15:
|
|
74656
74670
|
this.currentLayout = undefined;
|
|
74657
74671
|
this.nextLayout = undefined;
|
|
74658
74672
|
this.currentLayoutIndex = 0;
|
|
74659
|
-
_context2.next =
|
|
74673
|
+
_context2.next = 20;
|
|
74660
74674
|
return this.prepareLayouts();
|
|
74661
|
-
case
|
|
74675
|
+
case 20:
|
|
74662
74676
|
xlr = _context2.sent;
|
|
74663
74677
|
this.playSchedules(xlr);
|
|
74664
|
-
_context2.next =
|
|
74678
|
+
_context2.next = 65;
|
|
74665
74679
|
break;
|
|
74666
|
-
case
|
|
74680
|
+
case 24:
|
|
74667
74681
|
/** Case 2: When currentLayout is in inputLayouts, then continue playing
|
|
74668
74682
|
* Also check for nextLayout if in inputLayouts and same sequence, then don't change and continue playing.
|
|
74669
74683
|
* If not in inputLayouts, then replace and prepare nextLayout.
|
|
@@ -74671,73 +74685,92 @@ function XiboLayoutRenderer(inputLayouts, options) {
|
|
|
74671
74685
|
// 2.1 We don't have to do anything for currentLayout
|
|
74672
74686
|
// 2.2 Check for nextLayout
|
|
74673
74687
|
// Get nextLayout index
|
|
74674
|
-
currLayoutIndex = getIndexByLayoutId(inputLayouts, (_this$
|
|
74688
|
+
currLayoutIndex = getIndexByLayoutId(inputLayouts, (_this$currentLayout2 = this.currentLayout) === null || _this$currentLayout2 === void 0 ? void 0 : _this$currentLayout2.layoutId).index;
|
|
74675
74689
|
nxtLayoutIndex = getIndexByLayoutId(inputLayouts, (_this$nextLayout = this.nextLayout) === null || _this$nextLayout === void 0 ? void 0 : _this$nextLayout.layoutId).index;
|
|
74676
74690
|
tempOldNxtLayout = this.layouts[nxtLayoutIndex];
|
|
74677
74691
|
newNxtLayoutIndex = currLayoutIndex + 1;
|
|
74678
74692
|
if (!(nxtLayoutIndex !== newNxtLayoutIndex)) {
|
|
74679
|
-
_context2.next =
|
|
74693
|
+
_context2.next = 54;
|
|
74680
74694
|
break;
|
|
74681
74695
|
}
|
|
74682
74696
|
// Delete old nextLayout
|
|
74683
74697
|
delete this.layouts[nxtLayoutIndex];
|
|
74684
74698
|
if (!Boolean(this.layouts[newNxtLayoutIndex])) {
|
|
74685
|
-
_context2.next =
|
|
74699
|
+
_context2.next = 35;
|
|
74686
74700
|
break;
|
|
74687
74701
|
}
|
|
74688
74702
|
this.nextLayout = this.layouts[newNxtLayoutIndex];
|
|
74689
74703
|
this.layouts[newNxtLayoutIndex] = this.nextLayout;
|
|
74690
|
-
_context2.next =
|
|
74704
|
+
_context2.next = 52;
|
|
74691
74705
|
break;
|
|
74692
|
-
case
|
|
74706
|
+
case 35:
|
|
74693
74707
|
// Check if newNxtLayoutIndex is still within inputLayouts
|
|
74694
74708
|
if (newNxtLayoutIndex + 1 > inputLayouts.length) {
|
|
74695
74709
|
// Goes back to first layout in the sequence
|
|
74696
74710
|
newNxtLayoutIndex = 0;
|
|
74697
74711
|
}
|
|
74698
74712
|
if (!Boolean(inputLayouts[newNxtLayoutIndex])) {
|
|
74699
|
-
_context2.next =
|
|
74713
|
+
_context2.next = 42;
|
|
74700
74714
|
break;
|
|
74701
74715
|
}
|
|
74702
74716
|
tempNxtLayout = _objectSpread2(_objectSpread2({}, initialLayout), inputLayouts[newNxtLayoutIndex]);
|
|
74703
|
-
_context2.next =
|
|
74717
|
+
_context2.next = 40;
|
|
74704
74718
|
return this.prepareLayoutXlf(tempNxtLayout);
|
|
74705
|
-
case
|
|
74719
|
+
case 40:
|
|
74706
74720
|
this.nextLayout = _context2.sent;
|
|
74707
74721
|
this.layouts[newNxtLayoutIndex] = this.nextLayout;
|
|
74708
|
-
case
|
|
74722
|
+
case 42:
|
|
74709
74723
|
// Move old nextLayout to its index
|
|
74710
74724
|
hasOldNxtLayout = inputLayouts.filter(function (_layout) {
|
|
74711
74725
|
return _layout.layoutId === (tempOldNxtLayout === null || tempOldNxtLayout === void 0 ? void 0 : tempOldNxtLayout.layoutId);
|
|
74712
74726
|
});
|
|
74713
|
-
if (hasOldNxtLayout.length === 1) {
|
|
74714
|
-
|
|
74715
|
-
|
|
74727
|
+
if (!(hasOldNxtLayout.length === 1)) {
|
|
74728
|
+
_context2.next = 48;
|
|
74729
|
+
break;
|
|
74716
74730
|
}
|
|
74717
|
-
|
|
74718
|
-
|
|
74731
|
+
oldNxtLayoutIndex = getIndexByLayoutId(inputLayouts, hasOldNxtLayout[0].layoutId).index;
|
|
74732
|
+
this.layouts[oldNxtLayoutIndex] = tempOldNxtLayout;
|
|
74733
|
+
_context2.next = 52;
|
|
74719
74734
|
break;
|
|
74720
|
-
case
|
|
74735
|
+
case 48:
|
|
74736
|
+
if (!tempOldNxtLayout) {
|
|
74737
|
+
_context2.next = 52;
|
|
74738
|
+
break;
|
|
74739
|
+
}
|
|
74740
|
+
_context2.next = 51;
|
|
74741
|
+
return tempOldNxtLayout.finishAllRegions();
|
|
74742
|
+
case 51:
|
|
74743
|
+
delete this.layouts[tempOldNxtLayout.index];
|
|
74744
|
+
case 52:
|
|
74745
|
+
_context2.next = 65;
|
|
74746
|
+
break;
|
|
74747
|
+
case 54:
|
|
74721
74748
|
if (!(inputLayouts[nxtLayoutIndex].layoutId !== ((_this$nextLayout2 = this.nextLayout) === null || _this$nextLayout2 === void 0 ? void 0 : _this$nextLayout2.layoutId))) {
|
|
74722
|
-
_context2.next =
|
|
74749
|
+
_context2.next = 60;
|
|
74723
74750
|
break;
|
|
74724
74751
|
}
|
|
74725
74752
|
tempNewNxtLayout = _objectSpread2(_objectSpread2({}, initialLayout), inputLayouts[nxtLayoutIndex]);
|
|
74726
|
-
_context2.next =
|
|
74753
|
+
_context2.next = 58;
|
|
74727
74754
|
return this.prepareLayoutXlf(tempNewNxtLayout);
|
|
74728
|
-
case
|
|
74755
|
+
case 58:
|
|
74729
74756
|
this.nextLayout = _context2.sent;
|
|
74730
74757
|
this.layouts[nxtLayoutIndex] = this.nextLayout;
|
|
74731
|
-
case
|
|
74732
|
-
|
|
74733
|
-
|
|
74734
|
-
|
|
74735
|
-
|
|
74736
|
-
|
|
74737
|
-
|
|
74738
|
-
|
|
74758
|
+
case 60:
|
|
74759
|
+
if (!(tempOldNxtLayout !== null && tempOldNxtLayout !== void 0 && tempOldNxtLayout.index && Boolean(this.layouts[tempOldNxtLayout === null || tempOldNxtLayout === void 0 ? void 0 : tempOldNxtLayout.index]))) {
|
|
74760
|
+
_context2.next = 65;
|
|
74761
|
+
break;
|
|
74762
|
+
}
|
|
74763
|
+
if (!(inputLayouts.filter(function (_layout) {
|
|
74764
|
+
return _layout.layoutId === (tempOldNxtLayout === null || tempOldNxtLayout === void 0 ? void 0 : tempOldNxtLayout.layoutId);
|
|
74765
|
+
}).length === 0)) {
|
|
74766
|
+
_context2.next = 65;
|
|
74767
|
+
break;
|
|
74739
74768
|
}
|
|
74740
|
-
|
|
74769
|
+
_context2.next = 64;
|
|
74770
|
+
return tempOldNxtLayout.finishAllRegions();
|
|
74771
|
+
case 64:
|
|
74772
|
+
delete this.layouts[tempOldNxtLayout === null || tempOldNxtLayout === void 0 ? void 0 : tempOldNxtLayout.index];
|
|
74773
|
+
case 65:
|
|
74741
74774
|
case "end":
|
|
74742
74775
|
return _context2.stop();
|
|
74743
74776
|
}
|
|
@@ -74848,7 +74881,7 @@ function XiboLayoutRenderer(inputLayouts, options) {
|
|
|
74848
74881
|
}();
|
|
74849
74882
|
xlrObject.gotoPrevLayout = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
74850
74883
|
var _this4 = this;
|
|
74851
|
-
var _currentLayoutIndex, _assumedPrevIndex, _this$
|
|
74884
|
+
var _currentLayoutIndex, _assumedPrevIndex, _this$currentLayout3;
|
|
74852
74885
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
74853
74886
|
while (1) switch (_context5.prev = _context5.next) {
|
|
74854
74887
|
case 0:
|
|
@@ -74870,7 +74903,7 @@ function XiboLayoutRenderer(inputLayouts, options) {
|
|
|
74870
74903
|
break;
|
|
74871
74904
|
}
|
|
74872
74905
|
_context5.next = 8;
|
|
74873
|
-
return (_this$
|
|
74906
|
+
return (_this$currentLayout3 = this.currentLayout) === null || _this$currentLayout3 === void 0 ? void 0 : _this$currentLayout3.finishAllRegions();
|
|
74874
74907
|
case 8:
|
|
74875
74908
|
// and set the previous layout as current layout
|
|
74876
74909
|
this.currentLayoutIndex = _assumedPrevIndex;
|