@rnacanvas/utilities 3.1.1 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,6 +12,7 @@ export declare class KeyBinding {
12
12
  constructor(key: string, callbackFn: () => void, options?: Options);
13
13
  }
14
14
  type Options = {
15
+ altKey?: boolean;
15
16
  shiftKey?: boolean;
16
17
  ctrlKey?: boolean;
17
18
  metaKey?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"KeyBinding.d.ts","sourceRoot":"","sources":["../src/KeyBinding.ts"],"names":[],"mappings":"AAIA,qBAAa,UAAU;;IAYT,QAAQ,CAAC,GAAG,EAAE,MAAM;IAXhC;;;;;;OAMG;IACI,KAAK,EAAE,OAAO,GAAG,SAAS,CAAa;gBAIzB,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,IAAI,EAAE,OAAO,CAAC,EAAE,OAAO;CAoB5E;AAED,KAAK,OAAO,GAAG;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC"}
1
+ {"version":3,"file":"KeyBinding.d.ts","sourceRoot":"","sources":["../src/KeyBinding.ts"],"names":[],"mappings":"AAIA,qBAAa,UAAU;;IAYT,QAAQ,CAAC,GAAG,EAAE,MAAM;IAXhC;;;;;;OAMG;IACI,KAAK,EAAE,OAAO,GAAG,SAAS,CAAa;gBAIzB,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,IAAI,EAAE,OAAO,CAAC,EAAE,OAAO;CAqB5E;AAED,KAAK,OAAO,GAAG;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC"}
@@ -3,5 +3,5 @@
3
3
  *
4
4
  * Returns false otherwise.
5
5
  */
6
- export declare function detectMac(): boolean;
7
- //# sourceMappingURL=detectMac.d.ts.map
6
+ export declare function detectMacOS(): boolean;
7
+ //# sourceMappingURL=detectMacOS.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detectMacOS.d.ts","sourceRoot":"","sources":["../src/detectMacOS.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAOrC"}
package/dist/index.d.ts CHANGED
@@ -6,8 +6,8 @@ import { isBeingInteractedWith } from './isBeingInteractedWith';
6
6
  export { isBeingInteractedWith };
7
7
  import { KeyBinding } from './KeyBinding';
8
8
  export { KeyBinding };
9
- import { detectMac } from './detectMac';
10
- export { detectMac };
9
+ import { detectMacOS } from './detectMacOS';
10
+ export { detectMacOS };
11
11
  import { DownloadableFile } from './DownloadableFile';
12
12
  export { DownloadableFile };
13
13
  import { EventfulSet } from './EventfulSet';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,CAAC;AAEpB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,CAAC;AAEpB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,CAAC"}
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:()=>d,EventfulSet:()=>l,FiniteStack:()=>y,KeyBinding:()=>h,detectMac:()=>c,isBeingInteractedWith:()=>s,isURL:()=>m,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))}}function m(e){try{return new URL(e),!0}catch(e){return!1}}return f=new WeakMap,p=new WeakMap,u=new WeakSet,v=function(e){w(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:()=>l,EventfulSet:()=>d,FiniteStack:()=>w,KeyBinding:()=>h,detectMacOS:()=>c,isBeingInteractedWith:()=>o,isURL:()=>m,shuffled:()=>i,userIsTyping:()=>r});let n=new Set;function o(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 s,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,s.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,s,i,"f"),window.addEventListener("keydown",(i=>{var n,h,c,l;i.key.toUpperCase()===e.toUpperCase()&&(void 0===(null===(n=a(this,s,"f"))||void 0===n?void 0:n.altKey)||a(this,s,"f").altKey==i.altKey)&&(void 0===(null===(h=a(this,s,"f"))||void 0===h?void 0:h.shiftKey)||a(this,s,"f").shiftKey==i.shiftKey)&&(void 0===(null===(c=a(this,s,"f"))||void 0===c?void 0:c.ctrlKey)||a(this,s,"f").ctrlKey==i.ctrlKey)&&(void 0===(null===(l=a(this,s,"f"))||void 0===l?void 0:l.metaKey)||a(this,s,"f").metaKey==i.metaKey)&&!r()&&this.scope&&o(this.scope)&&(i.preventDefault(),t())}),{passive:!1})}}function c(){try{return window.navigator.platform.toLowerCase().includes("mac")}catch(e){return!1}}s=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))}}function m(e){try{return new URL(e),!0}catch(e){return!1}}return f=new WeakMap,p=new WeakMap,u=new WeakSet,v=function(e){y(this,p,"f")[e].forEach((e=>e()))},t})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnacanvas/utilities",
3
- "version": "3.1.1",
3
+ "version": "4.1.0",
4
4
  "description": "General utilities",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"detectMac.d.ts","sourceRoot":"","sources":["../src/detectMac.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAOnC"}