@rnacanvas/utilities 2.1.1 → 2.2.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.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { shuffled } from './shuffled';
|
|
|
2
2
|
export { shuffled };
|
|
3
3
|
import { userIsTyping } from './userIsTyping';
|
|
4
4
|
export { userIsTyping };
|
|
5
|
+
import { isBeingInteractedWith } from './isBeingInteractedWith';
|
|
6
|
+
export { isBeingInteractedWith };
|
|
5
7
|
import { detectMac } from './detectMac';
|
|
6
8
|
export { detectMac };
|
|
7
9
|
import { DownloadableFile } from './DownloadableFile';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,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"}
|
|
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,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"}
|
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,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[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 n(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}
|
|
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,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[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 n(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:()=>a,detectMac:()=>s,isBeingInteractedWith:()=>o,shuffled:()=>n,userIsTyping:()=>r});let i=null;function o(e){return e===document.body||(document.activeElement?e.contains(document.activeElement):!!i&&i.target instanceof Node&&e.contains(i.target))}function s(){try{return window.navigator.platform.toLowerCase().includes("mac")}catch(e){return!1}}window.addEventListener("mousedown",(e=>i=e));class l{constructor(e){this.textContent=e}downloadAs(e,t){let n=new File([this.textContent],e,{type:t.type}),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,i.download=n.name,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(r)}}class a{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))}}return t})()));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true if and only if the provided element (or any of its child elements)
|
|
3
|
+
* are currently being interacted with by the user.
|
|
4
|
+
*
|
|
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).
|
|
7
|
+
*/
|
|
8
|
+
export declare function isBeingInteractedWith(ele: Element): boolean;
|
|
9
|
+
//# sourceMappingURL=isBeingInteractedWith.d.ts.map
|
|
@@ -0,0 +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,CAY3D"}
|