@rnacanvas/utilities 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.utilities=t():e.utilities=t()}(this,(()=>(()=>{"use strict";var e={d:(t,i)=>{for(var r in i)e.o(i,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:i[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function i(e){return e.map((e=>({v:e,priority:Math.random()}))).sort(((e,t)=>e.priority-t.priority)).map((({v:e})=>e))}function r(){return!(!document.activeElement||"textarea"!==document.activeElement.tagName.toLowerCase()&&(e=document.activeElement,"input"!==e.tagName.toLowerCase()||"text"!==(null===(t=e.getAttribute("type"))||void 0===t?void 0:t.toLowerCase())));var e,t}e.r(t),e.d(t,{DownloadableFile:()=>l,EventfulSet:()=>d,FiniteStack:()=>w,KeyBinding:()=>h,detectMac:()=>c,isBeingInteractedWith:()=>s,shuffled:()=>i,userIsTyping:()=>r});let n=null;function s(e){return e===document.body||!!n&&n.target instanceof Node&&e.contains(n.target)}window.addEventListener("mousedown",(e=>n=e));var o,a=function(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)};class h{constructor(e,t,i){this.key=e,this.scope=void 0,o.set(this,void 0),function(e,t,i,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?n.call(e,i):n?n.value=i:t.set(e,i)}(this,o,i,"f"),window.addEventListener("keydown",(i=>{var n,h,c;i.key.toUpperCase()===e.toUpperCase()&&(void 0===(null===(n=a(this,o,"f"))||void 0===n?void 0:n.shiftKey)||a(this,o,"f").shiftKey==i.shiftKey)&&(void 0===(null===(h=a(this,o,"f"))||void 0===h?void 0:h.ctrlKey)||a(this,o,"f").ctrlKey==i.ctrlKey)&&(void 0===(null===(c=a(this,o,"f"))||void 0===c?void 0:c.metaKey)||a(this,o,"f").metaKey==i.metaKey)&&!r()&&this.scope&&s(this.scope)&&(i.preventDefault(),t())}),{passive:!1})}}function c(){try{return window.navigator.platform.toLowerCase().includes("mac")}catch(e){return!1}}o=new WeakMap;class l{constructor(e){this.textContent=e}downloadAs(e,t){let i=new File([this.textContent],e,{type:t.type}),r=URL.createObjectURL(i),n=document.createElement("a");n.href=r,n.download=i.name,document.body.appendChild(n),n.click(),n.remove(),URL.revokeObjectURL(r)}}class d{constructor(){this.eventListeners={change:[]},this.underlyingSet=new Set}[Symbol.iterator](){return this.underlyingSet.values()}includes(e){return this.underlyingSet.has(e)}include(e){return this.includes(e)}addAll(e){let t=[...e];0!=t.length&&(t.every((e=>this.includes(e)))||(t.forEach((e=>this.underlyingSet.add(e))),this.callEventListeners("change")))}removeAll(e){let t=[...e];0!=t.length&&(t.every((e=>!this.includes(e)))||(t.forEach((e=>this.underlyingSet.delete(e))),this.callEventListeners("change")))}clear(){0!=this.underlyingSet.size&&(this.underlyingSet.clear(),this.callEventListeners("change"))}addEventListener(e,t){this.eventListeners[e].push(t)}callEventListeners(e){this.eventListeners[e].forEach((e=>e()))}removeEventListener(e,t){this.eventListeners[e]=this.eventListeners[e].filter((e=>e!==t))}}var u,f,p,v,y=function(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)};class w{constructor(e){u.add(this),this.maxSize=e,f.set(this,[]),p.set(this,{change:[]})}get size(){return y(this,f,"f").length}isEmpty(){return 0==this.size}empty(){0!=this.size&&(function(e,t,i,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?n.call(e,i):n?n.value=i:t.set(e,i)}(this,f,[],"f"),y(this,u,"m",v).call(this,"change"))}peek(){if(0==this.size)throw new Error("The stack is empty.");return y(this,f,"f")[y(this,f,"f").length-1]}push(e){y(this,f,"f").push(e),this.size>this.maxSize&&y(this,f,"f").shift(),y(this,u,"m",v).call(this,"change")}pop(){if(0==this.size)throw new Error("The stack is empty.");let e=y(this,f,"f").pop();return y(this,u,"m",v).call(this,"change"),e}addEventListener(e,t){y(this,p,"f")[e].push(t)}removeEventListener(e,t){y(this,p,"f")[e]=y(this,p,"f")[e].filter((e=>e!==t))}}return f=new WeakMap,p=new WeakMap,u=new WeakSet,v=function(e){y(this,p,"f")[e].forEach((e=>e()))},t})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.utilities=t():e.utilities=t()}(this,(()=>(()=>{"use strict";var e={d:(t,i)=>{for(var r in i)e.o(i,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:i[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function i(e){return e.map((e=>({v:e,priority:Math.random()}))).sort(((e,t)=>e.priority-t.priority)).map((({v:e})=>e))}function r(){return!(!document.activeElement||"textarea"!==document.activeElement.tagName.toLowerCase()&&(e=document.activeElement,"input"!==e.tagName.toLowerCase()||"text"!==(null===(t=e.getAttribute("type"))||void 0===t?void 0:t.toLowerCase())));var e,t}e.r(t),e.d(t,{DownloadableFile:()=>d,EventfulSet:()=>l,FiniteStack:()=>y,KeyBinding:()=>h,detectMac:()=>c,isBeingInteractedWith:()=>s,shuffled:()=>i,userIsTyping:()=>r});let n=new Set;function s(e){return e===document.body||n.has(e)}window.addEventListener("mousedown",(e=>{if(!(e.target instanceof Node))return void(n=new Set);n=new Set;let t=e.target;for(n.add(t);t.parentNode&&!n.has(t.parentNode);)n.add(t.parentNode),t=t.parentNode}));var o,a=function(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)};class h{constructor(e,t,i){this.key=e,this.scope=void 0,o.set(this,void 0),function(e,t,i,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?n.call(e,i):n?n.value=i:t.set(e,i)}(this,o,i,"f"),window.addEventListener("keydown",(i=>{var n,h,c;i.key.toUpperCase()===e.toUpperCase()&&(void 0===(null===(n=a(this,o,"f"))||void 0===n?void 0:n.shiftKey)||a(this,o,"f").shiftKey==i.shiftKey)&&(void 0===(null===(h=a(this,o,"f"))||void 0===h?void 0:h.ctrlKey)||a(this,o,"f").ctrlKey==i.ctrlKey)&&(void 0===(null===(c=a(this,o,"f"))||void 0===c?void 0:c.metaKey)||a(this,o,"f").metaKey==i.metaKey)&&!r()&&this.scope&&s(this.scope)&&(i.preventDefault(),t())}),{passive:!1})}}function c(){try{return window.navigator.platform.toLowerCase().includes("mac")}catch(e){return!1}}o=new WeakMap;class d{constructor(e){this.textContent=e}downloadAs(e,t){let i=new File([this.textContent],e,{type:t.type}),r=URL.createObjectURL(i),n=document.createElement("a");n.href=r,n.download=i.name,document.body.appendChild(n),n.click(),n.remove(),URL.revokeObjectURL(r)}}class l{constructor(){this.eventListeners={change:[]},this.underlyingSet=new Set}[Symbol.iterator](){return this.underlyingSet.values()}includes(e){return this.underlyingSet.has(e)}include(e){return this.includes(e)}addAll(e){let t=[...e];0!=t.length&&(t.every((e=>this.includes(e)))||(t.forEach((e=>this.underlyingSet.add(e))),this.callEventListeners("change")))}removeAll(e){let t=[...e];0!=t.length&&(t.every((e=>!this.includes(e)))||(t.forEach((e=>this.underlyingSet.delete(e))),this.callEventListeners("change")))}clear(){0!=this.underlyingSet.size&&(this.underlyingSet.clear(),this.callEventListeners("change"))}addEventListener(e,t){this.eventListeners[e].push(t)}callEventListeners(e){this.eventListeners[e].forEach((e=>e()))}removeEventListener(e,t){this.eventListeners[e]=this.eventListeners[e].filter((e=>e!==t))}}var u,f,p,v,w=function(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)};class y{constructor(e){u.add(this),this.maxSize=e,f.set(this,[]),p.set(this,{change:[]})}get size(){return w(this,f,"f").length}isEmpty(){return 0==this.size}empty(){0!=this.size&&(function(e,t,i,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?n.call(e,i):n?n.value=i:t.set(e,i)}(this,f,[],"f"),w(this,u,"m",v).call(this,"change"))}peek(){if(0==this.size)throw new Error("The stack is empty.");return w(this,f,"f")[w(this,f,"f").length-1]}push(e){w(this,f,"f").push(e),this.size>this.maxSize&&w(this,f,"f").shift(),w(this,u,"m",v).call(this,"change")}pop(){if(0==this.size)throw new Error("The stack is empty.");let e=w(this,f,"f").pop();return w(this,u,"m",v).call(this,"change"),e}addEventListener(e,t){w(this,p,"f")[e].push(t)}removeEventListener(e,t){w(this,p,"f")[e]=w(this,p,"f")[e].filter((e=>e!==t))}}return f=new WeakMap,p=new WeakMap,u=new WeakSet,v=function(e){w(this,p,"f")[e].forEach((e=>e()))},t})()));
@@ -3,7 +3,7 @@
3
3
  * are currently being interacted with by the user.
4
4
  *
5
5
  * Note that this function may not work properly with lazy loading or dynamic imports
6
- * (since it only begins tracking which element is being interacted with after being imported).
6
+ * (since it only begins tracking which elements are being interacted with after being imported).
7
7
  */
8
8
  export declare function isBeingInteractedWith(ele: Element): boolean;
9
9
  //# sourceMappingURL=isBeingInteractedWith.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isBeingInteractedWith.d.ts","sourceRoot":"","sources":["../src/isBeingInteractedWith.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAQ3D"}
1
+ {"version":3,"file":"isBeingInteractedWith.d.ts","sourceRoot":"","sources":["../src/isBeingInteractedWith.ts"],"names":[],"mappings":"AAsBA;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAK3D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnacanvas/utilities",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "General utilities",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {