@rnacanvas/draw.floating 3.1.2 → 3.2.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/Rectangle.d.ts +57 -0
- package/dist/Rectangle.d.ts.map +1 -0
- package/dist/RectangleDefinition.d.ts +2 -0
- package/dist/RectangleDefinition.d.ts.map +1 -1
- package/dist/RectangleLike.d.ts +9 -0
- package/dist/RectangleLike.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/jest.config.js +10 -0
- package/package.json +3 -2
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Drawing } from './Drawing';
|
|
2
|
+
import { Box } from '@rnacanvas/boxes';
|
|
3
|
+
/**
|
|
4
|
+
* A rectangle element.
|
|
5
|
+
*/
|
|
6
|
+
export declare class Rectangle {
|
|
7
|
+
#private;
|
|
8
|
+
readonly domNode: SVGPathElement;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new rectangle element from scratch.
|
|
11
|
+
*
|
|
12
|
+
* Will assign a UUID to the newly created rectangle element,
|
|
13
|
+
* as well as some default values (e.g., width and height, colors).
|
|
14
|
+
*/
|
|
15
|
+
static create(): Rectangle;
|
|
16
|
+
constructor(domNode: SVGPathElement);
|
|
17
|
+
get id(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Center X coordinate.
|
|
20
|
+
*/
|
|
21
|
+
get centerX(): number;
|
|
22
|
+
set centerX(centerX: number);
|
|
23
|
+
/**
|
|
24
|
+
* Center Y coordinate.
|
|
25
|
+
*/
|
|
26
|
+
get centerY(): number;
|
|
27
|
+
set centerY(centerY: number);
|
|
28
|
+
drag(x: number, y: number): void;
|
|
29
|
+
get direction(): number;
|
|
30
|
+
set direction(direction: number);
|
|
31
|
+
get width(): number;
|
|
32
|
+
set width(width: number);
|
|
33
|
+
get height(): number;
|
|
34
|
+
set height(height: number);
|
|
35
|
+
get cornerRadius(): number;
|
|
36
|
+
set cornerRadius(cornerRadius: number);
|
|
37
|
+
/**
|
|
38
|
+
* Bounding box.
|
|
39
|
+
*/
|
|
40
|
+
get bbox(): Box;
|
|
41
|
+
/**
|
|
42
|
+
* Returns the serialized form of the rectangle,
|
|
43
|
+
* which is a JSON-serializable object.
|
|
44
|
+
*
|
|
45
|
+
* Throws if the rectangle ID is falsy.
|
|
46
|
+
*/
|
|
47
|
+
serialized(): {
|
|
48
|
+
id: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Recreates a saved rectangle given the parent drawing that its DOM node is in.
|
|
52
|
+
*
|
|
53
|
+
* Throws if unable to recreate the saved rectangle.
|
|
54
|
+
*/
|
|
55
|
+
static recreate(savedRectangle: unknown, parentDrawing: Drawing): Rectangle | never;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=Rectangle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Rectangle.d.ts","sourceRoot":"","sources":["../src/Rectangle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAMvC;;GAEG;AACH,qBAAa,SAAS;;IAwCR,QAAQ,CAAC,OAAO,EAAE,cAAc;IAvC5C;;;;;OAKG;IACH,MAAM,CAAC,MAAM,IAAI,SAAS;gBAiCL,OAAO,EAAE,cAAc;IAsB5C,IAAI,EAAE,IAAI,MAAM,CAEf;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAIpB;IAED,IAAI,OAAO,CAAC,OAAO,EANJ,MAMI,EASlB;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAIpB;IAED,IAAI,OAAO,CAAC,OAAO,EANJ,MAMI,EASlB;IAED,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;IAKhC,IAAI,SAAS,IAAI,MAAM,CAItB;IAED,IAAI,SAAS,CAAC,SAAS,EANN,MAMM,EAStB;IAED,IAAI,KAAK,IAAI,MAAM,CAIlB;IAED,IAAI,KAAK,CAAC,KAAK,EANF,MAME,EASd;IAED,IAAI,MAAM,IAAI,MAAM,CAInB;IAED,IAAI,MAAM,CAAC,MAAM,EANH,MAMG,EAShB;IAED,IAAI,YAAY,IAAI,MAAM,CAIzB;IAED,IAAI,YAAY,CAAC,YAAY,EANT,MAMS,EAS5B;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,GAAG,CAEd;IAkBD;;;;;OAKG;IACH,UAAU;;;IAUV;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK;CAqBpF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RectangleLike } from './RectangleLike';
|
|
1
2
|
export declare class RectangleDefinition {
|
|
2
3
|
centerX: number;
|
|
3
4
|
centerY: number;
|
|
@@ -8,6 +9,7 @@ export declare class RectangleDefinition {
|
|
|
8
9
|
width: number;
|
|
9
10
|
height: number;
|
|
10
11
|
cornerRadius: number;
|
|
12
|
+
static matching(rectangle: RectangleLike): RectangleDefinition;
|
|
11
13
|
/**
|
|
12
14
|
* Returns an SVG path definition.
|
|
13
15
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RectangleDefinition.d.ts","sourceRoot":"","sources":["../src/RectangleDefinition.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RectangleDefinition.d.ts","sourceRoot":"","sources":["../src/RectangleDefinition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIrD,qBAAa,mBAAmB;IAC9B,OAAO,SAAK;IACZ,OAAO,SAAK;IAEZ;;OAEG;IACH,SAAS,SAAgB;IAEzB,KAAK,SAAK;IACV,MAAM,SAAK;IAEX,YAAY,SAAK;IAEjB,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,aAAa,GAAG,mBAAmB;IAgB9D;;OAEG;IACH,QAAQ,IAAI,MAAM;CAoEnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RectangleLike.d.ts","sourceRoot":"","sources":["../src/RectangleLike.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B,CAAC"}
|
package/dist/index.d.ts
CHANGED
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,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,CAAC;AAEhB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,CAAC;AAEhB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["draw.floating"]=e():t["draw.floating"]=e()}(this,()=>(()=>{var t={645(t){var e;e=()=>(()=>{var t={986(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){var e=0;return t.forEach(function(t){return e+=t}),e}function n(t){return r(t)/t.length}function i(t){t.sort(function(t,e){return t-e})}t.r(e),t.d(e,{areWithin:()=>f,average:()=>n,clamp:()=>d,degrees:()=>y,flipAway:()=>v,isBetween:()=>h,isBetweenExclusive:()=>l,isBetweenInclusive:()=>h,max:()=>c,mean:()=>n,median:()=>a,min:()=>u,normalizeAngle:()=>w,radians:()=>g,round:()=>p,sortNumbers:()=>i,sortNumbersAscending:()=>i,sortNumbersDescending:()=>m,sortedNumbers:()=>s,sortedNumbersAscending:()=>s,sortedNumbersDescending:()=>b,sum:()=>r});var o=function(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))};function s(t){var e=o([],t,!0);return i(e),e}function a(t){if(0==t.length)return NaN;var e=s(t);if(e.length%2!=0)return e[Math.floor(e.length/2)];var r=e.length/2,i=r-1;return n([e[r],e[i]])}function u(t){if(0==t.length)return 1/0;var e=t[0];return t.slice(1).forEach(function(t){e=Math.min(e,t)}),e}function c(t){if(0==t.length)return-1/0;var e=t[0];return t.slice(1).forEach(function(t){e=Math.max(e,t)}),e}function h(t,e,r){return t>=e&&t<=r}function l(t,e,r){return t>e&&t<r}function d(t,e,r){return t<e?e:t>r?r:t}function f(t,e,r){return Math.abs(t-e)<=r}function m(t){i(t),t.reverse()}function b(t){var e=s(t);return e.reverse(),e}function p(t,e){return Number.parseFloat(t.toFixed(null!=e?e:0))}function y(t){return t*(180/Math.PI)}function g(t){return t*(Math.PI/180)}function w(t,e){void 0===e&&(e=-Math.PI);var r=t-e;return e+((r%=2*Math.PI)>=0?r:r+2*Math.PI)}function v(t,e){var r=(e=w(e,t))-t;return(r<Math.PI/2||r>3*Math.PI/2)&&(t+=Math.PI),t}return e})()}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{Box:()=>e});var t=r(986);class e{static matching(t){let{x:r,y:n,width:i,height:o}=t;return new e(r,n,i,o)}static bounding(r){let n=[...r];if(0==n.length)throw new Error("An empty collection of boxes doesn't have a bounding box.");let i=n.map(t=>e.matching(t)),o=(0,t.min)(i.map(t=>t.left)),s=(0,t.min)(i.map(t=>t.top)),a=(0,t.max)(i.map(t=>t.right))-o,u=(0,t.max)(i.map(t=>t.bottom))-s;return new e(o,s,a,u)}constructor(t,e,r,n){this.x=t,this.y=e,this.width=r,this.height=n}get centerX(){return this.minX+this.width/2}get centerY(){return this.minY+this.height/2}get minX(){return this.x}get minY(){return this.y}get maxX(){return this.minX+this.width}get maxY(){return this.minY+this.height}get top(){return this.minY}get right(){return this.maxX}get bottom(){return this.maxY}get left(){return this.minX}bounds(t){let r=e.matching(t);return this.minX<=r.minX&&this.minY<=r.minY&&this.maxX>=r.maxX&&this.maxY>=r.maxY}padded(...t){let r="number"==typeof t[0]?t[0]:"factor"in t[0]?t[0].factor*this.width:t[0].percentage/100*this.width,n="number"==typeof t[0]&&"number"==typeof t[1]?t[1]:"number"==typeof t[0]?t[0]:"factor"in t[0]?t[0].factor*this.height:t[0].percentage/100*this.height;return new e(this.x-r,this.y-n,this.width+2*r,this.height+2*n)}get periphery(){return{atAngle:t=>{let e=this.width/2,r=this.height/2,n=Math.pow(Math.pow(e,2)+Math.pow(r,2),.5),i=this.centerX+n*Math.cos(t),o=this.centerY+n*Math.sin(t),s=n;return Math.abs(this.centerX-i)>e&&(s=Math.abs(e/Math.cos(t)),s=Number.isFinite(s)?s:r),Math.abs(this.centerY-o)>r&&(s=Math.abs(r/Math.sin(t)),s=Number.isFinite(s)?s:e),{x:this.centerX+s*Math.cos(t),y:this.centerY+s*Math.sin(t)}}}}}})(),n})(),t.exports=e()},731(t){var e;e=()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{CenterPoint:()=>c});var r,n,i,o,s,a=function(t,e,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(t,r):i?i.value=r:e.set(t,r),r},u=function(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)};class c{constructor(t){r.add(this),n.set(this,void 0),i.set(this,{move:[]}),o.set(this,void 0),a(this,n,t,"f"),a(this,o,new MutationObserver(()=>u(this,r,"m",s).call(this,"move")),"f"),u(this,o,"f").observe(t,{attributes:!0,childList:!0,characterData:!0,subtree:!0})}get x(){let t=u(this,n,"f").getBBox();return t.x+t.width/2}set x(t){let e=this.x,r=[...u(this,n,"f").x.baseVal].map(t=>t.value);0!=r.length||r.push(0),r=r.map(r=>r+(t-e)),u(this,n,"f").setAttribute("x",r.join(", "))}get y(){let t=u(this,n,"f").getBBox();return t.y+t.height/2}set y(t){let e=this.y,r=[...u(this,n,"f").y.baseVal].map(t=>t.value);0!=r.length||r.push(0),r=r.map(r=>r+(t-e)),u(this,n,"f").setAttribute("y",r.join(", "))}addEventListener(t,e){u(this,i,"f")[t].push(e)}removeEventListener(t,e){u(this,i,"f")[t]=u(this,i,"f")[t].filter(t=>t!==e)}}return n=new WeakMap,i=new WeakMap,o=new WeakMap,r=new WeakSet,s=function(t){u(this,i,"f")[t].forEach(t=>t())},e})(),t.exports=e()},854(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return"number"==typeof t}function n(t){return r(t)&&Number.isFinite(t)}function i(t){return r(t)&&!Number.isFinite(t)}function o(t){return n(t)&&t>0}function s(t){return n(t)&&t>=0}function a(t){return"string"==typeof t}function u(t){return null==t}function c(t){return"object"==typeof t&&null!==t}function h(t){return Array.isArray(t)}function l(t){return h(t)&&0==t.length}function d(t){return h(t)&&t.length>0}function f(t){return h(t)&&t.every(r)}function m(t){return f(t)&&t.length>0}function b(t){return h(t)&&t.every(n)}function p(t){return h(t)&&t.every(i)}function y(t){return h(t)&&t.every(a)}function g(t){return y(t)&&t.length>0}return t.r(e),t.d(e,{isArray:()=>h,isEmptyArray:()=>l,isFiniteNumber:()=>n,isFiniteNumbersArray:()=>b,isNonEmptyArray:()=>d,isNonEmptyNumbersArray:()=>m,isNonEmptyStringsArray:()=>g,isNonFiniteNumber:()=>i,isNonFiniteNumbersArray:()=>p,isNonNegativeFiniteNumber:()=>s,isNonNullObject:()=>c,isNullish:()=>u,isNumber:()=>r,isNumbersArray:()=>f,isPositiveFiniteNumber:()=>o,isString:()=>a,isStringsArray:()=>y}),e})()}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{Circle:()=>s,Text:()=>o});var t=r(645),e=r(731),i=r(854);class o{static create(t){let e=document.createElementNS("http://www.w3.org/2000/svg","text");return e.id="id-"+self.crypto.randomUUID(),e.textContent=null!=t?t:"",e.setAttribute("font-family","Arial"),e.setAttribute("font-size","9"),e.setAttribute("font-weight","700"),e.setAttribute("font-style","normal"),e.setAttribute("fill","black"),e.setAttribute("fill-opacity","1"),new o(e)}constructor(t){this.domNode=t}get id(){return this.domNode.id}get bbox(){return t.Box.matching(this.domNode.getBBox())}get centerX(){return this.bbox.centerX}set centerX(t){new e.CenterPoint(this.domNode).x=t}get centerY(){return this.bbox.centerY}set centerY(t){new e.CenterPoint(this.domNode).y=t}drag(t,e){this.centerX+=t,this.centerY+=e}serialized(){if(!this.id)throw new Error("Text element ID is falsy.");return{id:this.id}}static recreate(t,e){if(!(0,i.isNonNullObject)(t))throw new Error(`Saved text element is not an object: ${t}.`);if(!t.id)throw new Error("Saved text element ID is falsy.");if(!(0,i.isString)(t.id))throw new Error(`Saved text element ID is not a string: ${t.id}.`);let r=e.domNode.querySelector("#"+t.id);if(!r)throw new Error("Unable to find text element DOM node in parent drawing by ID.");if(!(r instanceof SVGTextElement))throw new Error(`Text element DOM node is not an SVG text element: ${r}.`);return new o(r)}}class s{static create(){let t=document.createElementNS("http://www.w3.org/2000/svg","circle");return t.id="id-"+self.crypto.randomUUID(),t.setAttribute("r","6"),t.setAttribute("stroke","black"),t.setAttribute("stroke-width","1"),t.setAttribute("stroke-opacity","1"),t.setAttribute("stroke-dasharray",""),t.setAttribute("stroke-linecap",""),t.setAttribute("fill","white"),t.setAttribute("fill-opacity","1"),new s(t)}constructor(t){this.domNode=t}get id(){return this.domNode.id}get centerX(){return this.domNode.cx.baseVal.value}set centerX(t){this.domNode.setAttribute("cx",`${t}`)}get centerY(){return this.domNode.cy.baseVal.value}set centerY(t){this.domNode.setAttribute("cy",`${t}`)}drag(t,e){this.centerX+=t,this.centerY+=e}serialized(){if(!this.id)throw new Error("Circle ID is falsy.");return{id:this.id}}static recreate(t,e){if(!(0,i.isNonNullObject)(t))throw new Error(`Saved circle must be an object: ${t}.`);if(!t.id)throw new Error("Saved circle ID is falsy.");if(!(0,i.isString)(t.id))throw new Error(`Saved circle ID must be a string: ${t.id}.`);let r=e.domNode.querySelector("#"+t.id);if(!r)throw new Error("Unable to find circle element DOM node by ID.");if(!(r instanceof SVGCircleElement))throw new Error(`Circle element DOM node is not an SVG circle element: ${r}.`);return new s(r)}}})(),n})());
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["draw.floating"]=e():t["draw.floating"]=e()}(this,()=>(()=>{var t={645(t){var e;e=()=>(()=>{var t={986(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){var e=0;return t.forEach(function(t){return e+=t}),e}function i(t){return r(t)/t.length}function n(t){t.sort(function(t,e){return t-e})}t.r(e),t.d(e,{areWithin:()=>m,average:()=>i,clamp:()=>l,degrees:()=>y,flipAway:()=>v,isBetween:()=>h,isBetweenExclusive:()=>u,isBetweenInclusive:()=>h,max:()=>d,mean:()=>i,median:()=>a,min:()=>c,normalizeAngle:()=>w,radians:()=>b,round:()=>g,sortNumbers:()=>n,sortNumbersAscending:()=>n,sortNumbersDescending:()=>f,sortedNumbers:()=>s,sortedNumbersAscending:()=>s,sortedNumbersDescending:()=>p,sum:()=>r});var o=function(t,e,r){if(r||2===arguments.length)for(var i,n=0,o=e.length;n<o;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))};function s(t){var e=o([],t,!0);return n(e),e}function a(t){if(0==t.length)return NaN;var e=s(t);if(e.length%2!=0)return e[Math.floor(e.length/2)];var r=e.length/2,n=r-1;return i([e[r],e[n]])}function c(t){if(0==t.length)return 1/0;var e=t[0];return t.slice(1).forEach(function(t){e=Math.min(e,t)}),e}function d(t){if(0==t.length)return-1/0;var e=t[0];return t.slice(1).forEach(function(t){e=Math.max(e,t)}),e}function h(t,e,r){return t>=e&&t<=r}function u(t,e,r){return t>e&&t<r}function l(t,e,r){return t<e?e:t>r?r:t}function m(t,e,r){return Math.abs(t-e)<=r}function f(t){n(t),t.reverse()}function p(t){var e=s(t);return e.reverse(),e}function g(t,e){return Number.parseFloat(t.toFixed(null!=e?e:0))}function y(t){return t*(180/Math.PI)}function b(t){return t*(Math.PI/180)}function w(t,e){void 0===e&&(e=-Math.PI);var r=t-e;return e+((r%=2*Math.PI)>=0?r:r+2*Math.PI)}function v(t,e){var r=(e=w(e,t))-t;return(r<Math.PI/2||r>3*Math.PI/2)&&(t+=Math.PI),t}return e})()}},e={};function r(i){var n=e[i];if(void 0!==n)return n.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{"use strict";r.r(i),r.d(i,{Box:()=>e});var t=r(986);class e{static matching(t){let{x:r,y:i,width:n,height:o}=t;return new e(r,i,n,o)}static bounding(r){let i=[...r];if(0==i.length)throw new Error("An empty collection of boxes doesn't have a bounding box.");let n=i.map(t=>e.matching(t)),o=(0,t.min)(n.map(t=>t.left)),s=(0,t.min)(n.map(t=>t.top)),a=(0,t.max)(n.map(t=>t.right))-o,c=(0,t.max)(n.map(t=>t.bottom))-s;return new e(o,s,a,c)}constructor(t,e,r,i){this.x=t,this.y=e,this.width=r,this.height=i}get centerX(){return this.minX+this.width/2}get centerY(){return this.minY+this.height/2}get minX(){return this.x}get minY(){return this.y}get maxX(){return this.minX+this.width}get maxY(){return this.minY+this.height}get top(){return this.minY}get right(){return this.maxX}get bottom(){return this.maxY}get left(){return this.minX}bounds(t){let r=e.matching(t);return this.minX<=r.minX&&this.minY<=r.minY&&this.maxX>=r.maxX&&this.maxY>=r.maxY}padded(...t){let r="number"==typeof t[0]?t[0]:"factor"in t[0]?t[0].factor*this.width:t[0].percentage/100*this.width,i="number"==typeof t[0]&&"number"==typeof t[1]?t[1]:"number"==typeof t[0]?t[0]:"factor"in t[0]?t[0].factor*this.height:t[0].percentage/100*this.height;return new e(this.x-r,this.y-i,this.width+2*r,this.height+2*i)}get periphery(){return{atAngle:t=>{let e=this.width/2,r=this.height/2,i=Math.pow(Math.pow(e,2)+Math.pow(r,2),.5),n=this.centerX+i*Math.cos(t),o=this.centerY+i*Math.sin(t),s=i;return Math.abs(this.centerX-n)>e&&(s=Math.abs(e/Math.cos(t)),s=Number.isFinite(s)?s:r),Math.abs(this.centerY-o)>r&&(s=Math.abs(r/Math.sin(t)),s=Number.isFinite(s)?s:e),{x:this.centerX+s*Math.cos(t),y:this.centerY+s*Math.sin(t)}}}}}})(),i})(),t.exports=e()},731(t){var e;e=()=>(()=>{"use strict";var t={d:(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{CenterPoint:()=>d});var r,i,n,o,s,a=function(t,e,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(t,r):n?n.value=r:e.set(t,r),r},c=function(t,e,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)};class d{constructor(t){r.add(this),i.set(this,void 0),n.set(this,{move:[]}),o.set(this,void 0),a(this,i,t,"f"),a(this,o,new MutationObserver(()=>c(this,r,"m",s).call(this,"move")),"f"),c(this,o,"f").observe(t,{attributes:!0,childList:!0,characterData:!0,subtree:!0})}get x(){let t=c(this,i,"f").getBBox();return t.x+t.width/2}set x(t){let e=this.x,r=[...c(this,i,"f").x.baseVal].map(t=>t.value);0!=r.length||r.push(0),r=r.map(r=>r+(t-e)),c(this,i,"f").setAttribute("x",r.join(", "))}get y(){let t=c(this,i,"f").getBBox();return t.y+t.height/2}set y(t){let e=this.y,r=[...c(this,i,"f").y.baseVal].map(t=>t.value);0!=r.length||r.push(0),r=r.map(r=>r+(t-e)),c(this,i,"f").setAttribute("y",r.join(", "))}addEventListener(t,e){c(this,n,"f")[t].push(e)}removeEventListener(t,e){c(this,n,"f")[t]=c(this,n,"f")[t].filter(t=>t!==e)}}return i=new WeakMap,n=new WeakMap,o=new WeakMap,r=new WeakSet,s=function(t){c(this,n,"f")[t].forEach(t=>t())},e})(),t.exports=e()},456(t){var e;e=()=>(()=>{var t={277(t){var e;e=()=>(()=>{"use strict";var t={d:(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{Vector:()=>r});class r{static matching(t){let e="x"in t?t.x:t.magnitude*Math.cos(t.direction),i="y"in t?t.y:t.magnitude*Math.sin(t.direction);return new r(e,i)}constructor(t,e){this.x=t,this.y=e}[Symbol.iterator](){return[this.x,this.y].values()}get magnitude(){return Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2))}set magnitude(t){let e=this.direction;this.x=t*Math.cos(e),this.y=t*Math.sin(e)}get direction(){return Math.atan2(this.y,this.x)}set direction(t){let e=this.magnitude;this.x=e*Math.cos(t),this.y=e*Math.sin(t)}}return e})(),t.exports=e()}},e={};function r(i){var n=e[i];if(void 0!==n)return n.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{"use strict";r.r(i),r.d(i,{Point:()=>e,RelativePoint:()=>h});var t=r(277);class e{static matching(t){return new e(t.x,t.y)}constructor(t,e){this.x=t,this.y=e}[Symbol.iterator](){return[this.x,this.y].values()}displace(e){let r=t.Vector.matching(e);this.x+=r.x,this.y+=r.y}displaced(t){let r=e.matching(this);return r.displace(t),r}displacementTo(e){return new t.Vector(e.x-this.x,e.y-this.y)}displacementFrom(e){return new t.Vector(this.x-e.x,this.y-e.y)}distanceTo(t){return this.displacementTo(t).magnitude}distanceFrom(t){return this.distanceTo(t)}directionTo(t){return this.displacementTo(t).direction}directionFrom(t){return this.displacementFrom(t).direction}}var n,o,s,a,c,d=function(t,e,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)};class h{constructor(e){n.add(this),o.set(this,void 0),s.set(this,new t.Vector(0,0)),a.set(this,{move:[]}),function(t,e,r){if("function"==typeof e||!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");e.set(t,r)}(this,o,e),e.addEventListener("move",()=>d(this,n,"m",c).call(this,"move"))}get x(){return d(this,o,"f").x+d(this,s,"f").x}set x(t){d(this,s,"f").x=t-d(this,o,"f").x,d(this,n,"m",c).call(this,"move")}get y(){return d(this,o,"f").y+d(this,s,"f").y}set y(t){d(this,s,"f").y=t-d(this,o,"f").y,d(this,n,"m",c).call(this,"move")}addEventListener(t,e){d(this,a,"f")[t].push(e)}removeEventListener(t,e){d(this,a,"f")[t]=d(this,a,"f")[t].filter(t=>t!==e)}}o=new WeakMap,s=new WeakMap,a=new WeakMap,n=new WeakSet,c=function(t){d(this,a,"f")[t].forEach(t=>t())}})(),i})(),t.exports=e()},854(t){t.exports=(()=>{"use strict";var t={d:(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return"number"==typeof t}function i(t){return r(t)&&Number.isFinite(t)}function n(t){return r(t)&&!Number.isFinite(t)}function o(t){return i(t)&&t>0}function s(t){return i(t)&&t>=0}function a(t){return"string"==typeof t}function c(t){return null==t}function d(t){return"object"==typeof t&&null!==t}function h(t){return Array.isArray(t)}function u(t){return h(t)&&0==t.length}function l(t){return h(t)&&t.length>0}function m(t){return h(t)&&t.every(r)}function f(t){return m(t)&&t.length>0}function p(t){return h(t)&&t.every(i)}function g(t){return h(t)&&t.every(n)}function y(t){return h(t)&&t.every(a)}function b(t){return y(t)&&t.length>0}return t.r(e),t.d(e,{isArray:()=>h,isEmptyArray:()=>u,isFiniteNumber:()=>i,isFiniteNumbersArray:()=>p,isNonEmptyArray:()=>l,isNonEmptyNumbersArray:()=>f,isNonEmptyStringsArray:()=>b,isNonFiniteNumber:()=>n,isNonFiniteNumbersArray:()=>g,isNonNegativeFiniteNumber:()=>s,isNonNullObject:()=>d,isNullish:()=>c,isNumber:()=>r,isNumbersArray:()=>m,isPositiveFiniteNumber:()=>o,isString:()=>a,isStringsArray:()=>y}),e})()}},e={};function r(i){var n=e[i];if(void 0!==n)return n.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{"use strict";r.r(i),r.d(i,{Circle:()=>s,Rectangle:()=>w,Text:()=>o});var t=r(645),e=r(731),n=r(854);class o{static create(t){let e=document.createElementNS("http://www.w3.org/2000/svg","text");return e.id="id-"+self.crypto.randomUUID(),e.textContent=null!=t?t:"",e.setAttribute("font-family","Arial"),e.setAttribute("font-size","9"),e.setAttribute("font-weight","700"),e.setAttribute("font-style","normal"),e.setAttribute("fill","black"),e.setAttribute("fill-opacity","1"),new o(e)}constructor(t){this.domNode=t}get id(){return this.domNode.id}get bbox(){return t.Box.matching(this.domNode.getBBox())}get centerX(){return this.bbox.centerX}set centerX(t){new e.CenterPoint(this.domNode).x=t}get centerY(){return this.bbox.centerY}set centerY(t){new e.CenterPoint(this.domNode).y=t}drag(t,e){this.centerX+=t,this.centerY+=e}serialized(){if(!this.id)throw new Error("Text element ID is falsy.");return{id:this.id}}static recreate(t,e){if(!(0,n.isNonNullObject)(t))throw new Error(`Saved text element is not an object: ${t}.`);if(!t.id)throw new Error("Saved text element ID is falsy.");if(!(0,n.isString)(t.id))throw new Error(`Saved text element ID is not a string: ${t.id}.`);let r=e.domNode.querySelector("#"+t.id);if(!r)throw new Error("Unable to find text element DOM node in parent drawing by ID.");if(!(r instanceof SVGTextElement))throw new Error(`Text element DOM node is not an SVG text element: ${r}.`);return new o(r)}}class s{static create(){let t=document.createElementNS("http://www.w3.org/2000/svg","circle");return t.id="id-"+self.crypto.randomUUID(),t.setAttribute("r","6"),t.setAttribute("stroke","black"),t.setAttribute("stroke-width","1"),t.setAttribute("stroke-opacity","1"),t.setAttribute("stroke-dasharray",""),t.setAttribute("stroke-linecap",""),t.setAttribute("fill","white"),t.setAttribute("fill-opacity","1"),new s(t)}constructor(t){this.domNode=t}get id(){return this.domNode.id}get centerX(){return this.domNode.cx.baseVal.value}set centerX(t){this.domNode.setAttribute("cx",`${t}`)}get centerY(){return this.domNode.cy.baseVal.value}set centerY(t){this.domNode.setAttribute("cy",`${t}`)}drag(t,e){this.centerX+=t,this.centerY+=e}serialized(){if(!this.id)throw new Error("Circle ID is falsy.");return{id:this.id}}static recreate(t,e){if(!(0,n.isNonNullObject)(t))throw new Error(`Saved circle must be an object: ${t}.`);if(!t.id)throw new Error("Saved circle ID is falsy.");if(!(0,n.isString)(t.id))throw new Error(`Saved circle ID must be a string: ${t.id}.`);let r=e.domNode.querySelector("#"+t.id);if(!r)throw new Error("Unable to find circle element DOM node by ID.");if(!(r instanceof SVGCircleElement))throw new Error(`Circle element DOM node is not an SVG circle element: ${r}.`);return new s(r)}}var a=r(456);class c{constructor(){this.centerX=0,this.centerY=0,this.direction=-Math.PI/2,this.width=0,this.height=0,this.cornerRadius=0}static matching(t){let e=new c;return e.centerX=t.centerX,e.centerY=t.centerY,e.direction=t.direction,e.width=t.width,e.height=t.height,e.cornerRadius=t.cornerRadius,e}toString(){let t=new a.Point(this.centerX,this.centerY);t.displace({magnitude:this.height/2,direction:this.direction}),t.displace({magnitude:this.width/2-this.cornerRadius,direction:this.direction+Math.PI/2});let e=`M ${t.x} ${t.y}`;return t.displace({magnitude:Math.SQRT2*this.cornerRadius,direction:this.direction+3*Math.PI/4}),e+=` A ${this.cornerRadius} ${this.cornerRadius} 90 0 1 ${t.x} ${t.y}`,t.displace({magnitude:this.height-2*this.cornerRadius,direction:this.direction+Math.PI}),e+=` L ${t.x} ${t.y}`,t.displace({magnitude:Math.SQRT2*this.cornerRadius,direction:this.direction+5*Math.PI/4}),e+=` A ${this.cornerRadius} ${this.cornerRadius} 90 0 1 ${t.x} ${t.y}`,t.displace({magnitude:this.width-2*this.cornerRadius,direction:this.direction+3*Math.PI/2}),e+=` L ${t.x} ${t.y}`,t.displace({magnitude:Math.SQRT2*this.cornerRadius,direction:this.direction+7*Math.PI/4}),e+=` A ${this.cornerRadius} ${this.cornerRadius} 90 0 1 ${t.x} ${t.y}`,t.displace({magnitude:this.height-2*this.cornerRadius,direction:this.direction}),e+=` L ${t.x} ${t.y}`,t.displace({magnitude:Math.SQRT2*this.cornerRadius,direction:this.direction+9*Math.PI/4}),e+=` A ${this.cornerRadius} ${this.cornerRadius} 90 0 1 ${t.x} ${t.y}`,e+=" Z",e}}const d={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let h;const u=new Uint8Array(16),l=[];for(let t=0;t<256;++t)l.push((t+256).toString(16).slice(1));function m(t,e,r){const i=(t=t||{}).random??t.rng?.()??function(){if(!h){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");h=crypto.getRandomValues.bind(crypto)}return h(u)}();if(i.length<16)throw new Error("Random bytes length must be >= 16");if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e){if((r=r||0)<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let t=0;t<16;++t)e[r+t]=i[t];return e}return function(t,e=0){return(l[t[e+0]]+l[t[e+1]]+l[t[e+2]]+l[t[e+3]]+"-"+l[t[e+4]]+l[t[e+5]]+"-"+l[t[e+6]]+l[t[e+7]]+"-"+l[t[e+8]]+l[t[e+9]]+"-"+l[t[e+10]]+l[t[e+11]]+l[t[e+12]]+l[t[e+13]]+l[t[e+14]]+l[t[e+15]]).toLowerCase()}(i)}var f,p,g,y,b=function(t,e,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(t):i?i.value:e.get(t)};class w{static create(){let t=document.createElementNS("http://www.w3.org/2000/svg","path");var e,r,i;t.id="id-"+(!d.randomUUID||r||e?m(e,r,i):d.randomUUID());let n=new w(t);return n.centerX=0,n.centerY=0,n.direction=-Math.PI/2,n.width=5.5,n.height=5.5,n.cornerRadius=0,n.domNode.setAttribute("stroke","black"),n.domNode.setAttribute("stroke-width","1"),n.domNode.setAttribute("stroke-opacity","1"),n.domNode.setAttribute("stroke-linejoin",""),n.domNode.setAttribute("stroke-dasharray",""),n.domNode.setAttribute("stroke-linecap",""),n.domNode.setAttribute("fill","white"),n.domNode.setAttribute("fill-opacity","1"),n}constructor(t){f.add(this),this.domNode=t,t.dataset.centerX||b(this,f,"m",p).call(this),t.dataset.centerY||b(this,f,"m",g).call(this)}get id(){return this.domNode.id}get centerX(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.centerX)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set centerX(t){Number.isFinite(t)?(this.domNode.dataset.centerX=`${t}`,b(this,f,"m",y).call(this)):console.error(`The specified center X coordinate is nonfinite: ${t}.`)}get centerY(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.centerY)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set centerY(t){Number.isFinite(t)?(this.domNode.dataset.centerY=`${t}`,b(this,f,"m",y).call(this)):console.error(`The specified center Y coordinate is nonfinite: ${t}.`)}drag(t,e){this.centerX+=t,this.centerY+=e}get direction(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.direction)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set direction(t){Number.isFinite(t)?(this.domNode.dataset.direction=`${t}`,b(this,f,"m",y).call(this)):console.error(`The specified direction angle is nonfinite: ${t}.`)}get width(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.width)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set width(t){Number.isFinite(t)?(this.domNode.dataset.width=`${t}`,b(this,f,"m",y).call(this)):console.error(`The specified width is nonfinite: ${t}.`)}get height(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.height)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set height(t){Number.isFinite(t)?(this.domNode.dataset.height=`${t}`,b(this,f,"m",y).call(this)):console.error(`The specified height is nonfinite: ${t}.`)}get cornerRadius(){var t;let e=Number.parseFloat(null!==(t=this.domNode.dataset.cornerRadius)&&void 0!==t?t:"");return Number.isFinite(e)?e:0}set cornerRadius(t){Number.isFinite(t)?(this.domNode.dataset.cornerRadius=`${t}`,b(this,f,"m",y).call(this)):console.error(`The specified corner radius is nonfinite: ${t}.`)}get bbox(){return t.Box.matching(this.domNode.getBBox())}serialized(){if(!this.id)throw new Error("Rectangle ID is falsy.");return{id:this.id}}static recreate(t,e){if(!(0,n.isNonNullObject)(t))throw new Error(`Saved rectangle is not an object: ${t}.`);if(!t.id)throw new Error("Saved rectangle ID is falsy.");if(!(0,n.isString)(t.id))throw new Error(`Saved rectangle ID is not a string: ${t.id}.`);let r=e.domNode.querySelector("#"+t.id);if(!r)throw new Error("Unable to find saved rectangle DOM node in parent drawing by ID.");if(!(r instanceof SVGPathElement))throw new Error(`DOM node found for saved rectangle is not an SVG path element: ${r}.`);return new w(r)}}f=new WeakSet,p=function(){let e=t.Box.matching(this.domNode.getBBox());this.domNode.dataset.centerX=`${e.centerX}`},g=function(){let e=t.Box.matching(this.domNode.getBBox());this.domNode.dataset.centerY=`${e.centerY}`},y=function(){let t=new c;t.centerX=this.centerX,t.centerY=this.centerY,t.direction=this.direction,t.width=this.width,t.height=this.height,t.cornerRadius=this.cornerRadius,this.domNode.setAttribute("d",t.toString())}})(),i})());
|
package/jest.config.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rnacanvas/draw.floating",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Draw floating elements",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@rnacanvas/draw.svg.text": "^1.3.0",
|
|
34
34
|
"@rnacanvas/points.oopified": "^2.1.0",
|
|
35
35
|
"@rnacanvas/value-check": "^1.14.1",
|
|
36
|
-
"jquery": "^4.0.0"
|
|
36
|
+
"jquery": "^4.0.0",
|
|
37
|
+
"uuid": "^13.0.0"
|
|
37
38
|
}
|
|
38
39
|
}
|