@rnacanvas/copy-interface 1.1.4 → 3.0.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 CHANGED
@@ -6,9 +6,33 @@ export interface App {
6
6
  */
7
7
  readonly bases: Iterable<Nucleobase>;
8
8
  };
9
+ readonly selection: {
10
+ /**
11
+ * Returns `true` if nothing is currently selected within the drawing of the app
12
+ * and `false` otherwise.
13
+ */
14
+ isEmpty(): boolean;
15
+ };
9
16
  /**
10
17
  * Not necessarily in the same order as in the drawing of the app.
11
18
  */
12
19
  readonly selectedBases: Iterable<Nucleobase>;
20
+ /**
21
+ * Returns the state of the app at the time the method is called.
22
+ */
23
+ save(): AppState;
24
+ /**
25
+ * Restores the app to the previous state.
26
+ */
27
+ restore(previousState: AppState): void;
13
28
  }
29
+ /**
30
+ * A JSON-serializable non-null object that stores the state of the app
31
+ * (including things such as the state of the drawing and which elements are currently selected).
32
+ *
33
+ * Can be included in a saved drawing file, for instance,
34
+ * or the undo stack of the app.
35
+ */
36
+ type AppState = {};
37
+ export {};
14
38
  //# 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,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,GAAG;IAClB,QAAQ,CAAC,OAAO,EAAE;QAChB;;WAEG;QACH,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;KACtC,CAAC;IAEF;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;CAC9C"}
1
+ {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,GAAG;IAClB,QAAQ,CAAC,OAAO,EAAE;QAChB;;WAEG;QACH,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;KACtC,CAAC;IAEF,QAAQ,CAAC,SAAS,EAAE;QAClB;;;WAGG;QACH,OAAO,IAAI,OAAO,CAAC;KACpB,CAAA;IAED;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;IAE7C;;OAEG;IACH,IAAI,IAAI,QAAQ,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,aAAa,EAAE,QAAQ,GAAG,IAAI,CAAC;CACxC;AAED;;;;;;GAMG;AACH,KAAK,QAAQ,GAAG,EAAE,CAAC"}
@@ -6,8 +6,8 @@ export declare class CopyHandler {
6
6
  #private;
7
7
  constructor(targetApp: App);
8
8
  /**
9
- * Handles the input copy event.
9
+ * Handles the input copy event (or writes to the window navigator clipboard when no copy event is provided).
10
10
  */
11
- handle(event: ClipboardEvent): void;
11
+ handle(event?: ClipboardEvent): Promise<void>;
12
12
  }
13
13
  //# sourceMappingURL=CopyHandler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CopyHandler.d.ts","sourceRoot":"","sources":["../src/CopyHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC;;GAEG;AACH,qBAAa,WAAW;;gBAGV,SAAS,EAAE,GAAG;IAI1B;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,cAAc;CA6B7B"}
1
+ {"version":3,"file":"CopyHandler.d.ts","sourceRoot":"","sources":["../src/CopyHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC;;GAEG;AACH,qBAAa,WAAW;;gBAGV,SAAS,EAAE,GAAG;IAI1B;;OAEG;IACG,MAAM,CAAC,KAAK,CAAC,EAAE,cAAc;CAuCpC"}
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.copyInterface=t():e.copyInterface=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={};e.r(t),e.d(t,{CopyHandler:()=>a});var o,r=function(e,t,o,r){if("a"===o&&!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"===o?r:"a"===o?r.call(e):r?r.value:t.get(e)};class a{constructor(e){o.set(this,void 0),function(e,t,o,r,a){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?a.call(e,o):a?a.value=o:t.set(e,o)}(this,o,e,"f")}handle(e){var t;let a=window.getSelection();if(a&&(!a.isCollapsed||a.toString()))return;let n=new Set(r(this,o,"f").selectedBases);if(0==n.size)return;e.preventDefault(),e.stopPropagation();let i=[...r(this,o,"f").drawing.bases].filter(e=>n.has(e)).map(e=>e.domNode.textContent).join("");null===(t=e.clipboardData)||void 0===t||t.setData("text/plain",i)}}return o=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.copyInterface=t():e.copyInterface=t()}(this,()=>(()=>{"use strict";const 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=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}};let t={};e.r(t),e.d(t,{CopyHandler:()=>a});var o,r=function(e,t,o,r){if("a"===o&&!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"===o?r:"a"===o?r.call(e):r?r.value:t.get(e)};class a{constructor(e){o.set(this,void 0),function(e,t,o,r,a){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?a.call(e,o):a?a.value=o:t.set(e,o)}(this,o,e,"f")}async handle(e){var t,a;let i=window.getSelection();if(i&&(i.toString()||!i.isCollapsed))return;if(r(this,o,"f").selection.isEmpty())return;null==e||e.preventDefault(),null==e||e.stopPropagation();let n=new Set(r(this,o,"f").selectedBases);if(n.size>0){let a=[...r(this,o,"f").drawing.bases].filter(e=>n.has(e)).map(e=>e.domNode.textContent).join("");e?null===(t=e.clipboardData)||void 0===t||t.setData("text/plain",a):await navigator.clipboard.writeText(a)}null===(a=null==e?void 0:e.clipboardData)||void 0===a||a.setData("application/json",JSON.stringify(r(this,o,"f").save()))}}return o=new WeakMap,t})());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnacanvas/copy-interface",
3
- "version": "1.1.4",
3
+ "version": "3.0.0",
4
4
  "description": "Copy things",
5
5
  "repository": {
6
6
  "type": "git",