Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vrembem/core

Package Overview
Dependencies
Maintainers
1
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vrembem/core - npm Package Compare versions

Comparing version 3.0.13 to 3.0.14

26

dev/scripts.esm.js

@@ -577,8 +577,18 @@ import focusableSelectors from 'focusable-selectors';

return new Promise(function (resolve) {
// Check if transitions are enabled.
if (settings.transition) {
// Toggle classes for opening transition.
el.classList.remove(settings.stateClosed);
el.classList.add(settings.stateOpening);
el.addEventListener('transitionend', function _f() {
// Add event listener for when the transition is finished.
el.addEventListener('transitionend', function _f(event) {
// Prevent child transition bubbling from firing this event.
if (event.target != el) return;
// Toggle final opened state classes.
el.classList.add(settings.stateOpened);
el.classList.remove(settings.stateOpening);
// Resolve the promise and remove the event listener.
resolve(el);

@@ -588,2 +598,3 @@ this.removeEventListener('transitionend', _f);

} else {
// Toggle final opened state classes and resolve the promise.
el.classList.add(settings.stateOpened);

@@ -597,8 +608,18 @@ el.classList.remove(settings.stateClosed);

return new Promise(function (resolve) {
// Check if transitions are enabled.
if (settings.transition) {
// Toggle classes for closing transition.
el.classList.add(settings.stateClosing);
el.classList.remove(settings.stateOpened);
el.addEventListener('transitionend', function _f() {
// Add event listener for when the transition is finished.
el.addEventListener('transitionend', function _f(event) {
// Prevent child transition bubbling from firing this event.
if (event.target != el) return;
// Toggle final closed state classes.
el.classList.remove(settings.stateClosing);
el.classList.add(settings.stateClosed);
// Resolve the promise and remove the event listener.
resolve(el);

@@ -608,2 +629,3 @@ this.removeEventListener('transitionend', _f);

} else {
// Toggle final closed state classes and resolve the promise.
el.classList.add(settings.stateClosed);

@@ -610,0 +632,0 @@ el.classList.remove(settings.stateOpened);

@@ -581,8 +581,18 @@ var focusableSelectors = require('focusable-selectors');

return new Promise(function (resolve) {
// Check if transitions are enabled.
if (settings.transition) {
// Toggle classes for opening transition.
el.classList.remove(settings.stateClosed);
el.classList.add(settings.stateOpening);
el.addEventListener('transitionend', function _f() {
// Add event listener for when the transition is finished.
el.addEventListener('transitionend', function _f(event) {
// Prevent child transition bubbling from firing this event.
if (event.target != el) return;
// Toggle final opened state classes.
el.classList.add(settings.stateOpened);
el.classList.remove(settings.stateOpening);
// Resolve the promise and remove the event listener.
resolve(el);

@@ -592,2 +602,3 @@ this.removeEventListener('transitionend', _f);

} else {
// Toggle final opened state classes and resolve the promise.
el.classList.add(settings.stateOpened);

@@ -601,8 +612,18 @@ el.classList.remove(settings.stateClosed);

return new Promise(function (resolve) {
// Check if transitions are enabled.
if (settings.transition) {
// Toggle classes for closing transition.
el.classList.add(settings.stateClosing);
el.classList.remove(settings.stateOpened);
el.addEventListener('transitionend', function _f() {
// Add event listener for when the transition is finished.
el.addEventListener('transitionend', function _f(event) {
// Prevent child transition bubbling from firing this event.
if (event.target != el) return;
// Toggle final closed state classes.
el.classList.remove(settings.stateClosing);
el.classList.add(settings.stateClosed);
// Resolve the promise and remove the event listener.
resolve(el);

@@ -612,2 +633,3 @@ this.removeEventListener('transitionend', _f);

} else {
// Toggle final closed state classes and resolve the promise.
el.classList.add(settings.stateClosed);

@@ -614,0 +636,0 @@ el.classList.remove(settings.stateOpened);

@@ -584,8 +584,18 @@ (function (global, factory) {

return new Promise(function (resolve) {
// Check if transitions are enabled.
if (settings.transition) {
// Toggle classes for opening transition.
el.classList.remove(settings.stateClosed);
el.classList.add(settings.stateOpening);
el.addEventListener('transitionend', function _f() {
// Add event listener for when the transition is finished.
el.addEventListener('transitionend', function _f(event) {
// Prevent child transition bubbling from firing this event.
if (event.target != el) return;
// Toggle final opened state classes.
el.classList.add(settings.stateOpened);
el.classList.remove(settings.stateOpening);
// Resolve the promise and remove the event listener.
resolve(el);

@@ -595,2 +605,3 @@ this.removeEventListener('transitionend', _f);

} else {
// Toggle final opened state classes and resolve the promise.
el.classList.add(settings.stateOpened);

@@ -604,8 +615,18 @@ el.classList.remove(settings.stateClosed);

return new Promise(function (resolve) {
// Check if transitions are enabled.
if (settings.transition) {
// Toggle classes for closing transition.
el.classList.add(settings.stateClosing);
el.classList.remove(settings.stateOpened);
el.addEventListener('transitionend', function _f() {
// Add event listener for when the transition is finished.
el.addEventListener('transitionend', function _f(event) {
// Prevent child transition bubbling from firing this event.
if (event.target != el) return;
// Toggle final closed state classes.
el.classList.remove(settings.stateClosing);
el.classList.add(settings.stateClosed);
// Resolve the promise and remove the event listener.
resolve(el);

@@ -615,2 +636,3 @@ this.removeEventListener('transitionend', _f);

} else {
// Toggle final closed state classes and resolve the promise.
el.classList.add(settings.stateClosed);

@@ -617,0 +639,0 @@ el.classList.remove(settings.stateOpened);

2

dist/scripts.esm.js

@@ -1,2 +0,2 @@

import e from"focusable-selectors";function t(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,"symbol"==typeof(r=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(i.key))?r:String(r),i)}var r}function n(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}var i=0;function r(e){return"__private_"+i+++"_"+e}function o(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var s=/*#__PURE__*/r("handler"),c=/*#__PURE__*/function(){function e(e,t){Object.defineProperty(this,s,{writable:!0,value:void 0}),this.value=e,o(this,s)[s]=t,this.mql=null}var t=e.prototype;return t.mount=function(e,t){return e&&(this.value=e),t&&(o(this,s)[s]=t),this.value?(this.mql=window.matchMedia("(min-width: "+this.value+")"),"function"==typeof this.mql.addEventListener?this.mql.addEventListener("change",o(this,s)[s]):this.mql.addListener(o(this,s)[s]),o(this,s)[s](this.mql),this):this},t.unmount=function(){return this.mql?("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",o(this,s)[s]):this.mql.removeListener(o(this,s)[s]),this.value=null,o(this,s)[s]=null,this.mql=null,this):this},n(e,[{key:"handler",get:function(){return o(this,s)[s]},set:function(e){this.mql&&("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",o(this,s)[s]):this.mql.removeListener(o(this,s)[s])),o(this,s)[s]=e}}]),e}();function u(e,t,n){if(!e.s){if(n instanceof l){if(!n.s)return void(n.o=u.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(u.bind(null,e,t),u.bind(null,e,2));e.s=t,e.v=n;const i=e.o;i&&i(e)}}var l=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var i=new e,r=this.s;if(r){var o=1&r?t:n;if(o){try{u(i,1,o(this.v))}catch(e){u(i,2,e)}return i}return this}return this.o=function(e){try{var r=e.v;1&e.s?u(i,1,t?t(r):r):n?u(i,1,n(r)):u(i,2,r)}catch(e){u(i,2,e)}},i},e}();function a(e){return e instanceof l&&1&e.s}var f=/*#__PURE__*/function(){function e(){this.collection=[]}var t=e.prototype;return t.register=function(e){try{var t=this;return Promise.resolve(t.deregister(e)).then(function(){return t.collection.push(e),t.collection})}catch(e){return Promise.reject(e)}},t.deregister=function(e){try{var t=this,n=t.collection.findIndex(function(t){return t===e});if(n>=0){var i=t.collection[n];Object.getOwnPropertyNames(i).forEach(function(e){delete i[e]}),t.collection.splice(n,1)}return Promise.resolve(t.collection)}catch(e){return Promise.reject(e)}},t.registerCollection=function(e){try{var t=this;return Promise.resolve(Promise.all(Array.from(e,function(e){t.register(e)}))).then(function(){return t.collection})}catch(e){return Promise.reject(e)}},t.deregisterCollection=function(){try{var e=function(){return t.collection},t=this,n=function(e,t,n){for(var i;;){var r=e();if(a(r)&&(r=r.v),!r)return o;if(r.then){i=0;break}var o=n();if(o&&o.then){if(!a(o)){i=1;break}o=o.s}if(t){var s=t();if(s&&s.then&&!a(s)){i=2;break}}}var c=new l,f=u.bind(null,c,2);return(0===i?r.then(d):1===i?o.then(h):s.then(v)).then(void 0,f),c;function h(i){o=i;do{if(t&&(s=t())&&s.then&&!a(s))return void s.then(v).then(void 0,f);if(!(r=e())||a(r)&&!r.v)return void u(c,1,o);if(r.then)return void r.then(d).then(void 0,f);a(o=n())&&(o=o.v)}while(!o||!o.then);o.then(h).then(void 0,f)}function d(e){e?(o=n())&&o.then?o.then(h).then(void 0,f):h(o):u(c,1,o)}function v(){(r=e())?r.then?r.then(d).then(void 0,f):d(r):u(c,1,o)}}(function(){return t.collection.length>0},void 0,function(){return Promise.resolve(t.deregister(t.collection[0])).then(function(){})});return Promise.resolve(n&&n.then?n.then(e):e())}catch(e){return Promise.reject(e)}},t.get=function(e,t){return void 0===t&&(t="id"),this.collection.find(function(n){return n[t]===e})},e}(),h=/*#__PURE__*/r("focusable"),d=/*#__PURE__*/r("handleFocusTrap"),v=/*#__PURE__*/r("handleFocusLock"),m=/*#__PURE__*/function(){function t(e,t){void 0===e&&(e=null),void 0===t&&(t="[data-focus]"),Object.defineProperty(this,h,{writable:!0,value:void 0}),Object.defineProperty(this,d,{writable:!0,value:void 0}),Object.defineProperty(this,v,{writable:!0,value:void 0}),this.el=e,this.selectorFocus=t,o(this,d)[d]=p.bind(this),o(this,v)[v]=y.bind(this)}var i=t.prototype;return i.mount=function(e,t){e&&(this.el=e),t&&(this.selectorFocus=t),this.focusable=this.getFocusable(),this.focus()},i.unmount=function(){this.el=null,this.focusable=[],document.removeEventListener("keydown",o(this,d)[d]),document.removeEventListener("keydown",o(this,v)[v])},i.focus=function(e,t){void 0===e&&(e=this.el),void 0===t&&(t=this.selectorFocus),(e.querySelector(t)||e).focus()},i.getFocusable=function(t){void 0===t&&(t=this.el);var n=[],i=document.activeElement,r=t.scrollTop;return t.querySelectorAll(e.join(",")).forEach(function(e){e.focus(),document.activeElement===e&&n.push(e)}),t.scrollTop=r,i.focus(),n},n(t,[{key:"focusable",get:function(){return o(this,h)[h]},set:function(e){o(this,h)[h]=e,o(this,h)[h].length?(document.removeEventListener("keydown",o(this,v)[v]),document.addEventListener("keydown",o(this,d)[d])):(document.removeEventListener("keydown",o(this,d)[d]),document.addEventListener("keydown",o(this,v)[v]))}},{key:"focusableFirst",get:function(){return this.focusable[0]}},{key:"focusableLast",get:function(){return this.focusable[this.focusable.length-1]}}]),t}();function p(e){("Tab"===e.key||9===e.keyCode)&&(e.shiftKey?document.activeElement!==this.focusableFirst&&document.activeElement!==this.el||(e.preventDefault(),this.focusableLast.focus()):document.activeElement!==this.focusableLast&&document.activeElement!==this.el||(e.preventDefault(),this.focusableFirst.focus()))}function y(e){("Tab"===e.key||9===e.keyCode)&&e.preventDefault()}function b(e,t){var n=(e.getAttribute("data-"+t)||"").replace(/'/g,'"');return n?JSON.parse(n):{}}function g(){return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim()}function E(e,t){void 0===t&&(t=!0);var n=localStorage.getItem(e),i=n?JSON.parse(n):{};return{get:function(e){return e?i[e]:i},set:function(n,r){return r?i[n]=r:delete i[n],t&&localStorage.setItem(e,JSON.stringify(i)),i}}}function L(e,t,n){var i=t.nodeType===Node.COMMENT_NODE,r=t.nodeType===Node.ELEMENT_NODE;if(i&&(n="after"),!(t=i||r?t:document.querySelector(t)))throw new Error("Not a valid teleport reference: '"+t+"'");if("function"!=typeof t[n])throw new Error("Not a valid teleport method: '"+n+"'");var o=null;return i||(o=document.createComment("teleported #"+e.id),e.before(o)),t[n](e),i&&t.remove(),o}var w=function(e,t){return new Promise(function(n){t.transition?(e.classList.remove(t.stateClosed),e.classList.add(t.stateOpening),e.addEventListener("transitionend",function i(){e.classList.add(t.stateOpened),e.classList.remove(t.stateOpening),n(e),this.removeEventListener("transitionend",i)})):(e.classList.add(t.stateOpened),e.classList.remove(t.stateClosed),n(e))})},P=function(e,t){return new Promise(function(n){t.transition?(e.classList.add(t.stateClosing),e.classList.remove(t.stateOpened),e.addEventListener("transitionend",function i(){e.classList.remove(t.stateClosing),e.classList.add(t.stateClosed),n(e),this.removeEventListener("transitionend",i)})):(e.classList.add(t.stateClosed),e.classList.remove(t.stateOpened),n(e))})};function O(e,t){var n,i;n=!!e,(i=t.selectorInert)&&document.querySelectorAll(i).forEach(function(e){n?(e.inert=!0,e.setAttribute("aria-hidden",!0)):(e.inert=null,e.removeAttribute("aria-hidden"))}),function(e,t){t&&document.querySelectorAll(t).forEach(function(t){e?t.style.overflow="hidden":t.style.removeProperty("overflow")})}(!!e,t.selectorOverflow)}export{c as Breakpoint,f as Collection,m as FocusTrap,P as closeTransition,b as getConfig,g as getPrefix,E as localStore,w as openTransition,L as teleport,O as updateGlobalState};
import e from"focusable-selectors";function t(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,"symbol"==typeof(r=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(i.key))?r:String(r),i)}var r}function n(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}var i=0;function r(e){return"__private_"+i+++"_"+e}function o(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var s=/*#__PURE__*/r("handler"),c=/*#__PURE__*/function(){function e(e,t){Object.defineProperty(this,s,{writable:!0,value:void 0}),this.value=e,o(this,s)[s]=t,this.mql=null}var t=e.prototype;return t.mount=function(e,t){return e&&(this.value=e),t&&(o(this,s)[s]=t),this.value?(this.mql=window.matchMedia("(min-width: "+this.value+")"),"function"==typeof this.mql.addEventListener?this.mql.addEventListener("change",o(this,s)[s]):this.mql.addListener(o(this,s)[s]),o(this,s)[s](this.mql),this):this},t.unmount=function(){return this.mql?("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",o(this,s)[s]):this.mql.removeListener(o(this,s)[s]),this.value=null,o(this,s)[s]=null,this.mql=null,this):this},n(e,[{key:"handler",get:function(){return o(this,s)[s]},set:function(e){this.mql&&("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",o(this,s)[s]):this.mql.removeListener(o(this,s)[s])),o(this,s)[s]=e}}]),e}();function u(e,t,n){if(!e.s){if(n instanceof l){if(!n.s)return void(n.o=u.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(u.bind(null,e,t),u.bind(null,e,2));e.s=t,e.v=n;const i=e.o;i&&i(e)}}var l=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var i=new e,r=this.s;if(r){var o=1&r?t:n;if(o){try{u(i,1,o(this.v))}catch(e){u(i,2,e)}return i}return this}return this.o=function(e){try{var r=e.v;1&e.s?u(i,1,t?t(r):r):n?u(i,1,n(r)):u(i,2,r)}catch(e){u(i,2,e)}},i},e}();function a(e){return e instanceof l&&1&e.s}var f=/*#__PURE__*/function(){function e(){this.collection=[]}var t=e.prototype;return t.register=function(e){try{var t=this;return Promise.resolve(t.deregister(e)).then(function(){return t.collection.push(e),t.collection})}catch(e){return Promise.reject(e)}},t.deregister=function(e){try{var t=this,n=t.collection.findIndex(function(t){return t===e});if(n>=0){var i=t.collection[n];Object.getOwnPropertyNames(i).forEach(function(e){delete i[e]}),t.collection.splice(n,1)}return Promise.resolve(t.collection)}catch(e){return Promise.reject(e)}},t.registerCollection=function(e){try{var t=this;return Promise.resolve(Promise.all(Array.from(e,function(e){t.register(e)}))).then(function(){return t.collection})}catch(e){return Promise.reject(e)}},t.deregisterCollection=function(){try{var e=function(){return t.collection},t=this,n=function(e,t,n){for(var i;;){var r=e();if(a(r)&&(r=r.v),!r)return o;if(r.then){i=0;break}var o=n();if(o&&o.then){if(!a(o)){i=1;break}o=o.s}if(t){var s=t();if(s&&s.then&&!a(s)){i=2;break}}}var c=new l,f=u.bind(null,c,2);return(0===i?r.then(d):1===i?o.then(h):s.then(v)).then(void 0,f),c;function h(i){o=i;do{if(t&&(s=t())&&s.then&&!a(s))return void s.then(v).then(void 0,f);if(!(r=e())||a(r)&&!r.v)return void u(c,1,o);if(r.then)return void r.then(d).then(void 0,f);a(o=n())&&(o=o.v)}while(!o||!o.then);o.then(h).then(void 0,f)}function d(e){e?(o=n())&&o.then?o.then(h).then(void 0,f):h(o):u(c,1,o)}function v(){(r=e())?r.then?r.then(d).then(void 0,f):d(r):u(c,1,o)}}(function(){return t.collection.length>0},void 0,function(){return Promise.resolve(t.deregister(t.collection[0])).then(function(){})});return Promise.resolve(n&&n.then?n.then(e):e())}catch(e){return Promise.reject(e)}},t.get=function(e,t){return void 0===t&&(t="id"),this.collection.find(function(n){return n[t]===e})},e}(),h=/*#__PURE__*/r("focusable"),d=/*#__PURE__*/r("handleFocusTrap"),v=/*#__PURE__*/r("handleFocusLock"),m=/*#__PURE__*/function(){function t(e,t){void 0===e&&(e=null),void 0===t&&(t="[data-focus]"),Object.defineProperty(this,h,{writable:!0,value:void 0}),Object.defineProperty(this,d,{writable:!0,value:void 0}),Object.defineProperty(this,v,{writable:!0,value:void 0}),this.el=e,this.selectorFocus=t,o(this,d)[d]=p.bind(this),o(this,v)[v]=y.bind(this)}var i=t.prototype;return i.mount=function(e,t){e&&(this.el=e),t&&(this.selectorFocus=t),this.focusable=this.getFocusable(),this.focus()},i.unmount=function(){this.el=null,this.focusable=[],document.removeEventListener("keydown",o(this,d)[d]),document.removeEventListener("keydown",o(this,v)[v])},i.focus=function(e,t){void 0===e&&(e=this.el),void 0===t&&(t=this.selectorFocus),(e.querySelector(t)||e).focus()},i.getFocusable=function(t){void 0===t&&(t=this.el);var n=[],i=document.activeElement,r=t.scrollTop;return t.querySelectorAll(e.join(",")).forEach(function(e){e.focus(),document.activeElement===e&&n.push(e)}),t.scrollTop=r,i.focus(),n},n(t,[{key:"focusable",get:function(){return o(this,h)[h]},set:function(e){o(this,h)[h]=e,o(this,h)[h].length?(document.removeEventListener("keydown",o(this,v)[v]),document.addEventListener("keydown",o(this,d)[d])):(document.removeEventListener("keydown",o(this,d)[d]),document.addEventListener("keydown",o(this,v)[v]))}},{key:"focusableFirst",get:function(){return this.focusable[0]}},{key:"focusableLast",get:function(){return this.focusable[this.focusable.length-1]}}]),t}();function p(e){("Tab"===e.key||9===e.keyCode)&&(e.shiftKey?document.activeElement!==this.focusableFirst&&document.activeElement!==this.el||(e.preventDefault(),this.focusableLast.focus()):document.activeElement!==this.focusableLast&&document.activeElement!==this.el||(e.preventDefault(),this.focusableFirst.focus()))}function y(e){("Tab"===e.key||9===e.keyCode)&&e.preventDefault()}function b(e,t){var n=(e.getAttribute("data-"+t)||"").replace(/'/g,'"');return n?JSON.parse(n):{}}function g(){return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim()}function E(e,t){void 0===t&&(t=!0);var n=localStorage.getItem(e),i=n?JSON.parse(n):{};return{get:function(e){return e?i[e]:i},set:function(n,r){return r?i[n]=r:delete i[n],t&&localStorage.setItem(e,JSON.stringify(i)),i}}}function L(e,t,n){var i=t.nodeType===Node.COMMENT_NODE,r=t.nodeType===Node.ELEMENT_NODE;if(i&&(n="after"),!(t=i||r?t:document.querySelector(t)))throw new Error("Not a valid teleport reference: '"+t+"'");if("function"!=typeof t[n])throw new Error("Not a valid teleport method: '"+n+"'");var o=null;return i||(o=document.createComment("teleported #"+e.id),e.before(o)),t[n](e),i&&t.remove(),o}var w=function(e,t){return new Promise(function(n){t.transition?(e.classList.remove(t.stateClosed),e.classList.add(t.stateOpening),e.addEventListener("transitionend",function i(r){r.target==e&&(e.classList.add(t.stateOpened),e.classList.remove(t.stateOpening),n(e),this.removeEventListener("transitionend",i))})):(e.classList.add(t.stateOpened),e.classList.remove(t.stateClosed),n(e))})},P=function(e,t){return new Promise(function(n){t.transition?(e.classList.add(t.stateClosing),e.classList.remove(t.stateOpened),e.addEventListener("transitionend",function i(r){r.target==e&&(e.classList.remove(t.stateClosing),e.classList.add(t.stateClosed),n(e),this.removeEventListener("transitionend",i))})):(e.classList.add(t.stateClosed),e.classList.remove(t.stateOpened),n(e))})};function O(e,t){var n,i;n=!!e,(i=t.selectorInert)&&document.querySelectorAll(i).forEach(function(e){n?(e.inert=!0,e.setAttribute("aria-hidden",!0)):(e.inert=null,e.removeAttribute("aria-hidden"))}),function(e,t){t&&document.querySelectorAll(t).forEach(function(t){e?t.style.overflow="hidden":t.style.removeProperty("overflow")})}(!!e,t.selectorOverflow)}export{c as Breakpoint,f as Collection,m as FocusTrap,P as closeTransition,b as getConfig,g as getPrefix,E as localStore,w as openTransition,L as teleport,O as updateGlobalState};
//# sourceMappingURL=scripts.esm.js.map

@@ -1,2 +0,2 @@

function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=/*#__PURE__*/e(require("focusable-selectors"));function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,"symbol"==typeof(i=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key))?i:String(i),r)}var i}function r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var i=0;function o(e){return"__private_"+i+++"_"+e}function s(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var c=/*#__PURE__*/o("handler"),u=/*#__PURE__*/function(){function e(e,t){Object.defineProperty(this,c,{writable:!0,value:void 0}),this.value=e,s(this,c)[c]=t,this.mql=null}var t=e.prototype;return t.mount=function(e,t){return e&&(this.value=e),t&&(s(this,c)[c]=t),this.value?(this.mql=window.matchMedia("(min-width: "+this.value+")"),"function"==typeof this.mql.addEventListener?this.mql.addEventListener("change",s(this,c)[c]):this.mql.addListener(s(this,c)[c]),s(this,c)[c](this.mql),this):this},t.unmount=function(){return this.mql?("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",s(this,c)[c]):this.mql.removeListener(s(this,c)[c]),this.value=null,s(this,c)[c]=null,this.mql=null,this):this},r(e,[{key:"handler",get:function(){return s(this,c)[c]},set:function(e){this.mql&&("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",s(this,c)[c]):this.mql.removeListener(s(this,c)[c])),s(this,c)[c]=e}}]),e}();function l(e,t,n){if(!e.s){if(n instanceof a){if(!n.s)return void(n.o=l.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(l.bind(null,e,t),l.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}var a=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var o=1&i?t:n;if(o){try{l(r,1,o(this.v))}catch(e){l(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?l(r,1,t?t(i):i):n?l(r,1,n(i)):l(r,2,i)}catch(e){l(r,2,e)}},r},e}();function f(e){return e instanceof a&&1&e.s}var h=/*#__PURE__*/function(){function e(){this.collection=[]}var t=e.prototype;return t.register=function(e){try{var t=this;return Promise.resolve(t.deregister(e)).then(function(){return t.collection.push(e),t.collection})}catch(e){return Promise.reject(e)}},t.deregister=function(e){try{var t=this,n=t.collection.findIndex(function(t){return t===e});if(n>=0){var r=t.collection[n];Object.getOwnPropertyNames(r).forEach(function(e){delete r[e]}),t.collection.splice(n,1)}return Promise.resolve(t.collection)}catch(e){return Promise.reject(e)}},t.registerCollection=function(e){try{var t=this;return Promise.resolve(Promise.all(Array.from(e,function(e){t.register(e)}))).then(function(){return t.collection})}catch(e){return Promise.reject(e)}},t.deregisterCollection=function(){try{var e=function(){return t.collection},t=this,n=function(e,t,n){for(var r;;){var i=e();if(f(i)&&(i=i.v),!i)return o;if(i.then){r=0;break}var o=n();if(o&&o.then){if(!f(o)){r=1;break}o=o.s}if(t){var s=t();if(s&&s.then&&!f(s)){r=2;break}}}var c=new a,u=l.bind(null,c,2);return(0===r?i.then(d):1===r?o.then(h):s.then(v)).then(void 0,u),c;function h(r){o=r;do{if(t&&(s=t())&&s.then&&!f(s))return void s.then(v).then(void 0,u);if(!(i=e())||f(i)&&!i.v)return void l(c,1,o);if(i.then)return void i.then(d).then(void 0,u);f(o=n())&&(o=o.v)}while(!o||!o.then);o.then(h).then(void 0,u)}function d(e){e?(o=n())&&o.then?o.then(h).then(void 0,u):h(o):l(c,1,o)}function v(){(i=e())?i.then?i.then(d).then(void 0,u):d(i):l(c,1,o)}}(function(){return t.collection.length>0},void 0,function(){return Promise.resolve(t.deregister(t.collection[0])).then(function(){})});return Promise.resolve(n&&n.then?n.then(e):e())}catch(e){return Promise.reject(e)}},t.get=function(e,t){return void 0===t&&(t="id"),this.collection.find(function(n){return n[t]===e})},e}(),d=/*#__PURE__*/o("focusable"),v=/*#__PURE__*/o("handleFocusTrap"),m=/*#__PURE__*/o("handleFocusLock"),p=/*#__PURE__*/function(){function e(e,t){void 0===e&&(e=null),void 0===t&&(t="[data-focus]"),Object.defineProperty(this,d,{writable:!0,value:void 0}),Object.defineProperty(this,v,{writable:!0,value:void 0}),Object.defineProperty(this,m,{writable:!0,value:void 0}),this.el=e,this.selectorFocus=t,s(this,v)[v]=y.bind(this),s(this,m)[m]=b.bind(this)}var n=e.prototype;return n.mount=function(e,t){e&&(this.el=e),t&&(this.selectorFocus=t),this.focusable=this.getFocusable(),this.focus()},n.unmount=function(){this.el=null,this.focusable=[],document.removeEventListener("keydown",s(this,v)[v]),document.removeEventListener("keydown",s(this,m)[m])},n.focus=function(e,t){void 0===e&&(e=this.el),void 0===t&&(t=this.selectorFocus),(e.querySelector(t)||e).focus()},n.getFocusable=function(e){void 0===e&&(e=this.el);var n=[],r=document.activeElement,i=e.scrollTop;return e.querySelectorAll(t.default.join(",")).forEach(function(e){e.focus(),document.activeElement===e&&n.push(e)}),e.scrollTop=i,r.focus(),n},r(e,[{key:"focusable",get:function(){return s(this,d)[d]},set:function(e){s(this,d)[d]=e,s(this,d)[d].length?(document.removeEventListener("keydown",s(this,m)[m]),document.addEventListener("keydown",s(this,v)[v])):(document.removeEventListener("keydown",s(this,v)[v]),document.addEventListener("keydown",s(this,m)[m]))}},{key:"focusableFirst",get:function(){return this.focusable[0]}},{key:"focusableLast",get:function(){return this.focusable[this.focusable.length-1]}}]),e}();function y(e){("Tab"===e.key||9===e.keyCode)&&(e.shiftKey?document.activeElement!==this.focusableFirst&&document.activeElement!==this.el||(e.preventDefault(),this.focusableLast.focus()):document.activeElement!==this.focusableLast&&document.activeElement!==this.el||(e.preventDefault(),this.focusableFirst.focus()))}function b(e){("Tab"===e.key||9===e.keyCode)&&e.preventDefault()}exports.Breakpoint=u,exports.Collection=h,exports.FocusTrap=p,exports.closeTransition=function(e,t){return new Promise(function(n){t.transition?(e.classList.add(t.stateClosing),e.classList.remove(t.stateOpened),e.addEventListener("transitionend",function r(){e.classList.remove(t.stateClosing),e.classList.add(t.stateClosed),n(e),this.removeEventListener("transitionend",r)})):(e.classList.add(t.stateClosed),e.classList.remove(t.stateOpened),n(e))})},exports.getConfig=function(e,t){var n=(e.getAttribute("data-"+t)||"").replace(/'/g,'"');return n?JSON.parse(n):{}},exports.getPrefix=function(){return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim()},exports.localStore=function(e,t){void 0===t&&(t=!0);var n=localStorage.getItem(e),r=n?JSON.parse(n):{};return{get:function(e){return e?r[e]:r},set:function(n,i){return i?r[n]=i:delete r[n],t&&localStorage.setItem(e,JSON.stringify(r)),r}}},exports.openTransition=function(e,t){return new Promise(function(n){t.transition?(e.classList.remove(t.stateClosed),e.classList.add(t.stateOpening),e.addEventListener("transitionend",function r(){e.classList.add(t.stateOpened),e.classList.remove(t.stateOpening),n(e),this.removeEventListener("transitionend",r)})):(e.classList.add(t.stateOpened),e.classList.remove(t.stateClosed),n(e))})},exports.teleport=function(e,t,n){var r=t.nodeType===Node.COMMENT_NODE,i=t.nodeType===Node.ELEMENT_NODE;if(r&&(n="after"),!(t=r||i?t:document.querySelector(t)))throw new Error("Not a valid teleport reference: '"+t+"'");if("function"!=typeof t[n])throw new Error("Not a valid teleport method: '"+n+"'");var o=null;return r||(o=document.createComment("teleported #"+e.id),e.before(o)),t[n](e),r&&t.remove(),o},exports.updateGlobalState=function(e,t){var n,r;n=!!e,(r=t.selectorInert)&&document.querySelectorAll(r).forEach(function(e){n?(e.inert=!0,e.setAttribute("aria-hidden",!0)):(e.inert=null,e.removeAttribute("aria-hidden"))}),function(e,t){t&&document.querySelectorAll(t).forEach(function(t){e?t.style.overflow="hidden":t.style.removeProperty("overflow")})}(!!e,t.selectorOverflow)};
function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=/*#__PURE__*/e(require("focusable-selectors"));function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,"symbol"==typeof(i=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key))?i:String(i),r)}var i}function r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var i=0;function o(e){return"__private_"+i+++"_"+e}function s(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var c=/*#__PURE__*/o("handler"),u=/*#__PURE__*/function(){function e(e,t){Object.defineProperty(this,c,{writable:!0,value:void 0}),this.value=e,s(this,c)[c]=t,this.mql=null}var t=e.prototype;return t.mount=function(e,t){return e&&(this.value=e),t&&(s(this,c)[c]=t),this.value?(this.mql=window.matchMedia("(min-width: "+this.value+")"),"function"==typeof this.mql.addEventListener?this.mql.addEventListener("change",s(this,c)[c]):this.mql.addListener(s(this,c)[c]),s(this,c)[c](this.mql),this):this},t.unmount=function(){return this.mql?("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",s(this,c)[c]):this.mql.removeListener(s(this,c)[c]),this.value=null,s(this,c)[c]=null,this.mql=null,this):this},r(e,[{key:"handler",get:function(){return s(this,c)[c]},set:function(e){this.mql&&("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",s(this,c)[c]):this.mql.removeListener(s(this,c)[c])),s(this,c)[c]=e}}]),e}();function l(e,t,n){if(!e.s){if(n instanceof a){if(!n.s)return void(n.o=l.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(l.bind(null,e,t),l.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}var a=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var o=1&i?t:n;if(o){try{l(r,1,o(this.v))}catch(e){l(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?l(r,1,t?t(i):i):n?l(r,1,n(i)):l(r,2,i)}catch(e){l(r,2,e)}},r},e}();function f(e){return e instanceof a&&1&e.s}var h=/*#__PURE__*/function(){function e(){this.collection=[]}var t=e.prototype;return t.register=function(e){try{var t=this;return Promise.resolve(t.deregister(e)).then(function(){return t.collection.push(e),t.collection})}catch(e){return Promise.reject(e)}},t.deregister=function(e){try{var t=this,n=t.collection.findIndex(function(t){return t===e});if(n>=0){var r=t.collection[n];Object.getOwnPropertyNames(r).forEach(function(e){delete r[e]}),t.collection.splice(n,1)}return Promise.resolve(t.collection)}catch(e){return Promise.reject(e)}},t.registerCollection=function(e){try{var t=this;return Promise.resolve(Promise.all(Array.from(e,function(e){t.register(e)}))).then(function(){return t.collection})}catch(e){return Promise.reject(e)}},t.deregisterCollection=function(){try{var e=function(){return t.collection},t=this,n=function(e,t,n){for(var r;;){var i=e();if(f(i)&&(i=i.v),!i)return o;if(i.then){r=0;break}var o=n();if(o&&o.then){if(!f(o)){r=1;break}o=o.s}if(t){var s=t();if(s&&s.then&&!f(s)){r=2;break}}}var c=new a,u=l.bind(null,c,2);return(0===r?i.then(d):1===r?o.then(h):s.then(v)).then(void 0,u),c;function h(r){o=r;do{if(t&&(s=t())&&s.then&&!f(s))return void s.then(v).then(void 0,u);if(!(i=e())||f(i)&&!i.v)return void l(c,1,o);if(i.then)return void i.then(d).then(void 0,u);f(o=n())&&(o=o.v)}while(!o||!o.then);o.then(h).then(void 0,u)}function d(e){e?(o=n())&&o.then?o.then(h).then(void 0,u):h(o):l(c,1,o)}function v(){(i=e())?i.then?i.then(d).then(void 0,u):d(i):l(c,1,o)}}(function(){return t.collection.length>0},void 0,function(){return Promise.resolve(t.deregister(t.collection[0])).then(function(){})});return Promise.resolve(n&&n.then?n.then(e):e())}catch(e){return Promise.reject(e)}},t.get=function(e,t){return void 0===t&&(t="id"),this.collection.find(function(n){return n[t]===e})},e}(),d=/*#__PURE__*/o("focusable"),v=/*#__PURE__*/o("handleFocusTrap"),m=/*#__PURE__*/o("handleFocusLock"),p=/*#__PURE__*/function(){function e(e,t){void 0===e&&(e=null),void 0===t&&(t="[data-focus]"),Object.defineProperty(this,d,{writable:!0,value:void 0}),Object.defineProperty(this,v,{writable:!0,value:void 0}),Object.defineProperty(this,m,{writable:!0,value:void 0}),this.el=e,this.selectorFocus=t,s(this,v)[v]=y.bind(this),s(this,m)[m]=b.bind(this)}var n=e.prototype;return n.mount=function(e,t){e&&(this.el=e),t&&(this.selectorFocus=t),this.focusable=this.getFocusable(),this.focus()},n.unmount=function(){this.el=null,this.focusable=[],document.removeEventListener("keydown",s(this,v)[v]),document.removeEventListener("keydown",s(this,m)[m])},n.focus=function(e,t){void 0===e&&(e=this.el),void 0===t&&(t=this.selectorFocus),(e.querySelector(t)||e).focus()},n.getFocusable=function(e){void 0===e&&(e=this.el);var n=[],r=document.activeElement,i=e.scrollTop;return e.querySelectorAll(t.default.join(",")).forEach(function(e){e.focus(),document.activeElement===e&&n.push(e)}),e.scrollTop=i,r.focus(),n},r(e,[{key:"focusable",get:function(){return s(this,d)[d]},set:function(e){s(this,d)[d]=e,s(this,d)[d].length?(document.removeEventListener("keydown",s(this,m)[m]),document.addEventListener("keydown",s(this,v)[v])):(document.removeEventListener("keydown",s(this,v)[v]),document.addEventListener("keydown",s(this,m)[m]))}},{key:"focusableFirst",get:function(){return this.focusable[0]}},{key:"focusableLast",get:function(){return this.focusable[this.focusable.length-1]}}]),e}();function y(e){("Tab"===e.key||9===e.keyCode)&&(e.shiftKey?document.activeElement!==this.focusableFirst&&document.activeElement!==this.el||(e.preventDefault(),this.focusableLast.focus()):document.activeElement!==this.focusableLast&&document.activeElement!==this.el||(e.preventDefault(),this.focusableFirst.focus()))}function b(e){("Tab"===e.key||9===e.keyCode)&&e.preventDefault()}exports.Breakpoint=u,exports.Collection=h,exports.FocusTrap=p,exports.closeTransition=function(e,t){return new Promise(function(n){t.transition?(e.classList.add(t.stateClosing),e.classList.remove(t.stateOpened),e.addEventListener("transitionend",function r(i){i.target==e&&(e.classList.remove(t.stateClosing),e.classList.add(t.stateClosed),n(e),this.removeEventListener("transitionend",r))})):(e.classList.add(t.stateClosed),e.classList.remove(t.stateOpened),n(e))})},exports.getConfig=function(e,t){var n=(e.getAttribute("data-"+t)||"").replace(/'/g,'"');return n?JSON.parse(n):{}},exports.getPrefix=function(){return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim()},exports.localStore=function(e,t){void 0===t&&(t=!0);var n=localStorage.getItem(e),r=n?JSON.parse(n):{};return{get:function(e){return e?r[e]:r},set:function(n,i){return i?r[n]=i:delete r[n],t&&localStorage.setItem(e,JSON.stringify(r)),r}}},exports.openTransition=function(e,t){return new Promise(function(n){t.transition?(e.classList.remove(t.stateClosed),e.classList.add(t.stateOpening),e.addEventListener("transitionend",function r(i){i.target==e&&(e.classList.add(t.stateOpened),e.classList.remove(t.stateOpening),n(e),this.removeEventListener("transitionend",r))})):(e.classList.add(t.stateOpened),e.classList.remove(t.stateClosed),n(e))})},exports.teleport=function(e,t,n){var r=t.nodeType===Node.COMMENT_NODE,i=t.nodeType===Node.ELEMENT_NODE;if(r&&(n="after"),!(t=r||i?t:document.querySelector(t)))throw new Error("Not a valid teleport reference: '"+t+"'");if("function"!=typeof t[n])throw new Error("Not a valid teleport method: '"+n+"'");var o=null;return r||(o=document.createComment("teleported #"+e.id),e.before(o)),t[n](e),r&&t.remove(),o},exports.updateGlobalState=function(e,t){var n,r;n=!!e,(r=t.selectorInert)&&document.querySelectorAll(r).forEach(function(e){n?(e.inert=!0,e.setAttribute("aria-hidden",!0)):(e.inert=null,e.removeAttribute("aria-hidden"))}),function(e,t){t&&document.querySelectorAll(t).forEach(function(t){e?t.style.overflow="hidden":t.style.removeProperty("overflow")})}(!!e,t.selectorOverflow)};
//# sourceMappingURL=scripts.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("focusable-selectors")):"function"==typeof define&&define.amd?define(["exports","focusable-selectors"],t):t(((e||self).vrembem=e.vrembem||{},e.vrembem.core={}),e.focusableSelectors)}(this,function(e,t){function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=/*#__PURE__*/n(t);function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,"symbol"==typeof(r=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(i.key))?r:String(r),i)}var r}function o(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var s=0;function c(e){return"__private_"+s+++"_"+e}function u(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var l=/*#__PURE__*/c("handler"),a=/*#__PURE__*/function(){function e(e,t){Object.defineProperty(this,l,{writable:!0,value:void 0}),this.value=e,u(this,l)[l]=t,this.mql=null}var t=e.prototype;return t.mount=function(e,t){return e&&(this.value=e),t&&(u(this,l)[l]=t),this.value?(this.mql=window.matchMedia("(min-width: "+this.value+")"),"function"==typeof this.mql.addEventListener?this.mql.addEventListener("change",u(this,l)[l]):this.mql.addListener(u(this,l)[l]),u(this,l)[l](this.mql),this):this},t.unmount=function(){return this.mql?("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",u(this,l)[l]):this.mql.removeListener(u(this,l)[l]),this.value=null,u(this,l)[l]=null,this.mql=null,this):this},o(e,[{key:"handler",get:function(){return u(this,l)[l]},set:function(e){this.mql&&("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",u(this,l)[l]):this.mql.removeListener(u(this,l)[l])),u(this,l)[l]=e}}]),e}();function f(e,t,n){if(!e.s){if(n instanceof h){if(!n.s)return void(n.o=f.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(f.bind(null,e,t),f.bind(null,e,2));e.s=t,e.v=n;const i=e.o;i&&i(e)}}var h=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var i=new e,r=this.s;if(r){var o=1&r?t:n;if(o){try{f(i,1,o(this.v))}catch(e){f(i,2,e)}return i}return this}return this.o=function(e){try{var r=e.v;1&e.s?f(i,1,t?t(r):r):n?f(i,1,n(r)):f(i,2,r)}catch(e){f(i,2,e)}},i},e}();function d(e){return e instanceof h&&1&e.s}var v=/*#__PURE__*/function(){function e(){this.collection=[]}var t=e.prototype;return t.register=function(e){try{var t=this;return Promise.resolve(t.deregister(e)).then(function(){return t.collection.push(e),t.collection})}catch(e){return Promise.reject(e)}},t.deregister=function(e){try{var t=this,n=t.collection.findIndex(function(t){return t===e});if(n>=0){var i=t.collection[n];Object.getOwnPropertyNames(i).forEach(function(e){delete i[e]}),t.collection.splice(n,1)}return Promise.resolve(t.collection)}catch(e){return Promise.reject(e)}},t.registerCollection=function(e){try{var t=this;return Promise.resolve(Promise.all(Array.from(e,function(e){t.register(e)}))).then(function(){return t.collection})}catch(e){return Promise.reject(e)}},t.deregisterCollection=function(){try{var e=function(){return t.collection},t=this,n=function(e,t,n){for(var i;;){var r=e();if(d(r)&&(r=r.v),!r)return o;if(r.then){i=0;break}var o=n();if(o&&o.then){if(!d(o)){i=1;break}o=o.s}if(t){var s=t();if(s&&s.then&&!d(s)){i=2;break}}}var c=new h,u=f.bind(null,c,2);return(0===i?r.then(a):1===i?o.then(l):s.then(v)).then(void 0,u),c;function l(i){o=i;do{if(t&&(s=t())&&s.then&&!d(s))return void s.then(v).then(void 0,u);if(!(r=e())||d(r)&&!r.v)return void f(c,1,o);if(r.then)return void r.then(a).then(void 0,u);d(o=n())&&(o=o.v)}while(!o||!o.then);o.then(l).then(void 0,u)}function a(e){e?(o=n())&&o.then?o.then(l).then(void 0,u):l(o):f(c,1,o)}function v(){(r=e())?r.then?r.then(a).then(void 0,u):a(r):f(c,1,o)}}(function(){return t.collection.length>0},void 0,function(){return Promise.resolve(t.deregister(t.collection[0])).then(function(){})});return Promise.resolve(n&&n.then?n.then(e):e())}catch(e){return Promise.reject(e)}},t.get=function(e,t){return void 0===t&&(t="id"),this.collection.find(function(n){return n[t]===e})},e}(),m=/*#__PURE__*/c("focusable"),p=/*#__PURE__*/c("handleFocusTrap"),y=/*#__PURE__*/c("handleFocusLock"),b=/*#__PURE__*/function(){function e(e,t){void 0===e&&(e=null),void 0===t&&(t="[data-focus]"),Object.defineProperty(this,m,{writable:!0,value:void 0}),Object.defineProperty(this,p,{writable:!0,value:void 0}),Object.defineProperty(this,y,{writable:!0,value:void 0}),this.el=e,this.selectorFocus=t,u(this,p)[p]=g.bind(this),u(this,y)[y]=E.bind(this)}var t=e.prototype;return t.mount=function(e,t){e&&(this.el=e),t&&(this.selectorFocus=t),this.focusable=this.getFocusable(),this.focus()},t.unmount=function(){this.el=null,this.focusable=[],document.removeEventListener("keydown",u(this,p)[p]),document.removeEventListener("keydown",u(this,y)[y])},t.focus=function(e,t){void 0===e&&(e=this.el),void 0===t&&(t=this.selectorFocus),(e.querySelector(t)||e).focus()},t.getFocusable=function(e){void 0===e&&(e=this.el);var t=[],n=document.activeElement,r=e.scrollTop;return e.querySelectorAll(i.default.join(",")).forEach(function(e){e.focus(),document.activeElement===e&&t.push(e)}),e.scrollTop=r,n.focus(),t},o(e,[{key:"focusable",get:function(){return u(this,m)[m]},set:function(e){u(this,m)[m]=e,u(this,m)[m].length?(document.removeEventListener("keydown",u(this,y)[y]),document.addEventListener("keydown",u(this,p)[p])):(document.removeEventListener("keydown",u(this,p)[p]),document.addEventListener("keydown",u(this,y)[y]))}},{key:"focusableFirst",get:function(){return this.focusable[0]}},{key:"focusableLast",get:function(){return this.focusable[this.focusable.length-1]}}]),e}();function g(e){("Tab"===e.key||9===e.keyCode)&&(e.shiftKey?document.activeElement!==this.focusableFirst&&document.activeElement!==this.el||(e.preventDefault(),this.focusableLast.focus()):document.activeElement!==this.focusableLast&&document.activeElement!==this.el||(e.preventDefault(),this.focusableFirst.focus()))}function E(e){("Tab"===e.key||9===e.keyCode)&&e.preventDefault()}e.Breakpoint=a,e.Collection=v,e.FocusTrap=b,e.closeTransition=function(e,t){return new Promise(function(n){t.transition?(e.classList.add(t.stateClosing),e.classList.remove(t.stateOpened),e.addEventListener("transitionend",function i(){e.classList.remove(t.stateClosing),e.classList.add(t.stateClosed),n(e),this.removeEventListener("transitionend",i)})):(e.classList.add(t.stateClosed),e.classList.remove(t.stateOpened),n(e))})},e.getConfig=function(e,t){var n=(e.getAttribute("data-"+t)||"").replace(/'/g,'"');return n?JSON.parse(n):{}},e.getPrefix=function(){return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim()},e.localStore=function(e,t){void 0===t&&(t=!0);var n=localStorage.getItem(e),i=n?JSON.parse(n):{};return{get:function(e){return e?i[e]:i},set:function(n,r){return r?i[n]=r:delete i[n],t&&localStorage.setItem(e,JSON.stringify(i)),i}}},e.openTransition=function(e,t){return new Promise(function(n){t.transition?(e.classList.remove(t.stateClosed),e.classList.add(t.stateOpening),e.addEventListener("transitionend",function i(){e.classList.add(t.stateOpened),e.classList.remove(t.stateOpening),n(e),this.removeEventListener("transitionend",i)})):(e.classList.add(t.stateOpened),e.classList.remove(t.stateClosed),n(e))})},e.teleport=function(e,t,n){var i=t.nodeType===Node.COMMENT_NODE,r=t.nodeType===Node.ELEMENT_NODE;if(i&&(n="after"),!(t=i||r?t:document.querySelector(t)))throw new Error("Not a valid teleport reference: '"+t+"'");if("function"!=typeof t[n])throw new Error("Not a valid teleport method: '"+n+"'");var o=null;return i||(o=document.createComment("teleported #"+e.id),e.before(o)),t[n](e),i&&t.remove(),o},e.updateGlobalState=function(e,t){var n,i;n=!!e,(i=t.selectorInert)&&document.querySelectorAll(i).forEach(function(e){n?(e.inert=!0,e.setAttribute("aria-hidden",!0)):(e.inert=null,e.removeAttribute("aria-hidden"))}),function(e,t){t&&document.querySelectorAll(t).forEach(function(t){e?t.style.overflow="hidden":t.style.removeProperty("overflow")})}(!!e,t.selectorOverflow)}});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("focusable-selectors")):"function"==typeof define&&define.amd?define(["exports","focusable-selectors"],t):t(((e||self).vrembem=e.vrembem||{},e.vrembem.core={}),e.focusableSelectors)}(this,function(e,t){function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=/*#__PURE__*/n(t);function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,"symbol"==typeof(r=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(i.key))?r:String(r),i)}var r}function o(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var s=0;function c(e){return"__private_"+s+++"_"+e}function u(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var l=/*#__PURE__*/c("handler"),a=/*#__PURE__*/function(){function e(e,t){Object.defineProperty(this,l,{writable:!0,value:void 0}),this.value=e,u(this,l)[l]=t,this.mql=null}var t=e.prototype;return t.mount=function(e,t){return e&&(this.value=e),t&&(u(this,l)[l]=t),this.value?(this.mql=window.matchMedia("(min-width: "+this.value+")"),"function"==typeof this.mql.addEventListener?this.mql.addEventListener("change",u(this,l)[l]):this.mql.addListener(u(this,l)[l]),u(this,l)[l](this.mql),this):this},t.unmount=function(){return this.mql?("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",u(this,l)[l]):this.mql.removeListener(u(this,l)[l]),this.value=null,u(this,l)[l]=null,this.mql=null,this):this},o(e,[{key:"handler",get:function(){return u(this,l)[l]},set:function(e){this.mql&&("function"==typeof this.mql.removeEventListener?this.mql.removeEventListener("change",u(this,l)[l]):this.mql.removeListener(u(this,l)[l])),u(this,l)[l]=e}}]),e}();function f(e,t,n){if(!e.s){if(n instanceof h){if(!n.s)return void(n.o=f.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(f.bind(null,e,t),f.bind(null,e,2));e.s=t,e.v=n;const i=e.o;i&&i(e)}}var h=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var i=new e,r=this.s;if(r){var o=1&r?t:n;if(o){try{f(i,1,o(this.v))}catch(e){f(i,2,e)}return i}return this}return this.o=function(e){try{var r=e.v;1&e.s?f(i,1,t?t(r):r):n?f(i,1,n(r)):f(i,2,r)}catch(e){f(i,2,e)}},i},e}();function d(e){return e instanceof h&&1&e.s}var v=/*#__PURE__*/function(){function e(){this.collection=[]}var t=e.prototype;return t.register=function(e){try{var t=this;return Promise.resolve(t.deregister(e)).then(function(){return t.collection.push(e),t.collection})}catch(e){return Promise.reject(e)}},t.deregister=function(e){try{var t=this,n=t.collection.findIndex(function(t){return t===e});if(n>=0){var i=t.collection[n];Object.getOwnPropertyNames(i).forEach(function(e){delete i[e]}),t.collection.splice(n,1)}return Promise.resolve(t.collection)}catch(e){return Promise.reject(e)}},t.registerCollection=function(e){try{var t=this;return Promise.resolve(Promise.all(Array.from(e,function(e){t.register(e)}))).then(function(){return t.collection})}catch(e){return Promise.reject(e)}},t.deregisterCollection=function(){try{var e=function(){return t.collection},t=this,n=function(e,t,n){for(var i;;){var r=e();if(d(r)&&(r=r.v),!r)return o;if(r.then){i=0;break}var o=n();if(o&&o.then){if(!d(o)){i=1;break}o=o.s}if(t){var s=t();if(s&&s.then&&!d(s)){i=2;break}}}var c=new h,u=f.bind(null,c,2);return(0===i?r.then(a):1===i?o.then(l):s.then(v)).then(void 0,u),c;function l(i){o=i;do{if(t&&(s=t())&&s.then&&!d(s))return void s.then(v).then(void 0,u);if(!(r=e())||d(r)&&!r.v)return void f(c,1,o);if(r.then)return void r.then(a).then(void 0,u);d(o=n())&&(o=o.v)}while(!o||!o.then);o.then(l).then(void 0,u)}function a(e){e?(o=n())&&o.then?o.then(l).then(void 0,u):l(o):f(c,1,o)}function v(){(r=e())?r.then?r.then(a).then(void 0,u):a(r):f(c,1,o)}}(function(){return t.collection.length>0},void 0,function(){return Promise.resolve(t.deregister(t.collection[0])).then(function(){})});return Promise.resolve(n&&n.then?n.then(e):e())}catch(e){return Promise.reject(e)}},t.get=function(e,t){return void 0===t&&(t="id"),this.collection.find(function(n){return n[t]===e})},e}(),m=/*#__PURE__*/c("focusable"),p=/*#__PURE__*/c("handleFocusTrap"),y=/*#__PURE__*/c("handleFocusLock"),b=/*#__PURE__*/function(){function e(e,t){void 0===e&&(e=null),void 0===t&&(t="[data-focus]"),Object.defineProperty(this,m,{writable:!0,value:void 0}),Object.defineProperty(this,p,{writable:!0,value:void 0}),Object.defineProperty(this,y,{writable:!0,value:void 0}),this.el=e,this.selectorFocus=t,u(this,p)[p]=g.bind(this),u(this,y)[y]=E.bind(this)}var t=e.prototype;return t.mount=function(e,t){e&&(this.el=e),t&&(this.selectorFocus=t),this.focusable=this.getFocusable(),this.focus()},t.unmount=function(){this.el=null,this.focusable=[],document.removeEventListener("keydown",u(this,p)[p]),document.removeEventListener("keydown",u(this,y)[y])},t.focus=function(e,t){void 0===e&&(e=this.el),void 0===t&&(t=this.selectorFocus),(e.querySelector(t)||e).focus()},t.getFocusable=function(e){void 0===e&&(e=this.el);var t=[],n=document.activeElement,r=e.scrollTop;return e.querySelectorAll(i.default.join(",")).forEach(function(e){e.focus(),document.activeElement===e&&t.push(e)}),e.scrollTop=r,n.focus(),t},o(e,[{key:"focusable",get:function(){return u(this,m)[m]},set:function(e){u(this,m)[m]=e,u(this,m)[m].length?(document.removeEventListener("keydown",u(this,y)[y]),document.addEventListener("keydown",u(this,p)[p])):(document.removeEventListener("keydown",u(this,p)[p]),document.addEventListener("keydown",u(this,y)[y]))}},{key:"focusableFirst",get:function(){return this.focusable[0]}},{key:"focusableLast",get:function(){return this.focusable[this.focusable.length-1]}}]),e}();function g(e){("Tab"===e.key||9===e.keyCode)&&(e.shiftKey?document.activeElement!==this.focusableFirst&&document.activeElement!==this.el||(e.preventDefault(),this.focusableLast.focus()):document.activeElement!==this.focusableLast&&document.activeElement!==this.el||(e.preventDefault(),this.focusableFirst.focus()))}function E(e){("Tab"===e.key||9===e.keyCode)&&e.preventDefault()}e.Breakpoint=a,e.Collection=v,e.FocusTrap=b,e.closeTransition=function(e,t){return new Promise(function(n){t.transition?(e.classList.add(t.stateClosing),e.classList.remove(t.stateOpened),e.addEventListener("transitionend",function i(r){r.target==e&&(e.classList.remove(t.stateClosing),e.classList.add(t.stateClosed),n(e),this.removeEventListener("transitionend",i))})):(e.classList.add(t.stateClosed),e.classList.remove(t.stateOpened),n(e))})},e.getConfig=function(e,t){var n=(e.getAttribute("data-"+t)||"").replace(/'/g,'"');return n?JSON.parse(n):{}},e.getPrefix=function(){return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim()},e.localStore=function(e,t){void 0===t&&(t=!0);var n=localStorage.getItem(e),i=n?JSON.parse(n):{};return{get:function(e){return e?i[e]:i},set:function(n,r){return r?i[n]=r:delete i[n],t&&localStorage.setItem(e,JSON.stringify(i)),i}}},e.openTransition=function(e,t){return new Promise(function(n){t.transition?(e.classList.remove(t.stateClosed),e.classList.add(t.stateOpening),e.addEventListener("transitionend",function i(r){r.target==e&&(e.classList.add(t.stateOpened),e.classList.remove(t.stateOpening),n(e),this.removeEventListener("transitionend",i))})):(e.classList.add(t.stateOpened),e.classList.remove(t.stateClosed),n(e))})},e.teleport=function(e,t,n){var i=t.nodeType===Node.COMMENT_NODE,r=t.nodeType===Node.ELEMENT_NODE;if(i&&(n="after"),!(t=i||r?t:document.querySelector(t)))throw new Error("Not a valid teleport reference: '"+t+"'");if("function"!=typeof t[n])throw new Error("Not a valid teleport method: '"+n+"'");var o=null;return i||(o=document.createComment("teleported #"+e.id),e.before(o)),t[n](e),i&&t.remove(),o},e.updateGlobalState=function(e,t){var n,i;n=!!e,(i=t.selectorInert)&&document.querySelectorAll(i).forEach(function(e){n?(e.inert=!0,e.setAttribute("aria-hidden",!0)):(e.inert=null,e.removeAttribute("aria-hidden"))}),function(e,t){t&&document.querySelectorAll(t).forEach(function(t){e?t.style.overflow="hidden":t.style.removeProperty("overflow")})}(!!e,t.selectorOverflow)}});
//# sourceMappingURL=scripts.umd.js.map
{
"name": "@vrembem/core",
"description": "The core variables, functions and mixins for Vrembem components.",
"version": "3.0.13",
"version": "3.0.14",
"license": "MIT",

@@ -48,3 +48,3 @@ "keywords": [

},
"gitHead": "cf26f984a069fb61d2e3ec36e3179f4f6b24ac91",
"gitHead": "9be4699627b4930c17b7173312b65f674b698f6c",
"dependencies": {

@@ -51,0 +51,0 @@ "focusable-selectors": "^0.8.1"

export const openTransition = (el, settings) => {
return new Promise((resolve) => {
// Check if transitions are enabled.
if (settings.transition) {
// Toggle classes for opening transition.
el.classList.remove(settings.stateClosed);
el.classList.add(settings.stateOpening);
el.addEventListener('transitionend', function _f() {
// Add event listener for when the transition is finished.
el.addEventListener('transitionend', function _f(event) {
// Prevent child transition bubbling from firing this event.
if (event.target != el) return;
// Toggle final opened state classes.
el.classList.add(settings.stateOpened);
el.classList.remove(settings.stateOpening);
// Resolve the promise and remove the event listener.
resolve(el);

@@ -13,2 +23,3 @@ this.removeEventListener('transitionend', _f);

} else {
// Toggle final opened state classes and resolve the promise.
el.classList.add(settings.stateOpened);

@@ -23,8 +34,18 @@ el.classList.remove(settings.stateClosed);

return new Promise((resolve) => {
// Check if transitions are enabled.
if (settings.transition) {
// Toggle classes for closing transition.
el.classList.add(settings.stateClosing);
el.classList.remove(settings.stateOpened);
el.addEventListener('transitionend', function _f() {
// Add event listener for when the transition is finished.
el.addEventListener('transitionend', function _f(event) {
// Prevent child transition bubbling from firing this event.
if (event.target != el) return;
// Toggle final closed state classes.
el.classList.remove(settings.stateClosing);
el.classList.add(settings.stateClosed);
// Resolve the promise and remove the event listener.
resolve(el);

@@ -34,2 +55,3 @@ this.removeEventListener('transitionend', _f);

} else {
// Toggle final closed state classes and resolve the promise.
el.classList.add(settings.stateClosed);

@@ -36,0 +58,0 @@ el.classList.remove(settings.stateOpened);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc