@rnacanvas/drop-interface 1.1.0 → 2.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.
- package/dist/App.d.ts +10 -0
- package/dist/App.d.ts.map +1 -1
- package/dist/DropEvent.d.ts +10 -0
- package/dist/DropEvent.d.ts.map +1 -0
- package/dist/DropHandler.d.ts +2 -1
- package/dist/DropHandler.d.ts.map +1 -1
- package/dist/RNAcanvasFileDropHandler.d.ts +2 -1
- package/dist/RNAcanvasFileDropHandler.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/App.d.ts
CHANGED
|
@@ -10,5 +10,15 @@ export interface App {
|
|
|
10
10
|
* Throws if unable to do so.
|
|
11
11
|
*/
|
|
12
12
|
restore(previousState: unknown): void | never;
|
|
13
|
+
/**
|
|
14
|
+
* Deselects all selected elements.
|
|
15
|
+
*/
|
|
16
|
+
deselect(): void;
|
|
17
|
+
readonly drawingView: {
|
|
18
|
+
/**
|
|
19
|
+
* Fits the user's view of the drawing to its content.
|
|
20
|
+
*/
|
|
21
|
+
fitToContent(): void;
|
|
22
|
+
};
|
|
13
23
|
}
|
|
14
24
|
//# sourceMappingURL=App.d.ts.map
|
package/dist/App.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,GAAG;IAClB,IAAI,IAAI,IAAI,CAAC;IACb,aAAa,IAAI,IAAI,CAAC;IAEtB;;;;OAIG;IACH,OAAO,CAAC,aAAa,EAAE,OAAO,GAAG,IAAI,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,GAAG;IAClB,IAAI,IAAI,IAAI,CAAC;IACb,aAAa,IAAI,IAAI,CAAC;IAEtB;;;;OAIG;IACH,OAAO,CAAC,aAAa,EAAE,OAAO,GAAG,IAAI,GAAG,KAAK,CAAC;IAE9C;;OAEG;IACH,QAAQ,IAAI,IAAI,CAAC;IAEjB,QAAQ,CAAC,WAAW,EAAE;QACpB;;WAEG;QACH,YAAY,IAAI,IAAI,CAAC;KACtB,CAAA;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropEvent.d.ts","sourceRoot":"","sources":["../src/DropEvent.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,YAAY,EAAE;QACrB,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAC;KAC7B,GAAG,IAAI,CAAC;IAET,cAAc,IAAI,IAAI,CAAC;CACxB"}
|
package/dist/DropHandler.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { App } from './App';
|
|
2
|
+
import { DropEvent } from './DropEvent';
|
|
2
3
|
/**
|
|
3
4
|
* Handles drop events for a target RNAcanvas app.
|
|
4
5
|
*/
|
|
@@ -8,6 +9,6 @@ export declare class DropHandler {
|
|
|
8
9
|
/**
|
|
9
10
|
* Handles the provided drop event.
|
|
10
11
|
*/
|
|
11
|
-
handle(event:
|
|
12
|
+
handle(event: DropEvent): Promise<void>;
|
|
12
13
|
}
|
|
13
14
|
//# sourceMappingURL=DropHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropHandler.d.ts","sourceRoot":"","sources":["../src/DropHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DropHandler.d.ts","sourceRoot":"","sources":["../src/DropHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC;;GAEG;AACH,qBAAa,WAAW;;gBAGV,SAAS,EAAE,GAAG;IAI1B;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,SAAS;CAG9B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { App } from './App';
|
|
2
|
+
import type { DropEvent } from './DropEvent';
|
|
2
3
|
/**
|
|
3
4
|
* Opens dropped RNAcanvas files (with ".rnacanvas" extension) in the target app.
|
|
4
5
|
*/
|
|
@@ -10,6 +11,6 @@ export declare class RNAcanvasFileDropHandler {
|
|
|
10
11
|
*
|
|
11
12
|
* Does nothing if an RNAcanvas file (with ".rnacanvas") was not dropped.
|
|
12
13
|
*/
|
|
13
|
-
handle(event:
|
|
14
|
+
handle(event: DropEvent): Promise<void>;
|
|
14
15
|
}
|
|
15
16
|
//# sourceMappingURL=RNAcanvasFileDropHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RNAcanvasFileDropHandler.d.ts","sourceRoot":"","sources":["../src/RNAcanvasFileDropHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC;;GAEG;AACH,qBAAa,wBAAwB;;gBAGvB,SAAS,EAAE,GAAG;IAI1B;;;;OAIG;IACG,MAAM,CAAC,KAAK,EAAE,SAAS;
|
|
1
|
+
{"version":3,"file":"RNAcanvasFileDropHandler.d.ts","sourceRoot":"","sources":["../src/RNAcanvasFileDropHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,qBAAa,wBAAwB;;gBAGvB,SAAS,EAAE,GAAG;IAI1B;;;;OAIG;IACG,MAAM,CAAC,KAAK,EAAE,SAAS;CAgC9B"}
|
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.dropInterface=t():e.dropInterface=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},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={};e.r(t),e.d(t,{DropHandler:()=>i});var r,o=function(e,t,r,o){if("a"===r&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?o:"a"===r?o.call(e):o?o.value:t.get(e)};class n{constructor(e){r.set(this,void 0),function(e,t,r,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!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"===o?n.call(e,r):n?n.value=r:t.set(e,r)}(this,r,e,"f")}handle(e){return t=this,n=void 0,i=function*(){var t,n;let a=[...null!==(n=null===(t=e.dataTransfer)||void 0===t?void 0:t.files)&&void 0!==n?n:[]];if(0==a.length)return;let i=a[0];if(i.name.toLowerCase().endsWith(".rnacanvas")){e.preventDefault(),o(this,r,"f").pushUndoStack();try{o(this,r,"f").restore(JSON.parse(yield i.text()))}catch(e){console.error(e),console.error("Unable to open saved drawing."),o(this,r,"f").undo()}}},new((a=void 0)||(a=Promise))((function(e,r){function o(e){try{s(i.next(e))}catch(e){r(e)}}function c(e){try{s(i.throw(e))}catch(e){r(e)}}function s(t){var r;t.done?e(t.value):(r=t.value,r instanceof a?r:new a((function(e){e(r)}))).then(o,c)}s((i=i.apply(t,n||[])).next())}));var t,n,a,i}}r=new WeakMap;var a;class i{constructor(e){a.set(this,void 0),function(e,t,r,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!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"===o?n.call(e,r):n?n.value=r:t.set(e,r)}(this,a,new n(e),"f")}handle(e){return t=this,r=void 0,n=function*(){yield function(e,t,r,o){if("a"===r&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?o:"a"===r?o.call(e):o?o.value:t.get(e)}(this,a,"f").handle(e)},new((o=void 0)||(o=Promise))((function(e,a){function i(e){try{s(n.next(e))}catch(e){a(e)}}function c(e){try{s(n.throw(e))}catch(e){a(e)}}function s(t){var r;t.done?e(t.value):(r=t.value,r instanceof o?r:new o((function(e){e(r)}))).then(i,c)}s((n=n.apply(t,r||[])).next())}));var t,r,o,n}}return a=new WeakMap,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.dropInterface=t():e.dropInterface=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},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={};e.r(t),e.d(t,{DropHandler:()=>i});var r,o=function(e,t,r,o){if("a"===r&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?o:"a"===r?o.call(e):o?o.value:t.get(e)};class n{constructor(e){r.set(this,void 0),function(e,t,r,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!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"===o?n.call(e,r):n?n.value=r:t.set(e,r)}(this,r,e,"f")}handle(e){return t=this,n=void 0,i=function*(){var t,n;let a=[...null!==(n=null===(t=e.dataTransfer)||void 0===t?void 0:t.files)&&void 0!==n?n:[]];if(0==a.length)return;let i=a[0];if(i.name.toLowerCase().endsWith(".rnacanvas")){e.preventDefault(),o(this,r,"f").pushUndoStack();try{o(this,r,"f").restore(JSON.parse(yield i.text())),o(this,r,"f").deselect(),o(this,r,"f").drawingView.fitToContent()}catch(e){console.error(e),console.error("Unable to open saved drawing."),o(this,r,"f").undo()}}},new((a=void 0)||(a=Promise))((function(e,r){function o(e){try{s(i.next(e))}catch(e){r(e)}}function c(e){try{s(i.throw(e))}catch(e){r(e)}}function s(t){var r;t.done?e(t.value):(r=t.value,r instanceof a?r:new a((function(e){e(r)}))).then(o,c)}s((i=i.apply(t,n||[])).next())}));var t,n,a,i}}r=new WeakMap;var a;class i{constructor(e){a.set(this,void 0),function(e,t,r,o,n){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!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"===o?n.call(e,r):n?n.value=r:t.set(e,r)}(this,a,new n(e),"f")}handle(e){return t=this,r=void 0,n=function*(){yield function(e,t,r,o){if("a"===r&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?o:"a"===r?o.call(e):o?o.value:t.get(e)}(this,a,"f").handle(e)},new((o=void 0)||(o=Promise))((function(e,a){function i(e){try{s(n.next(e))}catch(e){a(e)}}function c(e){try{s(n.throw(e))}catch(e){a(e)}}function s(t){var r;t.done?e(t.value):(r=t.value,r instanceof o?r:new o((function(e){e(r)}))).then(i,c)}s((n=n.apply(t,r||[])).next())}));var t,r,o,n}}return a=new WeakMap,t})()));
|