parsegraph-rect
Advanced tools
@@ -1,216 +0,2 @@ | ||
| (function webpackUniversalModuleDefinition(root, factory) { | ||
| if(typeof exports === 'object' && typeof module === 'object') | ||
| module.exports = factory(); | ||
| else if(typeof define === 'function' && define.amd) | ||
| define([], factory); | ||
| else if(typeof exports === 'object') | ||
| exports["parsegraph_rect"] = factory(); | ||
| else | ||
| root["parsegraph_rect"] = factory(); | ||
| })(this, function() { | ||
| return /******/ (() => { // webpackBootstrap | ||
| /******/ "use strict"; | ||
| /******/ // The require scope | ||
| /******/ var __webpack_require__ = {}; | ||
| /******/ | ||
| /************************************************************************/ | ||
| /******/ /* webpack/runtime/define property getters */ | ||
| /******/ (() => { | ||
| /******/ // define getter functions for harmony exports | ||
| /******/ __webpack_require__.d = (exports, definition) => { | ||
| /******/ for(var key in definition) { | ||
| /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | ||
| /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | ||
| /******/ } | ||
| /******/ } | ||
| /******/ }; | ||
| /******/ })(); | ||
| /******/ | ||
| /******/ /* webpack/runtime/hasOwnProperty shorthand */ | ||
| /******/ (() => { | ||
| /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) | ||
| /******/ })(); | ||
| /******/ | ||
| /******/ /* webpack/runtime/make namespace object */ | ||
| /******/ (() => { | ||
| /******/ // define __esModule on exports | ||
| /******/ __webpack_require__.r = (exports) => { | ||
| /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | ||
| /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
| /******/ } | ||
| /******/ Object.defineProperty(exports, '__esModule', { value: true }); | ||
| /******/ }; | ||
| /******/ })(); | ||
| /******/ | ||
| /************************************************************************/ | ||
| var __webpack_exports__ = {}; | ||
| /*!**********************!*\ | ||
| !*** ./src/index.ts ***! | ||
| \**********************/ | ||
| __webpack_require__.r(__webpack_exports__); | ||
| /* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
| /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | ||
| /* harmony export */ }); | ||
| /* eslint-disable require-jsdoc */ | ||
| var Rect = | ||
| /** @class */ | ||
| function () { | ||
| function Rect(x, y, width, height) { | ||
| this._x = x; | ||
| this._y = y; | ||
| this._width = width; | ||
| this._height = height; | ||
| } | ||
| Rect.prototype.isNaN = function () { | ||
| return isNaN(this._x) || isNaN(this._y) || isNaN(this._width) || isNaN(this._height); | ||
| }; | ||
| Rect.prototype.toNaN = function () { | ||
| this._x = NaN; | ||
| this._y = NaN; | ||
| this._width = NaN; | ||
| this._height = NaN; | ||
| }; | ||
| Rect.prototype.clear = function () { | ||
| this.toNaN(); | ||
| }; | ||
| Rect.prototype.reset = function () { | ||
| this.toNaN(); | ||
| }; | ||
| Rect.prototype.x = function () { | ||
| return this._x; | ||
| }; | ||
| Rect.prototype.setX = function (x) { | ||
| this._x = x; | ||
| }; | ||
| Rect.prototype.y = function () { | ||
| return this._y; | ||
| }; | ||
| Rect.prototype.setY = function (y) { | ||
| this._y = y; | ||
| }; | ||
| Rect.prototype.clone = function (target) { | ||
| if (target) { | ||
| this.copy(target); | ||
| return target; | ||
| } | ||
| return new Rect(this.x(), this.y(), this.width(), this.height()); | ||
| }; | ||
| Rect.prototype.copy = function (dest) { | ||
| if (!dest) { | ||
| return this.clone(); | ||
| } | ||
| dest.setX(this.x()); | ||
| dest.setY(this.y()); | ||
| dest.setWidth(this.width()); | ||
| dest.setHeight(this.height()); | ||
| return dest; | ||
| }; | ||
| Rect.prototype.translate = function (x, y) { | ||
| this.setX(this.x() + x); | ||
| this.setY(this.y() + y); | ||
| }; | ||
| Rect.prototype.scale = function (sx, sy) { | ||
| if (arguments.length < 2) { | ||
| sy = sx; | ||
| } | ||
| this.setX(this.x() * sx); | ||
| this.setY(this.y() * sy); | ||
| this.setWidth(this.width() * sx); | ||
| this.setHeight(this.height() * sy); | ||
| }; | ||
| Rect.prototype.height = function () { | ||
| return this._height; | ||
| }; | ||
| Rect.prototype.setHeight = function (height) { | ||
| this._height = height; | ||
| }; | ||
| Rect.prototype.width = function () { | ||
| return this._width; | ||
| }; | ||
| Rect.prototype.w = function () { | ||
| return this.width(); | ||
| }; | ||
| Rect.prototype.h = function () { | ||
| return this.height(); | ||
| }; | ||
| Rect.prototype.setWidth = function (width) { | ||
| this._width = width; | ||
| }; | ||
| Rect.prototype.toString = function () { | ||
| return "[Rect x=" + this.x() + ", y=" + this.y() + ", w=" + this.width() + ", h=" + this.height() + "]"; | ||
| }; | ||
| Rect.prototype.vMin = function () { | ||
| return this.y() - this.height() / 2; | ||
| }; | ||
| Rect.prototype.vMax = function () { | ||
| return this.y() + this.height() / 2; | ||
| }; | ||
| Rect.prototype.hMin = function () { | ||
| return this.x() - this.width() / 2; | ||
| }; | ||
| Rect.prototype.hMax = function () { | ||
| return this.x() + this.width() / 2; | ||
| }; | ||
| Rect.prototype.include = function (bx, by, bwidth, bheight) { | ||
| if (this.isNaN()) { | ||
| this._x = bx; | ||
| this._y = by; | ||
| this._width = bwidth; | ||
| this._height = bheight; | ||
| return; | ||
| } | ||
| var ax = this._x; | ||
| var ay = this._y; | ||
| var awidth = this._width; | ||
| var aheight = this._height; | ||
| var leftEdge = Math.min(ax - awidth / 2, bx - bwidth / 2); | ||
| var rightEdge = Math.max(ax + awidth / 2, bx + bwidth / 2); | ||
| var topEdge = Math.min(ay - aheight / 2, by - bheight / 2); | ||
| var bottomEdge = Math.max(ay + aheight / 2, by + bheight / 2); | ||
| var w = rightEdge - leftEdge; | ||
| var h = bottomEdge - topEdge; | ||
| var x = leftEdge + w / 2; | ||
| var y = topEdge + h / 2; | ||
| this._x = x; | ||
| this._y = y; | ||
| this._width = w; | ||
| this._height = h; | ||
| }; | ||
| return Rect; | ||
| }(); | ||
| /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Rect); | ||
| /******/ return __webpack_exports__; | ||
| /******/ })() | ||
| ; | ||
| }); | ||
| !function(t,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof exports?exports.parsegraph_rect=i():t.parsegraph_rect=i()}(this,(function(){return(()=>{"use strict";var t={d:(i,e)=>{for(var h in e)t.o(e,h)&&!t.o(i,h)&&Object.defineProperty(i,h,{enumerable:!0,get:e[h]})},o:(t,i)=>Object.prototype.hasOwnProperty.call(t,i),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},i={};t.r(i),t.d(i,{default:()=>h});var e=function(){function t(t,i,e,h){this._x=t,this._y=i,this._width=e,this._height=h}return t.prototype.isNaN=function(){return isNaN(this._x)||isNaN(this._y)||isNaN(this._width)||isNaN(this._height)},t.prototype.toNaN=function(){this._x=NaN,this._y=NaN,this._width=NaN,this._height=NaN},t.prototype.clear=function(){this.toNaN()},t.prototype.reset=function(){this.toNaN()},t.prototype.x=function(){return this._x},t.prototype.setX=function(t){this._x=t},t.prototype.y=function(){return this._y},t.prototype.setY=function(t){this._y=t},t.prototype.clone=function(i){return i?(this.copy(i),i):new t(this.x(),this.y(),this.width(),this.height())},t.prototype.copy=function(t){return t?(t.setX(this.x()),t.setY(this.y()),t.setWidth(this.width()),t.setHeight(this.height()),t):this.clone()},t.prototype.translate=function(t,i){this.setX(this.x()+t),this.setY(this.y()+i)},t.prototype.scale=function(t,i){arguments.length<2&&(i=t),this.setX(this.x()*t),this.setY(this.y()*i),this.setWidth(this.width()*t),this.setHeight(this.height()*i)},t.prototype.height=function(){return this._height},t.prototype.setHeight=function(t){this._height=t},t.prototype.width=function(){return this._width},t.prototype.w=function(){return this.width()},t.prototype.h=function(){return this.height()},t.prototype.setWidth=function(t){this._width=t},t.prototype.toString=function(){return"[Rect x="+this.x()+", y="+this.y()+", w="+this.width()+", h="+this.height()+"]"},t.prototype.vMin=function(){return this.y()-this.height()/2},t.prototype.vMax=function(){return this.y()+this.height()/2},t.prototype.hMin=function(){return this.x()-this.width()/2},t.prototype.hMax=function(){return this.x()+this.width()/2},t.prototype.include=function(t,i,e,h){if(this.isNaN())return this._x=t,this._y=i,this._width=e,void(this._height=h);var o=this._x,s=this._y,n=this._width,r=this._height,p=Math.min(o-n/2,t-e/2),u=Math.max(o+n/2,t+e/2),y=Math.min(s-r/2,i-h/2),c=u-p,f=Math.max(s+r/2,i+h/2)-y,a=p+c/2,d=y+f/2;this._x=a,this._y=d,this._width=c,this._height=f},t}();const h=e;return i})()})); | ||
| //# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;UCVA;UACA;;;;;WCDA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;ACNA;AACA,IAAIA,IAAI;AAAG;AAAe,YAAY;AAClC,WAASA,IAAT,CAAcC,CAAd,EAAiBC,CAAjB,EAAoBC,KAApB,EAA2BC,MAA3B,EAAmC;AAC/B,SAAKC,EAAL,GAAUJ,CAAV;AACA,SAAKK,EAAL,GAAUJ,CAAV;AACA,SAAKK,MAAL,GAAcJ,KAAd;AACA,SAAKK,OAAL,GAAeJ,MAAf;AACH;;AACDJ,EAAAA,IAAI,CAACS,SAAL,CAAeC,KAAf,GAAuB,YAAY;AAC/B,WAAQA,KAAK,CAAC,KAAKL,EAAN,CAAL,IACJK,KAAK,CAAC,KAAKJ,EAAN,CADD,IAEJI,KAAK,CAAC,KAAKH,MAAN,CAFD,IAGJG,KAAK,CAAC,KAAKF,OAAN,CAHT;AAIH,GALD;;AAMAR,EAAAA,IAAI,CAACS,SAAL,CAAeE,KAAf,GAAuB,YAAY;AAC/B,SAAKN,E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","webpack://parsegraph_rect/webpack/bootstrap","webpack://parsegraph_rect/webpack/runtime/define property getters","webpack://parsegraph_rect/webpack/runtime/hasOwnProperty shorthand","webpack://parsegraph_rect/webpack/runtime/make namespace object","webpack://parsegraph_rect/./src/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"parsegraph_rect\"] = factory();\n\telse\n\t\troot[\"parsegraph_rect\"] = factory();\n})(this, function() {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/* eslint-disable require-jsdoc */\nvar Rect = /** @class */ (function () {\n function Rect(x, y, width, height) {\n this._x = x;\n this._y = y;\n this._width = width;\n this._height = height;\n }\n Rect.prototype.isNaN = function () {\n return (isNaN(this._x) ||\n isNaN(this._y) ||\n isNaN(this._width) ||\n isNaN(this._height));\n };\n Rect.prototype.toNaN = function () {\n this._x = NaN;\n this._y = NaN;\n this._width = NaN;\n this._height = NaN;\n };\n Rect.prototype.clear = function () {\n this.toNaN();\n };\n Rect.prototype.reset = function () {\n this.toNaN();\n };\n Rect.prototype.x = function () {\n return this._x;\n };\n Rect.prototype.setX = function (x) {\n this._x = x;\n };\n Rect.prototype.y = function () {\n return this._y;\n };\n Rect.prototype.setY = function (y) {\n this._y = y;\n };\n Rect.prototype.clone = function (target) {\n if (target) {\n this.copy(target);\n return target;\n }\n return new Rect(this.x(), this.y(), this.width(), this.height());\n };\n Rect.prototype.copy = function (dest) {\n if (!dest) {\n return this.clone();\n }\n dest.setX(this.x());\n dest.setY(this.y());\n dest.setWidth(this.width());\n dest.setHeight(this.height());\n return dest;\n };\n Rect.prototype.translate = function (x, y) {\n this.setX(this.x() + x);\n this.setY(this.y() + y);\n };\n Rect.prototype.scale = function (sx, sy) {\n if (arguments.length < 2) {\n sy = sx;\n }\n this.setX(this.x() * sx);\n this.setY(this.y() * sy);\n this.setWidth(this.width() * sx);\n this.setHeight(this.height() * sy);\n };\n Rect.prototype.height = function () {\n return this._height;\n };\n Rect.prototype.setHeight = function (height) {\n this._height = height;\n };\n Rect.prototype.width = function () {\n return this._width;\n };\n Rect.prototype.w = function () {\n return this.width();\n };\n Rect.prototype.h = function () {\n return this.height();\n };\n Rect.prototype.setWidth = function (width) {\n this._width = width;\n };\n Rect.prototype.toString = function () {\n return (\"[Rect x=\" +\n this.x() +\n \", y=\" +\n this.y() +\n \", w=\" +\n this.width() +\n \", h=\" +\n this.height() +\n \"]\");\n };\n Rect.prototype.vMin = function () {\n return this.y() - this.height() / 2;\n };\n Rect.prototype.vMax = function () {\n return this.y() + this.height() / 2;\n };\n Rect.prototype.hMin = function () {\n return this.x() - this.width() / 2;\n };\n Rect.prototype.hMax = function () {\n return this.x() + this.width() / 2;\n };\n Rect.prototype.include = function (bx, by, bwidth, bheight) {\n if (this.isNaN()) {\n this._x = bx;\n this._y = by;\n this._width = bwidth;\n this._height = bheight;\n return;\n }\n var ax = this._x;\n var ay = this._y;\n var awidth = this._width;\n var aheight = this._height;\n var leftEdge = Math.min(ax - awidth / 2, bx - bwidth / 2);\n var rightEdge = Math.max(ax + awidth / 2, bx + bwidth / 2);\n var topEdge = Math.min(ay - aheight / 2, by - bheight / 2);\n var bottomEdge = Math.max(ay + aheight / 2, by + bheight / 2);\n var w = rightEdge - leftEdge;\n var h = bottomEdge - topEdge;\n var x = leftEdge + w / 2;\n var y = topEdge + h / 2;\n this._x = x;\n this._y = y;\n this._width = w;\n this._height = h;\n };\n return Rect;\n}());\nexport default Rect;\n"],"names":["Rect","x","y","width","height","_x","_y","_width","_height","prototype","isNaN","toNaN","NaN","clear","reset","setX","setY","clone","target","copy","dest","setWidth","setHeight","translate","scale","sx","sy","arguments","length","w","h","toString","vMin","vMax","hMin","hMax","include","bx","by","bwidth","bheight","ax","ay","awidth","aheight","leftEdge","Math","min","rightEdge","max","topEdge","bottomEdge"],"sourceRoot":""} | ||
| {"version":3,"file":"index.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAyB,gBAAID,IAE7BD,EAAsB,gBAAIC,IAR5B,CASGK,MAAM,WACT,M,mBCTA,IAAIC,EAAsB,CCA1BA,EAAwB,CAACL,EAASM,KACjC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAER,EAASO,IAC5EE,OAAOC,eAAeV,EAASO,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3EF,EAAwB,CAACQ,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFT,EAAyBL,IACH,oBAAXkB,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeV,EAASkB,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeV,EAAS,aAAc,CAAEoB,OAAO,M,mCCHvD,iBAME,WAAYC,EAAYC,EAAYC,EAAgBC,GAClDpB,KAAKqB,GAAKJ,EACVjB,KAAKsB,GAAKJ,EACVlB,KAAKuB,OAASJ,EACdnB,KAAKwB,QAAUJ,EA+JnB,OA5JEK,EAA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,EAAU,EAAGN,EAAKE,EAAU,GAGpDW,EAAIH,EAAYH,EAChBO,EAHaN,KAAKG,IAAIP,EAAKE,EAAU,EAAGN,EAAKE,EAAU,GAGtCU,EACjBrC,EAAIgC,EAAWM,EAAI,EACnBrC,EAAIoC,EAAUE,EAAI,EAExBxD,KAAKqB,GAAKJ,EACVjB,KAAKsB,GAAKJ,EACVlB,KAAKuB,OAASgC,EACdvD,KAAKwB,QAAUgC,GAEnB,EAzKA,G","sources":["webpack://parsegraph_rect/webpack/universalModuleDefinition","webpack://parsegraph_rect/webpack/bootstrap","webpack://parsegraph_rect/webpack/runtime/define property getters","webpack://parsegraph_rect/webpack/runtime/hasOwnProperty shorthand","webpack://parsegraph_rect/webpack/runtime/make namespace object","webpack://parsegraph_rect/./src/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"parsegraph_rect\"] = factory();\n\telse\n\t\troot[\"parsegraph_rect\"] = factory();\n})(this, function() {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/* eslint-disable require-jsdoc */\n\nexport default class Rect {\n _x: number;\n _y: number;\n _width: number;\n _height: number;\n\n constructor(x?: number, y?: number, width?: number, height?: number) {\n this._x = x;\n this._y = y;\n this._width = width;\n this._height = height;\n }\n\n isNaN(): boolean {\n return (\n isNaN(this._x) ||\n isNaN(this._y) ||\n isNaN(this._width) ||\n isNaN(this._height)\n );\n }\n\n toNaN(): void {\n this._x = NaN;\n this._y = NaN;\n this._width = NaN;\n this._height = NaN;\n }\n\n clear(): void {\n this.toNaN();\n }\n\n reset(): void {\n this.toNaN();\n }\n\n x(): number {\n return this._x;\n }\n\n setX(x: number): void {\n this._x = x;\n }\n\n y(): number {\n return this._y;\n }\n\n setY(y: number): void {\n this._y = y;\n }\n\n clone(target?: Rect) {\n if (target) {\n this.copy(target);\n return target;\n }\n return new Rect(this.x(), this.y(), this.width(), this.height());\n }\n\n copy(dest?: Rect): Rect {\n if (!dest) {\n return this.clone();\n }\n dest.setX(this.x());\n dest.setY(this.y());\n dest.setWidth(this.width());\n dest.setHeight(this.height());\n return dest;\n }\n\n translate(x: number, y: number): void {\n this.setX(this.x() + x);\n this.setY(this.y() + y);\n }\n\n scale(sx: number, sy?: number): void {\n if (arguments.length < 2) {\n sy = sx;\n }\n this.setX(this.x() * sx);\n this.setY(this.y() * sy);\n this.setWidth(this.width() * sx);\n this.setHeight(this.height() * sy);\n }\n\n height(): number {\n return this._height;\n }\n\n setHeight(height: number): void {\n this._height = height;\n }\n\n width(): number {\n return this._width;\n }\n\n w() {\n return this.width();\n }\n\n h() {\n return this.height();\n }\n\n setWidth(width: number): void {\n this._width = width;\n }\n\n toString(): string {\n return (\n \"[Rect x=\" +\n this.x() +\n \", y=\" +\n this.y() +\n \", w=\" +\n this.width() +\n \", h=\" +\n this.height() +\n \"]\"\n );\n }\n\n vMin(): number {\n return this.y() - this.height() / 2;\n }\n\n vMax(): number {\n return this.y() + this.height() / 2;\n }\n\n hMin(): number {\n return this.x() - this.width() / 2;\n }\n\n hMax(): number {\n return this.x() + this.width() / 2;\n }\n\n include(bx: number, by: number, bwidth: number, bheight: number): void {\n if (this.isNaN()) {\n this._x = bx;\n this._y = by;\n this._width = bwidth;\n this._height = bheight;\n return;\n }\n const ax = this._x;\n const ay = this._y;\n const awidth = this._width;\n const aheight = this._height;\n\n const leftEdge = Math.min(ax - awidth / 2, bx - bwidth / 2);\n const rightEdge = Math.max(ax + awidth / 2, bx + bwidth / 2);\n const topEdge = Math.min(ay - aheight / 2, by - bheight / 2);\n const bottomEdge = Math.max(ay + aheight / 2, by + bheight / 2);\n\n const w = rightEdge - leftEdge;\n const h = bottomEdge - topEdge;\n const x = leftEdge + w / 2;\n const y = topEdge + h / 2;\n\n this._x = x;\n this._y = y;\n this._width = w;\n this._height = h;\n }\n}\n"],"names":["root","factory","exports","module","define","amd","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","x","y","width","height","_x","_y","_width","_height","Rect","isNaN","NaN","toNaN","target","copy","dest","setX","setY","setWidth","setHeight","clone","sx","sy","arguments","length","bx","by","bwidth","bheight","ax","ay","awidth","aheight","leftEdge","Math","min","rightEdge","max","topEdge","w","h"],"sourceRoot":""} |
| { | ||
| "name": "parsegraph-rect", | ||
| "version": "1.5.2-dev", | ||
| "version": "1.5.2", | ||
| "description": "rectangle class", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
| export {}; | ||
| //# sourceMappingURL=demo.d.ts.map |
| {"version":3,"file":"demo.d.ts","sourceRoot":"","sources":["../../src/demo.ts"],"names":[],"mappings":""} |
| (function webpackUniversalModuleDefinition(root, factory) { | ||
| if(typeof exports === 'object' && typeof module === 'object') | ||
| module.exports = factory(); | ||
| else if(typeof define === 'function' && define.amd) | ||
| define([], factory); | ||
| else if(typeof exports === 'object') | ||
| exports["parsegraph_rect"] = factory(); | ||
| else | ||
| root["parsegraph_rect"] = factory(); | ||
| })(this, function() { | ||
| return /******/ (() => { // webpackBootstrap | ||
| /******/ "use strict"; | ||
| /******/ var __webpack_modules__ = ({ | ||
| /***/ "./src/index.ts": | ||
| /*!**********************!*\ | ||
| !*** ./src/index.ts ***! | ||
| \**********************/ | ||
| /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | ||
| __webpack_require__.r(__webpack_exports__); | ||
| /* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
| /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | ||
| /* harmony export */ }); | ||
| /* eslint-disable require-jsdoc */ | ||
| var Rect = | ||
| /** @class */ | ||
| function () { | ||
| function Rect(x, y, width, height) { | ||
| this._x = x; | ||
| this._y = y; | ||
| this._width = width; | ||
| this._height = height; | ||
| } | ||
| Rect.prototype.isNaN = function () { | ||
| return isNaN(this._x) || isNaN(this._y) || isNaN(this._width) || isNaN(this._height); | ||
| }; | ||
| Rect.prototype.toNaN = function () { | ||
| this._x = NaN; | ||
| this._y = NaN; | ||
| this._width = NaN; | ||
| this._height = NaN; | ||
| }; | ||
| Rect.prototype.clear = function () { | ||
| this.toNaN(); | ||
| }; | ||
| Rect.prototype.reset = function () { | ||
| this.toNaN(); | ||
| }; | ||
| Rect.prototype.x = function () { | ||
| return this._x; | ||
| }; | ||
| Rect.prototype.setX = function (x) { | ||
| this._x = x; | ||
| }; | ||
| Rect.prototype.y = function () { | ||
| return this._y; | ||
| }; | ||
| Rect.prototype.setY = function (y) { | ||
| this._y = y; | ||
| }; | ||
| Rect.prototype.clone = function (target) { | ||
| if (target) { | ||
| this.copy(target); | ||
| return target; | ||
| } | ||
| return new Rect(this.x(), this.y(), this.width(), this.height()); | ||
| }; | ||
| Rect.prototype.copy = function (dest) { | ||
| if (!dest) { | ||
| return this.clone(); | ||
| } | ||
| dest.setX(this.x()); | ||
| dest.setY(this.y()); | ||
| dest.setWidth(this.width()); | ||
| dest.setHeight(this.height()); | ||
| return dest; | ||
| }; | ||
| Rect.prototype.translate = function (x, y) { | ||
| this.setX(this.x() + x); | ||
| this.setY(this.y() + y); | ||
| }; | ||
| Rect.prototype.scale = function (sx, sy) { | ||
| if (arguments.length < 2) { | ||
| sy = sx; | ||
| } | ||
| this.setX(this.x() * sx); | ||
| this.setY(this.y() * sy); | ||
| this.setWidth(this.width() * sx); | ||
| this.setHeight(this.height() * sy); | ||
| }; | ||
| Rect.prototype.height = function () { | ||
| return this._height; | ||
| }; | ||
| Rect.prototype.setHeight = function (height) { | ||
| this._height = height; | ||
| }; | ||
| Rect.prototype.width = function () { | ||
| return this._width; | ||
| }; | ||
| Rect.prototype.w = function () { | ||
| return this.width(); | ||
| }; | ||
| Rect.prototype.h = function () { | ||
| return this.height(); | ||
| }; | ||
| Rect.prototype.setWidth = function (width) { | ||
| this._width = width; | ||
| }; | ||
| Rect.prototype.toString = function () { | ||
| return "[Rect x=" + this.x() + ", y=" + this.y() + ", w=" + this.width() + ", h=" + this.height() + "]"; | ||
| }; | ||
| Rect.prototype.vMin = function () { | ||
| return this.y() - this.height() / 2; | ||
| }; | ||
| Rect.prototype.vMax = function () { | ||
| return this.y() + this.height() / 2; | ||
| }; | ||
| Rect.prototype.hMin = function () { | ||
| return this.x() - this.width() / 2; | ||
| }; | ||
| Rect.prototype.hMax = function () { | ||
| return this.x() + this.width() / 2; | ||
| }; | ||
| Rect.prototype.include = function (bx, by, bwidth, bheight) { | ||
| if (this.isNaN()) { | ||
| this._x = bx; | ||
| this._y = by; | ||
| this._width = bwidth; | ||
| this._height = bheight; | ||
| return; | ||
| } | ||
| var ax = this._x; | ||
| var ay = this._y; | ||
| var awidth = this._width; | ||
| var aheight = this._height; | ||
| var leftEdge = Math.min(ax - awidth / 2, bx - bwidth / 2); | ||
| var rightEdge = Math.max(ax + awidth / 2, bx + bwidth / 2); | ||
| var topEdge = Math.min(ay - aheight / 2, by - bheight / 2); | ||
| var bottomEdge = Math.max(ay + aheight / 2, by + bheight / 2); | ||
| var w = rightEdge - leftEdge; | ||
| var h = bottomEdge - topEdge; | ||
| var x = leftEdge + w / 2; | ||
| var y = topEdge + h / 2; | ||
| this._x = x; | ||
| this._y = y; | ||
| this._width = w; | ||
| this._height = h; | ||
| }; | ||
| return Rect; | ||
| }(); | ||
| /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Rect); | ||
| /***/ }) | ||
| /******/ }); | ||
| /************************************************************************/ | ||
| /******/ // The module cache | ||
| /******/ var __webpack_module_cache__ = {}; | ||
| /******/ | ||
| /******/ // The require function | ||
| /******/ function __webpack_require__(moduleId) { | ||
| /******/ // Check if module is in cache | ||
| /******/ var cachedModule = __webpack_module_cache__[moduleId]; | ||
| /******/ if (cachedModule !== undefined) { | ||
| /******/ return cachedModule.exports; | ||
| /******/ } | ||
| /******/ // Create a new module (and put it into the cache) | ||
| /******/ var module = __webpack_module_cache__[moduleId] = { | ||
| /******/ // no module.id needed | ||
| /******/ // no module.loaded needed | ||
| /******/ exports: {} | ||
| /******/ }; | ||
| /******/ | ||
| /******/ // Execute the module function | ||
| /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); | ||
| /******/ | ||
| /******/ // Return the exports of the module | ||
| /******/ return module.exports; | ||
| /******/ } | ||
| /******/ | ||
| /************************************************************************/ | ||
| /******/ /* webpack/runtime/define property getters */ | ||
| /******/ (() => { | ||
| /******/ // define getter functions for harmony exports | ||
| /******/ __webpack_require__.d = (exports, definition) => { | ||
| /******/ for(var key in definition) { | ||
| /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | ||
| /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | ||
| /******/ } | ||
| /******/ } | ||
| /******/ }; | ||
| /******/ })(); | ||
| /******/ | ||
| /******/ /* webpack/runtime/hasOwnProperty shorthand */ | ||
| /******/ (() => { | ||
| /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) | ||
| /******/ })(); | ||
| /******/ | ||
| /******/ /* webpack/runtime/make namespace object */ | ||
| /******/ (() => { | ||
| /******/ // define __esModule on exports | ||
| /******/ __webpack_require__.r = (exports) => { | ||
| /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | ||
| /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
| /******/ } | ||
| /******/ Object.defineProperty(exports, '__esModule', { value: true }); | ||
| /******/ }; | ||
| /******/ })(); | ||
| /******/ | ||
| /************************************************************************/ | ||
| var __webpack_exports__ = {}; | ||
| // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. | ||
| (() => { | ||
| /*!*********************!*\ | ||
| !*** ./src/demo.ts ***! | ||
| \*********************/ | ||
| __webpack_require__.r(__webpack_exports__); | ||
| /* harmony import */ var ___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! . */ "./src/index.ts"); | ||
| document.addEventListener("DOMContentLoaded", function () { | ||
| var root = document.getElementById("demo"); | ||
| root.style.position = "relative"; | ||
| var rect = new ___WEBPACK_IMPORTED_MODULE_0__["default"](200, 200, 100, 100); | ||
| var container = document.createElement("div"); | ||
| container.innerHTML = "".concat(JSON.stringify(rect.toString())); | ||
| container.style.position = "absolute"; | ||
| container.style.left = "0px"; | ||
| container.style.top = "0px"; | ||
| container.style.pointerEvents = "none"; | ||
| root.appendChild(container); | ||
| container.style.fontSize = "18px"; | ||
| container.style.fontFamily = "sans"; | ||
| var refresh = function refresh() { | ||
| var rand = function rand() { | ||
| return Math.floor(Math.random() * 255); | ||
| }; | ||
| document.body.style.backgroundColor = "rgb(".concat(rand(), ", ").concat(rand(), ", ").concat(rand(), ")"); | ||
| container.style.color = "rgb(".concat(rand(), ", ").concat(rand(), ", ").concat(rand(), ")"); | ||
| container.style.left = "".concat(Math.random() * root.clientWidth, "px"); | ||
| container.style.top = "".concat(Math.random() * root.clientHeight, "px"); | ||
| }; | ||
| var dot = document.createElement("div"); | ||
| dot.style.position = "absolute"; | ||
| dot.style.right = "8px"; | ||
| dot.style.top = "8px"; | ||
| dot.style.width = "16px"; | ||
| dot.style.height = "16px"; | ||
| dot.style.borderRadius = "8px"; | ||
| dot.style.transition = "background-color 400ms"; | ||
| dot.style.backgroundColor = "#222"; | ||
| root.appendChild(dot); | ||
| container.style.transition = "color 2s, left 2s, top 2s"; | ||
| document.body.style.transition = "background-color 2s"; | ||
| var timer = null; | ||
| var dotTimer = null; | ||
| var dotIndex = 0; | ||
| var dotState = ["#f00", "#c00"]; | ||
| var refreshDot = function refreshDot() { | ||
| dotIndex = (dotIndex + 1) % dotState.length; | ||
| dot.style.backgroundColor = dotState[dotIndex]; | ||
| }; | ||
| var interval = 3000; | ||
| var dotInterval = 500; | ||
| root.addEventListener("click", function () { | ||
| if (timer) { | ||
| clearInterval(timer); | ||
| timer = null; | ||
| clearInterval(dotTimer); | ||
| dotTimer = null; | ||
| dot.style.transition = "background-color 3s"; | ||
| dot.style.backgroundColor = "#222"; | ||
| } else { | ||
| refresh(); | ||
| dot.style.transition = "background-color 400ms"; | ||
| refreshDot(); | ||
| timer = setInterval(refresh, interval); | ||
| dotTimer = setInterval(refreshDot, dotInterval); | ||
| } | ||
| }); | ||
| }); | ||
| })(); | ||
| /******/ return __webpack_exports__; | ||
| /******/ })() | ||
| ; | ||
| }); | ||
| //# sourceMappingURL=demo.js.map |
| {"version":3,"file":"demo.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;;;;;ACVA;AACA,IAAIA,IAAI;AAAG;AAAe,YAAY;AAClC,WAASA,IAAT,CAAcC,CAAd,EAAiBC,CAAjB,EAAoBC,KAApB,EAA2BC,MAA3B,EAAmC;AAC/B,SAAKC,EAAL,GAAUJ,CAAV;AACA,SAAKK,EAAL,GAAUJ,CAAV;AACA,SAAKK,MAAL,GAAcJ,KAAd;AACA,SAAKK,OAAL,GAAeJ,MAAf;AACH;;AACDJ,EAAAA,IAAI,CAACS,SAAL,CAAeC,KAAf,GAAuB,YAAY;AAC/B,WAAQA,KAAK,CAAC,KAAKL,EAAN,CAAL,IACJK,KAAK,CAAC,KAAKJ,EAAN,CADD,IAEJI,KAAK,CAAC,KAAKH,MAAN,CAFD,I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MAAAA,GAAG,CAACxB,KAAJ,CAAUoB,eAAV,GAA4B,MAA5B;AACH,KAPD,MAQK;AACDL,MAAAA,OAAO;AACPS,MAAAA,GAAG,CAACxB,KAAJ,CAAU2B,UAAV,GAAuB,wBAAvB;AACAK,MAAAA,UAAU;AACVJ,MAAAA,KAAK,GAAGQ,WAAW,CAACrB,OAAD,EAAUkB,QAAV,CAAnB;AACAJ,MAAAA,QAAQ,GAAGO,WAAW,CAACJ,UAAD,EAAaE,WAAb,CAAtB;AACH;AACJ,GAhBD;AAiBH,CA3DD,E","sources":["webpack://parsegraph_rect/webpack/universalModuleDefinition","webpack://parsegraph_rect/./src/index.ts","webpack://parsegraph_rect/webpack/bootstrap","webpack://parsegraph_rect/webpack/runtime/define property getters","webpack://parsegraph_rect/webpack/runtime/hasOwnProperty shorthand","webpack://parsegraph_rect/webpack/runtime/make namespace object","webpack://parsegraph_rect/./src/demo.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"parsegraph_rect\"] = factory();\n\telse\n\t\troot[\"parsegraph_rect\"] = factory();\n})(this, function() {\nreturn ","/* eslint-disable require-jsdoc */\nvar Rect = /** @class */ (function () {\n function Rect(x, y, width, height) {\n this._x = x;\n this._y = y;\n this._width = width;\n this._height = height;\n }\n Rect.prototype.isNaN = function () {\n return (isNaN(this._x) ||\n isNaN(this._y) ||\n isNaN(this._width) ||\n isNaN(this._height));\n };\n Rect.prototype.toNaN = function () {\n this._x = NaN;\n this._y = NaN;\n this._width = NaN;\n this._height = NaN;\n };\n Rect.prototype.clear = function () {\n this.toNaN();\n };\n Rect.prototype.reset = function () {\n this.toNaN();\n };\n Rect.prototype.x = function () {\n return this._x;\n };\n Rect.prototype.setX = function (x) {\n this._x = x;\n };\n Rect.prototype.y = function () {\n return this._y;\n };\n Rect.prototype.setY = function (y) {\n this._y = y;\n };\n Rect.prototype.clone = function (target) {\n if (target) {\n this.copy(target);\n return target;\n }\n return new Rect(this.x(), this.y(), this.width(), this.height());\n };\n Rect.prototype.copy = function (dest) {\n if (!dest) {\n return this.clone();\n }\n dest.setX(this.x());\n dest.setY(this.y());\n dest.setWidth(this.width());\n dest.setHeight(this.height());\n return dest;\n };\n Rect.prototype.translate = function (x, y) {\n this.setX(this.x() + x);\n this.setY(this.y() + y);\n };\n Rect.prototype.scale = function (sx, sy) {\n if (arguments.length < 2) {\n sy = sx;\n }\n this.setX(this.x() * sx);\n this.setY(this.y() * sy);\n this.setWidth(this.width() * sx);\n this.setHeight(this.height() * sy);\n };\n Rect.prototype.height = function () {\n return this._height;\n };\n Rect.prototype.setHeight = function (height) {\n this._height = height;\n };\n Rect.prototype.width = function () {\n return this._width;\n };\n Rect.prototype.w = function () {\n return this.width();\n };\n Rect.prototype.h = function () {\n return this.height();\n };\n Rect.prototype.setWidth = function (width) {\n this._width = width;\n };\n Rect.prototype.toString = function () {\n return (\"[Rect x=\" +\n this.x() +\n \", y=\" +\n this.y() +\n \", w=\" +\n this.width() +\n \", h=\" +\n this.height() +\n \"]\");\n };\n Rect.prototype.vMin = function () {\n return this.y() - this.height() / 2;\n };\n Rect.prototype.vMax = function () {\n return this.y() + this.height() / 2;\n };\n Rect.prototype.hMin = function () {\n return this.x() - this.width() / 2;\n };\n Rect.prototype.hMax = function () {\n return this.x() + this.width() / 2;\n };\n Rect.prototype.include = function (bx, by, bwidth, bheight) {\n if (this.isNaN()) {\n this._x = bx;\n this._y = by;\n this._width = bwidth;\n this._height = bheight;\n return;\n }\n var ax = this._x;\n var ay = this._y;\n var awidth = this._width;\n var aheight = this._height;\n var leftEdge = Math.min(ax - awidth / 2, bx - bwidth / 2);\n var rightEdge = Math.max(ax + awidth / 2, bx + bwidth / 2);\n var topEdge = Math.min(ay - aheight / 2, by - bheight / 2);\n var bottomEdge = Math.max(ay + aheight / 2, by + bheight / 2);\n var w = rightEdge - leftEdge;\n var h = bottomEdge - topEdge;\n var x = leftEdge + w / 2;\n var y = topEdge + h / 2;\n this._x = x;\n this._y = y;\n this._width = w;\n this._height = h;\n };\n return Rect;\n}());\nexport default Rect;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import Rect from \".\";\ndocument.addEventListener(\"DOMContentLoaded\", function () {\n var root = document.getElementById(\"demo\");\n root.style.position = \"relative\";\n var rect = new Rect(200, 200, 100, 100);\n var container = document.createElement(\"div\");\n container.innerHTML = \"\".concat(JSON.stringify(rect.toString()));\n container.style.position = \"absolute\";\n container.style.left = \"0px\";\n container.style.top = \"0px\";\n container.style.pointerEvents = \"none\";\n root.appendChild(container);\n container.style.fontSize = \"18px\";\n container.style.fontFamily = \"sans\";\n var refresh = function () {\n var rand = function () { return Math.floor(Math.random() * 255); };\n document.body.style.backgroundColor = \"rgb(\".concat(rand(), \", \").concat(rand(), \", \").concat(rand(), \")\");\n container.style.color = \"rgb(\".concat(rand(), \", \").concat(rand(), \", \").concat(rand(), \")\");\n container.style.left = \"\".concat(Math.random() * root.clientWidth, \"px\");\n container.style.top = \"\".concat(Math.random() * root.clientHeight, \"px\");\n };\n var dot = document.createElement(\"div\");\n dot.style.position = \"absolute\";\n dot.style.right = \"8px\";\n dot.style.top = \"8px\";\n dot.style.width = \"16px\";\n dot.style.height = \"16px\";\n dot.style.borderRadius = \"8px\";\n dot.style.transition = \"background-color 400ms\";\n dot.style.backgroundColor = \"#222\";\n root.appendChild(dot);\n container.style.transition = \"color 2s, left 2s, top 2s\";\n document.body.style.transition = \"background-color 2s\";\n var timer = null;\n var dotTimer = null;\n var dotIndex = 0;\n var dotState = [\"#f00\", \"#c00\"];\n var refreshDot = function () {\n dotIndex = (dotIndex + 1) % dotState.length;\n dot.style.backgroundColor = dotState[dotIndex];\n };\n var interval = 3000;\n var dotInterval = 500;\n root.addEventListener(\"click\", function () {\n if (timer) {\n clearInterval(timer);\n timer = null;\n clearInterval(dotTimer);\n dotTimer = null;\n dot.style.transition = \"background-color 3s\";\n dot.style.backgroundColor = \"#222\";\n }\n else {\n refresh();\n dot.style.transition = \"background-color 400ms\";\n refreshDot();\n timer = setInterval(refresh, interval);\n dotTimer = setInterval(refreshDot, dotInterval);\n }\n });\n});\n"],"names":["Rect","x","y","width","height","_x","_y","_width","_height","prototype","isNaN","toNaN","NaN","clear","reset","setX","setY","clone","target","copy","dest","setWidth","setHeight","translate","scale","sx","sy","arguments","length","w","h","toString","vMin","vMax","hMin","hMax","include","bx","by","bwidth","bheight","ax","ay","awidth","aheight","leftEdge","Math","min","rightEdge","max","topEdge","bottomEdge","document","addEventListener","root","getElementById","style","position","rect","container","createElement","innerHTML","concat","JSON","stringify","left","top","pointerEvents","appendChild","fontSize","fontFamily","refresh","rand","floor","random","body","backgroundColor","color","clientWidth","clientHeight","dot","right","borderRadius","transition","timer","dotTimer","dotIndex","dotState","refreshDot","interval","dotInterval","clearInterval","setInterval"],"sourceRoot":""} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
15797
-67.51%7
-36.36%42
-91.57%