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