vrembem 3.0.3 → 3.0.6

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.
@@ -617,12 +617,14 @@ function localStore(key, enable) {
617
617
 
618
618
  return new Proxy(getStore(), {
619
619
  set: function set(target, property, value) {
620
- target[property] = value;
621
- if (enable) setStore(target);
622
- return true;
623
- },
624
- deleteProperty: function deleteProperty(target, property) {
625
- delete target[property];
620
+ console.log('localStore() => set');
621
+
622
+ if (value === undefined) {
623
+ delete target[property];
624
+ } else {
625
+ target[property] = value;
626
+ }
627
+
626
628
  if (enable) setStore(target);
627
629
  return true;
628
630
  }
@@ -966,7 +968,7 @@ var deregister$2 = function deregister(obj, close) {
966
968
  if (index >= 0) {
967
969
  var _temp7 = function _temp7() {
968
970
  // Remove entry from local store.
969
- delete _this2.store[_entry.id]; // Unmount the MatchMedia functionality.
971
+ _this2.store[_entry.id] = undefined; // Unmount the MatchMedia functionality.
970
972
 
971
973
  _entry.unmountBreakpoint(); // Delete properties from collection entry.
972
974
 
@@ -998,12 +1000,12 @@ var deregister$2 = function deregister(obj, close) {
998
1000
  }
999
1001
  };
1000
1002
 
1001
- function L() {
1003
+ function g() {
1002
1004
  return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim();
1003
1005
  }
1004
1006
 
1005
1007
  function getBreakpoint(drawer) {
1006
- var prefix = L();
1008
+ var prefix = g();
1007
1009
  var bp = drawer.getAttribute("data-" + this.settings.dataBreakpoint);
1008
1010
 
1009
1011
  if (this.settings.breakpoints && this.settings.breakpoints[bp]) {
@@ -2308,7 +2310,7 @@ function getConfig(el, settings) {
2308
2310
 
2309
2311
  for (var prop in config) {
2310
2312
  // Get the CSS variable property values.
2311
- var prefix = L();
2313
+ var prefix = g();
2312
2314
  var value = styles.getPropertyValue("--" + prefix + "popover-" + prop).trim(); // If a value was found, replace the default in config obj.
2313
2315
 
2314
2316
  if (value) {
@@ -2537,7 +2539,7 @@ function closeCheck(popover) {
2537
2539
  // Check if trigger or element are being hovered.
2538
2540
  var isHovered = popover.el.closest(':hover') === popover.el || popover.trigger.closest(':hover') === popover.trigger; // Check if trigger or element are being focused.
2539
2541
 
2540
- var isFocused = document.activeElement.closest("#" + popover.id + ", [aria-controls=\"" + popover.id + "\"]"); // Close if the trigger and element are not currently hovered or focused.
2542
+ var isFocused = document.activeElement.closest("#" + popover.id + ", [aria-controls=\"" + popover.id + "\"], [aria-describedby=\"" + popover.id + "\"]"); // Close if the trigger and element are not currently hovered or focused.
2541
2543
 
2542
2544
  if (!isHovered && !isFocused) {
2543
2545
  popover.close();
@@ -2582,21 +2584,21 @@ function handleKeydown(event) {
2582
2584
  function handleDocumentClick(popover) {
2583
2585
  var root = this;
2584
2586
  document.addEventListener('click', function _f(event) {
2585
- // Check if a popover was clicked.
2586
- var result = event.target.closest("#" + popover.id + ", [aria-controls=\"" + popover.id + "\"]");
2587
+ // Check if a popover or its trigger was clicked.
2588
+ var wasClicked = event.target.closest("#" + popover.id + ", [aria-controls=\"" + popover.id + "\"], [aria-describedby=\"" + popover.id + "\"]"); // If popover or popover trigger was clicked...
2587
2589
 
2588
- if (!result) {
2589
- // If it doesn't match and popover is open, close it and remove event listener.
2590
+ if (wasClicked) {
2591
+ // If popover element exists and is not active...
2592
+ if (popover.el && !popover.el.classList.contains(root.settings.stateActive)) {
2593
+ this.removeEventListener('click', _f);
2594
+ }
2595
+ } else {
2596
+ // If popover element exists and is active...
2590
2597
  if (popover.el && popover.el.classList.contains(root.settings.stateActive)) {
2591
2598
  popover.close();
2592
2599
  }
2593
2600
 
2594
2601
  this.removeEventListener('click', _f);
2595
- } else {
2596
- // If it does match and popover isn't currently active, remove event listener.
2597
- if (popover.el && !popover.el.classList.contains(root.settings.stateActive)) {
2598
- this.removeEventListener('click', _f);
2599
- }
2600
2602
  }
2601
2603
  });
2602
2604
  }