vrembem 1.38.0 → 1.39.0

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.
@@ -356,14 +356,6 @@
356
356
  });
357
357
  };
358
358
 
359
- var breakpoints = {
360
- xs: '480px',
361
- sm: '620px',
362
- md: '760px',
363
- lg: '990px',
364
- xl: '1380px'
365
- };
366
-
367
359
  var index = {
368
360
  __proto__: null,
369
361
  setInert: setInert,
@@ -381,8 +373,7 @@
381
373
  removeClass: removeClass,
382
374
  toggleClass: toggleClass,
383
375
  openTransition: openTransition,
384
- closeTransition: closeTransition,
385
- breakpoints: breakpoints
376
+ closeTransition: closeTransition
386
377
  };
387
378
 
388
379
  function _extends() {
@@ -500,7 +491,7 @@
500
491
  selectorInert: null,
501
492
  selectorOverflow: null,
502
493
  // Feature toggles
503
- breakpoints: breakpoints,
494
+ breakpoints: null,
504
495
  customEventPrefix: 'drawer:',
505
496
  eventListeners: true,
506
497
  stateSave: true,
@@ -562,6 +553,7 @@
562
553
  function Breakpoint(parent) {
563
554
  this.mediaQueryLists = [];
564
555
  this.parent = parent;
556
+ this.prefix = this.getVariablePrefix();
565
557
  this.__check = this.check.bind(this);
566
558
  }
567
559
 
@@ -574,7 +566,9 @@
574
566
  drawers.forEach(function (drawer) {
575
567
  var id = drawer.getAttribute("data-" + _this.parent.settings.dataDrawer);
576
568
  var key = drawer.getAttribute("data-" + _this.parent.settings.dataBreakpoint);
577
- var bp = _this.parent.settings.breakpoints[key] ? _this.parent.settings.breakpoints[key] : key;
569
+
570
+ var bp = _this.getBreakpoint(key);
571
+
578
572
  var mql = window.matchMedia('(min-width:' + bp + ')');
579
573
 
580
574
  _this.match(mql, drawer);
@@ -630,6 +624,25 @@
630
624
  }
631
625
  };
632
626
 
627
+ _proto.getBreakpoint = function getBreakpoint(key) {
628
+ var breakpoint = key;
629
+
630
+ if (this.parent.settings.breakpoints && this.parent.settings.breakpoints[key]) {
631
+ breakpoint = this.parent.settings.breakpoints[key];
632
+ } else if (getComputedStyle(document.body).getPropertyValue(this.prefix + key)) {
633
+ breakpoint = getComputedStyle(document.body).getPropertyValue(this.prefix + key);
634
+ }
635
+
636
+ return breakpoint;
637
+ };
638
+
639
+ _proto.getVariablePrefix = function getVariablePrefix() {
640
+ var prefix = '--';
641
+ prefix += getComputedStyle(document.body).getPropertyValue('--vrembem-variable-prefix');
642
+ prefix += 'breakpoint-';
643
+ return prefix;
644
+ };
645
+
633
646
  return Breakpoint;
634
647
  }();
635
648
 
@@ -1306,7 +1319,8 @@
1306
1319
 
1307
1320
  for (var prop in config) {
1308
1321
  // Get the CSS variable property values
1309
- var val = styles.getPropertyValue("--popover-" + prop).trim(); // If a value was found, replace the default in config obj
1322
+ var prefix = getComputedStyle(document.body).getPropertyValue('--vrembem-variable-prefix');
1323
+ var val = styles.getPropertyValue("--" + prefix + "popover-" + prop).trim(); // If a value was found, replace the default in config obj
1310
1324
 
1311
1325
  if (val) {
1312
1326
  config[prop] = val;