@rnacanvas/utilities 2.7.1 → 2.9.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.
- package/dist/FiniteStack.d.ts +4 -0
- package/dist/FiniteStack.d.ts.map +1 -1
- package/dist/KeyBinding.d.ts +7 -1
- package/dist/KeyBinding.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/FiniteStack.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FiniteStack.d.ts","sourceRoot":"","sources":["../src/FiniteStack.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,WAAW,CAAC,CAAC;;IAOZ,QAAQ,CAAC,OAAO,EAAE,MAAM;gBAAf,OAAO,EAAE,MAAM;IAEpC;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,OAAO,IAAI,OAAO;IAIlB;;;;OAIG;IACH,IAAI,IAAI,CAAC,GAAG,KAAK;IAQjB;;;;;OAKG;IACH,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI;IAUnB;;;;OAIG;IACH,GAAG,IAAI,CAAC,GAAG,KAAK;IAYhB,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI;IAIhE,mBAAmB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI;CAOpE;AAED,KAAK,SAAS,GAAG,CACf,QAAQ,CACT,CAAC;AAEF,KAAK,aAAa,GAAG,MAAM,IAAI,CAAC"}
|
|
1
|
+
{"version":3,"file":"FiniteStack.d.ts","sourceRoot":"","sources":["../src/FiniteStack.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,WAAW,CAAC,CAAC;;IAOZ,QAAQ,CAAC,OAAO,EAAE,MAAM;gBAAf,OAAO,EAAE,MAAM;IAEpC;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,OAAO,IAAI,OAAO;IAIlB;;OAEG;IACH,KAAK,IAAI,IAAI;IAUb;;;;OAIG;IACH,IAAI,IAAI,CAAC,GAAG,KAAK;IAQjB;;;;;OAKG;IACH,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI;IAUnB;;;;OAIG;IACH,GAAG,IAAI,CAAC,GAAG,KAAK;IAYhB,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI;IAIhE,mBAAmB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI;CAOpE;AAED,KAAK,SAAS,GAAG,CACf,QAAQ,CACT,CAAC;AAEF,KAAK,aAAa,GAAG,MAAM,IAAI,CAAC"}
|
package/dist/KeyBinding.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare class KeyBinding {
|
|
2
2
|
#private;
|
|
3
3
|
readonly key: string;
|
|
4
|
-
constructor(key: string, callbackFn: () => void);
|
|
4
|
+
constructor(key: string, callbackFn: () => void, options?: Options);
|
|
5
5
|
/**
|
|
6
6
|
* Must be currently being interacted with by the user
|
|
7
7
|
* for the key binding to be triggered.
|
|
@@ -11,4 +11,10 @@ export declare class KeyBinding {
|
|
|
11
11
|
get scope(): Element;
|
|
12
12
|
set scope(scope: Element);
|
|
13
13
|
}
|
|
14
|
+
type Options = {
|
|
15
|
+
shiftKey?: boolean;
|
|
16
|
+
ctrlKey?: boolean;
|
|
17
|
+
metaKey?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
14
20
|
//# sourceMappingURL=KeyBinding.d.ts.map
|
package/dist/KeyBinding.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyBinding.d.ts","sourceRoot":"","sources":["../src/KeyBinding.ts"],"names":[],"mappings":"AAIA,qBAAa,UAAU;;
|
|
1
|
+
{"version":3,"file":"KeyBinding.d.ts","sourceRoot":"","sources":["../src/KeyBinding.ts"],"names":[],"mappings":"AAIA,qBAAa,UAAU;;IAKT,QAAQ,CAAC,GAAG,EAAE,MAAM;gBAAX,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,IAAI,EAAE,OAAO,CAAC,EAAE,OAAO;IAoB3E;;;;;OAKG;IACH,IAAI,KAAK,IAAI,OAAO,CAEnB;IAED,IAAI,KAAK,CAAC,KAAK,EAJF,OAIE,EAEd;CACF;AAED,KAAK,OAAO,GAAG;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,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,
|
|
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:()=>u,EventfulSet:()=>f,FiniteStack:()=>g,KeyBinding:()=>l,detectMac:()=>d,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,h=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");return"a"===r?n.call(e,i):n?n.value=i:t.set(e,i),i},c=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 l{constructor(e,t,i){this.key=e,o.set(this,void 0),a.set(this,void 0),h(this,a,i,"f"),window.addEventListener("keydown",(i=>{var n,o,h;i.key.toUpperCase()===e.toUpperCase()&&(void 0===(null===(n=c(this,a,"f"))||void 0===n?void 0:n.shiftKey)||c(this,a,"f").shiftKey==i.shiftKey)&&(void 0===(null===(o=c(this,a,"f"))||void 0===o?void 0:o.ctrlKey)||c(this,a,"f").ctrlKey==i.ctrlKey)&&(void 0===(null===(h=c(this,a,"f"))||void 0===h?void 0:h.metaKey)||c(this,a,"f").metaKey==i.metaKey)&&!r()&&s(this.scope)&&(i.preventDefault(),t())}),{passive:!1})}get scope(){var e;return null!==(e=c(this,o,"f"))&&void 0!==e?e:document.body}set scope(e){h(this,o,e,"f")}}function d(){try{return window.navigator.platform.toLowerCase().includes("mac")}catch(e){return!1}}o=new WeakMap,a=new WeakMap;class u{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 f{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 p,v,y,w,m=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 g{constructor(e){p.add(this),this.maxSize=e,v.set(this,[]),y.set(this,{change:[]})}get size(){return m(this,v,"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,v,[],"f"),m(this,p,"m",w).call(this,"change"))}peek(){if(0==this.size)throw new Error("The stack is empty.");return m(this,v,"f")[m(this,v,"f").length-1]}push(e){m(this,v,"f").push(e),this.size>this.maxSize&&m(this,v,"f").shift(),m(this,p,"m",w).call(this,"change")}pop(){if(0==this.size)throw new Error("The stack is empty.");let e=m(this,v,"f").pop();return m(this,p,"m",w).call(this,"change"),e}addEventListener(e,t){m(this,y,"f")[e].push(t)}removeEventListener(e,t){m(this,y,"f")[e]=m(this,y,"f")[e].filter((e=>e!==t))}}return v=new WeakMap,y=new WeakMap,p=new WeakSet,w=function(e){m(this,y,"f")[e].forEach((e=>e()))},t})()));
|