@hpcc-js/react 2.54.0 → 3.1.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.
Files changed (65) hide show
  1. package/dist/index.js +2 -575
  2. package/dist/index.js.map +7 -1
  3. package/package.json +34 -33
  4. package/src/ImageChar.tsx +12 -9
  5. package/src/__package__.ts +2 -2
  6. package/src/edge.tsx +3 -3
  7. package/src/icon.tsx +10 -10
  8. package/src/image.tsx +3 -3
  9. package/src/index.ts +15 -13
  10. package/src/render.ts +46 -17
  11. package/src/shape.tsx +15 -15
  12. package/src/span.tsx +9 -0
  13. package/src/subgraph.tsx +3 -3
  14. package/src/text.tsx +58 -39
  15. package/src/vertex.tsx +17 -14
  16. package/src/vertex2.tsx +5 -5
  17. package/src/vertex3.tsx +11 -11
  18. package/src/vertex4.tsx +10 -11
  19. package/types/ImageChar.d.ts +4 -5
  20. package/types/__package__.d.ts +2 -3
  21. package/types/edge.d.ts +2 -3
  22. package/types/icon.d.ts +6 -7
  23. package/types/image.d.ts +3 -4
  24. package/types/index.d.ts +15 -14
  25. package/types/render.d.ts +16 -8
  26. package/types/shape.d.ts +9 -10
  27. package/types/span.d.ts +5 -0
  28. package/types/subgraph.d.ts +1 -2
  29. package/types/text.d.ts +11 -13
  30. package/types/vertex.d.ts +5 -6
  31. package/types/vertex2.d.ts +2 -3
  32. package/types/vertex3.d.ts +8 -9
  33. package/types/vertex4.d.ts +4 -5
  34. package/dist/index.es6.js +0 -542
  35. package/dist/index.es6.js.map +0 -1
  36. package/dist/index.min.js +0 -2
  37. package/dist/index.min.js.map +0 -1
  38. package/types/ImageChar.d.ts.map +0 -1
  39. package/types/__package__.d.ts.map +0 -1
  40. package/types/edge.d.ts.map +0 -1
  41. package/types/icon.d.ts.map +0 -1
  42. package/types/image.d.ts.map +0 -1
  43. package/types/index.d.ts.map +0 -1
  44. package/types/render.d.ts.map +0 -1
  45. package/types/shape.d.ts.map +0 -1
  46. package/types/subgraph.d.ts.map +0 -1
  47. package/types/text.d.ts.map +0 -1
  48. package/types/vertex.d.ts.map +0 -1
  49. package/types/vertex2.d.ts.map +0 -1
  50. package/types/vertex3.d.ts.map +0 -1
  51. package/types/vertex4.d.ts.map +0 -1
  52. package/types-3.4/ImageChar.d.ts +0 -14
  53. package/types-3.4/__package__.d.ts +0 -4
  54. package/types-3.4/edge.d.ts +0 -30
  55. package/types-3.4/icon.d.ts +0 -27
  56. package/types-3.4/image.d.ts +0 -11
  57. package/types-3.4/index.d.ts +0 -15
  58. package/types-3.4/render.d.ts +0 -27
  59. package/types-3.4/shape.d.ts +0 -41
  60. package/types-3.4/subgraph.d.ts +0 -14
  61. package/types-3.4/text.d.ts +0 -51
  62. package/types-3.4/vertex.d.ts +0 -33
  63. package/types-3.4/vertex2.d.ts +0 -4
  64. package/types-3.4/vertex3.d.ts +0 -34
  65. package/types-3.4/vertex4.d.ts +0 -32
package/dist/index.es6.js DELETED
@@ -1,542 +0,0 @@
1
- import { Utility, Palette, publish, HTMLWidget, SVGWidget } from '@hpcc-js/common';
2
-
3
- var PKG_NAME$1 = "@hpcc-js/react";
4
- var PKG_VERSION$1 = "2.54.0";
5
- var BUILD_VERSION$1 = "2.106.0";
6
-
7
- var PKG_NAME = "@hpcc-js/preact-shim";
8
- var PKG_VERSION = "2.17.0";
9
- var BUILD_VERSION = "2.106.0";
10
-
11
- var n,l$1,u$1,i$1,o$1,r$1,f$1,e$1,c$1,s$1,h$1={},p$1=[],v$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,y$1=Array.isArray;function d$1(n,l){for(var u in l)n[u]=l[u];return n}function w$1(n){var l=n.parentNode;l&&l.removeChild(n);}function _$1(l,u,t){var i,o,r,f={};for(r in u)"key"==r?i=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return g(l,f,i,o,null)}function g(n,t,i,o,r){var f={type:n,props:t,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++u$1:r,__i:-1,__u:0};return null==r&&null!=l$1.vnode&&l$1.vnode(f),f}function k$1(n){return n.children}function b(n,l){this.props=n,this.context=l;}function x$1(n,l){if(null==l)return n.__?x$1(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?x$1(n):null}function C$1(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return C$1(n)}}function M(n){(!n.__d&&(n.__d=!0)&&i$1.push(n)&&!P.__r++||o$1!==l$1.debounceRendering)&&((o$1=l$1.debounceRendering)||r$1)(P);}function P(){var n,u,t,o,r,e,c,s;for(i$1.sort(f$1);n=i$1.shift();)n.__d&&(u=i$1.length,o=void 0,e=(r=(t=n).__v).__e,c=[],s=[],t.__P&&((o=d$1({},r)).__v=r.__v+1,l$1.vnode&&l$1.vnode(o),O(t.__P,o,r,t.__n,t.__P.namespaceURI,32&r.__u?[e]:null,c,null==e?x$1(r):e,!!(32&r.__u),s),o.__v=r.__v,o.__.__k[o.__i]=o,j$1(c,o,s),o.__e!=e&&C$1(o)),i$1.length>u&&i$1.sort(f$1));P.__r=0;}function S(n,l,u,t,i,o,r,f,e,c,s){var a,v,y,d,w,_=t&&t.__k||p$1,g=l.length;for(u.__d=e,$(u,l,_),e=u.__d,a=0;a<g;a++)null!=(y=u.__k[a])&&"boolean"!=typeof y&&"function"!=typeof y&&(v=-1===y.__i?h$1:_[y.__i]||h$1,y.__i=a,O(n,y,v,i,o,r,f,e,c,s),d=y.__e,y.ref&&v.ref!=y.ref&&(v.ref&&N(v.ref,null,y),s.push(y.ref,y.__c||d,y)),null==w&&null!=d&&(w=d),65536&y.__u||v.__k===y.__k?(e&&!e.isConnected&&(e=x$1(v)),e=I(y,e,n)):"function"==typeof y.type&&void 0!==y.__d?e=y.__d:d&&(e=d.nextSibling),y.__d=void 0,y.__u&=-196609);u.__d=e,u.__e=w;}function $(n,l,u){var t,i,o,r,f,e=l.length,c=u.length,s=c,a=0;for(n.__k=[],t=0;t<e;t++)r=t+a,null!=(i=n.__k[t]=null==(i=l[t])||"boolean"==typeof i||"function"==typeof i?null:"string"==typeof i||"number"==typeof i||"bigint"==typeof i||i.constructor==String?g(null,i,null,null,null):y$1(i)?g(k$1,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?g(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)?(i.__=n,i.__b=n.__b+1,f=L(i,u,r,s),i.__i=f,o=null,-1!==f&&(s--,(o=u[f])&&(o.__u|=131072)),null==o||null===o.__v?(-1==f&&a--,"function"!=typeof i.type&&(i.__u|=65536)):f!==r&&(f===r+1?a++:f>r?s>e-r?a+=f-r:a--:f<r?f==r-1&&(a=f-r):a=0,f!==t+a&&(i.__u|=65536))):(o=u[r])&&null==o.key&&o.__e&&0==(131072&o.__u)&&(o.__e==n.__d&&(n.__d=x$1(o)),V(o,o,!1),u[r]=null,s--);if(s)for(t=0;t<c;t++)null!=(o=u[t])&&0==(131072&o.__u)&&(o.__e==n.__d&&(n.__d=x$1(o)),V(o,o));}function I(n,l,u){var t,i;if("function"==typeof n.type){for(t=n.__k,i=0;t&&i<t.length;i++)t[i]&&(t[i].__=n,l=I(t[i],l,u));return l}n.__e!=l&&(u.insertBefore(n.__e,l||null),l=n.__e);do{l=l&&l.nextSibling;}while(null!=l&&8===l.nodeType);return l}function L(n,l,u,t){var i=n.key,o=n.type,r=u-1,f=u+1,e=l[u];if(null===e||e&&i==e.key&&o===e.type&&0==(131072&e.__u))return u;if(t>(null!=e&&0==(131072&e.__u)?1:0))for(;r>=0||f<l.length;){if(r>=0){if((e=l[r])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return r;r--;}if(f<l.length){if((e=l[f])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return f;f++;}}return -1}function T(n,l,u){"-"===l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||v$1.test(l)?u:u+"px";}function A(n,l,u,t,i){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof t&&(n.style.cssText=t=""),t)for(l in t)u&&l in u||T(n.style,l,"");if(u)for(l in u)t&&u[l]===t[l]||T(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/(PointerCapture)$|Capture$/i,"$1")),l=l.toLowerCase()in n||"onFocusOut"===l||"onFocusIn"===l?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?t?u.u=t.u:(u.u=e$1,n.addEventListener(l,o?s$1:c$1,o)):n.removeEventListener(l,o?s$1:c$1,o);else {if("http://www.w3.org/2000/svg"==i)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=l&&"height"!=l&&"href"!=l&&"list"!=l&&"form"!=l&&"tabIndex"!=l&&"download"!=l&&"rowSpan"!=l&&"colSpan"!=l&&"role"!=l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&"-"!==l[4]?n.removeAttribute(l):n.setAttribute(l,u));}}function F(n){return function(u){if(this.l){var t=this.l[u.type+n];if(null==u.t)u.t=e$1++;else if(u.t<t.u)return;return t(l$1.event?l$1.event(u):u)}}}function O(n,u,t,i,o,r,f,e,c,s){var a,h,p,v,w,_,g,m,x,C,M,P,$,I,H,L=u.type;if(void 0!==u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),r=[e=u.__e=t.__e]),(a=l$1.__b)&&a(u);n:if("function"==typeof L)try{if(m=u.props,x=(a=L.contextType)&&i[a.__c],C=a?x?x.props.value:a.__:i,t.__c?g=(h=u.__c=t.__c).__=h.__E:("prototype"in L&&L.prototype.render?u.__c=h=new L(m,C):(u.__c=h=new b(m,C),h.constructor=L,h.render=q$1),x&&x.sub(h),h.props=m,h.state||(h.state={}),h.context=C,h.__n=i,p=h.__d=!0,h.__h=[],h._sb=[]),null==h.__s&&(h.__s=h.state),null!=L.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=d$1({},h.__s)),d$1(h.__s,L.getDerivedStateFromProps(m,h.__s))),v=h.props,w=h.state,h.__v=u,p)null==L.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(null==L.getDerivedStateFromProps&&m!==v&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(m,C),!h.__e&&(null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,C)||u.__v===t.__v)){for(u.__v!==t.__v&&(h.props=m,h.state=h.__s,h.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.forEach(function(n){n&&(n.__=u);}),M=0;M<h._sb.length;M++)h.__h.push(h._sb[M]);h._sb=[],h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(m,h.__s,C),null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(v,w,_);});}if(h.context=C,h.props=m,h.__P=n,h.__e=!1,P=l$1.__r,$=0,"prototype"in L&&L.prototype.render){for(h.state=h.__s,h.__d=!1,P&&P(u),a=h.render(h.props,h.state,h.context),I=0;I<h._sb.length;I++)h.__h.push(h._sb[I]);h._sb=[];}else do{h.__d=!1,P&&P(u),a=h.render(h.props,h.state,h.context),h.state=h.__s;}while(h.__d&&++$<25);h.state=h.__s,null!=h.getChildContext&&(i=d$1(d$1({},i),h.getChildContext())),p||null==h.getSnapshotBeforeUpdate||(_=h.getSnapshotBeforeUpdate(v,w)),S(n,y$1(H=null!=a&&a.type===k$1&&null==a.key?a.props.children:a)?H:[H],u,t,i,o,r,f,e,c,s),h.base=u.__e,u.__u&=-161,h.__h.length&&f.push(h),g&&(h.__E=h.__=null);}catch(n){u.__v=null,c||null!=r?(u.__e=e,u.__u|=c?160:32,r[r.indexOf(e)]=null):(u.__e=t.__e,u.__k=t.__k),l$1.__e(n,u,t);}else null==r&&u.__v===t.__v?(u.__k=t.__k,u.__e=t.__e):u.__e=z$1(t.__e,u,t,i,o,r,f,c,s);(a=l$1.diffed)&&a(u);}function j$1(n,u,t){u.__d=void 0;for(var i=0;i<t.length;i++)N(t[i],t[++i],t[++i]);l$1.__c&&l$1.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$1.__e(n,u.__v);}});}function z$1(l,u,t,i,o,r,f,e,c){var s,a,p,v,d,_,g,m=t.props,k=u.props,b=u.type;if("svg"===b?o="http://www.w3.org/2000/svg":"math"===b?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=r)for(s=0;s<r.length;s++)if((d=r[s])&&"setAttribute"in d==!!b&&(b?d.localName===b:3===d.nodeType)){l=d,r[s]=null;break}if(null==l){if(null===b)return document.createTextNode(k);l=document.createElementNS(o,b,k.is&&k),r=null,e=!1;}if(null===b)m===k||e&&l.data===k||(l.data=k);else {if(r=r&&n.call(l.childNodes),m=t.props||h$1,!e&&null!=r)for(m={},s=0;s<l.attributes.length;s++)m[(d=l.attributes[s]).name]=d.value;for(s in m)if(d=m[s],"children"==s);else if("dangerouslySetInnerHTML"==s)p=d;else if("key"!==s&&!(s in k)){if("value"==s&&"defaultValue"in k||"checked"==s&&"defaultChecked"in k)continue;A(l,s,null,d,o);}for(s in k)d=k[s],"children"==s?v=d:"dangerouslySetInnerHTML"==s?a=d:"value"==s?_=d:"checked"==s?g=d:"key"===s||e&&"function"!=typeof d||m[s]===d||A(l,s,d,m[s],o);if(a)e||p&&(a.__html===p.__html||a.__html===l.innerHTML)||(l.innerHTML=a.__html),u.__k=[];else if(p&&(l.innerHTML=""),S(l,y$1(v)?v:[v],u,t,i,"foreignObject"===b?"http://www.w3.org/1999/xhtml":o,r,f,r?r[0]:t.__k&&x$1(t,0),e,c),null!=r)for(s=r.length;s--;)null!=r[s]&&w$1(r[s]);e||(s="value",void 0!==_&&(_!==l[s]||"progress"===b&&!_||"option"===b&&_!==m[s])&&A(l,s,_,m[s],o),s="checked",void 0!==g&&g!==l[s]&&A(l,s,g,m[s],o));}return l}function N(n,u,t){try{"function"==typeof n?n(u):n.current=u;}catch(n){l$1.__e(n,t);}}function V(n,u,t){var i,o;if(l$1.unmount&&l$1.unmount(n),(i=n.ref)&&(i.current&&i.current!==n.__e||N(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount();}catch(n){l$1.__e(n,u);}i.base=i.__P=null;}if(i=n.__k)for(o=0;o<i.length;o++)i[o]&&V(i[o],u,t||"function"!=typeof n.type);t||null==n.__e||w$1(n.__e),n.__c=n.__=n.__e=n.__d=void 0;}function q$1(n,l,u){return this.constructor(n,u)}function B$1(u,t,i){var o,r,f,e;l$1.__&&l$1.__(u,t),r=(o="function"==typeof i)?null:i&&i.__k||t.__k,f=[],e=[],O(t,u=(!o&&i||t).__k=_$1(k$1,null,[u]),r||h$1,h$1,t.namespaceURI,!o&&i?[i]:r?null:t.firstChild?n.call(t.childNodes):null,f,!o&&i?i:r?r.__e:t.firstChild,o,e),j$1(f,u,e);}n=p$1.slice,l$1={__e:function(n,l,u,t){for(var i,o,r;l=l.__;)if((i=l.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(n)),r=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),r=i.__d),r)return i.__E=i}catch(l){n=l;}throw n}},u$1=0,b.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=d$1({},this.state),"function"==typeof n&&(n=n(d$1({},u),this.props)),n&&d$1(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),M(this));},b.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),M(this));},b.prototype.render=k$1,i$1=[],r$1="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f$1=function(n,l){return n.__v.__b-l.__v.__b},P.__r=0,e$1=0,c$1=F(!1),s$1=F(!0);
12
-
13
- var t,r,u,i,o=0,f=[],c=[],e=l$1,a=e.__b,v=e.__r,l=e.diffed,m=e.__c,s=e.unmount,d=e.__;function h(n,t){e.__h&&e.__h(r,n,o||t),o=0;var u=r.__H||(r.__H={__:[],__h:[]});return n>=u.__.length&&u.__.push({__V:c}),u.__[n]}function p(n){return o=1,y(D,n)}function y(n,u,i){var o=h(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):D(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}));}],o.__c=r,!r.u)){var f=function(n,t,r){if(!o.__c.__H)return !0;var u=o.__c.__H.__.filter(function(n){return !!n.__c});if(u.every(function(n){return !n.__N}))return !c||c.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0);}}),!(!i&&o.__c.props===n)&&(!c||c.call(this,n,t,r))};r.u=!0;var c=r.shouldComponentUpdate,e=r.componentWillUpdate;r.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u;}e&&e.call(this,n,t,r);},r.shouldComponentUpdate=f;}return o.__N||o.__}function _(n,u){var i=h(t++,3);!e.__s&&C(i.__H,u)&&(i.__=n,i.i=u,r.__H.__h.push(i));}function q(n,r){var u=h(t++,7);return C(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function x(n,t){return o=8,q(function(){return n},t)}function j(){for(var n;n=f.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(z),n.__H.__h.forEach(B),n.__H.__h=[];}catch(t){n.__H.__h=[],e.__e(t,n.__v);}}e.__b=function(n){r=null,a&&a(n);},e.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),d&&d(n,t);},e.__r=function(n){v&&v(n),t=0;var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c,n.__N=n.i=void 0;})):(i.__h.forEach(z),i.__h.forEach(B),i.__h=[],t=0)),u=r;},e.diffed=function(n){l&&l(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(1!==f.push(t)&&i===e.requestAnimationFrame||((i=e.requestAnimationFrame)||w)(j)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c&&(n.__=n.__V),n.i=void 0,n.__V=c;})),u=r=null;},e.__c=function(n,t){t.some(function(n){try{n.__h.forEach(z),n.__h=n.__h.filter(function(n){return !n.__||B(n)});}catch(r){t.some(function(n){n.__h&&(n.__h=[]);}),t=[],e.__e(r,n.__v);}}),m&&m(n,t);},e.unmount=function(n){s&&s(n);var t,r=n.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{z(n);}catch(n){t=n;}}),r.__H=void 0,t&&e.__e(t,r.__v));};var k="function"==typeof requestAnimationFrame;function w(n){var t,r=function(){clearTimeout(u),k&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,100);k&&(t=requestAnimationFrame(r));}function z(n){var t=r,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r=t;}function B(n){var t=r;n.__c=n.__(),r=t;}function C(n,t){return !n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function D(n,t){return "function"==typeof t?t(n):t}
14
-
15
- var index_es6 = /*#__PURE__*/Object.freeze({
16
- __proto__: null,
17
- BUILD_VERSION: BUILD_VERSION,
18
- Component: b,
19
- Fragment: k$1,
20
- PKG_NAME: PKG_NAME,
21
- PKG_VERSION: PKG_VERSION,
22
- createElement: _$1,
23
- h: _$1,
24
- render: B$1,
25
- useCallback: x,
26
- useEffect: _,
27
- useMemo: q,
28
- useReducer: y,
29
- useState: p
30
- });
31
-
32
- /******************************************************************************
33
- Copyright (c) Microsoft Corporation.
34
-
35
- Permission to use, copy, modify, and/or distribute this software for any
36
- purpose with or without fee is hereby granted.
37
-
38
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
39
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
40
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
41
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
42
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
43
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
44
- PERFORMANCE OF THIS SOFTWARE.
45
- ***************************************************************************** */
46
- /* global Reflect, Promise, SuppressedError, Symbol */
47
-
48
- var extendStatics = function(d, b) {
49
- extendStatics = Object.setPrototypeOf ||
50
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
51
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
52
- return extendStatics(d, b);
53
- };
54
-
55
- function __extends(d, b) {
56
- if (typeof b !== "function" && b !== null)
57
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
58
- extendStatics(d, b);
59
- function __() { this.constructor = d; }
60
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
61
- }
62
-
63
- var __assign = function() {
64
- __assign = Object.assign || function __assign(t) {
65
- for (var s, i = 1, n = arguments.length; i < n; i++) {
66
- s = arguments[i];
67
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
68
- }
69
- return t;
70
- };
71
- return __assign.apply(this, arguments);
72
- };
73
-
74
- function __decorate(decorators, target, key, desc) {
75
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
76
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
77
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
78
- return c > 3 && r && Object.defineProperty(target, key, r), r;
79
- }
80
-
81
- function __metadata(metadataKey, metadataValue) {
82
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
83
- }
84
-
85
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
86
- var e = new Error(message);
87
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
88
- };
89
-
90
- var Image = function (_a) {
91
- var href = _a.href, x = _a.x, _b = _a.y, y = _b === void 0 ? 0 : _b, _c = _a.height, height = _c === void 0 ? 12 : _c;
92
- return _$1("image", { href: href, x: x - height / 2, y: y - height / 2, width: height, height: height });
93
- };
94
-
95
- var ImageChar = function (_a) {
96
- var x = _a.x, _b = _a.y, y = _b === void 0 ? 0 : _b, _c = _a.height, height = _c === void 0 ? 12 : _c, fill = _a.fill, stroke = _a.stroke, _d = _a.fontFamily, fontFamily = _d === void 0 ? "FontAwesome" : _d, _e = _a.char, char = _e === void 0 ? "" : _e;
97
- var renderChar = q(function () {
98
- return fontFamily === "FontAwesome" ? Utility.faChar(char) : char;
99
- }, [char, fontFamily]);
100
- return _$1("text", { x: x, y: y, fill: fill, stroke: stroke, "font-family": fontFamily, "font-size": "".concat(height, "px"), "dominant-baseline": "middle", style: "text-anchor: middle;alignment-baseline:middle;" }, renderChar);
101
- };
102
-
103
- var Circle = function (_a) {
104
- var _b = _a.radius, radius = _b === void 0 ? 32 : _b, _c = _a.fill, fill = _c === void 0 ? "navy" : _c, _d = _a.stroke, stroke = _d === void 0 ? fill : _d, _e = _a.strokeWidth, strokeWidth = _e === void 0 ? 1 : _e, shapeRendering = _a.shapeRendering;
105
- return _$1("circle", { r: radius, fill: fill, stroke: stroke, "stroke-width": strokeWidth, "shape-rendering": shapeRendering });
106
- };
107
- var Square = function (_a) {
108
- var _b = _a.radius, radius = _b === void 0 ? 30 : _b, _c = _a.cornerRadius, cornerRadius = _c === void 0 ? 0 : _c, _d = _a.fill, fill = _d === void 0 ? "white" : _d, stroke = _a.stroke, _e = _a.strokeWidth, strokeWidth = _e === void 0 ? 1 : _e, shapeRendering = _a.shapeRendering;
109
- return _$1("rect", { x: -radius, y: -radius, rx: cornerRadius, ry: cornerRadius, width: radius * 2, height: radius * 2, fill: fill, stroke: stroke || fill, "stroke-width": strokeWidth, "shape-rendering": shapeRendering });
110
- };
111
- var Rectangle = function (_a) {
112
- var _b = _a.width, width = _b === void 0 ? 30 : _b, _c = _a.height, height = _c === void 0 ? 30 : _c, _d = _a.cornerRadius, cornerRadius = _d === void 0 ? 0 : _d, _e = _a.fill, fill = _e === void 0 ? "white" : _e, _f = _a.stroke, stroke = _f === void 0 ? "black" : _f, _g = _a.strokeWidth, strokeWidth = _g === void 0 ? 1 : _g, shapeRendering = _a.shapeRendering;
113
- return _$1("rect", { x: -width / 2, y: -height / 2, rx: cornerRadius, ry: cornerRadius, width: width, height: height, fill: fill, stroke: stroke || fill, "stroke-width": strokeWidth, "shape-rendering": shapeRendering });
114
- };
115
- var Shape = function (_a) {
116
- var _b = _a.shape, shape = _b === void 0 ? "circle" : _b, _c = _a.height, height = _c === void 0 ? 128 : _c, width = _a.width, fill = _a.fill, stroke = _a.stroke, _d = _a.strokeWidth, strokeWidth = _d === void 0 ? 1 : _d, shapeRendering = _a.shapeRendering, cornerRadius = _a.cornerRadius;
117
- switch (shape) {
118
- case "square":
119
- return _$1(Square, { radius: height / 2, fill: fill, stroke: stroke, strokeWidth: strokeWidth, shapeRendering: shapeRendering, cornerRadius: cornerRadius });
120
- case "rectangle":
121
- return _$1(Rectangle, { width: width !== null && width !== void 0 ? width : height, height: height, fill: fill, stroke: stroke, strokeWidth: strokeWidth, shapeRendering: shapeRendering, cornerRadius: cornerRadius });
122
- case "circle":
123
- default:
124
- return _$1(Circle, { radius: height / 2, fill: fill, stroke: stroke, strokeWidth: strokeWidth, shapeRendering: shapeRendering });
125
- }
126
- };
127
-
128
- var Icon = function (_a) {
129
- var _b = _a.shape, shape = _b === void 0 ? "circle" : _b, width = _a.width, _c = _a.height, height = _c === void 0 ? 32 : _c, fill = _a.fill, stroke = _a.stroke, _d = _a.strokeWidth, strokeWidth = _d === void 0 ? 0 : _d, _e = _a.imageUrl, imageUrl = _e === void 0 ? "" : _e, _f = _a.imageFontFamily, imageFontFamily = _f === void 0 ? "FontAwesome" : _f, _g = _a.imageChar, imageChar = _g === void 0 ? "" : _g, _h = _a.imageCharFill, imageCharFill = _h === void 0 ? Palette.textColor(fill) : _h, _j = _a.padding, padding = _j === void 0 ? height / 5 : _j, _k = _a.xOffset, xOffset = _k === void 0 ? 0 : _k, _l = _a.yOffset, yOffset = _l === void 0 ? 0 : _l, cornerRadius = _a.cornerRadius, shapeRendering = _a.shapeRendering;
130
- return _$1(k$1, null,
131
- _$1(Shape, { shape: shape, width: width, height: height, fill: fill, stroke: stroke, strokeWidth: strokeWidth, shapeRendering: shapeRendering, cornerRadius: cornerRadius }),
132
- imageUrl ?
133
- _$1(Image, { href: imageUrl, x: xOffset, y: yOffset, height: height - padding }) :
134
- _$1(ImageChar, { x: xOffset, y: yOffset, height: height - padding, fontFamily: imageFontFamily, char: imageChar, fill: imageCharFill, "font-weight": 400 }));
135
- };
136
- var Icons = function (_a) {
137
- var _b = _a.icons, icons = _b === void 0 ? [] : _b;
138
- var IconComponents = icons.map(function (cat) {
139
- return _$1("g", { key: cat.id, id: cat.id },
140
- _$1(Icon, __assign({}, cat)));
141
- });
142
- return _$1(k$1, null, IconComponents);
143
- };
144
-
145
- var TextLine = function (_a) {
146
- var text = _a.text, _b = _a.height, height = _b === void 0 ? 12 : _b, _c = _a.anchor, anchor = _c === void 0 ? "middle" : _c, _d = _a.baseline, baseline = _d === void 0 ? "middle" : _d, _e = _a.fontFamily, fontFamily = _e === void 0 ? "Verdana" : _e, _f = _a.fill, fill = _f === void 0 ? "black" : _f;
147
- return _$1("text", { "font-family": fontFamily, "font-size": "".concat(height, "px"), "text-anchor": anchor, "dominant-baseline": baseline, fill: fill }, text);
148
- };
149
- var Text = function (_a) {
150
- var text = _a.text, _b = _a.height, height = _b === void 0 ? 12 : _b, _c = _a.fontFamily, fontFamily = _c === void 0 ? "Verdana" : _c, _d = _a.fill, fill = _d === void 0 ? "black" : _d, onSizeUpdate = _a.onSizeUpdate;
151
- var _e = p(0), totalWidth = _e[0], setTotalWidthUpdate = _e[1];
152
- var _f = p(0), totalHeight = _f[0], setTotalHeightUpdate = _f[1];
153
- _(function () {
154
- onSizeUpdate && onSizeUpdate({ width: totalWidth, height: totalHeight });
155
- }, [totalWidth, totalHeight, onSizeUpdate]);
156
- var parts = q(function () {
157
- return text.split("\n");
158
- }, [text]);
159
- var ts = q(function () {
160
- return Utility.textSize(parts, fontFamily, height);
161
- }, [fontFamily, height, parts]);
162
- setTotalWidthUpdate(ts.width);
163
- setTotalHeightUpdate(parts.length * (height + 2) - 2);
164
- var yOffset = -(totalHeight / 2) + (height / 2);
165
- var TextLines = q(function () {
166
- return parts.map(function (p, i) {
167
- return _$1("g", { key: i, transform: "translate(0 ".concat(yOffset + i * (height + 2), ")") },
168
- _$1(TextLine, { text: p, height: height, fontFamily: fontFamily, fill: fill }));
169
- });
170
- }, [fill, fontFamily, height, parts, yOffset]);
171
- return _$1(k$1, null, TextLines);
172
- };
173
- var TextBox = function (_a) {
174
- var text = _a.text, _b = _a.height, height = _b === void 0 ? 12 : _b, _c = _a.fontFamily, fontFamily = _c === void 0 ? "Verdana" : _c, _d = _a.padding, padding = _d === void 0 ? 4 : _d, _e = _a.fill, fill = _e === void 0 ? "whitesmoke" : _e, _f = _a.stroke, stroke = _f === void 0 ? "lightgray" : _f, _g = _a.textFill, textFill = _g === void 0 ? "black" : _g, _h = _a.strokeWidth, strokeWidth = _h === void 0 ? 1 : _h, _j = _a.cornerRadius, cornerRadius = _j === void 0 ? 0 : _j, onSizeUpdate = _a.onSizeUpdate;
175
- var _k = p(0), textWidth = _k[0], setTextWidthUpdate = _k[1];
176
- var _l = p(0), textHeight = _l[0], setTextHeightUpdate = _l[1];
177
- _(function () {
178
- onSizeUpdate && onSizeUpdate({ width: textWidth, height: textHeight });
179
- }, [textWidth, textHeight, onSizeUpdate]);
180
- var onTextSizeUpdate = x(function (size) {
181
- setTextWidthUpdate(size.width);
182
- setTextHeightUpdate(size.height);
183
- }, []);
184
- var w = textWidth + padding * 2 + strokeWidth;
185
- var h = textHeight + padding * 2 + strokeWidth;
186
- var textOffsetY = Math.floor(height / 10);
187
- return _$1(k$1, null,
188
- _$1(Rectangle, { width: w, height: h, fill: fill, stroke: stroke, strokeWidth: strokeWidth, cornerRadius: cornerRadius }),
189
- _$1("g", { transform: "translate(0 ".concat(textOffsetY, ")") },
190
- _$1(Text, { text: text, fontFamily: fontFamily, height: height, fill: textFill, onSizeUpdate: onTextSizeUpdate })));
191
- };
192
- var LabelledRect = function (_a) {
193
- var text = _a.text, _b = _a.height, height = _b === void 0 ? 12 : _b, _c = _a.width, width = _c === void 0 ? 12 : _c, _d = _a.fontFamily, fontFamily = _d === void 0 ? "Verdana" : _d, _e = _a.fontSize, fontSize = _e === void 0 ? 10 : _e, _f = _a.padding, padding = _f === void 0 ? 3 : _f, _g = _a.fill, fill = _g === void 0 ? "whitesmoke" : _g, _h = _a.stroke, stroke = _h === void 0 ? "lightgray" : _h, _j = _a.textFill, textFill = _j === void 0 ? "black" : _j, _k = _a.strokeWidth, strokeWidth = _k === void 0 ? 1 : _k, _l = _a.cornerRadius, cornerRadius = _l === void 0 ? 0 : _l; _a.onSizeUpdate;
194
- return _$1(k$1, null,
195
- _$1(Rectangle, { width: width, height: height, fill: fill, stroke: stroke, strokeWidth: strokeWidth, cornerRadius: cornerRadius }),
196
- _$1("g", { transform: "translate(".concat(-(width / 2) + padding, " ").concat(-(height / 2) + padding, ")") },
197
- _$1(TextLine, { text: text, fontFamily: fontFamily, height: fontSize, fill: textFill, anchor: "start", baseline: "hanging" })));
198
- };
199
- var IconLabelledRect = function (_a) {
200
- var icon = _a.icon, iconFontFamily = _a.iconFontFamily, text = _a.text, _b = _a.height, height = _b === void 0 ? 12 : _b, _c = _a.width, width = _c === void 0 ? 12 : _c, _d = _a.fontFamily, fontFamily = _d === void 0 ? "Verdana" : _d, _e = _a.fontSize, fontSize = _e === void 0 ? 10 : _e, _f = _a.padding, padding = _f === void 0 ? 3 : _f, _g = _a.fill, fill = _g === void 0 ? "whitesmoke" : _g, _h = _a.stroke, stroke = _h === void 0 ? "lightgray" : _h, _j = _a.textFill, textFill = _j === void 0 ? "black" : _j, _k = _a.strokeWidth, strokeWidth = _k === void 0 ? 1 : _k, _l = _a.cornerRadius, cornerRadius = _l === void 0 ? 0 : _l; _a.onSizeUpdate;
201
- return _$1(k$1, null,
202
- _$1(Rectangle, { width: width, height: height, fill: fill, stroke: stroke, strokeWidth: strokeWidth, cornerRadius: cornerRadius }),
203
- _$1("g", { transform: "translate(".concat(-(width / 2) + padding, " ").concat(-(height / 2) + padding, ")") },
204
- _$1(Icon, { shape: "square", imageFontFamily: iconFontFamily, imageChar: icon, height: height, fill: fill, imageCharFill: textFill })),
205
- _$1("g", { transform: "translate(".concat(-(width / 2) + (padding * 2) + height, " ").concat(-(height / 2) + padding, ")") },
206
- _$1(TextLine, { text: text, fontFamily: fontFamily, height: fontSize, fill: textFill, anchor: "start", baseline: "hanging" })));
207
- };
208
-
209
- var Edge = function (_a) {
210
- var label = _a.label, labelPos = _a.labelPos, _b = _a.labelFill, labelFill = _b === void 0 ? "black" : _b, _c = _a.labelHeight, labelHeight = _c === void 0 ? 12 : _c, path = _a.path, stroke = _a.stroke, strokeWidth = _a.strokeWidth, strokeDasharray = _a.strokeDasharray;
211
- return _$1(k$1, null,
212
- _$1("path", { d: path, stroke: stroke, style: { strokeWidth: strokeWidth, strokeDasharray: strokeDasharray } }),
213
- label && labelPos && labelPos.length === 2 ?
214
- _$1("g", { transform: "translate(".concat(labelPos[0], " ").concat(labelPos[1], ")") },
215
- _$1(Text, { text: label, fill: labelFill, height: labelHeight })) : undefined);
216
- };
217
-
218
- function render(C, props, parent, replaceNode) {
219
- B$1(_$1(C, props), parent, replaceNode);
220
- }
221
- function svgRender(C, props, parent, replaceNode) {
222
- B$1(_$1("svg", null, _$1(C, props)), parent, replaceNode);
223
- }
224
- var HTMLAdapter = /** @class */ (function (_super) {
225
- __extends(HTMLAdapter, _super);
226
- function HTMLAdapter(_component) {
227
- var _this = _super.call(this) || this;
228
- _this._component = _component;
229
- _this._props = {};
230
- return _this;
231
- }
232
- HTMLAdapter.prototype.props = function (_) {
233
- if (!arguments.length)
234
- return this._props;
235
- this._props = __assign(__assign({}, this._props), _);
236
- return this;
237
- };
238
- HTMLAdapter.prototype.prop = function (_, value) {
239
- if (arguments.length === 1)
240
- return this._props[_];
241
- this._props[_] = value;
242
- return this;
243
- };
244
- HTMLAdapter.prototype.update = function (domNode, element) {
245
- _super.prototype.update.call(this, domNode, element);
246
- render(this._component, this._props, domNode);
247
- };
248
- __decorate([
249
- publish({}, "object", "Properties"),
250
- __metadata("design:type", Object)
251
- ], HTMLAdapter.prototype, "_props", void 0);
252
- return HTMLAdapter;
253
- }(HTMLWidget));
254
- var SVGAdapter = /** @class */ (function (_super) {
255
- __extends(SVGAdapter, _super);
256
- function SVGAdapter(_component) {
257
- var _this = _super.call(this) || this;
258
- _this._component = _component;
259
- _this._props = {};
260
- return _this;
261
- }
262
- SVGAdapter.prototype.props = function (_) {
263
- if (!arguments.length)
264
- return this._props;
265
- this._props = __assign(__assign({}, this._props), _);
266
- return this;
267
- };
268
- SVGAdapter.prototype.prop = function (_, value) {
269
- if (arguments.length === 1)
270
- return this._props[_];
271
- this._props[_] = value;
272
- return this;
273
- };
274
- SVGAdapter.prototype.update = function (domNode, element) {
275
- _super.prototype.update.call(this, domNode, element);
276
- render(this._component, this._props, domNode);
277
- };
278
- __decorate([
279
- publish({}, "object", "Properties"),
280
- __metadata("design:type", Object)
281
- ], SVGAdapter.prototype, "_props", void 0);
282
- return SVGAdapter;
283
- }(SVGWidget));
284
-
285
- var Annotations = function (_a) {
286
- var x = _a.x, y = _a.y, _b = _a.annotationIDs, annotationIDs = _b === void 0 ? [] : _b, _c = _a.stepSize, stepSize = _c === void 0 ? -16 : _c;
287
- var IconComponents = annotationIDs.map(function (id, i) { return _$1("g", { key: id, transform: "translate(".concat(x + i * stepSize, " ").concat(y, ")") },
288
- _$1("use", { href: "#" + id })); });
289
- return _$1(k$1, null, IconComponents);
290
- };
291
- var Vertex = function (_a) {
292
- var _b = _a.categoryID, categoryID = _b === void 0 ? "" : _b, _c = _a.text, text = _c === void 0 ? "" : _c, _d = _a.textHeight, textHeight = _d === void 0 ? 12 : _d, _e = _a.textPadding, textPadding = _e === void 0 ? 4 : _e, _f = _a.icon, icon = _f === void 0 ? {} : _f, _g = _a.annotationsHeight, annotationsHeight = _g === void 0 ? 12 : _g, _h = _a.annotationIDs, annotationIDs = _h === void 0 ? [] : _h, textFill = _a.textFill, textboxFill = _a.textboxFill, textboxStroke = _a.textboxStroke, textFontFamily = _a.textFontFamily, onSizeUpdate = _a.onSizeUpdate, _j = _a.showLabel, showLabel = _j === void 0 ? true : _j, _k = _a.scale, scale = _k === void 0 ? 1 : _k;
293
- var _l = p(0), textBoxWidth = _l[0], setTextBoxWidthUpdate = _l[1];
294
- var _m = p(0), textBoxHeight = _m[0], setTextBoxHeightUpdate = _m[1];
295
- _(function () {
296
- onSizeUpdate && onSizeUpdate({ width: 0, height: 0 });
297
- }, [textBoxWidth, textBoxHeight, onSizeUpdate]);
298
- icon = __assign({ imageChar: "fa-question", height: 32, fill: "transparent" }, icon);
299
- var width = textBoxWidth;
300
- width += 4;
301
- var offsetY = -(icon.height * 2 / 6 + textHeight + 8) / 2;
302
- var textboxOffsetY = icon.height / 3 + textBoxHeight / 2 + textPadding;
303
- var annotationOffsetY = icon.height / 3 + textBoxHeight + textPadding + annotationsHeight / 3;
304
- if (!showLabel) {
305
- offsetY += (textHeight + 8) / 2;
306
- annotationOffsetY -= textBoxHeight + textPadding;
307
- }
308
- var onTextBoxSizeUpdate = x(function (size) {
309
- setTextBoxWidthUpdate(size.width);
310
- setTextBoxHeightUpdate(size.height);
311
- }, []);
312
- var label = showLabel ? _$1("g", { transform: "translate(0 ".concat(textboxOffsetY, ")") },
313
- _$1(TextBox, { text: text, height: textHeight, padding: textPadding, onSizeUpdate: onTextBoxSizeUpdate, textFill: textFill, fill: textboxFill, stroke: textboxStroke, fontFamily: textFontFamily })) : undefined;
314
- return categoryID ?
315
- _$1("g", { transform: "translate(0 ".concat(offsetY, ") scale(").concat(scale, ")") },
316
- _$1("use", { href: "#" + categoryID }),
317
- label,
318
- _$1(Annotations, { x: width / 2, y: annotationOffsetY, annotationIDs: annotationIDs })) :
319
- _$1("g", { transform: "translate(0 ".concat(offsetY, ") scale(").concat(scale, ")") },
320
- _$1(Icon, __assign({}, icon)),
321
- label);
322
- };
323
-
324
- var Vertex2 = function (_a) {
325
- var _b = _a.categoryID, categoryID = _b === void 0 ? "" : _b, _c = _a.text, text = _c === void 0 ? "" : _c, _d = _a.textHeight, textHeight = _d === void 0 ? 12 : _d, _e = _a.textPadding, textPadding = _e === void 0 ? 4 : _e, _f = _a.icon, icon = _f === void 0 ? {} : _f, _g = _a.textFill, textFill = _g === void 0 ? "black" : _g, _h = _a.textboxFill, textboxFill = _h === void 0 ? "white" : _h, _j = _a.textboxStroke, textboxStroke = _j === void 0 ? "black" : _j, textFontFamily = _a.textFontFamily, _k = _a.annotationsHeight, annotationsHeight = _k === void 0 ? 12 : _k, _l = _a.annotationIDs, annotationIDs = _l === void 0 ? [] : _l;
326
- icon = __assign({ imageChar: "fa-question", imageCharFill: "white", height: 32, fill: "black", shape: "square" }, icon);
327
- var textBoxHeight = textHeight + textPadding * 2;
328
- var width = q(function () {
329
- return Utility.textSize(text, textFontFamily, textHeight, false);
330
- }, [text, textFontFamily, textHeight]).width;
331
- var stepSize = annotationsHeight;
332
- var textboxStrokeWidth = 1;
333
- var halfTextboxHeight = textBoxHeight / 2;
334
- var offsetX = 0;
335
- var offsetY = -(icon.height * 2 / 6 + textHeight + 8) / 2;
336
- var iconOffsetX = -icon.height / 2;
337
- var iconOffsetY = 0;
338
- var textboxOffsetX = Math.ceil((width / 2) + textPadding);
339
- var textboxOffsetY = halfTextboxHeight - (icon.height / 2);
340
- var annotationOffsetX = stepSize / 2;
341
- var annotationOffsetY = halfTextboxHeight;
342
- return categoryID ?
343
- _$1("g", { transform: "translate(".concat(offsetX, " ").concat(offsetY, ")") },
344
- _$1("g", { transform: "translate(".concat(iconOffsetX, " ").concat(iconOffsetY, ")") },
345
- _$1("use", { href: "#" + categoryID })),
346
- _$1("g", { transform: "translate(".concat(textboxOffsetX, " ").concat(textboxOffsetY, ")") },
347
- _$1(TextBox, { text: text, height: textHeight, padding: textPadding, strokeWidth: textboxStrokeWidth, stroke: textboxStroke, fill: textboxFill, textFill: textFill, fontFamily: textFontFamily })),
348
- _$1(Annotations, { x: annotationOffsetX, y: annotationOffsetY, annotationIDs: annotationIDs, stepSize: stepSize }))
349
- :
350
- _$1(k$1, null,
351
- _$1("g", { transform: "translate(".concat(iconOffsetX, " ").concat(iconOffsetY, ")scale(1.0002)") },
352
- _$1(Icon, __assign({}, icon, { shape: "square" }))),
353
- _$1("g", { transform: "translate(".concat(textboxOffsetX, " ").concat(textboxOffsetY, ")scale(1.0002)") },
354
- _$1(TextBox, { text: text, height: textHeight, padding: textPadding, stroke: textboxStroke, fill: textboxFill })));
355
- };
356
-
357
- var Vertex3 = function (_a) {
358
- var _b = _a.text, text = _b === void 0 ? "" : _b, _c = _a.textHeight, textHeight = _c === void 0 ? 10 : _c, _d = _a.textPadding, textPadding = _d === void 0 ? 4 : _d, _e = _a.textFill, textFill = _e === void 0 ? "#287EC4" : _e, _f = _a.textboxFill, textboxFill = _f === void 0 ? "white" : _f, _g = _a.textboxStroke, textboxStroke = _g === void 0 ? "#CCCCCC" : _g, _h = _a.textboxStrokeWidth, textboxStrokeWidth = _h === void 0 ? 1 : _h, _j = _a.textFontFamily, textFontFamily = _j === void 0 ? "Verdana" : _j, _k = _a.annotationGutter, annotationGutter = _k === void 0 ? 2 : _k, _l = _a.annotations, annotations = _l === void 0 ? [] : _l, _m = _a.cornerRadius, cornerRadius = _m === void 0 ? 3 : _m, _o = _a.icon, icon = _o === void 0 ? {} : _o, _p = _a.subText, subText = _p === void 0 ? { text: "" } : _p, _q = _a.showLabel, showLabel = _q === void 0 ? true : _q, _r = _a.noLabelRadius, noLabelRadius = _r === void 0 ? 5 : _r, expansionIcon = _a.expansionIcon, _s = _a.scale, scale = _s === void 0 ? 1 : _s;
359
- icon = __assign({ height: 50, imageChar: "?", imageFontFamily: "FontAwesome", imageCharFill: "#555555", fill: "transparent", strokeWidth: 0 }, icon);
360
- subText = __assign({ text: "", fill: "white", textFill: "#555555" }, subText);
361
- expansionIcon = expansionIcon ? __assign({ height: 16, shape: "circle", padding: 6, imageChar: "?", imageFontFamily: "FontAwesome", imageCharFill: "black", fill: "whitesmoke", stroke: "whitesmoke", strokeWidth: 0 }, expansionIcon) : undefined;
362
- var fullAnnotationWidth = 0;
363
- var annoOffsetY = 0;
364
- var labelWidth = q(function () {
365
- return Utility.textSize(text, textFontFamily, textHeight, false).width;
366
- }, [text, textFontFamily, textHeight]);
367
- var labelShapeWidth = 0;
368
- if (text !== "") {
369
- labelShapeWidth = labelWidth + (textPadding * 2) + (textboxStrokeWidth * 2);
370
- }
371
- fullAnnotationWidth += labelShapeWidth + annotationGutter;
372
- var textOffsetX = fullAnnotationWidth - (labelShapeWidth / 2);
373
- var textShapeHeight = textHeight + (textPadding * 2) + (textboxStrokeWidth * 2);
374
- var annotationArr = [];
375
- annotations.forEach(function (anno, idx) {
376
- var annoText = anno.imageChar;
377
- var annoShapeWidth = textShapeHeight;
378
- fullAnnotationWidth += annoShapeWidth + annotationGutter;
379
- var annoOffsetX = fullAnnotationWidth - (annoShapeWidth / 2);
380
- annotationArr.push(_$1("g", { key: idx, class: "vertex3-anno", "data-click": "annotation", "data-click-data": JSON.stringify(anno), transform: "translate(".concat(annoOffsetX, " ").concat(annoOffsetY, ")") },
381
- _$1(Icon, __assign({}, anno, { shape: "square", height: textShapeHeight, imageChar: annoText, imageFontFamily: anno.imageFontFamily, cornerRadius: cornerRadius, strokeWidth: 0 }))));
382
- });
383
- if (annotations.length > 0) {
384
- fullAnnotationWidth += annotationGutter * (annotations.length - 1);
385
- }
386
- var textElement = _$1("g", { "data-click": "text", transform: "translate(".concat(textOffsetX, " ").concat(annoOffsetY, ")") }, !showLabel || text === "" ? _$1("circle", { r: noLabelRadius, stroke: textboxStroke, fill: textFill }) : _$1(TextBox, { text: text, height: textHeight, padding: textPadding, strokeWidth: textboxStrokeWidth, stroke: textboxStroke, fill: textboxFill, textFill: textFill, fontFamily: textFontFamily, cornerRadius: cornerRadius }));
387
- var iconHeight = icon.height || 20;
388
- var iconStrokeWidth = icon.strokeWidth || 0;
389
- var iconOffsetX = 0;
390
- var iconOffsetY = 0;
391
- var subTextOffsetX = 0;
392
- var subTextOffsetY = textShapeHeight + (annotationGutter * 2);
393
- if (text !== "" || annotationArr.length > 0) {
394
- iconOffsetY = -(iconHeight / 2) - (iconStrokeWidth) - (textShapeHeight / 2) - (annotationGutter * 2);
395
- }
396
- else if (subText.text !== "") {
397
- subTextOffsetY = (iconHeight / 2) + iconStrokeWidth + (annotationGutter * 2);
398
- }
399
- var subtextElement = subText.text === "" ? null : _$1("g", { "data-click": "subtext", transform: "translate(".concat(subTextOffsetX, " ").concat(subTextOffsetY, ")") },
400
- _$1(TextBox, __assign({ fill: subText.fill || "#FFFFFF", textFill: subText.textFill || textFill }, subText, { height: textHeight, padding: textPadding, strokeWidth: 0, stroke: textboxStroke, fontFamily: textFontFamily, cornerRadius: cornerRadius })));
401
- return _$1("g", { transform: "scale(".concat(scale, ")") },
402
- _$1("g", { "data-click": "icon", transform: "translate(".concat(iconOffsetX, " ").concat(iconOffsetY, ")") },
403
- _$1(Icon, __assign({}, icon)),
404
- expansionIcon &&
405
- _$1("g", { "data-click": "expanded-icon", "data-click-data": JSON.stringify(expansionIcon), transform: "translate(".concat((icon.height + iconStrokeWidth) / 2 - expansionIcon.height / 2, " ").concat(-(icon.height + iconStrokeWidth) / 2 + expansionIcon.height / 2, ")") },
406
- _$1(Icon, __assign({}, expansionIcon)))),
407
- _$1("g", { transform: "translate(".concat(-fullAnnotationWidth / 2, " ").concat(annoOffsetY, ")") },
408
- textElement,
409
- annotationArr),
410
- subtextElement);
411
- };
412
- var CentroidVertex3 = function (_a) {
413
- var id = _a.id, _b = _a.categoryID, categoryID = _b === void 0 ? "" : _b, _c = _a.text, text = _c === void 0 ? "" : _c, _d = _a.textHeight, textHeight = _d === void 0 ? 12 : _d, _e = _a.textPadding, textPadding = _e === void 0 ? 10 : _e, _f = _a.textFill, textFill = _f === void 0 ? "#287EC4" : _f, _g = _a.textboxFill, textboxFill = _g === void 0 ? "white" : _g, _h = _a.textboxStroke, textboxStroke = _h === void 0 ? "#CCCCCC" : _h, _j = _a.textboxStrokeWidth, textboxStrokeWidth = _j === void 0 ? 1 : _j, _k = _a.textFontFamily, textFontFamily = _k === void 0 ? "Verdana" : _k, _l = _a.annotationGutter, annotationGutter = _l === void 0 ? 2 : _l, _m = _a.annotations, annotations = _m === void 0 ? [] : _m, cornerRadius = _a.cornerRadius, _o = _a.icon, icon = _o === void 0 ? {} : _o, _p = _a.subText, subText = _p === void 0 ? {} : _p, expansionIcon = _a.expansionIcon, _q = _a.scale, scale = _q === void 0 ? 1 : _q;
414
- icon = __assign({ height: 91, padding: 40, imageCharFill: "#555555", imageFontFamily: "FontAwesome", fill: "#FFCC33", stroke: "#DFDFDF", imageChar: "?", strokeWidth: 4, yOffset: -15 }, icon);
415
- subText = __assign({ text: "", fill: "transparent", textFill: "#555555" }, subText);
416
- var props = {
417
- id: id,
418
- categoryID: categoryID,
419
- text: text,
420
- textHeight: textHeight,
421
- textPadding: textPadding,
422
- textFill: textFill,
423
- textboxFill: textboxFill,
424
- textboxStroke: textboxStroke,
425
- textboxStrokeWidth: textboxStrokeWidth,
426
- textFontFamily: textFontFamily,
427
- annotationGutter: annotationGutter,
428
- annotations: annotations,
429
- cornerRadius: cornerRadius,
430
- icon: icon,
431
- subText: subText,
432
- expansionIcon: expansionIcon,
433
- scale: scale
434
- };
435
- return _$1(Vertex3, __assign({}, props, { icon: icon, subText: subText }));
436
- };
437
-
438
- var Vertex4 = function (_a) {
439
- _a.categoryID; var _c = _a.text, text = _c === void 0 ? "" : _c, _d = _a.textHeight, textHeight = _d === void 0 ? 10 : _d, _e = _a.textPadding, textPadding = _e === void 0 ? 4 : _e, _f = _a.textFill, textFill = _f === void 0 ? "#287EC4" : _f, _g = _a.textboxFill, textboxFill = _g === void 0 ? "white" : _g, _h = _a.textboxStroke, textboxStroke = _h === void 0 ? "#CCCCCC" : _h, _j = _a.textboxStrokeWidth, textboxStrokeWidth = _j === void 0 ? 1 : _j, _k = _a.textFontFamily, textFontFamily = _k === void 0 ? "Verdana" : _k, _l = _a.annotationGutter, annotationGutter = _l === void 0 ? 2 : _l, _m = _a.annotations, annotations = _m === void 0 ? [] : _m, _o = _a.iconAnnotations, iconAnnotations = _o === void 0 ? [] : _o, _p = _a.cornerRadius, cornerRadius = _p === void 0 ? 3 : _p, _q = _a.icon, icon = _q === void 0 ? {} : _q, _r = _a.subText, subText = _r === void 0 ? {} : _r, _s = _a.showLabel, showLabel = _s === void 0 ? true : _s, _t = _a.noLabelRadius, noLabelRadius = _t === void 0 ? 5 : _t, _u = _a.iconBorderWidth, iconBorderWidth = _u === void 0 ? 1 : _u, _v = _a.iconBorderColor, iconBorderColor = _v === void 0 ? "#333" : _v, _w = _a.iconBackgroundColor, iconBackgroundColor = _w === void 0 ? "#fff" : _w, _x = _a.iconFontColor, iconFontColor = _x === void 0 ? "#000" : _x, _y = _a.iconFontSize, iconFontSize = _y === void 0 ? 20 : _y, _z = _a.iconFontFamily, iconFontFamily = _z === void 0 ? "FontAwesome" : _z, _0 = _a.shapeOffsetX, shapeOffsetX = _0 === void 0 ? 0 : _0, _1 = _a.shapeOffsetY, shapeOffsetY = _1 === void 0 ? 0 : _1, _2 = _a.iconOffsetX, iconOffsetX = _2 === void 0 ? 0 : _2, _3 = _a.iconOffsetY, iconOffsetY = _3 === void 0 ? 0 : _3, _4 = _a.iconPadding, iconPadding = _4 === void 0 ? 4 : _4, _5 = _a.iconText, iconText = _5 === void 0 ? "?" : _5, _6 = _a.shapeRendering, shapeRendering = _6 === void 0 ? "auto" : _6;
440
- icon = __assign({ height: 50, imageChar: "?", imageFontFamily: "FontAwesome", imageCharFill: "#555555", fill: "transparent", strokeWidth: 0 }, icon);
441
- subText = __assign({ text: "", fill: "white", textFill: "#555555" }, subText);
442
- var annoOffsetY = 0;
443
- var labelWidth = q(function () {
444
- return Utility.textSize(text, textFontFamily, textHeight, false).width;
445
- }, [text, textFontFamily, textHeight]);
446
- var labelShapeWidth = 0;
447
- if (text !== "") {
448
- labelShapeWidth = labelWidth + (textPadding * 2) + (textboxStrokeWidth * 2);
449
- }
450
- var fullAnnotationWidth = labelShapeWidth + annotationGutter;
451
- var textOffsetX = fullAnnotationWidth - (labelShapeWidth / 2);
452
- var textShapeHeight = textHeight + (annotationGutter * 2) + (textboxStrokeWidth * 2);
453
- var annoWidthArr = annotations.map(function (anno, i) {
454
- return Utility.textSize(anno.imageChar, anno.imageFontFamily, anno.height, false).width;
455
- });
456
- var annotationArr = [];
457
- var _labelAnnoOffsetX = fullAnnotationWidth;
458
- annotations.forEach(function (anno, i) {
459
- var _a;
460
- var annoText = anno.imageChar;
461
- var annoTextHeight = (_a = anno.height) !== null && _a !== void 0 ? _a : textShapeHeight;
462
- _labelAnnoOffsetX += annoWidthArr[i] + annotationGutter;
463
- var annoOffsetX = _labelAnnoOffsetX - (annoWidthArr[i] / 2);
464
- annotationArr.push(_$1("g", { key: i, class: "vertex3-anno", "data-click": "annotation", "data-click-data": JSON.stringify(anno), transform: "translate(".concat(annoOffsetX, " ").concat(annoOffsetY, ")") },
465
- _$1(Icon, __assign({}, anno, { shape: "rectangle", width: annoWidthArr[i], height: annoTextHeight, imageChar: annoText, imageFontFamily: anno.imageFontFamily, cornerRadius: cornerRadius, strokeWidth: 0 }))));
466
- });
467
- if (annotations.length > 0) {
468
- fullAnnotationWidth += annotationGutter * (annotations.length - 1);
469
- }
470
- var iconAnnotationArr = [];
471
- iconAnnotations.forEach(function (anno, i) {
472
- var _a;
473
- var x = anno.shapeOffsetX;
474
- var y = anno.shapeOffsetY;
475
- iconAnnotationArr.push(_$1("g", { key: i, class: "vertex3-iconAnno", "data-click": "icon-annotation", "data-click-data": JSON.stringify(anno), transform: "translate(".concat(x, " ").concat(y, ")") },
476
- _$1(Icon, __assign({}, anno, { shape: (_a = anno.shape) !== null && _a !== void 0 ? _a : "square", imageChar: anno.imageChar, imageFontFamily: anno.imageFontFamily, cornerRadius: cornerRadius, stroke: anno.stroke, strokeWidth: anno.strokeWidth }))));
477
- });
478
- var textElement = _$1("g", { "data-click": "text", transform: "translate(".concat(textOffsetX, " ").concat(annoOffsetY, ")") }, !showLabel || text === "" ? _$1("circle", { r: noLabelRadius, stroke: textboxStroke, fill: textFill }) : _$1(TextBox, { text: text, height: textHeight, padding: textPadding, strokeWidth: textboxStrokeWidth, stroke: textboxStroke, fill: textboxFill, textFill: textFill, fontFamily: textFontFamily, cornerRadius: cornerRadius }));
479
- var subTextOffsetX = 0;
480
- var subTextOffsetY = textShapeHeight + (annotationGutter * 2);
481
- var subtextElement = subText.text === "" ? null : _$1("g", { "data-click": "subtext", transform: "translate(".concat(subTextOffsetX, " ").concat(subTextOffsetY, ")") },
482
- _$1(TextBox, __assign({ fill: subText.fill || "#FFFFFF", textFill: subText.textFill || textFill }, subText, { height: textHeight, padding: textPadding, strokeWidth: 0, stroke: textboxStroke, fontFamily: textFontFamily, cornerRadius: cornerRadius })));
483
- return _$1("g", null,
484
- _$1("g", { "data-click": "icon", transform: "translate(".concat(shapeOffsetX, " ").concat(shapeOffsetY, ")") },
485
- _$1(Icon, __assign({}, icon, { strokeWidth: iconBorderWidth, shape: "circle", height: iconFontSize, fill: iconBackgroundColor, stroke: iconBorderColor, imageFontFamily: iconFontFamily, imageChar: iconText, imageCharFill: iconFontColor, padding: iconPadding, xOffset: iconOffsetX, yOffset: iconOffsetY, cornerRadius: cornerRadius, shapeRendering: shapeRendering })),
486
- iconAnnotationArr),
487
- _$1("g", { transform: "translate(".concat(-fullAnnotationWidth / 2, " ").concat(annoOffsetY, ")") },
488
- textElement,
489
- annotationArr),
490
- subtextElement);
491
- };
492
- var CentroidVertex4 = function (_a) {
493
- var id = _a.id, _b = _a.categoryID, categoryID = _b === void 0 ? "" : _b, _c = _a.text, text = _c === void 0 ? "" : _c, _d = _a.textHeight, textHeight = _d === void 0 ? 12 : _d, _e = _a.textPadding, textPadding = _e === void 0 ? 10 : _e, _f = _a.textFill, textFill = _f === void 0 ? "#287EC4" : _f, _g = _a.textboxFill, textboxFill = _g === void 0 ? "white" : _g, _h = _a.textboxStroke, textboxStroke = _h === void 0 ? "#CCCCCC" : _h, _j = _a.textboxStrokeWidth, textboxStrokeWidth = _j === void 0 ? 1 : _j, _k = _a.textFontFamily, textFontFamily = _k === void 0 ? "Verdana" : _k, _l = _a.annotationGutter, annotationGutter = _l === void 0 ? 2 : _l, _m = _a.annotations, annotations = _m === void 0 ? [] : _m, _o = _a.iconAnnotations, iconAnnotations = _o === void 0 ? [] : _o, cornerRadius = _a.cornerRadius, _p = _a.icon, icon = _p === void 0 ? {} : _p, _q = _a.subText, subText = _q === void 0 ? {} : _q, _r = _a.showLabel, showLabel = _r === void 0 ? true : _r, _s = _a.noLabelRadius, noLabelRadius = _s === void 0 ? 5 : _s, _t = _a.iconBorderWidth, iconBorderWidth = _t === void 0 ? 1 : _t, _u = _a.iconBorderColor, iconBorderColor = _u === void 0 ? "#333" : _u, _v = _a.iconBackgroundColor, iconBackgroundColor = _v === void 0 ? "#fff" : _v, _w = _a.iconFontColor, iconFontColor = _w === void 0 ? "#000" : _w, _x = _a.iconFontSize, iconFontSize = _x === void 0 ? 20 : _x, _y = _a.iconFontFamily, iconFontFamily = _y === void 0 ? "FontAwesome" : _y, _z = _a.shapeOffsetX, shapeOffsetX = _z === void 0 ? 0 : _z, _0 = _a.shapeOffsetY, shapeOffsetY = _0 === void 0 ? 0 : _0, _1 = _a.iconOffsetX, iconOffsetX = _1 === void 0 ? 0 : _1, _2 = _a.iconOffsetY, iconOffsetY = _2 === void 0 ? 0 : _2, _3 = _a.iconPadding, iconPadding = _3 === void 0 ? 4 : _3, _4 = _a.iconText, iconText = _4 === void 0 ? "?" : _4, _5 = _a.shapeRendering, shapeRendering = _5 === void 0 ? "auto" : _5;
494
- icon = __assign({ height: 91, padding: 40, imageCharFill: "#555555", imageFontFamily: "FontAwesome", fill: "#FFCC33", stroke: "#DFDFDF", imageChar: "?", strokeWidth: 4, yOffset: -15 }, icon);
495
- subText = __assign({ text: "", fill: "transparent", textFill: "#555555" }, subText);
496
- var props = {
497
- id: id,
498
- categoryID: categoryID,
499
- text: text,
500
- textHeight: textHeight,
501
- textPadding: textPadding,
502
- textFill: textFill,
503
- textboxFill: textboxFill,
504
- textboxStroke: textboxStroke,
505
- textboxStrokeWidth: textboxStrokeWidth,
506
- textFontFamily: textFontFamily,
507
- annotationGutter: annotationGutter,
508
- annotations: annotations,
509
- iconAnnotations: iconAnnotations,
510
- cornerRadius: cornerRadius,
511
- icon: icon,
512
- subText: subText,
513
- showLabel: showLabel,
514
- noLabelRadius: noLabelRadius,
515
- iconBorderWidth: iconBorderWidth,
516
- iconBorderColor: iconBorderColor,
517
- iconBackgroundColor: iconBackgroundColor,
518
- iconFontColor: iconFontColor,
519
- iconFontSize: iconFontSize,
520
- iconFontFamily: iconFontFamily,
521
- shapeOffsetX: shapeOffsetX,
522
- shapeOffsetY: shapeOffsetY,
523
- iconOffsetX: iconOffsetX,
524
- iconOffsetY: iconOffsetY,
525
- iconPadding: iconPadding,
526
- iconText: iconText,
527
- shapeRendering: shapeRendering
528
- };
529
- return _$1(Vertex4, __assign({}, props, { icon: icon, subText: subText }));
530
- };
531
-
532
- var Subgraph = function (_a) {
533
- var text = _a.text, _b = _a.width, width = _b === void 0 ? 100 : _b, _c = _a.height, height = _c === void 0 ? 100 : _c, _d = _a.fill, fill = _d === void 0 ? "transparent" : _d, _e = _a.stroke, stroke = _e === void 0 ? "black" : _e, _f = _a.fontHeight, fontHeight = _f === void 0 ? 12 : _f, fontFamily = _a.fontFamily;
534
- var tSize = Utility.textSize(text, fontFamily, fontHeight, false);
535
- return _$1(k$1, null,
536
- _$1(Rectangle, { width: width, height: height, fill: fill, stroke: stroke }),
537
- _$1("g", { transform: "translate(".concat((-width + tSize.width) / 2 + 4, " ").concat((-height + tSize.height) / 2 + 4, ")") },
538
- _$1(Text, { height: fontHeight, text: text, fontFamily: fontFamily })));
539
- };
540
-
541
- export { Annotations, BUILD_VERSION$1 as BUILD_VERSION, CentroidVertex3, CentroidVertex4, Circle, Edge, HTMLAdapter, Icon, IconLabelledRect, Icons, ImageChar, LabelledRect, PKG_NAME$1 as PKG_NAME, PKG_VERSION$1 as PKG_VERSION, index_es6 as React, Rectangle, SVGAdapter, Shape, Square, Subgraph, Text, TextBox, TextLine, Vertex, Vertex2, Vertex3, Vertex4, render, svgRender };
542
- //# sourceMappingURL=index.es6.js.map