@rnacanvas/draw.svg 1.4.0 → 2.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.
@@ -1,4 +1,3 @@
1
- import * as SVG from '@svgdotjs/svg.js';
2
1
  /**
3
2
  * The horizontal scaling factor for a target SVG document
4
3
  * going from the coordinate system of the SVG document (as determined by its view box)
@@ -6,7 +5,7 @@ import * as SVG from '@svgdotjs/svg.js';
6
5
  */
7
6
  export declare class HorizontalClientScaling {
8
7
  private targetSVGDoc;
9
- constructor(targetSVGDoc: SVG.Svg);
8
+ constructor(targetSVGDoc: SVGSVGElement);
10
9
  /**
11
10
  * Can possibly return a nonfinite value
12
11
  * (e.g., if the target SVG document has a width of zero).
@@ -1 +1 @@
1
- {"version":3,"file":"HorizontalClientScaling.d.ts","sourceRoot":"","sources":["../src/HorizontalClientScaling.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AAExC;;;;GAIG;AACH,qBAAa,uBAAuB;IACtB,OAAO,CAAC,YAAY;gBAAZ,YAAY,EAAE,GAAG,CAAC,GAAG;IAEzC;;;OAGG;IACH,GAAG,IAAI,MAAM;CAMd"}
1
+ {"version":3,"file":"HorizontalClientScaling.d.ts","sourceRoot":"","sources":["../src/HorizontalClientScaling.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,uBAAuB;IACtB,OAAO,CAAC,YAAY;gBAAZ,YAAY,EAAE,aAAa;IAE/C;;;OAGG;IACH,GAAG,IAAI,MAAM;CAMd"}
package/dist/Scaling.d.ts CHANGED
@@ -1,11 +1,10 @@
1
- import * as SVG from '@svgdotjs/svg.js';
2
1
  /**
3
2
  * The scaling of a target SVG document
4
3
  * (as determined by its view box and its width and height attributes).
5
4
  */
6
5
  export declare class Scaling {
7
6
  private targetSVGDoc;
8
- constructor(targetSVGDoc: SVG.Svg);
7
+ constructor(targetSVGDoc: SVGSVGElement);
9
8
  /**
10
9
  * Modifies the width and height attributes of the target SVG document
11
10
  * to make its horizontal and vertical scaling equal to the given scaling factor.
@@ -1 +1 @@
1
- {"version":3,"file":"Scaling.d.ts","sourceRoot":"","sources":["../src/Scaling.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AAExC;;;GAGG;AACH,qBAAa,OAAO;IACN,OAAO,CAAC,YAAY;gBAAZ,YAAY,EAAE,GAAG,CAAC,GAAG;IAEzC;;;OAGG;IACH,GAAG,CAAC,OAAO,EAAE,MAAM;CAQpB"}
1
+ {"version":3,"file":"Scaling.d.ts","sourceRoot":"","sources":["../src/Scaling.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,OAAO;IACN,OAAO,CAAC,YAAY;gBAAZ,YAAY,EAAE,aAAa;IAE/C;;;OAGG;IACH,GAAG,CAAC,OAAO,EAAE,MAAM;CAMpB"}
@@ -1,4 +1,3 @@
1
- import * as SVG from '@svgdotjs/svg.js';
2
1
  /**
3
2
  * The vertical scaling factor for a target SVG document
4
3
  * going from the coordinate system of the SVG document (as determined by its view box)
@@ -6,7 +5,7 @@ import * as SVG from '@svgdotjs/svg.js';
6
5
  */
7
6
  export declare class VerticalClientScaling {
8
7
  private targetSVGDoc;
9
- constructor(targetSVGDoc: SVG.Svg);
8
+ constructor(targetSVGDoc: SVGSVGElement);
10
9
  /**
11
10
  * Can possibly return a nonfinite value
12
11
  * (e.g., if the target SVG document has a height of zero).
@@ -1 +1 @@
1
- {"version":3,"file":"VerticalClientScaling.d.ts","sourceRoot":"","sources":["../src/VerticalClientScaling.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AAExC;;;;GAIG;AACH,qBAAa,qBAAqB;IACpB,OAAO,CAAC,YAAY;gBAAZ,YAAY,EAAE,GAAG,CAAC,GAAG;IAEzC;;;OAGG;IACH,GAAG,IAAI,MAAM;CAMd"}
1
+ {"version":3,"file":"VerticalClientScaling.d.ts","sourceRoot":"","sources":["../src/VerticalClientScaling.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,qBAAqB;IACpB,OAAO,CAAC,YAAY;gBAAZ,YAAY,EAAE,aAAa;IAE/C;;;OAGG;IACH,GAAG,IAAI,MAAM;CAMd"}
@@ -1,4 +1,3 @@
1
- import * as SVG from '@svgdotjs/svg.js';
2
1
  /**
3
2
  * Assigns a UUID to the id attribute of the SVG element.
4
3
  *
@@ -9,5 +8,5 @@ import * as SVG from '@svgdotjs/svg.js';
9
8
  *
10
9
  * Thus, assigned UUIDs will be a little bit bigger than 36 characters (the standard size for UUIDs).
11
10
  */
12
- export declare function assignUUID(ele: SVG.Element): void;
11
+ export declare function assignUUID(ele: SVGElement): void;
13
12
  //# sourceMappingURL=assignUUID.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"assignUUID.d.ts","sourceRoot":"","sources":["../src/assignUUID.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AAIxC;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,OAAO,GAAG,IAAI,CAEjD"}
1
+ {"version":3,"file":"assignUUID.d.ts","sourceRoot":"","sources":["../src/assignUUID.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CAEhD"}
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.svg"]=e():t["draw.svg"]=e()}(this,(()=>(()=>{"use strict";var t={d:(e,o)=>{for(var n in o)t.o(o,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:o[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,{HorizontalClientScaling:()=>p,Scaling:()=>d,VerticalClientScaling:()=>s,assignUUID:()=>a});const o={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let n;const r=new Uint8Array(16);function i(){if(!n&&(n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!n))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(r)}const c=[];for(let t=0;t<256;++t)c.push((t+256).toString(16).slice(1));const u=function(t,e,n){if(o.randomUUID&&!e&&!t)return o.randomUUID();const r=(t=t||{}).random||(t.rng||i)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){n=n||0;for(let t=0;t<16;++t)e[n+t]=r[t];return e}return function(t,e=0){return c[t[e+0]]+c[t[e+1]]+c[t[e+2]]+c[t[e+3]]+"-"+c[t[e+4]]+c[t[e+5]]+"-"+c[t[e+6]]+c[t[e+7]]+"-"+c[t[e+8]]+c[t[e+9]]+"-"+c[t[e+10]]+c[t[e+11]]+c[t[e+12]]+c[t[e+13]]+c[t[e+14]]+c[t[e+15]]}(r)};function a(t){t.attr("id","uuid-"+u())}var d=function(){function t(t){this.targetSVGDoc=t}return t.prototype.set=function(t){var e=this.targetSVGDoc.viewbox();this.targetSVGDoc.attr({width:t*e.width+"px",height:t*e.height+"px"})},t}(),p=function(){function t(t){this.targetSVGDoc=t}return t.prototype.get=function(){var t=this.targetSVGDoc.node.getBoundingClientRect(),e=this.targetSVGDoc.viewbox();return t.width/e.width},t}(),s=function(){function t(t){this.targetSVGDoc=t}return t.prototype.get=function(){var t=this.targetSVGDoc.node.getBoundingClientRect(),e=this.targetSVGDoc.viewbox();return t.height/e.height},t}();return e})()));
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.svg"]=e():t["draw.svg"]=e()}(this,(()=>(()=>{"use strict";var t={d:(e,o)=>{for(var n in o)t.o(o,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:o[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,{HorizontalClientScaling:()=>s,Scaling:()=>d,VerticalClientScaling:()=>p,assignUUID:()=>a});const o={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let n;const r=new Uint8Array(16);function i(){if(!n&&(n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!n))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(r)}const c=[];for(let t=0;t<256;++t)c.push((t+256).toString(16).slice(1));const u=function(t,e,n){if(o.randomUUID&&!e&&!t)return o.randomUUID();const r=(t=t||{}).random||(t.rng||i)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){n=n||0;for(let t=0;t<16;++t)e[n+t]=r[t];return e}return function(t,e=0){return c[t[e+0]]+c[t[e+1]]+c[t[e+2]]+c[t[e+3]]+"-"+c[t[e+4]]+c[t[e+5]]+"-"+c[t[e+6]]+c[t[e+7]]+"-"+c[t[e+8]]+c[t[e+9]]+"-"+c[t[e+10]]+c[t[e+11]]+c[t[e+12]]+c[t[e+13]]+c[t[e+14]]+c[t[e+15]]}(r)};function a(t){t.id="uuid-"+u()}var d=function(){function t(t){this.targetSVGDoc=t}return t.prototype.set=function(t){var e=this.targetSVGDoc.viewBox.baseVal;this.targetSVGDoc.setAttribute("width",t*e.width+"px"),this.targetSVGDoc.setAttribute("height",t*e.height+"px")},t}(),s=function(){function t(t){this.targetSVGDoc=t}return t.prototype.get=function(){var t=this.targetSVGDoc.getBoundingClientRect(),e=this.targetSVGDoc.viewBox.baseVal;return t.width/e.width},t}(),p=function(){function t(t){this.targetSVGDoc=t}return t.prototype.get=function(){var t=this.targetSVGDoc.getBoundingClientRect(),e=this.targetSVGDoc.viewBox.baseVal;return t.height/e.height},t}();return e})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnacanvas/draw.svg",
3
- "version": "1.4.0",
3
+ "version": "2.0.0",
4
4
  "description": "SVG drawing utilities",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,6 +20,7 @@
20
20
  "@types/uuid": "^9.0.8",
21
21
  "babel-jest": "^29.7.0",
22
22
  "jest": "^29.7.0",
23
+ "jest-environment-jsdom": "^29.7.0",
23
24
  "ts-loader": "^9.5.1",
24
25
  "typescript": "^5.3.3",
25
26
  "webpack": "^5.89.0",