@vrembem/core
Advanced tools
Comparing version 3.0.11 to 3.0.13
@@ -275,6 +275,6 @@ import focusableSelectors from 'focusable-selectors'; | ||
try { | ||
var _this2 = this; | ||
return Promise.resolve(_this2.deregister(item)).then(function () { | ||
_this2.collection.push(item); | ||
return _this2.collection; | ||
var _this = this; | ||
return Promise.resolve(_this.deregister(item)).then(function () { | ||
_this.collection.push(item); | ||
return _this.collection; | ||
}); | ||
@@ -287,14 +287,14 @@ } catch (e) { | ||
try { | ||
var _this4 = this; | ||
var index = _this4.collection.findIndex(function (entry) { | ||
var _this2 = this; | ||
var index = _this2.collection.findIndex(function (entry) { | ||
return entry === ref; | ||
}); | ||
if (index >= 0) { | ||
var entry = _this4.collection[index]; | ||
var entry = _this2.collection[index]; | ||
Object.getOwnPropertyNames(entry).forEach(function (prop) { | ||
delete entry[prop]; | ||
}); | ||
_this4.collection.splice(index, 1); | ||
_this2.collection.splice(index, 1); | ||
} | ||
return Promise.resolve(_this4.collection); | ||
return Promise.resolve(_this2.collection); | ||
} catch (e) { | ||
@@ -306,7 +306,7 @@ return Promise.reject(e); | ||
try { | ||
var _this6 = this; | ||
var _this3 = this; | ||
return Promise.resolve(Promise.all(Array.from(items, function (item) { | ||
_this6.register(item); | ||
_this3.register(item); | ||
}))).then(function () { | ||
return _this6.collection; | ||
return _this3.collection; | ||
}); | ||
@@ -319,12 +319,12 @@ } catch (e) { | ||
try { | ||
var _temp3 = function _temp3() { | ||
return _this8.collection; | ||
var _temp2 = function _temp2() { | ||
return _this4.collection; | ||
}; | ||
var _this8 = this; | ||
var _temp4 = _for(function () { | ||
return _this8.collection.length > 0; | ||
var _this4 = this; | ||
var _temp = _for(function () { | ||
return _this4.collection.length > 0; | ||
}, void 0, function () { | ||
return Promise.resolve(_this8.deregister(_this8.collection[0])).then(function () {}); | ||
return Promise.resolve(_this4.deregister(_this4.collection[0])).then(function () {}); | ||
}); | ||
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4)); | ||
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp)); | ||
} catch (e) { | ||
@@ -331,0 +331,0 @@ return Promise.reject(e); |
@@ -279,6 +279,6 @@ var focusableSelectors = require('focusable-selectors'); | ||
try { | ||
var _this2 = this; | ||
return Promise.resolve(_this2.deregister(item)).then(function () { | ||
_this2.collection.push(item); | ||
return _this2.collection; | ||
var _this = this; | ||
return Promise.resolve(_this.deregister(item)).then(function () { | ||
_this.collection.push(item); | ||
return _this.collection; | ||
}); | ||
@@ -291,14 +291,14 @@ } catch (e) { | ||
try { | ||
var _this4 = this; | ||
var index = _this4.collection.findIndex(function (entry) { | ||
var _this2 = this; | ||
var index = _this2.collection.findIndex(function (entry) { | ||
return entry === ref; | ||
}); | ||
if (index >= 0) { | ||
var entry = _this4.collection[index]; | ||
var entry = _this2.collection[index]; | ||
Object.getOwnPropertyNames(entry).forEach(function (prop) { | ||
delete entry[prop]; | ||
}); | ||
_this4.collection.splice(index, 1); | ||
_this2.collection.splice(index, 1); | ||
} | ||
return Promise.resolve(_this4.collection); | ||
return Promise.resolve(_this2.collection); | ||
} catch (e) { | ||
@@ -310,7 +310,7 @@ return Promise.reject(e); | ||
try { | ||
var _this6 = this; | ||
var _this3 = this; | ||
return Promise.resolve(Promise.all(Array.from(items, function (item) { | ||
_this6.register(item); | ||
_this3.register(item); | ||
}))).then(function () { | ||
return _this6.collection; | ||
return _this3.collection; | ||
}); | ||
@@ -323,12 +323,12 @@ } catch (e) { | ||
try { | ||
var _temp3 = function _temp3() { | ||
return _this8.collection; | ||
var _temp2 = function _temp2() { | ||
return _this4.collection; | ||
}; | ||
var _this8 = this; | ||
var _temp4 = _for(function () { | ||
return _this8.collection.length > 0; | ||
var _this4 = this; | ||
var _temp = _for(function () { | ||
return _this4.collection.length > 0; | ||
}, void 0, function () { | ||
return Promise.resolve(_this8.deregister(_this8.collection[0])).then(function () {}); | ||
return Promise.resolve(_this4.deregister(_this4.collection[0])).then(function () {}); | ||
}); | ||
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4)); | ||
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp)); | ||
} catch (e) { | ||
@@ -424,3 +424,3 @@ return Promise.reject(e); | ||
// Query for all the focusable elements. | ||
var els = el.querySelectorAll(focusableSelectors__default['default'].join(',')); | ||
var els = el.querySelectorAll(focusableSelectors__default["default"].join(',')); | ||
@@ -427,0 +427,0 @@ // Loop through all focusable elements. |
@@ -5,3 +5,3 @@ (function (global, factory) { | ||
(global = global || self, factory((global.vrembem = global.vrembem || {}, global.vrembem.core = {}), global.focusableSelectors)); | ||
}(this, (function (exports, focusableSelectors) { | ||
})(this, (function (exports, focusableSelectors) { | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
@@ -283,6 +283,6 @@ | ||
try { | ||
var _this2 = this; | ||
return Promise.resolve(_this2.deregister(item)).then(function () { | ||
_this2.collection.push(item); | ||
return _this2.collection; | ||
var _this = this; | ||
return Promise.resolve(_this.deregister(item)).then(function () { | ||
_this.collection.push(item); | ||
return _this.collection; | ||
}); | ||
@@ -295,14 +295,14 @@ } catch (e) { | ||
try { | ||
var _this4 = this; | ||
var index = _this4.collection.findIndex(function (entry) { | ||
var _this2 = this; | ||
var index = _this2.collection.findIndex(function (entry) { | ||
return entry === ref; | ||
}); | ||
if (index >= 0) { | ||
var entry = _this4.collection[index]; | ||
var entry = _this2.collection[index]; | ||
Object.getOwnPropertyNames(entry).forEach(function (prop) { | ||
delete entry[prop]; | ||
}); | ||
_this4.collection.splice(index, 1); | ||
_this2.collection.splice(index, 1); | ||
} | ||
return Promise.resolve(_this4.collection); | ||
return Promise.resolve(_this2.collection); | ||
} catch (e) { | ||
@@ -314,7 +314,7 @@ return Promise.reject(e); | ||
try { | ||
var _this6 = this; | ||
var _this3 = this; | ||
return Promise.resolve(Promise.all(Array.from(items, function (item) { | ||
_this6.register(item); | ||
_this3.register(item); | ||
}))).then(function () { | ||
return _this6.collection; | ||
return _this3.collection; | ||
}); | ||
@@ -327,12 +327,12 @@ } catch (e) { | ||
try { | ||
var _temp3 = function _temp3() { | ||
return _this8.collection; | ||
var _temp2 = function _temp2() { | ||
return _this4.collection; | ||
}; | ||
var _this8 = this; | ||
var _temp4 = _for(function () { | ||
return _this8.collection.length > 0; | ||
var _this4 = this; | ||
var _temp = _for(function () { | ||
return _this4.collection.length > 0; | ||
}, void 0, function () { | ||
return Promise.resolve(_this8.deregister(_this8.collection[0])).then(function () {}); | ||
return Promise.resolve(_this4.deregister(_this4.collection[0])).then(function () {}); | ||
}); | ||
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4)); | ||
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp)); | ||
} catch (e) { | ||
@@ -428,3 +428,3 @@ return Promise.reject(e); | ||
// Query for all the focusable elements. | ||
var els = el.querySelectorAll(focusableSelectors__default['default'].join(',')); | ||
var els = el.querySelectorAll(focusableSelectors__default["default"].join(',')); | ||
@@ -670,3 +670,3 @@ // Loop through all focusable elements. | ||
}))); | ||
})); | ||
//# sourceMappingURL=scripts.umd.js.map |
@@ -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}}var s=new l,c=u.bind(null,s,2);return(0===i?r.then(h):1===i?o.then(f):(void 0).then(function(){(r=e())?r.then?r.then(h).then(void 0,c):h(r):u(s,1,o)})).then(void 0,c),s;function f(t){o=t;do{if(!(r=e())||a(r)&&!r.v)return void u(s,1,o);if(r.then)return void r.then(h).then(void 0,c);a(o=n())&&(o=o.v)}while(!o||!o.then);o.then(f).then(void 0,c)}function h(e){e?(o=n())&&o.then?o.then(f).then(void 0,c):f(o):u(s,1,o)}}(function(){return t.collection.length>0},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(){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}; | ||
//# 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}}var s=new a,c=l.bind(null,s,2);return(0===r?i.then(h):1===r?o.then(u):(void 0).then(function(){(i=e())?i.then?i.then(h).then(void 0,c):h(i):l(s,1,o)})).then(void 0,c),s;function u(t){o=t;do{if(!(i=e())||f(i)&&!i.v)return void l(s,1,o);if(i.then)return void i.then(h).then(void 0,c);f(o=n())&&(o=o.v)}while(!o||!o.then);o.then(u).then(void 0,c)}function h(e){e?(o=n())&&o.then?o.then(u).then(void 0,c):u(o):l(s,1,o)}}(function(){return t.collection.length>0},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(){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)}; | ||
//# 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}}var s=new h,c=f.bind(null,s,2);return(0===i?r.then(l):1===i?o.then(u):(void 0).then(function(){(r=e())?r.then?r.then(l).then(void 0,c):l(r):f(s,1,o)})).then(void 0,c),s;function u(t){o=t;do{if(!(r=e())||d(r)&&!r.v)return void f(s,1,o);if(r.then)return void r.then(l).then(void 0,c);d(o=n())&&(o=o.v)}while(!o||!o.then);o.then(u).then(void 0,c)}function l(e){e?(o=n())&&o.then?o.then(u).then(void 0,c):u(o):f(s,1,o)}}(function(){return t.collection.length>0},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(){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)}}); | ||
//# sourceMappingURL=scripts.umd.js.map |
{ | ||
"name": "@vrembem/core", | ||
"description": "The core variables, functions and mixins for Vrembem components.", | ||
"version": "3.0.11", | ||
"version": "3.0.13", | ||
"license": "MIT", | ||
@@ -33,4 +33,4 @@ "keywords": [ | ||
"root": "npm-run-all root:dev root:dist", | ||
"root:dev": "sass src/scss/root:dev --load-path=node_modules", | ||
"root:dist": "sass src/scss/root:dist --load-path=node_modules --style=compressed", | ||
"root:dev": "sass src/scss/root:dev --load-path=../../node_modules", | ||
"root:dist": "sass src/scss/root:dist --load-path=../../node_modules --style=compressed", | ||
"watch": "concurrently --kill-others 'npm run watch:scripts' 'npm run watch:root'", | ||
@@ -49,6 +49,6 @@ "watch:scripts": "nodemon -e js -x 'npm run scripts' -i dev -i dist", | ||
}, | ||
"gitHead": "d966f513f86f66dddf93ed60ddefe51124562dc0", | ||
"gitHead": "cf26f984a069fb61d2e3ec36e3179f4f6b24ac91", | ||
"dependencies": { | ||
"focusable-selectors": "^0.4.0" | ||
"focusable-selectors": "^0.8.1" | ||
} | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
359449
47
2705
+ Addedfocusable-selectors@0.8.4(transitive)
- Removedfocusable-selectors@0.4.0(transitive)
Updatedfocusable-selectors@^0.8.1