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.
@@ -2,7 +2,7 @@
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
3
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
4
  (global = global || self, factory(global.vrembem = {}));
5
- }(this, (function (exports) {
5
+ })(this, (function (exports) {
6
6
  function _defineProperties(target, props) {
7
7
  for (var i = 0; i < props.length; i++) {
8
8
  var descriptor = props[i];
@@ -307,10 +307,10 @@
307
307
  var _proto = Collection.prototype;
308
308
  _proto.register = function register(item) {
309
309
  try {
310
- var _this2 = this;
311
- return Promise.resolve(_this2.deregister(item)).then(function () {
312
- _this2.collection.push(item);
313
- return _this2.collection;
310
+ var _this = this;
311
+ return Promise.resolve(_this.deregister(item)).then(function () {
312
+ _this.collection.push(item);
313
+ return _this.collection;
314
314
  });
315
315
  } catch (e) {
316
316
  return Promise.reject(e);
@@ -318,29 +318,29 @@
318
318
  };
319
319
  _proto.deregister = function deregister(ref) {
320
320
  try {
321
- var _this4 = this;
322
- var index = _this4.collection.findIndex(function (entry) {
321
+ var _this2 = this;
322
+ var index = _this2.collection.findIndex(function (entry) {
323
323
  return entry === ref;
324
324
  });
325
325
  if (index >= 0) {
326
- var entry = _this4.collection[index];
326
+ var entry = _this2.collection[index];
327
327
  Object.getOwnPropertyNames(entry).forEach(function (prop) {
328
328
  delete entry[prop];
329
329
  });
330
- _this4.collection.splice(index, 1);
330
+ _this2.collection.splice(index, 1);
331
331
  }
332
- return Promise.resolve(_this4.collection);
332
+ return Promise.resolve(_this2.collection);
333
333
  } catch (e) {
334
334
  return Promise.reject(e);
335
335
  }
336
336
  };
337
337
  _proto.registerCollection = function registerCollection(items) {
338
338
  try {
339
- var _this6 = this;
339
+ var _this3 = this;
340
340
  return Promise.resolve(Promise.all(Array.from(items, function (item) {
341
- _this6.register(item);
341
+ _this3.register(item);
342
342
  }))).then(function () {
343
- return _this6.collection;
343
+ return _this3.collection;
344
344
  });
345
345
  } catch (e) {
346
346
  return Promise.reject(e);
@@ -348,16 +348,16 @@
348
348
  };
349
349
  _proto.deregisterCollection = function deregisterCollection() {
350
350
  try {
351
- var _temp3 = function _temp3() {
352
- return _this8.collection;
351
+ var _temp2 = function _temp2() {
352
+ return _this4.collection;
353
353
  };
354
- var _this8 = this;
355
- var _temp4 = _for(function () {
356
- return _this8.collection.length > 0;
354
+ var _this4 = this;
355
+ var _temp = _for(function () {
356
+ return _this4.collection.length > 0;
357
357
  }, void 0, function () {
358
- return Promise.resolve(_this8.deregister(_this8.collection[0])).then(function () {});
358
+ return Promise.resolve(_this4.deregister(_this4.collection[0])).then(function () {});
359
359
  });
360
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
360
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
361
361
  } catch (e) {
362
362
  return Promise.reject(e);
363
363
  }
@@ -373,19 +373,29 @@
373
373
  return Collection;
374
374
  }();
375
375
 
376
+ const not = {
377
+ inert: ':not([inert]):not([inert] *)',
378
+ negTabIndex: ':not([tabindex^="-"])',
379
+ disabled: ':not(:disabled)',
380
+ };
381
+
376
382
  var e = [
377
- 'a[href]:not([tabindex^="-"])',
378
- 'area[href]:not([tabindex^="-"])',
379
- 'input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])',
380
- 'input[type="radio"]:not([disabled]):not([tabindex^="-"])',
381
- 'select:not([disabled]):not([tabindex^="-"])',
382
- 'textarea:not([disabled]):not([tabindex^="-"])',
383
- 'button:not([disabled]):not([tabindex^="-"])',
384
- 'iframe:not([tabindex^="-"])',
385
- 'audio[controls]:not([tabindex^="-"])',
386
- 'video[controls]:not([tabindex^="-"])',
387
- '[contenteditable]:not([tabindex^="-"])',
388
- '[tabindex]:not([tabindex^="-"])',
383
+ `a[href]${not.inert}${not.negTabIndex}`,
384
+ `area[href]${not.inert}${not.negTabIndex}`,
385
+ `input:not([type="hidden"]):not([type="radio"])${not.inert}${not.negTabIndex}${not.disabled}`,
386
+ `input[type="radio"]${not.inert}${not.negTabIndex}${not.disabled}`,
387
+ `select${not.inert}${not.negTabIndex}${not.disabled}`,
388
+ `textarea${not.inert}${not.negTabIndex}${not.disabled}`,
389
+ `button${not.inert}${not.negTabIndex}${not.disabled}`,
390
+ `details${not.inert} > summary:first-of-type${not.negTabIndex}`,
391
+ // Discard until Firefox supports `:has()`
392
+ // See: https://github.com/KittyGiraudel/focusable-selectors/issues/12
393
+ // `details:not(:has(> summary))${not.inert}${not.negTabIndex}`,
394
+ `iframe${not.inert}${not.negTabIndex}`,
395
+ `audio[controls]${not.inert}${not.negTabIndex}`,
396
+ `video[controls]${not.inert}${not.negTabIndex}`,
397
+ `[contenteditable]${not.inert}${not.negTabIndex}`,
398
+ `[tabindex]${not.inert}${not.negTabIndex}`,
389
399
  ];
390
400
 
391
401
  var _focusable = /*#__PURE__*/_classPrivateFieldLooseKey("focusable");
@@ -624,16 +634,27 @@
624
634
 
625
635
  var openTransition = function openTransition(el, settings) {
626
636
  return new Promise(function (resolve) {
637
+ // Check if transitions are enabled.
627
638
  if (settings.transition) {
639
+ // Toggle classes for opening transition.
628
640
  el.classList.remove(settings.stateClosed);
629
641
  el.classList.add(settings.stateOpening);
630
- el.addEventListener('transitionend', function _f() {
642
+
643
+ // Add event listener for when the transition is finished.
644
+ el.addEventListener('transitionend', function _f(event) {
645
+ // Prevent child transition bubbling from firing this event.
646
+ if (event.target != el) return;
647
+
648
+ // Toggle final opened state classes.
631
649
  el.classList.add(settings.stateOpened);
632
650
  el.classList.remove(settings.stateOpening);
651
+
652
+ // Resolve the promise and remove the event listener.
633
653
  resolve(el);
634
654
  this.removeEventListener('transitionend', _f);
635
655
  });
636
656
  } else {
657
+ // Toggle final opened state classes and resolve the promise.
637
658
  el.classList.add(settings.stateOpened);
638
659
  el.classList.remove(settings.stateClosed);
639
660
  resolve(el);
@@ -642,16 +663,27 @@
642
663
  };
643
664
  var closeTransition = function closeTransition(el, settings) {
644
665
  return new Promise(function (resolve) {
666
+ // Check if transitions are enabled.
645
667
  if (settings.transition) {
668
+ // Toggle classes for closing transition.
646
669
  el.classList.add(settings.stateClosing);
647
670
  el.classList.remove(settings.stateOpened);
648
- el.addEventListener('transitionend', function _f() {
671
+
672
+ // Add event listener for when the transition is finished.
673
+ el.addEventListener('transitionend', function _f(event) {
674
+ // Prevent child transition bubbling from firing this event.
675
+ if (event.target != el) return;
676
+
677
+ // Toggle final closed state classes.
649
678
  el.classList.remove(settings.stateClosing);
650
679
  el.classList.add(settings.stateClosed);
680
+
681
+ // Resolve the promise and remove the event listener.
651
682
  resolve(el);
652
683
  this.removeEventListener('transitionend', _f);
653
684
  });
654
685
  } else {
686
+ // Toggle final closed state classes and resolve the promise.
655
687
  el.classList.add(settings.stateClosed);
656
688
  el.classList.remove(settings.stateOpened);
657
689
  resolve(el);
@@ -877,23 +909,23 @@
877
909
  close = true;
878
910
  }
879
911
  try {
880
- var _temp5 = function _temp5() {
912
+ var _temp4 = function _temp4() {
881
913
  // Return the modified collection.
882
- return _this2.collection;
914
+ return _this.collection;
883
915
  };
884
- var _this2 = this;
916
+ var _this = this;
885
917
  // Return collection if nothing was passed.
886
- if (!obj) return Promise.resolve(_this2.collection);
918
+ if (!obj) return Promise.resolve(_this.collection);
887
919
 
888
920
  // Check if entry has been registered in the collection.
889
- var index = _this2.collection.findIndex(function (entry) {
921
+ var index = _this.collection.findIndex(function (entry) {
890
922
  return entry.id === obj.id;
891
923
  });
892
- var _temp6 = function () {
924
+ var _temp3 = function () {
893
925
  if (index >= 0) {
894
- var _temp7 = function _temp7() {
926
+ var _temp2 = function _temp2() {
895
927
  // Remove entry from local store.
896
- _this2.store.set(_entry.id);
928
+ _this.store.set(_entry.id);
897
929
 
898
930
  // Unmount the MatchMedia functionality.
899
931
  _entry.unmountBreakpoint();
@@ -904,22 +936,22 @@
904
936
  });
905
937
 
906
938
  // Remove entry from collection.
907
- _this2.collection.splice(index, 1);
939
+ _this.collection.splice(index, 1);
908
940
  };
909
941
  // Get the collection entry.
910
- var _entry = _this2.collection[index];
942
+ var _entry = _this.collection[index];
911
943
 
912
944
  // If entry is in the opened state.
913
- var _temp8 = function () {
945
+ var _temp = function () {
914
946
  if (close && _entry.state === 'opened') {
915
947
  // Close the drawer.
916
948
  return Promise.resolve(_entry.close(false)).then(function () {});
917
949
  }
918
950
  }();
919
- return _temp8 && _temp8.then ? _temp8.then(_temp7) : _temp7(_temp8);
951
+ return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
920
952
  }
921
953
  }();
922
- return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(_temp5) : _temp5(_temp6));
954
+ return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
923
955
  } catch (e) {
924
956
  return Promise.reject(e);
925
957
  }
@@ -1023,33 +1055,33 @@
1023
1055
 
1024
1056
  var initialState = function initialState(entry) {
1025
1057
  try {
1026
- var _this2 = this;
1027
- var _temp3 = function () {
1028
- if (_this2.store.get(entry.id)) {
1029
- var _temp4 = function () {
1030
- if (_this2.store.get(entry.id) === 'opened') {
1058
+ var _this = this;
1059
+ var _temp2 = function () {
1060
+ if (_this.store.get(entry.id)) {
1061
+ var _temp = function () {
1062
+ if (_this.store.get(entry.id) === 'opened') {
1031
1063
  return Promise.resolve(entry.open(false, false)).then(function () {});
1032
1064
  } else {
1033
1065
  return Promise.resolve(entry.close(false, false)).then(function () {});
1034
1066
  }
1035
1067
  }();
1036
- if (_temp4 && _temp4.then) return _temp4.then(function () {});
1037
- } else if (entry.el.classList.contains(_this2.settings.stateOpened)) {
1068
+ if (_temp && _temp.then) return _temp.then(function () {});
1069
+ } else if (entry.el.classList.contains(_this.settings.stateOpened)) {
1038
1070
  // Update drawer state.
1039
1071
  entry.state = 'opened';
1040
1072
  } else {
1041
1073
  // Remove transition state classes.
1042
- entry.el.classList.remove(_this2.settings.stateOpening);
1043
- entry.el.classList.remove(_this2.settings.stateClosing);
1074
+ entry.el.classList.remove(_this.settings.stateOpening);
1075
+ entry.el.classList.remove(_this.settings.stateClosing);
1044
1076
  // Add closed state class.
1045
- entry.el.classList.add(_this2.settings.stateClosed);
1077
+ entry.el.classList.add(_this.settings.stateClosed);
1046
1078
  }
1047
1079
  }();
1048
1080
  // Setup initial state using the following priority:
1049
1081
  // 1. If a store state is available, restore from local store.
1050
1082
  // 2. If opened state class is set, set state to opened.
1051
1083
  // 3. Else, initialize default state.
1052
- return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
1084
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
1053
1085
  } catch (e) {
1054
1086
  return Promise.reject(e);
1055
1087
  }
@@ -1079,33 +1111,33 @@
1079
1111
  focus = true;
1080
1112
  }
1081
1113
  try {
1082
- var _temp3 = function _temp3() {
1114
+ var _temp2 = function _temp2() {
1083
1115
  // Set focus to the drawer element if the focus param is true.
1084
1116
  if (focus) {
1085
- updateFocusState$1.call(_this2, drawer);
1117
+ updateFocusState$1.call(_this, drawer);
1086
1118
  }
1087
1119
 
1088
1120
  // Dispatch custom opened event.
1089
1121
  drawer.el.dispatchEvent(new CustomEvent(config.customEventPrefix + 'opened', {
1090
- detail: _this2,
1122
+ detail: _this,
1091
1123
  bubbles: true
1092
1124
  }));
1093
1125
 
1094
1126
  // Return the drawer.
1095
1127
  return drawer;
1096
1128
  };
1097
- var _this2 = this;
1129
+ var _this = this;
1098
1130
  // Get the drawer from collection.
1099
- var drawer = getDrawer.call(_this2, query);
1131
+ var drawer = getDrawer.call(_this, query);
1100
1132
 
1101
1133
  // Get the modal configuration.
1102
- var config = _extends({}, _this2.settings, drawer.settings);
1134
+ var config = _extends({}, _this.settings, drawer.settings);
1103
1135
 
1104
1136
  // Add transition parameter to configuration.
1105
1137
  if (transition !== undefined) config.transition = transition;
1106
1138
 
1107
1139
  // If drawer is closed.
1108
- var _temp4 = function () {
1140
+ var _temp = function () {
1109
1141
  if (drawer.state === 'closed') {
1110
1142
  // Update drawer state.
1111
1143
  drawer.state = 'opening';
@@ -1120,7 +1152,7 @@
1120
1152
  });
1121
1153
  }
1122
1154
  }();
1123
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
1155
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
1124
1156
  } catch (e) {
1125
1157
  return Promise.reject(e);
1126
1158
  }
@@ -1131,18 +1163,18 @@
1131
1163
  focus = true;
1132
1164
  }
1133
1165
  try {
1134
- var _this2 = this;
1166
+ var _this = this;
1135
1167
  // Get the drawer from collection.
1136
- var drawer = getDrawer.call(_this2, query);
1168
+ var drawer = getDrawer.call(_this, query);
1137
1169
 
1138
1170
  // Get the modal configuration.
1139
- var config = _extends({}, _this2.settings, drawer.settings);
1171
+ var config = _extends({}, _this.settings, drawer.settings);
1140
1172
 
1141
1173
  // Add transition parameter to configuration.
1142
1174
  if (transition !== undefined) config.transition = transition;
1143
1175
 
1144
1176
  // If drawer is opened.
1145
- var _temp2 = function () {
1177
+ var _temp = function () {
1146
1178
  if (drawer.state === 'opened') {
1147
1179
  // Update drawer state.
1148
1180
  drawer.state = 'closing';
@@ -1157,7 +1189,7 @@
1157
1189
 
1158
1190
  // Set focus to the trigger element if the focus param is true.
1159
1191
  if (focus) {
1160
- updateFocusState$1.call(_this2, drawer);
1192
+ updateFocusState$1.call(_this, drawer);
1161
1193
  }
1162
1194
 
1163
1195
  // Update drawer state.
@@ -1165,13 +1197,13 @@
1165
1197
 
1166
1198
  // Dispatch custom closed event.
1167
1199
  drawer.el.dispatchEvent(new CustomEvent(config.customEventPrefix + 'closed', {
1168
- detail: _this2,
1200
+ detail: _this,
1169
1201
  bubbles: true
1170
1202
  }));
1171
1203
  });
1172
1204
  }
1173
1205
  }();
1174
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {
1206
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {
1175
1207
  // Return the drawer.
1176
1208
  return drawer;
1177
1209
  }) : drawer);
@@ -1182,15 +1214,15 @@
1182
1214
 
1183
1215
  var toggle = function toggle(query, transition, focus) {
1184
1216
  try {
1185
- var _this2 = this;
1217
+ var _this = this;
1186
1218
  // Get the drawer from collection.
1187
- var drawer = getDrawer.call(_this2, query);
1219
+ var drawer = getDrawer.call(_this, query);
1188
1220
 
1189
1221
  // Open or close the drawer based on its current state.
1190
1222
  if (drawer.state === 'closed') {
1191
- return Promise.resolve(open$2.call(_this2, drawer, transition, focus));
1223
+ return Promise.resolve(open$2.call(_this, drawer, transition, focus));
1192
1224
  } else {
1193
- return Promise.resolve(close$2.call(_this2, drawer, transition, focus));
1225
+ return Promise.resolve(close$2.call(_this, drawer, transition, focus));
1194
1226
  }
1195
1227
  } catch (e) {
1196
1228
  return Promise.reject(e);
@@ -1199,7 +1231,7 @@
1199
1231
 
1200
1232
  var toModal = function toModal(entry) {
1201
1233
  try {
1202
- var _this4 = this;
1234
+ var _this2 = this;
1203
1235
  // Get the drawer configuration.
1204
1236
 
1205
1237
  // Add the modal class.
@@ -1209,16 +1241,16 @@
1209
1241
  entry.dialog.setAttribute('aria-modal', 'true');
1210
1242
 
1211
1243
  // If there isn't a stored state but also has the opened state class...
1212
- if (!_this4.store.get(entry.id) && entry.el.classList.contains(entry.getSetting('stateOpened'))) {
1244
+ if (!_this2.store.get(entry.id) && entry.el.classList.contains(entry.getSetting('stateOpened'))) {
1213
1245
  // Save the opened state in local store.
1214
- _this4.store.set(entry.id, 'opened');
1246
+ _this2.store.set(entry.id, 'opened');
1215
1247
  }
1216
1248
 
1217
1249
  // Modal drawer defaults to closed state.
1218
- return Promise.resolve(close$2.call(_this4, entry, false, false)).then(function () {
1250
+ return Promise.resolve(close$2.call(_this2, entry, false, false)).then(function () {
1219
1251
  // Dispatch custom switch event.
1220
1252
  entry.el.dispatchEvent(new CustomEvent(entry.getSetting('customEventPrefix') + 'switchMode', {
1221
- detail: _this4,
1253
+ detail: _this2,
1222
1254
  bubbles: true
1223
1255
  }));
1224
1256
 
@@ -1231,7 +1263,7 @@
1231
1263
  };
1232
1264
  var toInline = function toInline(entry) {
1233
1265
  try {
1234
- var _this2 = this;
1266
+ var _this = this;
1235
1267
  // Remove the modal class.
1236
1268
  entry.el.classList.remove(entry.getSetting('classModal'));
1237
1269
 
@@ -1239,16 +1271,16 @@
1239
1271
  entry.dialog.removeAttribute('aria-modal');
1240
1272
 
1241
1273
  // Update the global state.
1242
- updateGlobalState(false, _extends({}, _this2.settings, entry.settings));
1274
+ updateGlobalState(false, _extends({}, _this.settings, entry.settings));
1243
1275
 
1244
1276
  // Remove any focus traps.
1245
- _this2.focusTrap.unmount();
1277
+ _this.focusTrap.unmount();
1246
1278
 
1247
1279
  // Setup initial state.
1248
- return Promise.resolve(initialState.call(_this2, entry)).then(function () {
1280
+ return Promise.resolve(initialState.call(_this, entry)).then(function () {
1249
1281
  // Dispatch custom switch event.
1250
1282
  entry.el.dispatchEvent(new CustomEvent(entry.getSetting('customEventPrefix') + 'switchMode', {
1251
- detail: _this2,
1283
+ detail: _this,
1252
1284
  bubbles: true
1253
1285
  }));
1254
1286
 
@@ -1272,11 +1304,11 @@
1272
1304
 
1273
1305
  var register$2 = function register(el, dialog) {
1274
1306
  try {
1275
- var _this2 = this;
1307
+ var _this = this;
1276
1308
  // Deregister entry incase it has already been registered.
1277
- return Promise.resolve(deregister$2.call(_this2, el, false)).then(function () {
1309
+ return Promise.resolve(deregister$2.call(_this, el, false)).then(function () {
1278
1310
  // Save root this for use inside methods API.
1279
- var root = _this2;
1311
+ var root = _this;
1280
1312
 
1281
1313
  // Create an instance of the Breakpoint class.
1282
1314
  var breakpoint = new Breakpoint();
@@ -1320,7 +1352,7 @@
1320
1352
  el: el,
1321
1353
  dialog: dialog,
1322
1354
  trigger: null,
1323
- settings: getConfig$1(el, _this2.settings.dataConfig),
1355
+ settings: getConfig$1(el, _this.settings.dataConfig),
1324
1356
  get breakpoint() {
1325
1357
  return getBreakpoint.call(root, el);
1326
1358
  },
@@ -1364,7 +1396,7 @@
1364
1396
  }
1365
1397
 
1366
1398
  // Add entry to collection.
1367
- _this2.collection.push(entry);
1399
+ _this.collection.push(entry);
1368
1400
 
1369
1401
  // If the entry has a breakpoint...
1370
1402
  var _temp = function () {
@@ -1373,7 +1405,7 @@
1373
1405
  entry.mountBreakpoint();
1374
1406
  } else {
1375
1407
  // Else, Setup initial state.
1376
- return Promise.resolve(initialState.call(_this2, entry)).then(function () {});
1408
+ return Promise.resolve(initialState.call(_this, entry)).then(function () {});
1377
1409
  }
1378
1410
  }();
1379
1411
  return _temp && _temp.then ? _temp.then(function () {
@@ -1418,20 +1450,20 @@
1418
1450
  options = null;
1419
1451
  }
1420
1452
  try {
1421
- var _this3 = this;
1453
+ var _this2 = this;
1422
1454
  // Update settings with passed options.
1423
- if (options) _this3.settings = _extends({}, _this3.settings, options);
1455
+ if (options) _this2.settings = _extends({}, _this2.settings, options);
1424
1456
 
1425
1457
  // Get all the modals.
1426
- var drawers = document.querySelectorAll(_this3.settings.selectorDrawer);
1458
+ var drawers = document.querySelectorAll(_this2.settings.selectorDrawer);
1427
1459
 
1428
1460
  // Register the collections array with modal instances.
1429
- return Promise.resolve(_this3.registerCollection(drawers)).then(function () {
1461
+ return Promise.resolve(_this2.registerCollection(drawers)).then(function () {
1430
1462
  // If eventListeners are enabled, init event listeners.
1431
- if (_this3.settings.eventListeners) {
1432
- _this3.initEventListeners();
1463
+ if (_this2.settings.eventListeners) {
1464
+ _this2.initEventListeners();
1433
1465
  }
1434
- return _this3;
1466
+ return _this2;
1435
1467
  });
1436
1468
  } catch (e) {
1437
1469
  return Promise.reject(e);
@@ -1439,14 +1471,14 @@
1439
1471
  };
1440
1472
  _proto.destroy = function destroy() {
1441
1473
  try {
1442
- var _this5 = this;
1474
+ var _this3 = this;
1443
1475
  // Remove all entries from the collection.
1444
- return Promise.resolve(_this5.deregisterCollection()).then(function () {
1476
+ return Promise.resolve(_this3.deregisterCollection()).then(function () {
1445
1477
  // If eventListeners are enabled, init event listeners.
1446
- if (_this5.settings.eventListeners) {
1447
- _this5.destroyEventListeners();
1478
+ if (_this3.settings.eventListeners) {
1479
+ _this3.destroyEventListeners();
1448
1480
  }
1449
- return _this5;
1481
+ return _this3;
1450
1482
  });
1451
1483
  } catch (e) {
1452
1484
  return Promise.reject(e);
@@ -1614,33 +1646,33 @@
1614
1646
 
1615
1647
  var handleClick$1 = function handleClick(event) {
1616
1648
  try {
1617
- var _this2 = this;
1649
+ var _this = this;
1618
1650
  // If an open or replace button was clicked, open or replace the modal.
1619
- var trigger = event.target.closest("[data-" + _this2.settings.dataOpen + "], [data-" + _this2.settings.dataReplace + "]");
1651
+ var trigger = event.target.closest("[data-" + _this.settings.dataOpen + "], [data-" + _this.settings.dataReplace + "]");
1620
1652
  if (trigger) {
1621
1653
  event.preventDefault();
1622
1654
  // Save the trigger if it's not coming from inside a modal.
1623
- var fromModal = event.target.closest(_this2.settings.selectorModal);
1624
- if (!fromModal) _this2.trigger = trigger;
1655
+ var fromModal = event.target.closest(_this.settings.selectorModal);
1656
+ if (!fromModal) _this.trigger = trigger;
1625
1657
  // Get the modal.
1626
- var modal = _this2.get(getModalID.call(_this2, trigger));
1658
+ var modal = _this.get(getModalID.call(_this, trigger));
1627
1659
  // Depending on the button type, either open or replace the modal.
1628
- return Promise.resolve(trigger.matches("[data-" + _this2.settings.dataOpen + "]") ? modal.open() : modal.replace());
1660
+ return Promise.resolve(trigger.matches("[data-" + _this.settings.dataOpen + "]") ? modal.open() : modal.replace());
1629
1661
  }
1630
1662
 
1631
1663
  // If a close button was clicked, close the modal.
1632
- trigger = event.target.closest("[data-" + _this2.settings.dataClose + "]");
1664
+ trigger = event.target.closest("[data-" + _this.settings.dataClose + "]");
1633
1665
  if (trigger) {
1634
1666
  event.preventDefault();
1635
1667
  // Get the value of the data attribute.
1636
- var value = trigger.getAttribute("data-" + _this2.settings.dataClose);
1668
+ var value = trigger.getAttribute("data-" + _this.settings.dataClose);
1637
1669
  // Close all if * wildcard is passed, otherwise close a single modal.
1638
- return Promise.resolve(value === '*' ? _this2.closeAll() : _this2.close(value));
1670
+ return Promise.resolve(value === '*' ? _this.closeAll() : _this.close(value));
1639
1671
  }
1640
1672
 
1641
1673
  // If the modal screen was clicked, close the modal.
1642
- if (event.target.matches(_this2.settings.selectorModal) && !event.target.querySelector(_this2.settings.selectorRequired)) {
1643
- return Promise.resolve(_this2.close(getModalID.call(_this2, event.target)));
1674
+ if (event.target.matches(_this.settings.selectorModal) && !event.target.querySelector(_this.settings.selectorRequired)) {
1675
+ return Promise.resolve(_this.close(getModalID.call(_this, event.target)));
1644
1676
  }
1645
1677
  return Promise.resolve();
1646
1678
  } catch (e) {
@@ -1662,21 +1694,21 @@
1662
1694
  close = true;
1663
1695
  }
1664
1696
  try {
1665
- var _temp5 = function _temp5() {
1697
+ var _temp4 = function _temp4() {
1666
1698
  // Return the modified collection.
1667
- return _this2.collection;
1699
+ return _this.collection;
1668
1700
  };
1669
- var _this2 = this;
1701
+ var _this = this;
1670
1702
  // Return collection if nothing was passed.
1671
- if (!obj) return Promise.resolve(_this2.collection);
1703
+ if (!obj) return Promise.resolve(_this.collection);
1672
1704
 
1673
1705
  // Check if entry has been registered in the collection.
1674
- var index = _this2.collection.findIndex(function (entry) {
1706
+ var index = _this.collection.findIndex(function (entry) {
1675
1707
  return entry.id === obj.id;
1676
1708
  });
1677
- var _temp6 = function () {
1709
+ var _temp3 = function () {
1678
1710
  if (index >= 0) {
1679
- var _temp7 = function _temp7() {
1711
+ var _temp2 = function _temp2() {
1680
1712
  // Return teleported modal if a reference has been set.
1681
1713
  if (_entry.getSetting('teleport')) {
1682
1714
  _entry.teleportReturn();
@@ -1688,24 +1720,24 @@
1688
1720
  });
1689
1721
 
1690
1722
  // Remove entry from collection.
1691
- _this2.collection.splice(index, 1);
1723
+ _this.collection.splice(index, 1);
1692
1724
  };
1693
1725
  // Get the collection entry.
1694
- var _entry = _this2.collection[index];
1726
+ var _entry = _this.collection[index];
1695
1727
 
1696
1728
  // If entry is in the opened state, close it.
1697
- var _temp8 = function () {
1729
+ var _temp = function () {
1698
1730
  if (close && _entry.state === 'opened') {
1699
1731
  return Promise.resolve(_entry.close(false)).then(function () {});
1700
1732
  } else {
1701
1733
  // Remove modal from stack.
1702
- _this2.stack.remove(_entry);
1734
+ _this.stack.remove(_entry);
1703
1735
  }
1704
1736
  }();
1705
- return _temp8 && _temp8.then ? _temp8.then(_temp7) : _temp7(_temp8);
1737
+ return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
1706
1738
  }
1707
1739
  }();
1708
- return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(_temp5) : _temp5(_temp6));
1740
+ return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
1709
1741
  } catch (e) {
1710
1742
  return Promise.reject(e);
1711
1743
  }
@@ -1716,42 +1748,42 @@
1716
1748
  focus = true;
1717
1749
  }
1718
1750
  try {
1719
- var _temp3 = function _temp3() {
1751
+ var _temp2 = function _temp2() {
1720
1752
  // Update focus if the focus param is true.
1721
1753
  if (focus) {
1722
- updateFocusState.call(_this2);
1754
+ updateFocusState.call(_this);
1723
1755
  }
1724
1756
 
1725
1757
  // Dispatch custom opened event.
1726
1758
  modal.el.dispatchEvent(new CustomEvent(config.customEventPrefix + 'opened', {
1727
- detail: _this2,
1759
+ detail: _this,
1728
1760
  bubbles: true
1729
1761
  }));
1730
1762
 
1731
1763
  // Return the modal.
1732
1764
  return modal;
1733
1765
  };
1734
- var _this2 = this;
1766
+ var _this = this;
1735
1767
  // Get the modal from collection.
1736
- var modal = getModal.call(_this2, query);
1768
+ var modal = getModal.call(_this, query);
1737
1769
 
1738
1770
  // Get the modal configuration.
1739
- var config = _extends({}, _this2.settings, modal.settings);
1771
+ var config = _extends({}, _this.settings, modal.settings);
1740
1772
 
1741
1773
  // Add transition parameter to configuration.
1742
1774
  if (transition !== undefined) config.transition = transition;
1743
1775
 
1744
1776
  // Maybe add modal to top of stack.
1745
- _this2.stack.moveToTop(modal);
1777
+ _this.stack.moveToTop(modal);
1746
1778
 
1747
1779
  // If modal is closed.
1748
- var _temp4 = function () {
1780
+ var _temp = function () {
1749
1781
  if (modal.state === 'closed') {
1750
1782
  // Update modal state.
1751
1783
  modal.state = 'opening';
1752
1784
 
1753
1785
  // Add modal to stack.
1754
- _this2.stack.add(modal);
1786
+ _this.stack.add(modal);
1755
1787
 
1756
1788
  // Run the open transition.
1757
1789
  return Promise.resolve(openTransition(modal.el, config)).then(function () {
@@ -1760,7 +1792,7 @@
1760
1792
  });
1761
1793
  }
1762
1794
  }();
1763
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
1795
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
1764
1796
  } catch (e) {
1765
1797
  return Promise.reject(e);
1766
1798
  }
@@ -1771,18 +1803,18 @@
1771
1803
  focus = true;
1772
1804
  }
1773
1805
  try {
1774
- var _this2 = this;
1806
+ var _this = this;
1775
1807
  // Get the modal from collection, or top modal in stack if no query is provided.
1776
- var modal = query ? getModal.call(_this2, query) : _this2.active;
1808
+ var modal = query ? getModal.call(_this, query) : _this.active;
1777
1809
 
1778
1810
  // If a modal exists and its state is opened.
1779
- var _temp2 = function () {
1811
+ var _temp = function () {
1780
1812
  if (modal && modal.state === 'opened') {
1781
1813
  // Update modal state.
1782
1814
  modal.state = 'closing';
1783
1815
 
1784
1816
  // Get the modal configuration.
1785
- var config = _extends({}, _this2.settings, modal.settings);
1817
+ var config = _extends({}, _this.settings, modal.settings);
1786
1818
 
1787
1819
  // Add transition parameter to configuration.
1788
1820
  if (transition !== undefined) config.transition = transition;
@@ -1793,11 +1825,11 @@
1793
1825
  // Run the close transition.
1794
1826
  return Promise.resolve(closeTransition(modal.el, config)).then(function () {
1795
1827
  // Remove modal from stack.
1796
- _this2.stack.remove(modal);
1828
+ _this.stack.remove(modal);
1797
1829
 
1798
1830
  // Update focus if the focus param is true.
1799
1831
  if (focus) {
1800
- updateFocusState.call(_this2);
1832
+ updateFocusState.call(_this);
1801
1833
  }
1802
1834
 
1803
1835
  // Update modal state.
@@ -1805,13 +1837,13 @@
1805
1837
 
1806
1838
  // Dispatch custom closed event.
1807
1839
  modal.el.dispatchEvent(new CustomEvent(config.customEventPrefix + 'closed', {
1808
- detail: _this2,
1840
+ detail: _this,
1809
1841
  bubbles: true
1810
1842
  }));
1811
1843
  });
1812
1844
  }
1813
1845
  }();
1814
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {
1846
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {
1815
1847
  // Return the modal.
1816
1848
  return modal;
1817
1849
  }) : modal);
@@ -1822,24 +1854,24 @@
1822
1854
 
1823
1855
  var closeAll$1 = function closeAll(exclude, transition) {
1824
1856
  try {
1825
- var _this2 = this;
1857
+ var _this = this;
1826
1858
  var result = [];
1827
- return Promise.resolve(Promise.all(_this2.stack.value.map(function (modal) {
1859
+ return Promise.resolve(Promise.all(_this.stack.value.map(function (modal) {
1828
1860
  try {
1829
- var _temp3 = function _temp3() {
1861
+ var _temp2 = function _temp2() {
1830
1862
  modal.trigger = null;
1831
1863
  };
1832
- var _temp4 = function () {
1864
+ var _temp = function () {
1833
1865
  if (exclude && exclude === modal.id) {
1834
1866
  Promise.resolve();
1835
1867
  } else {
1836
- var _push2 = result.push;
1837
- return Promise.resolve(close$1.call(_this2, modal, transition, false)).then(function (_close$call) {
1838
- _push2.call(result, _close$call);
1868
+ var _push = result.push;
1869
+ return Promise.resolve(close$1.call(_this, modal, transition, false)).then(function (_close$call) {
1870
+ _push.call(result, _close$call);
1839
1871
  });
1840
1872
  }
1841
1873
  }();
1842
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
1874
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
1843
1875
  } catch (e) {
1844
1876
  return Promise.reject(e);
1845
1877
  }
@@ -1856,10 +1888,10 @@
1856
1888
  focus = true;
1857
1889
  }
1858
1890
  try {
1859
- var _temp3 = function _temp3() {
1891
+ var _temp2 = function _temp2() {
1860
1892
  // Update focus if the focus param is true.
1861
1893
  if (focus) {
1862
- updateFocusState.call(_this2);
1894
+ updateFocusState.call(_this);
1863
1895
  }
1864
1896
 
1865
1897
  // Return the modals there were opened and closed.
@@ -1868,27 +1900,27 @@
1868
1900
  closed: resultClosed
1869
1901
  };
1870
1902
  };
1871
- var _this2 = this;
1903
+ var _this = this;
1872
1904
  // Get the modal from collection.
1873
- var modal = getModal.call(_this2, query);
1905
+ var modal = getModal.call(_this, query);
1874
1906
 
1875
1907
  // Setup results for return.
1876
1908
  var resultOpened, resultClosed;
1877
- var _temp4 = function () {
1909
+ var _temp = function () {
1878
1910
  if (modal.state === 'opened') {
1879
1911
  // If modal is open, close all modals except for replacement.
1880
1912
  resultOpened = modal;
1881
- return Promise.resolve(closeAll$1.call(_this2, modal.id, transition)).then(function (_closeAll$call) {
1913
+ return Promise.resolve(closeAll$1.call(_this, modal.id, transition)).then(function (_closeAll$call) {
1882
1914
  resultClosed = _closeAll$call;
1883
1915
  });
1884
1916
  } else {
1885
1917
  // If modal is closed, close all and open replacement at the same time.
1886
- resultOpened = open$1.call(_this2, modal, transition, false);
1887
- resultClosed = closeAll$1.call(_this2, false, transition);
1918
+ resultOpened = open$1.call(_this, modal, transition, false);
1919
+ resultClosed = closeAll$1.call(_this, false, transition);
1888
1920
  return Promise.resolve(Promise.all([resultOpened, resultClosed])).then(function () {});
1889
1921
  }
1890
1922
  }();
1891
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
1923
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
1892
1924
  } catch (e) {
1893
1925
  return Promise.reject(e);
1894
1926
  }
@@ -1896,11 +1928,11 @@
1896
1928
 
1897
1929
  var register$1 = function register(el, dialog) {
1898
1930
  try {
1899
- var _this2 = this;
1931
+ var _this = this;
1900
1932
  // Deregister entry incase it has already been registered.
1901
- return Promise.resolve(deregister$1.call(_this2, el, false)).then(function () {
1933
+ return Promise.resolve(deregister$1.call(_this, el, false)).then(function () {
1902
1934
  // Save root this for use inside methods API.
1903
- var root = _this2;
1935
+ var root = _this;
1904
1936
 
1905
1937
  // Setup methods API.
1906
1938
  var methods = {
@@ -1952,7 +1984,7 @@
1952
1984
  el: el,
1953
1985
  dialog: dialog,
1954
1986
  returnRef: null,
1955
- settings: getConfig$1(el, _this2.settings.dataConfig)
1987
+ settings: getConfig$1(el, _this.settings.dataConfig)
1956
1988
  }, methods);
1957
1989
 
1958
1990
  // Set aria-modal attribute to true.
@@ -1974,19 +2006,19 @@
1974
2006
  }
1975
2007
 
1976
2008
  // Add entry to collection.
1977
- _this2.collection.push(entry);
2009
+ _this.collection.push(entry);
1978
2010
 
1979
2011
  // Setup initial state.
1980
2012
  var _temp = function () {
1981
- if (entry.el.classList.contains(_this2.settings.stateOpened)) {
2013
+ if (entry.el.classList.contains(_this.settings.stateOpened)) {
1982
2014
  // Open entry with transitions disabled.
1983
2015
  return Promise.resolve(entry.open(false)).then(function () {});
1984
2016
  } else {
1985
2017
  // Remove transition state classes.
1986
- entry.el.classList.remove(_this2.settings.stateOpening);
1987
- entry.el.classList.remove(_this2.settings.stateClosing);
2018
+ entry.el.classList.remove(_this.settings.stateOpening);
2019
+ entry.el.classList.remove(_this.settings.stateClosing);
1988
2020
  // Add closed state class.
1989
- entry.el.classList.add(_this2.settings.stateClosed);
2021
+ entry.el.classList.add(_this.settings.stateClosed);
1990
2022
  }
1991
2023
  }();
1992
2024
  return _temp && _temp.then ? _temp.then(function () {
@@ -2097,20 +2129,20 @@
2097
2129
  var _proto = Modal.prototype;
2098
2130
  _proto.init = function init(options) {
2099
2131
  try {
2100
- var _this3 = this;
2132
+ var _this2 = this;
2101
2133
  // Update settings with passed options.
2102
- if (options) _this3.settings = _extends({}, _this3.settings, options);
2134
+ if (options) _this2.settings = _extends({}, _this2.settings, options);
2103
2135
 
2104
2136
  // Get all the modals.
2105
- var modals = document.querySelectorAll(_this3.settings.selectorModal);
2137
+ var modals = document.querySelectorAll(_this2.settings.selectorModal);
2106
2138
 
2107
2139
  // Register the collections array with modal instances.
2108
- return Promise.resolve(_this3.registerCollection(modals)).then(function () {
2140
+ return Promise.resolve(_this2.registerCollection(modals)).then(function () {
2109
2141
  // If eventListeners are enabled, init event listeners.
2110
- if (_this3.settings.eventListeners) {
2111
- _this3.initEventListeners();
2142
+ if (_this2.settings.eventListeners) {
2143
+ _this2.initEventListeners();
2112
2144
  }
2113
- return _this3;
2145
+ return _this2;
2114
2146
  });
2115
2147
  } catch (e) {
2116
2148
  return Promise.reject(e);
@@ -2118,17 +2150,17 @@
2118
2150
  };
2119
2151
  _proto.destroy = function destroy() {
2120
2152
  try {
2121
- var _this5 = this;
2153
+ var _this3 = this;
2122
2154
  // Clear stored trigger.
2123
- _this5.trigger = null;
2155
+ _this3.trigger = null;
2124
2156
 
2125
2157
  // Remove all entries from the collection.
2126
- return Promise.resolve(_this5.deregisterCollection()).then(function () {
2158
+ return Promise.resolve(_this3.deregisterCollection()).then(function () {
2127
2159
  // If eventListeners are enabled, destroy event listeners.
2128
- if (_this5.settings.eventListeners) {
2129
- _this5.destroyEventListeners();
2160
+ if (_this3.settings.eventListeners) {
2161
+ _this3.destroyEventListeners();
2130
2162
  }
2131
- return _this5;
2163
+ return _this3;
2132
2164
  });
2133
2165
  } catch (e) {
2134
2166
  return Promise.reject(e);
@@ -2168,11 +2200,11 @@
2168
2200
  focus = true;
2169
2201
  }
2170
2202
  try {
2171
- var _this7 = this;
2172
- return Promise.resolve(closeAll$1.call(_this7, exclude, transition)).then(function (result) {
2203
+ var _this4 = this;
2204
+ return Promise.resolve(closeAll$1.call(_this4, exclude, transition)).then(function (result) {
2173
2205
  // Update focus if the focus param is true.
2174
2206
  if (focus) {
2175
- updateFocusState.call(_this7);
2207
+ updateFocusState.call(_this4);
2176
2208
  }
2177
2209
  return result;
2178
2210
  });
@@ -2388,19 +2420,19 @@
2388
2420
 
2389
2421
  var closeAll = function closeAll() {
2390
2422
  try {
2391
- var _this4 = this;
2423
+ var _this2 = this;
2392
2424
  var result = [];
2393
- return Promise.resolve(Promise.all(_this4.collection.map(function (popover) {
2425
+ return Promise.resolve(Promise.all(_this2.collection.map(function (popover) {
2394
2426
  try {
2395
- var _temp4 = function () {
2427
+ var _temp2 = function () {
2396
2428
  if (popover.state === 'opened') {
2397
- var _push2 = result.push;
2398
- return Promise.resolve(close.call(_this4, popover)).then(function (_close$call) {
2399
- _push2.call(result, _close$call);
2429
+ var _push = result.push;
2430
+ return Promise.resolve(close.call(_this2, popover)).then(function (_close$call) {
2431
+ _push.call(result, _close$call);
2400
2432
  });
2401
2433
  }
2402
2434
  }();
2403
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
2435
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
2404
2436
  } catch (e) {
2405
2437
  return Promise.reject(e);
2406
2438
  }
@@ -2413,11 +2445,11 @@
2413
2445
  };
2414
2446
  var close = function close(query) {
2415
2447
  try {
2416
- var _temp2 = function _temp2(popover) {
2448
+ var _temp = function _temp(popover) {
2417
2449
  // If a modal exists and its state is opened.
2418
2450
  if (popover && popover.state === 'opened') {
2419
2451
  // Update state class.
2420
- popover.el.classList.remove(_this2.settings.stateActive);
2452
+ popover.el.classList.remove(_this.settings.stateActive);
2421
2453
 
2422
2454
  // Update accessibility attribute(s).
2423
2455
  if (popover.trigger.hasAttribute('aria-controls')) {
@@ -2436,17 +2468,17 @@
2436
2468
  popover.state = 'closed';
2437
2469
 
2438
2470
  // Clear root trigger if popover trigger matches.
2439
- if (popover.trigger === _this2.trigger) {
2440
- _this2.trigger = null;
2471
+ if (popover.trigger === _this.trigger) {
2472
+ _this.trigger = null;
2441
2473
  }
2442
2474
  }
2443
2475
 
2444
2476
  // Return the popover.
2445
2477
  return popover;
2446
2478
  };
2447
- var _this2 = this;
2479
+ var _this = this;
2448
2480
  // Get the popover from collection.
2449
- return Promise.resolve(query ? _temp2(getPopover.call(_this2, query)) : Promise.resolve(closeAll.call(_this2)).then(_temp2));
2481
+ return Promise.resolve(query ? _temp(getPopover.call(_this, query)) : Promise.resolve(closeAll.call(_this)).then(_temp));
2450
2482
  } catch (e) {
2451
2483
  return Promise.reject(e);
2452
2484
  }
@@ -2685,7 +2717,7 @@
2685
2717
  function getUAString() {
2686
2718
  var uaData = navigator.userAgentData;
2687
2719
 
2688
- if (uaData != null && uaData.brands) {
2720
+ if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
2689
2721
  return uaData.brands.map(function (item) {
2690
2722
  return item.brand + "/" + item.version;
2691
2723
  }).join(' ');
@@ -2973,7 +3005,6 @@
2973
3005
  }
2974
3006
 
2975
3007
  if (!contains(state.elements.popper, arrowElement)) {
2976
-
2977
3008
  return;
2978
3009
  }
2979
3010
 
@@ -3004,10 +3035,9 @@
3004
3035
  // Zooming can change the DPR, but it seems to report a value that will
3005
3036
  // cleanly divide the values into the appropriate subpixels.
3006
3037
 
3007
- function roundOffsetsByDPR(_ref) {
3038
+ function roundOffsetsByDPR(_ref, win) {
3008
3039
  var x = _ref.x,
3009
3040
  y = _ref.y;
3010
- var win = window;
3011
3041
  var dpr = win.devicePixelRatio || 1;
3012
3042
  return {
3013
3043
  x: round(x * dpr) / dpr || 0,
@@ -3090,7 +3120,7 @@
3090
3120
  var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
3091
3121
  x: x,
3092
3122
  y: y
3093
- }) : {
3123
+ }, getWindow(popper)) : {
3094
3124
  x: x,
3095
3125
  y: y
3096
3126
  };
@@ -3116,7 +3146,6 @@
3116
3146
  adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
3117
3147
  _options$roundOffsets = options.roundOffsets,
3118
3148
  roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
3119
-
3120
3149
  var commonStyles = {
3121
3150
  placement: getBasePlacement(state.placement),
3122
3151
  variation: getVariation(state.placement),
@@ -4184,8 +4213,7 @@
4184
4213
 
4185
4214
  state.orderedModifiers = orderedModifiers.filter(function (m) {
4186
4215
  return m.enabled;
4187
- }); // Validate the provided modifiers so that the consumer will get warned
4188
-
4216
+ });
4189
4217
  runModifierEffects();
4190
4218
  return instance.update();
4191
4219
  },
@@ -4205,7 +4233,6 @@
4205
4233
  // anymore
4206
4234
 
4207
4235
  if (!areValidElements(reference, popper)) {
4208
-
4209
4236
  return;
4210
4237
  } // Store the reference and popper rects to be read by modifiers
4211
4238
 
@@ -4230,7 +4257,6 @@
4230
4257
  });
4231
4258
 
4232
4259
  for (var index = 0; index < state.orderedModifiers.length; index++) {
4233
-
4234
4260
  if (state.reset === true) {
4235
4261
  state.reset = false;
4236
4262
  index = -1;
@@ -4268,7 +4294,6 @@
4268
4294
  };
4269
4295
 
4270
4296
  if (!areValidElements(reference, popper)) {
4271
-
4272
4297
  return instance;
4273
4298
  }
4274
4299
 
@@ -4283,11 +4308,11 @@
4283
4308
  // one.
4284
4309
 
4285
4310
  function runModifierEffects() {
4286
- state.orderedModifiers.forEach(function (_ref3) {
4287
- var name = _ref3.name,
4288
- _ref3$options = _ref3.options,
4289
- options = _ref3$options === void 0 ? {} : _ref3$options,
4290
- effect = _ref3.effect;
4311
+ state.orderedModifiers.forEach(function (_ref) {
4312
+ var name = _ref.name,
4313
+ _ref$options = _ref.options,
4314
+ options = _ref$options === void 0 ? {} : _ref$options,
4315
+ effect = _ref.effect;
4291
4316
 
4292
4317
  if (typeof effect === 'function') {
4293
4318
  var cleanupFn = effect({
@@ -4322,17 +4347,17 @@
4322
4347
 
4323
4348
  var deregister = function deregister(obj) {
4324
4349
  try {
4325
- var _this2 = this;
4350
+ var _this = this;
4326
4351
  // Return collection if nothing was passed.
4327
- if (!obj) return Promise.resolve(_this2.collection);
4352
+ if (!obj) return Promise.resolve(_this.collection);
4328
4353
 
4329
4354
  // Check if entry has been registered in the collection.
4330
- var index = _this2.collection.findIndex(function (entry) {
4355
+ var index = _this.collection.findIndex(function (entry) {
4331
4356
  return entry.id === obj.id;
4332
4357
  });
4333
4358
  if (index >= 0) {
4334
4359
  // Get the collection entry.
4335
- var entry = _this2.collection[index];
4360
+ var entry = _this.collection[index];
4336
4361
 
4337
4362
  // If entry is in the opened state, close it.
4338
4363
  if (entry.state === 'opened') {
@@ -4351,11 +4376,11 @@
4351
4376
  });
4352
4377
 
4353
4378
  // Remove entry from collection.
4354
- _this2.collection.splice(index, 1);
4379
+ _this.collection.splice(index, 1);
4355
4380
  }
4356
4381
 
4357
4382
  // Return the modified collection.
4358
- return Promise.resolve(_this2.collection);
4383
+ return Promise.resolve(_this.collection);
4359
4384
  } catch (e) {
4360
4385
  return Promise.reject(e);
4361
4386
  }
@@ -4382,12 +4407,12 @@
4382
4407
 
4383
4408
  var open = function open(query) {
4384
4409
  try {
4385
- var _this2 = this;
4410
+ var _this = this;
4386
4411
  // Get the popover from collection.
4387
- var popover = getPopover.call(_this2, query);
4412
+ var popover = getPopover.call(_this, query);
4388
4413
 
4389
4414
  // Update state class.
4390
- popover.el.classList.add(_this2.settings.stateActive);
4415
+ popover.el.classList.add(_this.settings.stateActive);
4391
4416
 
4392
4417
  // Update accessibility attribute(s).
4393
4418
  if (popover.trigger.hasAttribute('aria-controls')) {
@@ -4395,7 +4420,7 @@
4395
4420
  }
4396
4421
 
4397
4422
  // Update popover config.
4398
- popover.config = getConfig(popover.el, _this2.settings);
4423
+ popover.config = getConfig(popover.el, _this.settings);
4399
4424
 
4400
4425
  // Enable popper event listeners and set placement/modifiers.
4401
4426
  popover.popper.setOptions({
@@ -4421,12 +4446,12 @@
4421
4446
 
4422
4447
  var register = function register(el, trigger) {
4423
4448
  try {
4424
- var _this2 = this;
4449
+ var _this = this;
4425
4450
  // Deregister entry incase it has already been registered.
4426
- deregister.call(_this2, el);
4451
+ deregister.call(_this, el);
4427
4452
 
4428
4453
  // Save root this for use inside methods API.
4429
- var root = _this2;
4454
+ var root = _this;
4430
4455
 
4431
4456
  // Setup methods API.
4432
4457
  var methods = {
@@ -4448,7 +4473,7 @@
4448
4473
  el: el,
4449
4474
  trigger: trigger,
4450
4475
  popper: createPopper(trigger, el),
4451
- config: getConfig(el, _this2.settings)
4476
+ config: getConfig(el, _this.settings)
4452
4477
  }, methods);
4453
4478
 
4454
4479
  // Set aria-expanded to false if trigger has aria-controls attribute.
@@ -4457,20 +4482,20 @@
4457
4482
  }
4458
4483
 
4459
4484
  // Setup event listeners.
4460
- registerEventListeners.call(_this2, entry);
4485
+ registerEventListeners.call(_this, entry);
4461
4486
 
4462
4487
  // Add entry to collection.
4463
- _this2.collection.push(entry);
4488
+ _this.collection.push(entry);
4464
4489
 
4465
4490
  // Set initial state.
4466
- var _temp2 = function () {
4467
- if (entry.el.classList.contains(_this2.settings.stateActive)) {
4491
+ var _temp = function () {
4492
+ if (entry.el.classList.contains(_this.settings.stateActive)) {
4468
4493
  return Promise.resolve(entry.open()).then(function () {
4469
- handleDocumentClick.call(_this2, entry);
4494
+ handleDocumentClick.call(_this, entry);
4470
4495
  });
4471
4496
  }
4472
4497
  }();
4473
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {
4498
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {
4474
4499
  // Return the registered entry.
4475
4500
  return entry;
4476
4501
  }) : entry);
@@ -4551,22 +4576,22 @@
4551
4576
  var _proto = Popover.prototype;
4552
4577
  _proto.init = function init(options) {
4553
4578
  try {
4554
- var _this3 = this;
4579
+ var _this2 = this;
4555
4580
  // Update settings with passed options.
4556
- if (options) _this3.settings = _extends({}, _this3.settings, options);
4581
+ if (options) _this2.settings = _extends({}, _this2.settings, options);
4557
4582
 
4558
4583
  // Get all the popovers.
4559
- var popovers = document.querySelectorAll(_this3.settings.selectorPopover);
4584
+ var popovers = document.querySelectorAll(_this2.settings.selectorPopover);
4560
4585
 
4561
4586
  // Register the collections array with popover instances.
4562
- return Promise.resolve(_this3.registerCollection(popovers)).then(function () {
4587
+ return Promise.resolve(_this2.registerCollection(popovers)).then(function () {
4563
4588
  // If eventListeners are enabled, init event listeners.
4564
- if (_this3.settings.eventListeners) {
4589
+ if (_this2.settings.eventListeners) {
4565
4590
  // Pass false to initEventListeners() since registerCollection()
4566
4591
  // already adds event listeners to popovers.
4567
- _this3.initEventListeners(false);
4592
+ _this2.initEventListeners(false);
4568
4593
  }
4569
- return _this3;
4594
+ return _this2;
4570
4595
  });
4571
4596
  } catch (e) {
4572
4597
  return Promise.reject(e);
@@ -4574,33 +4599,33 @@
4574
4599
  };
4575
4600
  _proto.destroy = function destroy() {
4576
4601
  try {
4577
- var _this5 = this;
4602
+ var _this3 = this;
4578
4603
  // Clear stored trigger.
4579
- _this5.trigger = null;
4604
+ _this3.trigger = null;
4580
4605
 
4581
4606
  // Remove all entries from the collection.
4582
- return Promise.resolve(_this5.deregisterCollection()).then(function () {
4607
+ return Promise.resolve(_this3.deregisterCollection()).then(function () {
4583
4608
  // If eventListeners are enabled, destroy event listeners.
4584
- if (_this5.settings.eventListeners) {
4609
+ if (_this3.settings.eventListeners) {
4585
4610
  // Pass false to destroyEventListeners() since deregisterCollection()
4586
4611
  // already removes event listeners from popovers.
4587
- _this5.destroyEventListeners(false);
4612
+ _this3.destroyEventListeners(false);
4588
4613
  }
4589
- return _this5;
4614
+ return _this3;
4590
4615
  });
4591
4616
  } catch (e) {
4592
4617
  return Promise.reject(e);
4593
4618
  }
4594
4619
  };
4595
4620
  _proto.initEventListeners = function initEventListeners(processCollection) {
4596
- var _this6 = this;
4621
+ var _this4 = this;
4597
4622
  if (processCollection === void 0) {
4598
4623
  processCollection = true;
4599
4624
  }
4600
4625
  if (processCollection) {
4601
4626
  // Loop through collection and setup event listeners.
4602
4627
  this.collection.forEach(function (popover) {
4603
- registerEventListeners.call(_this6, popover);
4628
+ registerEventListeners.call(_this4, popover);
4604
4629
  });
4605
4630
  }
4606
4631
 
@@ -4645,5 +4670,5 @@
4645
4670
  exports.Popover = Popover;
4646
4671
  exports.core = index;
4647
4672
 
4648
- })));
4673
+ }));
4649
4674
  //# sourceMappingURL=scripts.umd.js.map