@rnacanvas/copy-interface 3.0.0 → 4.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
@@ -18,9 +18,15 @@ export interface App {
18
18
  */
19
19
  readonly selectedBases: Iterable<Nucleobase>;
20
20
  /**
21
- * Returns the state of the app at the time the method is called.
21
+ * Removes the selected elements from the drawing.
22
+ *
23
+ * (Also pushes the undo stack before doing so.)
22
24
  */
23
- save(): AppState;
25
+ removeSelected(): void;
26
+ /**
27
+ * Returns the state of the app (in a JSON-serializable form) at the time this method is called.
28
+ */
29
+ serialized(): AppState;
24
30
  /**
25
31
  * Restores the app to the previous state.
26
32
  */
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,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"}
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;;;;OAIG;IACH,cAAc,IAAI,IAAI,CAAC;IAEvB;;OAEG;IACH,UAAU,IAAI,QAAQ,CAAC;IAEvB;;OAEG;IACH,OAAO,CAAC,aAAa,EAAE,QAAQ,GAAG,IAAI,CAAC;CACxC;AAED;;;;;;GAMG;AACH,KAAK,QAAQ,GAAG,EAAE,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { App } from './App';
2
+ export declare class CutHandler {
3
+ #private;
4
+ constructor(targetApp: App);
5
+ /**
6
+ * Handles the input cut event.
7
+ *
8
+ * (Or writes to the window navigator clipboard if no cut event object is provided.)
9
+ */
10
+ handle(event?: ClipboardEvent): Promise<void>;
11
+ }
12
+ //# sourceMappingURL=CutHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CutHandler.d.ts","sourceRoot":"","sources":["../src/CutHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAIjC,qBAAa,UAAU;;gBAKT,SAAS,EAAE,GAAG;IAM1B;;;;OAIG;IACG,MAAM,CAAC,KAAK,CAAC,EAAE,cAAc;CAoBpC"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  import { CopyHandler } from './CopyHandler';
2
2
  export { CopyHandler };
3
+ import { CutHandler } from './CutHandler';
4
+ export { CutHandler };
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,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,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,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.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})());
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.defineProperties(e,{[Symbol.toStringTag]:{value:"Module"},__esModule:{value:!0}})}};let t={};e.r(t),e.d(t,{CopyHandler:()=>a,CutHandler:()=>c});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").serialized()))}}o=new WeakMap;var i,n,s=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");return"a"===r?a.call(e,o):a?a.value=o:t.set(e,o),o},l=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 c{constructor(e){i.set(this,void 0),n.set(this,void 0),s(this,i,e,"f"),s(this,n,new a(e),"f")}async handle(e){let t=window.getSelection();(!t||!t.toString()&&t.isCollapsed)&&(l(this,i,"f").selection.isEmpty()||(await l(this,n,"f").handle(e),l(this,i,"f").removeSelected()))}}return i=new WeakMap,n=new WeakMap,t})());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnacanvas/copy-interface",
3
- "version": "3.0.0",
3
+ "version": "4.0.0",
4
4
  "description": "Copy things",
5
5
  "repository": {
6
6
  "type": "git",