vrembem 3.0.11 → 3.0.14

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/dev/scripts.js CHANGED
@@ -302,10 +302,10 @@ var Collection = /*#__PURE__*/function () {
302
302
  var _proto = Collection.prototype;
303
303
  _proto.register = function register(item) {
304
304
  try {
305
- var _this2 = this;
306
- return Promise.resolve(_this2.deregister(item)).then(function () {
307
- _this2.collection.push(item);
308
- return _this2.collection;
305
+ var _this = this;
306
+ return Promise.resolve(_this.deregister(item)).then(function () {
307
+ _this.collection.push(item);
308
+ return _this.collection;
309
309
  });
310
310
  } catch (e) {
311
311
  return Promise.reject(e);
@@ -313,29 +313,29 @@ var Collection = /*#__PURE__*/function () {
313
313
  };
314
314
  _proto.deregister = function deregister(ref) {
315
315
  try {
316
- var _this4 = this;
317
- var index = _this4.collection.findIndex(function (entry) {
316
+ var _this2 = this;
317
+ var index = _this2.collection.findIndex(function (entry) {
318
318
  return entry === ref;
319
319
  });
320
320
  if (index >= 0) {
321
- var entry = _this4.collection[index];
321
+ var entry = _this2.collection[index];
322
322
  Object.getOwnPropertyNames(entry).forEach(function (prop) {
323
323
  delete entry[prop];
324
324
  });
325
- _this4.collection.splice(index, 1);
325
+ _this2.collection.splice(index, 1);
326
326
  }
327
- return Promise.resolve(_this4.collection);
327
+ return Promise.resolve(_this2.collection);
328
328
  } catch (e) {
329
329
  return Promise.reject(e);
330
330
  }
331
331
  };
332
332
  _proto.registerCollection = function registerCollection(items) {
333
333
  try {
334
- var _this6 = this;
334
+ var _this3 = this;
335
335
  return Promise.resolve(Promise.all(Array.from(items, function (item) {
336
- _this6.register(item);
336
+ _this3.register(item);
337
337
  }))).then(function () {
338
- return _this6.collection;
338
+ return _this3.collection;
339
339
  });
340
340
  } catch (e) {
341
341
  return Promise.reject(e);
@@ -343,16 +343,16 @@ var Collection = /*#__PURE__*/function () {
343
343
  };
344
344
  _proto.deregisterCollection = function deregisterCollection() {
345
345
  try {
346
- var _temp3 = function _temp3() {
347
- return _this8.collection;
346
+ var _temp2 = function _temp2() {
347
+ return _this4.collection;
348
348
  };
349
- var _this8 = this;
350
- var _temp4 = _for(function () {
351
- return _this8.collection.length > 0;
349
+ var _this4 = this;
350
+ var _temp = _for(function () {
351
+ return _this4.collection.length > 0;
352
352
  }, void 0, function () {
353
- return Promise.resolve(_this8.deregister(_this8.collection[0])).then(function () {});
353
+ return Promise.resolve(_this4.deregister(_this4.collection[0])).then(function () {});
354
354
  });
355
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
355
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
356
356
  } catch (e) {
357
357
  return Promise.reject(e);
358
358
  }
@@ -368,19 +368,29 @@ var Collection = /*#__PURE__*/function () {
368
368
  return Collection;
369
369
  }();
370
370
 
371
+ const not = {
372
+ inert: ':not([inert]):not([inert] *)',
373
+ negTabIndex: ':not([tabindex^="-"])',
374
+ disabled: ':not(:disabled)',
375
+ };
376
+
371
377
  var e = [
372
- 'a[href]:not([tabindex^="-"])',
373
- 'area[href]:not([tabindex^="-"])',
374
- 'input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])',
375
- 'input[type="radio"]:not([disabled]):not([tabindex^="-"])',
376
- 'select:not([disabled]):not([tabindex^="-"])',
377
- 'textarea:not([disabled]):not([tabindex^="-"])',
378
- 'button:not([disabled]):not([tabindex^="-"])',
379
- 'iframe:not([tabindex^="-"])',
380
- 'audio[controls]:not([tabindex^="-"])',
381
- 'video[controls]:not([tabindex^="-"])',
382
- '[contenteditable]:not([tabindex^="-"])',
383
- '[tabindex]:not([tabindex^="-"])',
378
+ `a[href]${not.inert}${not.negTabIndex}`,
379
+ `area[href]${not.inert}${not.negTabIndex}`,
380
+ `input:not([type="hidden"]):not([type="radio"])${not.inert}${not.negTabIndex}${not.disabled}`,
381
+ `input[type="radio"]${not.inert}${not.negTabIndex}${not.disabled}`,
382
+ `select${not.inert}${not.negTabIndex}${not.disabled}`,
383
+ `textarea${not.inert}${not.negTabIndex}${not.disabled}`,
384
+ `button${not.inert}${not.negTabIndex}${not.disabled}`,
385
+ `details${not.inert} > summary:first-of-type${not.negTabIndex}`,
386
+ // Discard until Firefox supports `:has()`
387
+ // See: https://github.com/KittyGiraudel/focusable-selectors/issues/12
388
+ // `details:not(:has(> summary))${not.inert}${not.negTabIndex}`,
389
+ `iframe${not.inert}${not.negTabIndex}`,
390
+ `audio[controls]${not.inert}${not.negTabIndex}`,
391
+ `video[controls]${not.inert}${not.negTabIndex}`,
392
+ `[contenteditable]${not.inert}${not.negTabIndex}`,
393
+ `[tabindex]${not.inert}${not.negTabIndex}`,
384
394
  ];
385
395
 
386
396
  var _focusable = /*#__PURE__*/_classPrivateFieldLooseKey("focusable");
@@ -619,16 +629,27 @@ function teleport(what, where, how) {
619
629
 
620
630
  var openTransition = function openTransition(el, settings) {
621
631
  return new Promise(function (resolve) {
632
+ // Check if transitions are enabled.
622
633
  if (settings.transition) {
634
+ // Toggle classes for opening transition.
623
635
  el.classList.remove(settings.stateClosed);
624
636
  el.classList.add(settings.stateOpening);
625
- el.addEventListener('transitionend', function _f() {
637
+
638
+ // Add event listener for when the transition is finished.
639
+ el.addEventListener('transitionend', function _f(event) {
640
+ // Prevent child transition bubbling from firing this event.
641
+ if (event.target != el) return;
642
+
643
+ // Toggle final opened state classes.
626
644
  el.classList.add(settings.stateOpened);
627
645
  el.classList.remove(settings.stateOpening);
646
+
647
+ // Resolve the promise and remove the event listener.
628
648
  resolve(el);
629
649
  this.removeEventListener('transitionend', _f);
630
650
  });
631
651
  } else {
652
+ // Toggle final opened state classes and resolve the promise.
632
653
  el.classList.add(settings.stateOpened);
633
654
  el.classList.remove(settings.stateClosed);
634
655
  resolve(el);
@@ -637,16 +658,27 @@ var openTransition = function openTransition(el, settings) {
637
658
  };
638
659
  var closeTransition = function closeTransition(el, settings) {
639
660
  return new Promise(function (resolve) {
661
+ // Check if transitions are enabled.
640
662
  if (settings.transition) {
663
+ // Toggle classes for closing transition.
641
664
  el.classList.add(settings.stateClosing);
642
665
  el.classList.remove(settings.stateOpened);
643
- el.addEventListener('transitionend', function _f() {
666
+
667
+ // Add event listener for when the transition is finished.
668
+ el.addEventListener('transitionend', function _f(event) {
669
+ // Prevent child transition bubbling from firing this event.
670
+ if (event.target != el) return;
671
+
672
+ // Toggle final closed state classes.
644
673
  el.classList.remove(settings.stateClosing);
645
674
  el.classList.add(settings.stateClosed);
675
+
676
+ // Resolve the promise and remove the event listener.
646
677
  resolve(el);
647
678
  this.removeEventListener('transitionend', _f);
648
679
  });
649
680
  } else {
681
+ // Toggle final closed state classes and resolve the promise.
650
682
  el.classList.add(settings.stateClosed);
651
683
  el.classList.remove(settings.stateOpened);
652
684
  resolve(el);
@@ -872,23 +904,23 @@ var deregister$2 = function deregister(obj, close) {
872
904
  close = true;
873
905
  }
874
906
  try {
875
- var _temp5 = function _temp5() {
907
+ var _temp4 = function _temp4() {
876
908
  // Return the modified collection.
877
- return _this2.collection;
909
+ return _this.collection;
878
910
  };
879
- var _this2 = this;
911
+ var _this = this;
880
912
  // Return collection if nothing was passed.
881
- if (!obj) return Promise.resolve(_this2.collection);
913
+ if (!obj) return Promise.resolve(_this.collection);
882
914
 
883
915
  // Check if entry has been registered in the collection.
884
- var index = _this2.collection.findIndex(function (entry) {
916
+ var index = _this.collection.findIndex(function (entry) {
885
917
  return entry.id === obj.id;
886
918
  });
887
- var _temp6 = function () {
919
+ var _temp3 = function () {
888
920
  if (index >= 0) {
889
- var _temp7 = function _temp7() {
921
+ var _temp2 = function _temp2() {
890
922
  // Remove entry from local store.
891
- _this2.store.set(_entry.id);
923
+ _this.store.set(_entry.id);
892
924
 
893
925
  // Unmount the MatchMedia functionality.
894
926
  _entry.unmountBreakpoint();
@@ -899,22 +931,22 @@ var deregister$2 = function deregister(obj, close) {
899
931
  });
900
932
 
901
933
  // Remove entry from collection.
902
- _this2.collection.splice(index, 1);
934
+ _this.collection.splice(index, 1);
903
935
  };
904
936
  // Get the collection entry.
905
- var _entry = _this2.collection[index];
937
+ var _entry = _this.collection[index];
906
938
 
907
939
  // If entry is in the opened state.
908
- var _temp8 = function () {
940
+ var _temp = function () {
909
941
  if (close && _entry.state === 'opened') {
910
942
  // Close the drawer.
911
943
  return Promise.resolve(_entry.close(false)).then(function () {});
912
944
  }
913
945
  }();
914
- return _temp8 && _temp8.then ? _temp8.then(_temp7) : _temp7(_temp8);
946
+ return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
915
947
  }
916
948
  }();
917
- return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(_temp5) : _temp5(_temp6));
949
+ return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
918
950
  } catch (e) {
919
951
  return Promise.reject(e);
920
952
  }
@@ -1018,33 +1050,33 @@ function getDrawerElements(query) {
1018
1050
 
1019
1051
  var initialState = function initialState(entry) {
1020
1052
  try {
1021
- var _this2 = this;
1022
- var _temp3 = function () {
1023
- if (_this2.store.get(entry.id)) {
1024
- var _temp4 = function () {
1025
- if (_this2.store.get(entry.id) === 'opened') {
1053
+ var _this = this;
1054
+ var _temp2 = function () {
1055
+ if (_this.store.get(entry.id)) {
1056
+ var _temp = function () {
1057
+ if (_this.store.get(entry.id) === 'opened') {
1026
1058
  return Promise.resolve(entry.open(false, false)).then(function () {});
1027
1059
  } else {
1028
1060
  return Promise.resolve(entry.close(false, false)).then(function () {});
1029
1061
  }
1030
1062
  }();
1031
- if (_temp4 && _temp4.then) return _temp4.then(function () {});
1032
- } else if (entry.el.classList.contains(_this2.settings.stateOpened)) {
1063
+ if (_temp && _temp.then) return _temp.then(function () {});
1064
+ } else if (entry.el.classList.contains(_this.settings.stateOpened)) {
1033
1065
  // Update drawer state.
1034
1066
  entry.state = 'opened';
1035
1067
  } else {
1036
1068
  // Remove transition state classes.
1037
- entry.el.classList.remove(_this2.settings.stateOpening);
1038
- entry.el.classList.remove(_this2.settings.stateClosing);
1069
+ entry.el.classList.remove(_this.settings.stateOpening);
1070
+ entry.el.classList.remove(_this.settings.stateClosing);
1039
1071
  // Add closed state class.
1040
- entry.el.classList.add(_this2.settings.stateClosed);
1072
+ entry.el.classList.add(_this.settings.stateClosed);
1041
1073
  }
1042
1074
  }();
1043
1075
  // Setup initial state using the following priority:
1044
1076
  // 1. If a store state is available, restore from local store.
1045
1077
  // 2. If opened state class is set, set state to opened.
1046
1078
  // 3. Else, initialize default state.
1047
- return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
1079
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
1048
1080
  } catch (e) {
1049
1081
  return Promise.reject(e);
1050
1082
  }
@@ -1074,33 +1106,33 @@ var open$2 = function open(query, transition, focus) {
1074
1106
  focus = true;
1075
1107
  }
1076
1108
  try {
1077
- var _temp3 = function _temp3() {
1109
+ var _temp2 = function _temp2() {
1078
1110
  // Set focus to the drawer element if the focus param is true.
1079
1111
  if (focus) {
1080
- updateFocusState$1.call(_this2, drawer);
1112
+ updateFocusState$1.call(_this, drawer);
1081
1113
  }
1082
1114
 
1083
1115
  // Dispatch custom opened event.
1084
1116
  drawer.el.dispatchEvent(new CustomEvent(config.customEventPrefix + 'opened', {
1085
- detail: _this2,
1117
+ detail: _this,
1086
1118
  bubbles: true
1087
1119
  }));
1088
1120
 
1089
1121
  // Return the drawer.
1090
1122
  return drawer;
1091
1123
  };
1092
- var _this2 = this;
1124
+ var _this = this;
1093
1125
  // Get the drawer from collection.
1094
- var drawer = getDrawer.call(_this2, query);
1126
+ var drawer = getDrawer.call(_this, query);
1095
1127
 
1096
1128
  // Get the modal configuration.
1097
- var config = _extends({}, _this2.settings, drawer.settings);
1129
+ var config = _extends({}, _this.settings, drawer.settings);
1098
1130
 
1099
1131
  // Add transition parameter to configuration.
1100
1132
  if (transition !== undefined) config.transition = transition;
1101
1133
 
1102
1134
  // If drawer is closed.
1103
- var _temp4 = function () {
1135
+ var _temp = function () {
1104
1136
  if (drawer.state === 'closed') {
1105
1137
  // Update drawer state.
1106
1138
  drawer.state = 'opening';
@@ -1115,7 +1147,7 @@ var open$2 = function open(query, transition, focus) {
1115
1147
  });
1116
1148
  }
1117
1149
  }();
1118
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
1150
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
1119
1151
  } catch (e) {
1120
1152
  return Promise.reject(e);
1121
1153
  }
@@ -1126,18 +1158,18 @@ var close$2 = function close(query, transition, focus) {
1126
1158
  focus = true;
1127
1159
  }
1128
1160
  try {
1129
- var _this2 = this;
1161
+ var _this = this;
1130
1162
  // Get the drawer from collection.
1131
- var drawer = getDrawer.call(_this2, query);
1163
+ var drawer = getDrawer.call(_this, query);
1132
1164
 
1133
1165
  // Get the modal configuration.
1134
- var config = _extends({}, _this2.settings, drawer.settings);
1166
+ var config = _extends({}, _this.settings, drawer.settings);
1135
1167
 
1136
1168
  // Add transition parameter to configuration.
1137
1169
  if (transition !== undefined) config.transition = transition;
1138
1170
 
1139
1171
  // If drawer is opened.
1140
- var _temp2 = function () {
1172
+ var _temp = function () {
1141
1173
  if (drawer.state === 'opened') {
1142
1174
  // Update drawer state.
1143
1175
  drawer.state = 'closing';
@@ -1152,7 +1184,7 @@ var close$2 = function close(query, transition, focus) {
1152
1184
 
1153
1185
  // Set focus to the trigger element if the focus param is true.
1154
1186
  if (focus) {
1155
- updateFocusState$1.call(_this2, drawer);
1187
+ updateFocusState$1.call(_this, drawer);
1156
1188
  }
1157
1189
 
1158
1190
  // Update drawer state.
@@ -1160,13 +1192,13 @@ var close$2 = function close(query, transition, focus) {
1160
1192
 
1161
1193
  // Dispatch custom closed event.
1162
1194
  drawer.el.dispatchEvent(new CustomEvent(config.customEventPrefix + 'closed', {
1163
- detail: _this2,
1195
+ detail: _this,
1164
1196
  bubbles: true
1165
1197
  }));
1166
1198
  });
1167
1199
  }
1168
1200
  }();
1169
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {
1201
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {
1170
1202
  // Return the drawer.
1171
1203
  return drawer;
1172
1204
  }) : drawer);
@@ -1177,15 +1209,15 @@ var close$2 = function close(query, transition, focus) {
1177
1209
 
1178
1210
  var toggle = function toggle(query, transition, focus) {
1179
1211
  try {
1180
- var _this2 = this;
1212
+ var _this = this;
1181
1213
  // Get the drawer from collection.
1182
- var drawer = getDrawer.call(_this2, query);
1214
+ var drawer = getDrawer.call(_this, query);
1183
1215
 
1184
1216
  // Open or close the drawer based on its current state.
1185
1217
  if (drawer.state === 'closed') {
1186
- return Promise.resolve(open$2.call(_this2, drawer, transition, focus));
1218
+ return Promise.resolve(open$2.call(_this, drawer, transition, focus));
1187
1219
  } else {
1188
- return Promise.resolve(close$2.call(_this2, drawer, transition, focus));
1220
+ return Promise.resolve(close$2.call(_this, drawer, transition, focus));
1189
1221
  }
1190
1222
  } catch (e) {
1191
1223
  return Promise.reject(e);
@@ -1194,7 +1226,7 @@ var toggle = function toggle(query, transition, focus) {
1194
1226
 
1195
1227
  var toModal = function toModal(entry) {
1196
1228
  try {
1197
- var _this4 = this;
1229
+ var _this2 = this;
1198
1230
  // Get the drawer configuration.
1199
1231
 
1200
1232
  // Add the modal class.
@@ -1204,16 +1236,16 @@ var toModal = function toModal(entry) {
1204
1236
  entry.dialog.setAttribute('aria-modal', 'true');
1205
1237
 
1206
1238
  // If there isn't a stored state but also has the opened state class...
1207
- if (!_this4.store.get(entry.id) && entry.el.classList.contains(entry.getSetting('stateOpened'))) {
1239
+ if (!_this2.store.get(entry.id) && entry.el.classList.contains(entry.getSetting('stateOpened'))) {
1208
1240
  // Save the opened state in local store.
1209
- _this4.store.set(entry.id, 'opened');
1241
+ _this2.store.set(entry.id, 'opened');
1210
1242
  }
1211
1243
 
1212
1244
  // Modal drawer defaults to closed state.
1213
- return Promise.resolve(close$2.call(_this4, entry, false, false)).then(function () {
1245
+ return Promise.resolve(close$2.call(_this2, entry, false, false)).then(function () {
1214
1246
  // Dispatch custom switch event.
1215
1247
  entry.el.dispatchEvent(new CustomEvent(entry.getSetting('customEventPrefix') + 'switchMode', {
1216
- detail: _this4,
1248
+ detail: _this2,
1217
1249
  bubbles: true
1218
1250
  }));
1219
1251
 
@@ -1226,7 +1258,7 @@ var toModal = function toModal(entry) {
1226
1258
  };
1227
1259
  var toInline = function toInline(entry) {
1228
1260
  try {
1229
- var _this2 = this;
1261
+ var _this = this;
1230
1262
  // Remove the modal class.
1231
1263
  entry.el.classList.remove(entry.getSetting('classModal'));
1232
1264
 
@@ -1234,16 +1266,16 @@ var toInline = function toInline(entry) {
1234
1266
  entry.dialog.removeAttribute('aria-modal');
1235
1267
 
1236
1268
  // Update the global state.
1237
- updateGlobalState(false, _extends({}, _this2.settings, entry.settings));
1269
+ updateGlobalState(false, _extends({}, _this.settings, entry.settings));
1238
1270
 
1239
1271
  // Remove any focus traps.
1240
- _this2.focusTrap.unmount();
1272
+ _this.focusTrap.unmount();
1241
1273
 
1242
1274
  // Setup initial state.
1243
- return Promise.resolve(initialState.call(_this2, entry)).then(function () {
1275
+ return Promise.resolve(initialState.call(_this, entry)).then(function () {
1244
1276
  // Dispatch custom switch event.
1245
1277
  entry.el.dispatchEvent(new CustomEvent(entry.getSetting('customEventPrefix') + 'switchMode', {
1246
- detail: _this2,
1278
+ detail: _this,
1247
1279
  bubbles: true
1248
1280
  }));
1249
1281
 
@@ -1267,11 +1299,11 @@ function switchMode(entry) {
1267
1299
 
1268
1300
  var register$2 = function register(el, dialog) {
1269
1301
  try {
1270
- var _this2 = this;
1302
+ var _this = this;
1271
1303
  // Deregister entry incase it has already been registered.
1272
- return Promise.resolve(deregister$2.call(_this2, el, false)).then(function () {
1304
+ return Promise.resolve(deregister$2.call(_this, el, false)).then(function () {
1273
1305
  // Save root this for use inside methods API.
1274
- var root = _this2;
1306
+ var root = _this;
1275
1307
 
1276
1308
  // Create an instance of the Breakpoint class.
1277
1309
  var breakpoint = new Breakpoint();
@@ -1315,7 +1347,7 @@ var register$2 = function register(el, dialog) {
1315
1347
  el: el,
1316
1348
  dialog: dialog,
1317
1349
  trigger: null,
1318
- settings: getConfig$1(el, _this2.settings.dataConfig),
1350
+ settings: getConfig$1(el, _this.settings.dataConfig),
1319
1351
  get breakpoint() {
1320
1352
  return getBreakpoint.call(root, el);
1321
1353
  },
@@ -1359,7 +1391,7 @@ var register$2 = function register(el, dialog) {
1359
1391
  }
1360
1392
 
1361
1393
  // Add entry to collection.
1362
- _this2.collection.push(entry);
1394
+ _this.collection.push(entry);
1363
1395
 
1364
1396
  // If the entry has a breakpoint...
1365
1397
  var _temp = function () {
@@ -1368,7 +1400,7 @@ var register$2 = function register(el, dialog) {
1368
1400
  entry.mountBreakpoint();
1369
1401
  } else {
1370
1402
  // Else, Setup initial state.
1371
- return Promise.resolve(initialState.call(_this2, entry)).then(function () {});
1403
+ return Promise.resolve(initialState.call(_this, entry)).then(function () {});
1372
1404
  }
1373
1405
  }();
1374
1406
  return _temp && _temp.then ? _temp.then(function () {
@@ -1413,20 +1445,20 @@ var Drawer = /*#__PURE__*/function (_Collection) {
1413
1445
  options = null;
1414
1446
  }
1415
1447
  try {
1416
- var _this3 = this;
1448
+ var _this2 = this;
1417
1449
  // Update settings with passed options.
1418
- if (options) _this3.settings = _extends({}, _this3.settings, options);
1450
+ if (options) _this2.settings = _extends({}, _this2.settings, options);
1419
1451
 
1420
1452
  // Get all the modals.
1421
- var drawers = document.querySelectorAll(_this3.settings.selectorDrawer);
1453
+ var drawers = document.querySelectorAll(_this2.settings.selectorDrawer);
1422
1454
 
1423
1455
  // Register the collections array with modal instances.
1424
- return Promise.resolve(_this3.registerCollection(drawers)).then(function () {
1456
+ return Promise.resolve(_this2.registerCollection(drawers)).then(function () {
1425
1457
  // If eventListeners are enabled, init event listeners.
1426
- if (_this3.settings.eventListeners) {
1427
- _this3.initEventListeners();
1458
+ if (_this2.settings.eventListeners) {
1459
+ _this2.initEventListeners();
1428
1460
  }
1429
- return _this3;
1461
+ return _this2;
1430
1462
  });
1431
1463
  } catch (e) {
1432
1464
  return Promise.reject(e);
@@ -1434,14 +1466,14 @@ var Drawer = /*#__PURE__*/function (_Collection) {
1434
1466
  };
1435
1467
  _proto.destroy = function destroy() {
1436
1468
  try {
1437
- var _this5 = this;
1469
+ var _this3 = this;
1438
1470
  // Remove all entries from the collection.
1439
- return Promise.resolve(_this5.deregisterCollection()).then(function () {
1471
+ return Promise.resolve(_this3.deregisterCollection()).then(function () {
1440
1472
  // If eventListeners are enabled, init event listeners.
1441
- if (_this5.settings.eventListeners) {
1442
- _this5.destroyEventListeners();
1473
+ if (_this3.settings.eventListeners) {
1474
+ _this3.destroyEventListeners();
1443
1475
  }
1444
- return _this5;
1476
+ return _this3;
1445
1477
  });
1446
1478
  } catch (e) {
1447
1479
  return Promise.reject(e);
@@ -1609,33 +1641,33 @@ function updateFocusState() {
1609
1641
 
1610
1642
  var handleClick$1 = function handleClick(event) {
1611
1643
  try {
1612
- var _this2 = this;
1644
+ var _this = this;
1613
1645
  // If an open or replace button was clicked, open or replace the modal.
1614
- var trigger = event.target.closest("[data-" + _this2.settings.dataOpen + "], [data-" + _this2.settings.dataReplace + "]");
1646
+ var trigger = event.target.closest("[data-" + _this.settings.dataOpen + "], [data-" + _this.settings.dataReplace + "]");
1615
1647
  if (trigger) {
1616
1648
  event.preventDefault();
1617
1649
  // Save the trigger if it's not coming from inside a modal.
1618
- var fromModal = event.target.closest(_this2.settings.selectorModal);
1619
- if (!fromModal) _this2.trigger = trigger;
1650
+ var fromModal = event.target.closest(_this.settings.selectorModal);
1651
+ if (!fromModal) _this.trigger = trigger;
1620
1652
  // Get the modal.
1621
- var modal = _this2.get(getModalID.call(_this2, trigger));
1653
+ var modal = _this.get(getModalID.call(_this, trigger));
1622
1654
  // Depending on the button type, either open or replace the modal.
1623
- return Promise.resolve(trigger.matches("[data-" + _this2.settings.dataOpen + "]") ? modal.open() : modal.replace());
1655
+ return Promise.resolve(trigger.matches("[data-" + _this.settings.dataOpen + "]") ? modal.open() : modal.replace());
1624
1656
  }
1625
1657
 
1626
1658
  // If a close button was clicked, close the modal.
1627
- trigger = event.target.closest("[data-" + _this2.settings.dataClose + "]");
1659
+ trigger = event.target.closest("[data-" + _this.settings.dataClose + "]");
1628
1660
  if (trigger) {
1629
1661
  event.preventDefault();
1630
1662
  // Get the value of the data attribute.
1631
- var value = trigger.getAttribute("data-" + _this2.settings.dataClose);
1663
+ var value = trigger.getAttribute("data-" + _this.settings.dataClose);
1632
1664
  // Close all if * wildcard is passed, otherwise close a single modal.
1633
- return Promise.resolve(value === '*' ? _this2.closeAll() : _this2.close(value));
1665
+ return Promise.resolve(value === '*' ? _this.closeAll() : _this.close(value));
1634
1666
  }
1635
1667
 
1636
1668
  // If the modal screen was clicked, close the modal.
1637
- if (event.target.matches(_this2.settings.selectorModal) && !event.target.querySelector(_this2.settings.selectorRequired)) {
1638
- return Promise.resolve(_this2.close(getModalID.call(_this2, event.target)));
1669
+ if (event.target.matches(_this.settings.selectorModal) && !event.target.querySelector(_this.settings.selectorRequired)) {
1670
+ return Promise.resolve(_this.close(getModalID.call(_this, event.target)));
1639
1671
  }
1640
1672
  return Promise.resolve();
1641
1673
  } catch (e) {
@@ -1657,21 +1689,21 @@ var deregister$1 = function deregister(obj, close) {
1657
1689
  close = true;
1658
1690
  }
1659
1691
  try {
1660
- var _temp5 = function _temp5() {
1692
+ var _temp4 = function _temp4() {
1661
1693
  // Return the modified collection.
1662
- return _this2.collection;
1694
+ return _this.collection;
1663
1695
  };
1664
- var _this2 = this;
1696
+ var _this = this;
1665
1697
  // Return collection if nothing was passed.
1666
- if (!obj) return Promise.resolve(_this2.collection);
1698
+ if (!obj) return Promise.resolve(_this.collection);
1667
1699
 
1668
1700
  // Check if entry has been registered in the collection.
1669
- var index = _this2.collection.findIndex(function (entry) {
1701
+ var index = _this.collection.findIndex(function (entry) {
1670
1702
  return entry.id === obj.id;
1671
1703
  });
1672
- var _temp6 = function () {
1704
+ var _temp3 = function () {
1673
1705
  if (index >= 0) {
1674
- var _temp7 = function _temp7() {
1706
+ var _temp2 = function _temp2() {
1675
1707
  // Return teleported modal if a reference has been set.
1676
1708
  if (_entry.getSetting('teleport')) {
1677
1709
  _entry.teleportReturn();
@@ -1683,24 +1715,24 @@ var deregister$1 = function deregister(obj, close) {
1683
1715
  });
1684
1716
 
1685
1717
  // Remove entry from collection.
1686
- _this2.collection.splice(index, 1);
1718
+ _this.collection.splice(index, 1);
1687
1719
  };
1688
1720
  // Get the collection entry.
1689
- var _entry = _this2.collection[index];
1721
+ var _entry = _this.collection[index];
1690
1722
 
1691
1723
  // If entry is in the opened state, close it.
1692
- var _temp8 = function () {
1724
+ var _temp = function () {
1693
1725
  if (close && _entry.state === 'opened') {
1694
1726
  return Promise.resolve(_entry.close(false)).then(function () {});
1695
1727
  } else {
1696
1728
  // Remove modal from stack.
1697
- _this2.stack.remove(_entry);
1729
+ _this.stack.remove(_entry);
1698
1730
  }
1699
1731
  }();
1700
- return _temp8 && _temp8.then ? _temp8.then(_temp7) : _temp7(_temp8);
1732
+ return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
1701
1733
  }
1702
1734
  }();
1703
- return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(_temp5) : _temp5(_temp6));
1735
+ return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
1704
1736
  } catch (e) {
1705
1737
  return Promise.reject(e);
1706
1738
  }
@@ -1711,42 +1743,42 @@ var open$1 = function open(query, transition, focus) {
1711
1743
  focus = true;
1712
1744
  }
1713
1745
  try {
1714
- var _temp3 = function _temp3() {
1746
+ var _temp2 = function _temp2() {
1715
1747
  // Update focus if the focus param is true.
1716
1748
  if (focus) {
1717
- updateFocusState.call(_this2);
1749
+ updateFocusState.call(_this);
1718
1750
  }
1719
1751
 
1720
1752
  // Dispatch custom opened event.
1721
1753
  modal.el.dispatchEvent(new CustomEvent(config.customEventPrefix + 'opened', {
1722
- detail: _this2,
1754
+ detail: _this,
1723
1755
  bubbles: true
1724
1756
  }));
1725
1757
 
1726
1758
  // Return the modal.
1727
1759
  return modal;
1728
1760
  };
1729
- var _this2 = this;
1761
+ var _this = this;
1730
1762
  // Get the modal from collection.
1731
- var modal = getModal.call(_this2, query);
1763
+ var modal = getModal.call(_this, query);
1732
1764
 
1733
1765
  // Get the modal configuration.
1734
- var config = _extends({}, _this2.settings, modal.settings);
1766
+ var config = _extends({}, _this.settings, modal.settings);
1735
1767
 
1736
1768
  // Add transition parameter to configuration.
1737
1769
  if (transition !== undefined) config.transition = transition;
1738
1770
 
1739
1771
  // Maybe add modal to top of stack.
1740
- _this2.stack.moveToTop(modal);
1772
+ _this.stack.moveToTop(modal);
1741
1773
 
1742
1774
  // If modal is closed.
1743
- var _temp4 = function () {
1775
+ var _temp = function () {
1744
1776
  if (modal.state === 'closed') {
1745
1777
  // Update modal state.
1746
1778
  modal.state = 'opening';
1747
1779
 
1748
1780
  // Add modal to stack.
1749
- _this2.stack.add(modal);
1781
+ _this.stack.add(modal);
1750
1782
 
1751
1783
  // Run the open transition.
1752
1784
  return Promise.resolve(openTransition(modal.el, config)).then(function () {
@@ -1755,7 +1787,7 @@ var open$1 = function open(query, transition, focus) {
1755
1787
  });
1756
1788
  }
1757
1789
  }();
1758
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
1790
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
1759
1791
  } catch (e) {
1760
1792
  return Promise.reject(e);
1761
1793
  }
@@ -1766,18 +1798,18 @@ var close$1 = function close(query, transition, focus) {
1766
1798
  focus = true;
1767
1799
  }
1768
1800
  try {
1769
- var _this2 = this;
1801
+ var _this = this;
1770
1802
  // Get the modal from collection, or top modal in stack if no query is provided.
1771
- var modal = query ? getModal.call(_this2, query) : _this2.active;
1803
+ var modal = query ? getModal.call(_this, query) : _this.active;
1772
1804
 
1773
1805
  // If a modal exists and its state is opened.
1774
- var _temp2 = function () {
1806
+ var _temp = function () {
1775
1807
  if (modal && modal.state === 'opened') {
1776
1808
  // Update modal state.
1777
1809
  modal.state = 'closing';
1778
1810
 
1779
1811
  // Get the modal configuration.
1780
- var config = _extends({}, _this2.settings, modal.settings);
1812
+ var config = _extends({}, _this.settings, modal.settings);
1781
1813
 
1782
1814
  // Add transition parameter to configuration.
1783
1815
  if (transition !== undefined) config.transition = transition;
@@ -1788,11 +1820,11 @@ var close$1 = function close(query, transition, focus) {
1788
1820
  // Run the close transition.
1789
1821
  return Promise.resolve(closeTransition(modal.el, config)).then(function () {
1790
1822
  // Remove modal from stack.
1791
- _this2.stack.remove(modal);
1823
+ _this.stack.remove(modal);
1792
1824
 
1793
1825
  // Update focus if the focus param is true.
1794
1826
  if (focus) {
1795
- updateFocusState.call(_this2);
1827
+ updateFocusState.call(_this);
1796
1828
  }
1797
1829
 
1798
1830
  // Update modal state.
@@ -1800,13 +1832,13 @@ var close$1 = function close(query, transition, focus) {
1800
1832
 
1801
1833
  // Dispatch custom closed event.
1802
1834
  modal.el.dispatchEvent(new CustomEvent(config.customEventPrefix + 'closed', {
1803
- detail: _this2,
1835
+ detail: _this,
1804
1836
  bubbles: true
1805
1837
  }));
1806
1838
  });
1807
1839
  }
1808
1840
  }();
1809
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {
1841
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {
1810
1842
  // Return the modal.
1811
1843
  return modal;
1812
1844
  }) : modal);
@@ -1817,24 +1849,24 @@ var close$1 = function close(query, transition, focus) {
1817
1849
 
1818
1850
  var closeAll$1 = function closeAll(exclude, transition) {
1819
1851
  try {
1820
- var _this2 = this;
1852
+ var _this = this;
1821
1853
  var result = [];
1822
- return Promise.resolve(Promise.all(_this2.stack.value.map(function (modal) {
1854
+ return Promise.resolve(Promise.all(_this.stack.value.map(function (modal) {
1823
1855
  try {
1824
- var _temp3 = function _temp3() {
1856
+ var _temp2 = function _temp2() {
1825
1857
  modal.trigger = null;
1826
1858
  };
1827
- var _temp4 = function () {
1859
+ var _temp = function () {
1828
1860
  if (exclude && exclude === modal.id) {
1829
1861
  Promise.resolve();
1830
1862
  } else {
1831
- var _push2 = result.push;
1832
- return Promise.resolve(close$1.call(_this2, modal, transition, false)).then(function (_close$call) {
1833
- _push2.call(result, _close$call);
1863
+ var _push = result.push;
1864
+ return Promise.resolve(close$1.call(_this, modal, transition, false)).then(function (_close$call) {
1865
+ _push.call(result, _close$call);
1834
1866
  });
1835
1867
  }
1836
1868
  }();
1837
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
1869
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
1838
1870
  } catch (e) {
1839
1871
  return Promise.reject(e);
1840
1872
  }
@@ -1851,10 +1883,10 @@ var replace = function replace(query, transition, focus) {
1851
1883
  focus = true;
1852
1884
  }
1853
1885
  try {
1854
- var _temp3 = function _temp3() {
1886
+ var _temp2 = function _temp2() {
1855
1887
  // Update focus if the focus param is true.
1856
1888
  if (focus) {
1857
- updateFocusState.call(_this2);
1889
+ updateFocusState.call(_this);
1858
1890
  }
1859
1891
 
1860
1892
  // Return the modals there were opened and closed.
@@ -1863,27 +1895,27 @@ var replace = function replace(query, transition, focus) {
1863
1895
  closed: resultClosed
1864
1896
  };
1865
1897
  };
1866
- var _this2 = this;
1898
+ var _this = this;
1867
1899
  // Get the modal from collection.
1868
- var modal = getModal.call(_this2, query);
1900
+ var modal = getModal.call(_this, query);
1869
1901
 
1870
1902
  // Setup results for return.
1871
1903
  var resultOpened, resultClosed;
1872
- var _temp4 = function () {
1904
+ var _temp = function () {
1873
1905
  if (modal.state === 'opened') {
1874
1906
  // If modal is open, close all modals except for replacement.
1875
1907
  resultOpened = modal;
1876
- return Promise.resolve(closeAll$1.call(_this2, modal.id, transition)).then(function (_closeAll$call) {
1908
+ return Promise.resolve(closeAll$1.call(_this, modal.id, transition)).then(function (_closeAll$call) {
1877
1909
  resultClosed = _closeAll$call;
1878
1910
  });
1879
1911
  } else {
1880
1912
  // If modal is closed, close all and open replacement at the same time.
1881
- resultOpened = open$1.call(_this2, modal, transition, false);
1882
- resultClosed = closeAll$1.call(_this2, false, transition);
1913
+ resultOpened = open$1.call(_this, modal, transition, false);
1914
+ resultClosed = closeAll$1.call(_this, false, transition);
1883
1915
  return Promise.resolve(Promise.all([resultOpened, resultClosed])).then(function () {});
1884
1916
  }
1885
1917
  }();
1886
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
1918
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
1887
1919
  } catch (e) {
1888
1920
  return Promise.reject(e);
1889
1921
  }
@@ -1891,11 +1923,11 @@ var replace = function replace(query, transition, focus) {
1891
1923
 
1892
1924
  var register$1 = function register(el, dialog) {
1893
1925
  try {
1894
- var _this2 = this;
1926
+ var _this = this;
1895
1927
  // Deregister entry incase it has already been registered.
1896
- return Promise.resolve(deregister$1.call(_this2, el, false)).then(function () {
1928
+ return Promise.resolve(deregister$1.call(_this, el, false)).then(function () {
1897
1929
  // Save root this for use inside methods API.
1898
- var root = _this2;
1930
+ var root = _this;
1899
1931
 
1900
1932
  // Setup methods API.
1901
1933
  var methods = {
@@ -1947,7 +1979,7 @@ var register$1 = function register(el, dialog) {
1947
1979
  el: el,
1948
1980
  dialog: dialog,
1949
1981
  returnRef: null,
1950
- settings: getConfig$1(el, _this2.settings.dataConfig)
1982
+ settings: getConfig$1(el, _this.settings.dataConfig)
1951
1983
  }, methods);
1952
1984
 
1953
1985
  // Set aria-modal attribute to true.
@@ -1969,19 +2001,19 @@ var register$1 = function register(el, dialog) {
1969
2001
  }
1970
2002
 
1971
2003
  // Add entry to collection.
1972
- _this2.collection.push(entry);
2004
+ _this.collection.push(entry);
1973
2005
 
1974
2006
  // Setup initial state.
1975
2007
  var _temp = function () {
1976
- if (entry.el.classList.contains(_this2.settings.stateOpened)) {
2008
+ if (entry.el.classList.contains(_this.settings.stateOpened)) {
1977
2009
  // Open entry with transitions disabled.
1978
2010
  return Promise.resolve(entry.open(false)).then(function () {});
1979
2011
  } else {
1980
2012
  // Remove transition state classes.
1981
- entry.el.classList.remove(_this2.settings.stateOpening);
1982
- entry.el.classList.remove(_this2.settings.stateClosing);
2013
+ entry.el.classList.remove(_this.settings.stateOpening);
2014
+ entry.el.classList.remove(_this.settings.stateClosing);
1983
2015
  // Add closed state class.
1984
- entry.el.classList.add(_this2.settings.stateClosed);
2016
+ entry.el.classList.add(_this.settings.stateClosed);
1985
2017
  }
1986
2018
  }();
1987
2019
  return _temp && _temp.then ? _temp.then(function () {
@@ -2092,20 +2124,20 @@ var Modal = /*#__PURE__*/function (_Collection) {
2092
2124
  var _proto = Modal.prototype;
2093
2125
  _proto.init = function init(options) {
2094
2126
  try {
2095
- var _this3 = this;
2127
+ var _this2 = this;
2096
2128
  // Update settings with passed options.
2097
- if (options) _this3.settings = _extends({}, _this3.settings, options);
2129
+ if (options) _this2.settings = _extends({}, _this2.settings, options);
2098
2130
 
2099
2131
  // Get all the modals.
2100
- var modals = document.querySelectorAll(_this3.settings.selectorModal);
2132
+ var modals = document.querySelectorAll(_this2.settings.selectorModal);
2101
2133
 
2102
2134
  // Register the collections array with modal instances.
2103
- return Promise.resolve(_this3.registerCollection(modals)).then(function () {
2135
+ return Promise.resolve(_this2.registerCollection(modals)).then(function () {
2104
2136
  // If eventListeners are enabled, init event listeners.
2105
- if (_this3.settings.eventListeners) {
2106
- _this3.initEventListeners();
2137
+ if (_this2.settings.eventListeners) {
2138
+ _this2.initEventListeners();
2107
2139
  }
2108
- return _this3;
2140
+ return _this2;
2109
2141
  });
2110
2142
  } catch (e) {
2111
2143
  return Promise.reject(e);
@@ -2113,17 +2145,17 @@ var Modal = /*#__PURE__*/function (_Collection) {
2113
2145
  };
2114
2146
  _proto.destroy = function destroy() {
2115
2147
  try {
2116
- var _this5 = this;
2148
+ var _this3 = this;
2117
2149
  // Clear stored trigger.
2118
- _this5.trigger = null;
2150
+ _this3.trigger = null;
2119
2151
 
2120
2152
  // Remove all entries from the collection.
2121
- return Promise.resolve(_this5.deregisterCollection()).then(function () {
2153
+ return Promise.resolve(_this3.deregisterCollection()).then(function () {
2122
2154
  // If eventListeners are enabled, destroy event listeners.
2123
- if (_this5.settings.eventListeners) {
2124
- _this5.destroyEventListeners();
2155
+ if (_this3.settings.eventListeners) {
2156
+ _this3.destroyEventListeners();
2125
2157
  }
2126
- return _this5;
2158
+ return _this3;
2127
2159
  });
2128
2160
  } catch (e) {
2129
2161
  return Promise.reject(e);
@@ -2163,11 +2195,11 @@ var Modal = /*#__PURE__*/function (_Collection) {
2163
2195
  focus = true;
2164
2196
  }
2165
2197
  try {
2166
- var _this7 = this;
2167
- return Promise.resolve(closeAll$1.call(_this7, exclude, transition)).then(function (result) {
2198
+ var _this4 = this;
2199
+ return Promise.resolve(closeAll$1.call(_this4, exclude, transition)).then(function (result) {
2168
2200
  // Update focus if the focus param is true.
2169
2201
  if (focus) {
2170
- updateFocusState.call(_this7);
2202
+ updateFocusState.call(_this4);
2171
2203
  }
2172
2204
  return result;
2173
2205
  });
@@ -2383,19 +2415,19 @@ function getPopoverElements(query) {
2383
2415
 
2384
2416
  var closeAll = function closeAll() {
2385
2417
  try {
2386
- var _this4 = this;
2418
+ var _this2 = this;
2387
2419
  var result = [];
2388
- return Promise.resolve(Promise.all(_this4.collection.map(function (popover) {
2420
+ return Promise.resolve(Promise.all(_this2.collection.map(function (popover) {
2389
2421
  try {
2390
- var _temp4 = function () {
2422
+ var _temp2 = function () {
2391
2423
  if (popover.state === 'opened') {
2392
- var _push2 = result.push;
2393
- return Promise.resolve(close.call(_this4, popover)).then(function (_close$call) {
2394
- _push2.call(result, _close$call);
2424
+ var _push = result.push;
2425
+ return Promise.resolve(close.call(_this2, popover)).then(function (_close$call) {
2426
+ _push.call(result, _close$call);
2395
2427
  });
2396
2428
  }
2397
2429
  }();
2398
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
2430
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
2399
2431
  } catch (e) {
2400
2432
  return Promise.reject(e);
2401
2433
  }
@@ -2408,11 +2440,11 @@ var closeAll = function closeAll() {
2408
2440
  };
2409
2441
  var close = function close(query) {
2410
2442
  try {
2411
- var _temp2 = function _temp2(popover) {
2443
+ var _temp = function _temp(popover) {
2412
2444
  // If a modal exists and its state is opened.
2413
2445
  if (popover && popover.state === 'opened') {
2414
2446
  // Update state class.
2415
- popover.el.classList.remove(_this2.settings.stateActive);
2447
+ popover.el.classList.remove(_this.settings.stateActive);
2416
2448
 
2417
2449
  // Update accessibility attribute(s).
2418
2450
  if (popover.trigger.hasAttribute('aria-controls')) {
@@ -2431,17 +2463,17 @@ var close = function close(query) {
2431
2463
  popover.state = 'closed';
2432
2464
 
2433
2465
  // Clear root trigger if popover trigger matches.
2434
- if (popover.trigger === _this2.trigger) {
2435
- _this2.trigger = null;
2466
+ if (popover.trigger === _this.trigger) {
2467
+ _this.trigger = null;
2436
2468
  }
2437
2469
  }
2438
2470
 
2439
2471
  // Return the popover.
2440
2472
  return popover;
2441
2473
  };
2442
- var _this2 = this;
2474
+ var _this = this;
2443
2475
  // Get the popover from collection.
2444
- return Promise.resolve(query ? _temp2(getPopover.call(_this2, query)) : Promise.resolve(closeAll.call(_this2)).then(_temp2));
2476
+ return Promise.resolve(query ? _temp(getPopover.call(_this, query)) : Promise.resolve(closeAll.call(_this)).then(_temp));
2445
2477
  } catch (e) {
2446
2478
  return Promise.reject(e);
2447
2479
  }
@@ -2680,7 +2712,7 @@ var round = Math.round;
2680
2712
  function getUAString() {
2681
2713
  var uaData = navigator.userAgentData;
2682
2714
 
2683
- if (uaData != null && uaData.brands) {
2715
+ if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
2684
2716
  return uaData.brands.map(function (item) {
2685
2717
  return item.brand + "/" + item.version;
2686
2718
  }).join(' ');
@@ -2968,7 +3000,6 @@ function effect$1(_ref2) {
2968
3000
  }
2969
3001
 
2970
3002
  if (!contains(state.elements.popper, arrowElement)) {
2971
-
2972
3003
  return;
2973
3004
  }
2974
3005
 
@@ -2999,10 +3030,9 @@ var unsetSides = {
2999
3030
  // Zooming can change the DPR, but it seems to report a value that will
3000
3031
  // cleanly divide the values into the appropriate subpixels.
3001
3032
 
3002
- function roundOffsetsByDPR(_ref) {
3033
+ function roundOffsetsByDPR(_ref, win) {
3003
3034
  var x = _ref.x,
3004
3035
  y = _ref.y;
3005
- var win = window;
3006
3036
  var dpr = win.devicePixelRatio || 1;
3007
3037
  return {
3008
3038
  x: round(x * dpr) / dpr || 0,
@@ -3085,7 +3115,7 @@ function mapToStyles(_ref2) {
3085
3115
  var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
3086
3116
  x: x,
3087
3117
  y: y
3088
- }) : {
3118
+ }, getWindow(popper)) : {
3089
3119
  x: x,
3090
3120
  y: y
3091
3121
  };
@@ -3111,7 +3141,6 @@ function computeStyles(_ref5) {
3111
3141
  adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
3112
3142
  _options$roundOffsets = options.roundOffsets,
3113
3143
  roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
3114
-
3115
3144
  var commonStyles = {
3116
3145
  placement: getBasePlacement(state.placement),
3117
3146
  variation: getVariation(state.placement),
@@ -4179,8 +4208,7 @@ function popperGenerator(generatorOptions) {
4179
4208
 
4180
4209
  state.orderedModifiers = orderedModifiers.filter(function (m) {
4181
4210
  return m.enabled;
4182
- }); // Validate the provided modifiers so that the consumer will get warned
4183
-
4211
+ });
4184
4212
  runModifierEffects();
4185
4213
  return instance.update();
4186
4214
  },
@@ -4200,7 +4228,6 @@ function popperGenerator(generatorOptions) {
4200
4228
  // anymore
4201
4229
 
4202
4230
  if (!areValidElements(reference, popper)) {
4203
-
4204
4231
  return;
4205
4232
  } // Store the reference and popper rects to be read by modifiers
4206
4233
 
@@ -4225,7 +4252,6 @@ function popperGenerator(generatorOptions) {
4225
4252
  });
4226
4253
 
4227
4254
  for (var index = 0; index < state.orderedModifiers.length; index++) {
4228
-
4229
4255
  if (state.reset === true) {
4230
4256
  state.reset = false;
4231
4257
  index = -1;
@@ -4263,7 +4289,6 @@ function popperGenerator(generatorOptions) {
4263
4289
  };
4264
4290
 
4265
4291
  if (!areValidElements(reference, popper)) {
4266
-
4267
4292
  return instance;
4268
4293
  }
4269
4294
 
@@ -4278,11 +4303,11 @@ function popperGenerator(generatorOptions) {
4278
4303
  // one.
4279
4304
 
4280
4305
  function runModifierEffects() {
4281
- state.orderedModifiers.forEach(function (_ref3) {
4282
- var name = _ref3.name,
4283
- _ref3$options = _ref3.options,
4284
- options = _ref3$options === void 0 ? {} : _ref3$options,
4285
- effect = _ref3.effect;
4306
+ state.orderedModifiers.forEach(function (_ref) {
4307
+ var name = _ref.name,
4308
+ _ref$options = _ref.options,
4309
+ options = _ref$options === void 0 ? {} : _ref$options,
4310
+ effect = _ref.effect;
4286
4311
 
4287
4312
  if (typeof effect === 'function') {
4288
4313
  var cleanupFn = effect({
@@ -4317,17 +4342,17 @@ var createPopper = /*#__PURE__*/popperGenerator({
4317
4342
 
4318
4343
  var deregister = function deregister(obj) {
4319
4344
  try {
4320
- var _this2 = this;
4345
+ var _this = this;
4321
4346
  // Return collection if nothing was passed.
4322
- if (!obj) return Promise.resolve(_this2.collection);
4347
+ if (!obj) return Promise.resolve(_this.collection);
4323
4348
 
4324
4349
  // Check if entry has been registered in the collection.
4325
- var index = _this2.collection.findIndex(function (entry) {
4350
+ var index = _this.collection.findIndex(function (entry) {
4326
4351
  return entry.id === obj.id;
4327
4352
  });
4328
4353
  if (index >= 0) {
4329
4354
  // Get the collection entry.
4330
- var entry = _this2.collection[index];
4355
+ var entry = _this.collection[index];
4331
4356
 
4332
4357
  // If entry is in the opened state, close it.
4333
4358
  if (entry.state === 'opened') {
@@ -4346,11 +4371,11 @@ var deregister = function deregister(obj) {
4346
4371
  });
4347
4372
 
4348
4373
  // Remove entry from collection.
4349
- _this2.collection.splice(index, 1);
4374
+ _this.collection.splice(index, 1);
4350
4375
  }
4351
4376
 
4352
4377
  // Return the modified collection.
4353
- return Promise.resolve(_this2.collection);
4378
+ return Promise.resolve(_this.collection);
4354
4379
  } catch (e) {
4355
4380
  return Promise.reject(e);
4356
4381
  }
@@ -4377,12 +4402,12 @@ function deregisterEventListeners(entry) {
4377
4402
 
4378
4403
  var open = function open(query) {
4379
4404
  try {
4380
- var _this2 = this;
4405
+ var _this = this;
4381
4406
  // Get the popover from collection.
4382
- var popover = getPopover.call(_this2, query);
4407
+ var popover = getPopover.call(_this, query);
4383
4408
 
4384
4409
  // Update state class.
4385
- popover.el.classList.add(_this2.settings.stateActive);
4410
+ popover.el.classList.add(_this.settings.stateActive);
4386
4411
 
4387
4412
  // Update accessibility attribute(s).
4388
4413
  if (popover.trigger.hasAttribute('aria-controls')) {
@@ -4390,7 +4415,7 @@ var open = function open(query) {
4390
4415
  }
4391
4416
 
4392
4417
  // Update popover config.
4393
- popover.config = getConfig(popover.el, _this2.settings);
4418
+ popover.config = getConfig(popover.el, _this.settings);
4394
4419
 
4395
4420
  // Enable popper event listeners and set placement/modifiers.
4396
4421
  popover.popper.setOptions({
@@ -4416,12 +4441,12 @@ var open = function open(query) {
4416
4441
 
4417
4442
  var register = function register(el, trigger) {
4418
4443
  try {
4419
- var _this2 = this;
4444
+ var _this = this;
4420
4445
  // Deregister entry incase it has already been registered.
4421
- deregister.call(_this2, el);
4446
+ deregister.call(_this, el);
4422
4447
 
4423
4448
  // Save root this for use inside methods API.
4424
- var root = _this2;
4449
+ var root = _this;
4425
4450
 
4426
4451
  // Setup methods API.
4427
4452
  var methods = {
@@ -4443,7 +4468,7 @@ var register = function register(el, trigger) {
4443
4468
  el: el,
4444
4469
  trigger: trigger,
4445
4470
  popper: createPopper(trigger, el),
4446
- config: getConfig(el, _this2.settings)
4471
+ config: getConfig(el, _this.settings)
4447
4472
  }, methods);
4448
4473
 
4449
4474
  // Set aria-expanded to false if trigger has aria-controls attribute.
@@ -4452,20 +4477,20 @@ var register = function register(el, trigger) {
4452
4477
  }
4453
4478
 
4454
4479
  // Setup event listeners.
4455
- registerEventListeners.call(_this2, entry);
4480
+ registerEventListeners.call(_this, entry);
4456
4481
 
4457
4482
  // Add entry to collection.
4458
- _this2.collection.push(entry);
4483
+ _this.collection.push(entry);
4459
4484
 
4460
4485
  // Set initial state.
4461
- var _temp2 = function () {
4462
- if (entry.el.classList.contains(_this2.settings.stateActive)) {
4486
+ var _temp = function () {
4487
+ if (entry.el.classList.contains(_this.settings.stateActive)) {
4463
4488
  return Promise.resolve(entry.open()).then(function () {
4464
- handleDocumentClick.call(_this2, entry);
4489
+ handleDocumentClick.call(_this, entry);
4465
4490
  });
4466
4491
  }
4467
4492
  }();
4468
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {
4493
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {
4469
4494
  // Return the registered entry.
4470
4495
  return entry;
4471
4496
  }) : entry);
@@ -4546,22 +4571,22 @@ var Popover = /*#__PURE__*/function (_Collection) {
4546
4571
  var _proto = Popover.prototype;
4547
4572
  _proto.init = function init(options) {
4548
4573
  try {
4549
- var _this3 = this;
4574
+ var _this2 = this;
4550
4575
  // Update settings with passed options.
4551
- if (options) _this3.settings = _extends({}, _this3.settings, options);
4576
+ if (options) _this2.settings = _extends({}, _this2.settings, options);
4552
4577
 
4553
4578
  // Get all the popovers.
4554
- var popovers = document.querySelectorAll(_this3.settings.selectorPopover);
4579
+ var popovers = document.querySelectorAll(_this2.settings.selectorPopover);
4555
4580
 
4556
4581
  // Register the collections array with popover instances.
4557
- return Promise.resolve(_this3.registerCollection(popovers)).then(function () {
4582
+ return Promise.resolve(_this2.registerCollection(popovers)).then(function () {
4558
4583
  // If eventListeners are enabled, init event listeners.
4559
- if (_this3.settings.eventListeners) {
4584
+ if (_this2.settings.eventListeners) {
4560
4585
  // Pass false to initEventListeners() since registerCollection()
4561
4586
  // already adds event listeners to popovers.
4562
- _this3.initEventListeners(false);
4587
+ _this2.initEventListeners(false);
4563
4588
  }
4564
- return _this3;
4589
+ return _this2;
4565
4590
  });
4566
4591
  } catch (e) {
4567
4592
  return Promise.reject(e);
@@ -4569,33 +4594,33 @@ var Popover = /*#__PURE__*/function (_Collection) {
4569
4594
  };
4570
4595
  _proto.destroy = function destroy() {
4571
4596
  try {
4572
- var _this5 = this;
4597
+ var _this3 = this;
4573
4598
  // Clear stored trigger.
4574
- _this5.trigger = null;
4599
+ _this3.trigger = null;
4575
4600
 
4576
4601
  // Remove all entries from the collection.
4577
- return Promise.resolve(_this5.deregisterCollection()).then(function () {
4602
+ return Promise.resolve(_this3.deregisterCollection()).then(function () {
4578
4603
  // If eventListeners are enabled, destroy event listeners.
4579
- if (_this5.settings.eventListeners) {
4604
+ if (_this3.settings.eventListeners) {
4580
4605
  // Pass false to destroyEventListeners() since deregisterCollection()
4581
4606
  // already removes event listeners from popovers.
4582
- _this5.destroyEventListeners(false);
4607
+ _this3.destroyEventListeners(false);
4583
4608
  }
4584
- return _this5;
4609
+ return _this3;
4585
4610
  });
4586
4611
  } catch (e) {
4587
4612
  return Promise.reject(e);
4588
4613
  }
4589
4614
  };
4590
4615
  _proto.initEventListeners = function initEventListeners(processCollection) {
4591
- var _this6 = this;
4616
+ var _this4 = this;
4592
4617
  if (processCollection === void 0) {
4593
4618
  processCollection = true;
4594
4619
  }
4595
4620
  if (processCollection) {
4596
4621
  // Loop through collection and setup event listeners.
4597
4622
  this.collection.forEach(function (popover) {
4598
- registerEventListeners.call(_this6, popover);
4623
+ registerEventListeners.call(_this4, popover);
4599
4624
  });
4600
4625
  }
4601
4626