@rnacanvas/utilities 1.1.0 → 1.3.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.
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Represents a file that can be downloaded.
3
+ */
4
+ export declare class DownloadableFile {
5
+ private textContent;
6
+ /**
7
+ * Creates a downloadable file with the given text content.
8
+ */
9
+ constructor(textContent: string);
10
+ /**
11
+ * Offers the file to the user for download with the given name and type.
12
+ */
13
+ downloadAs(name: string, options: {
14
+ type: string;
15
+ }): void;
16
+ }
17
+ //# sourceMappingURL=DownloadableFile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DownloadableFile.d.ts","sourceRoot":"","sources":["../src/DownloadableFile.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,gBAAgB;IAIf,OAAO,CAAC,WAAW;IAH/B;;OAEG;gBACiB,WAAW,EAAE,MAAM;IAEvC;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;CAc1D"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Returns true if this function detects that the user is using a Mac device.
3
+ *
4
+ * Returns false otherwise.
5
+ */
6
+ export declare function detectMac(): boolean;
7
+ //# sourceMappingURL=detectMac.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detectMac.d.ts","sourceRoot":"","sources":["../src/detectMac.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAOnC"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,7 @@
1
1
  import { shuffled } from './shuffled';
2
2
  export { shuffled };
3
+ import { detectMac } from './detectMac';
4
+ export { detectMac };
5
+ import { DownloadableFile } from './DownloadableFile';
6
+ export { DownloadableFile };
3
7
  //# sourceMappingURL=index.d.ts.map
@@ -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"}
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,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"}
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,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[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 o(e){return e.map((function(e){return{v:e,priority:Math.random()}})).sort((function(e,t){return e.priority-t.priority})).map((function(e){return e.v}))}return e.r(t),e.d(t,{shuffled:()=>o}),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,o)=>{for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},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 o(e){return e.map((function(e){return{v:e,priority:Math.random()}})).sort((function(e,t){return e.priority-t.priority})).map((function(e){return e.v}))}function n(){try{return window.navigator.platform.toLowerCase().includes("mac")}catch(e){return!1}}e.r(t),e.d(t,{DownloadableFile:()=>r,detectMac:()=>n,shuffled:()=>o});var r=function(){function e(e){this.textContent=e}return e.prototype.downloadAs=function(e,t){var o=new File([this.textContent],e,{type:t.type}),n=URL.createObjectURL(o),r=document.createElement("a");r.href=n,r.download=o.name,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(n)},e}();return t})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnacanvas/utilities",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "General utilities",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
@@ -15,6 +15,7 @@
15
15
  "@babel/preset-typescript": "^7.23.3",
16
16
  "babel-jest": "^29.7.0",
17
17
  "jest": "^29.7.0",
18
+ "jest-environment-jsdom": "^29.7.0",
18
19
  "ts-loader": "^9.5.1",
19
20
  "typescript": "^5.3.3",
20
21
  "webpack": "^5.89.0",