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.
@@ -329,14 +329,6 @@ const closeTransition = (el, settings) => {
329
329
  });
330
330
  };
331
331
 
332
- const breakpoints = {
333
- xs: '480px',
334
- sm: '620px',
335
- md: '760px',
336
- lg: '990px',
337
- xl: '1380px'
338
- };
339
-
340
332
  var index = {
341
333
  __proto__: null,
342
334
  setInert: setInert,
@@ -354,8 +346,7 @@ var index = {
354
346
  removeClass: removeClass,
355
347
  toggleClass: toggleClass,
356
348
  openTransition: openTransition,
357
- closeTransition: closeTransition,
358
- breakpoints: breakpoints
349
+ closeTransition: closeTransition
359
350
  };
360
351
 
361
352
  function _extends() {
@@ -456,7 +447,7 @@ var defaults$2 = {
456
447
  selectorInert: null,
457
448
  selectorOverflow: null,
458
449
  // Feature toggles
459
- breakpoints: breakpoints,
450
+ breakpoints: null,
460
451
  customEventPrefix: 'drawer:',
461
452
  eventListeners: true,
462
453
  stateSave: true,
@@ -510,6 +501,7 @@ class Breakpoint {
510
501
  constructor(parent) {
511
502
  this.mediaQueryLists = [];
512
503
  this.parent = parent;
504
+ this.prefix = this.getVariablePrefix();
513
505
  this.__check = this.check.bind(this);
514
506
  }
515
507
 
@@ -518,7 +510,7 @@ class Breakpoint {
518
510
  drawers.forEach(drawer => {
519
511
  const id = drawer.getAttribute(`data-${this.parent.settings.dataDrawer}`);
520
512
  const key = drawer.getAttribute(`data-${this.parent.settings.dataBreakpoint}`);
521
- const bp = this.parent.settings.breakpoints[key] ? this.parent.settings.breakpoints[key] : key;
513
+ const bp = this.getBreakpoint(key);
522
514
  const mql = window.matchMedia('(min-width:' + bp + ')');
523
515
  this.match(mql, drawer);
524
516
  mql.addEventListener('change', this.__check);
@@ -563,6 +555,25 @@ class Breakpoint {
563
555
  }
564
556
  }
565
557
 
558
+ getBreakpoint(key) {
559
+ let breakpoint = key;
560
+
561
+ if (this.parent.settings.breakpoints && this.parent.settings.breakpoints[key]) {
562
+ breakpoint = this.parent.settings.breakpoints[key];
563
+ } else if (getComputedStyle(document.body).getPropertyValue(this.prefix + key)) {
564
+ breakpoint = getComputedStyle(document.body).getPropertyValue(this.prefix + key);
565
+ }
566
+
567
+ return breakpoint;
568
+ }
569
+
570
+ getVariablePrefix() {
571
+ let prefix = '--';
572
+ prefix += getComputedStyle(document.body).getPropertyValue('--vrembem-variable-prefix');
573
+ prefix += 'breakpoint-';
574
+ return prefix;
575
+ }
576
+
566
577
  }
567
578
 
568
579
  function handlerClick$2(event) {
@@ -1147,7 +1158,8 @@ function getConfig(el, settings) {
1147
1158
 
1148
1159
  for (const prop in config) {
1149
1160
  // Get the CSS variable property values
1150
- const val = styles.getPropertyValue(`--popover-${prop}`).trim(); // If a value was found, replace the default in config obj
1161
+ const prefix = getComputedStyle(document.body).getPropertyValue('--vrembem-variable-prefix');
1162
+ const val = styles.getPropertyValue(`--${prefix}popover-${prop}`).trim(); // If a value was found, replace the default in config obj
1151
1163
 
1152
1164
  if (val) {
1153
1165
  config[prop] = val;