@hpcc-js/react 2.53.2 → 2.53.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es6.js +99 -393
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +540 -834
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +4 -4
- package/src/__package__.ts +2 -2
- package/src/edge.tsx +34 -33
- package/src/vertex.tsx +1 -0
- package/src/vertex3.tsx +3 -3
- package/types/__package__.d.ts +2 -2
- package/types/edge.d.ts +19 -5
- package/types/edge.d.ts.map +1 -1
- package/types/vertex.d.ts +1 -0
- package/types/vertex.d.ts.map +1 -1
- package/types/vertex3.d.ts +3 -3
- package/types/vertex3.d.ts.map +1 -1
- package/types-3.4/__package__.d.ts +2 -2
- package/types-3.4/edge.d.ts +22 -5
- package/types-3.4/vertex.d.ts +1 -0
- package/types-3.4/vertex3.d.ts +3 -3
package/dist/index.es6.js
CHANGED
|
@@ -1,345 +1,34 @@
|
|
|
1
1
|
import { Utility, Palette, publish, HTMLWidget, SVGWidget } from '@hpcc-js/common';
|
|
2
2
|
|
|
3
3
|
var PKG_NAME$1 = "@hpcc-js/react";
|
|
4
|
-
var PKG_VERSION$1 = "2.53.
|
|
5
|
-
var BUILD_VERSION$1 = "2.104.
|
|
4
|
+
var PKG_VERSION$1 = "2.53.3";
|
|
5
|
+
var BUILD_VERSION$1 = "2.104.14";
|
|
6
6
|
|
|
7
7
|
var PKG_NAME = "@hpcc-js/preact-shim";
|
|
8
8
|
var PKG_VERSION = "2.16.3";
|
|
9
|
-
var BUILD_VERSION = "2.104.
|
|
9
|
+
var BUILD_VERSION = "2.104.14";
|
|
10
10
|
|
|
11
11
|
var n,l$1,u$1,t$1,o$1,f$1={},e$1=[],c$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s(n,l){for(var u in l)n[u]=l[u];return n}function a$1(n){var l=n.parentNode;l&&l.removeChild(n);}function h$1(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return v$1(l,f,t,o,null)}function v$1(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u$1:r};return null==r&&null!=l$1.vnode&&l$1.vnode(f),f}function p$1(n){return n.children}function d$1(n,l){this.props=n,this.context=l;}function _(n,l){if(null==l)return n.__?_(n.__,n.__.__k.indexOf(n)+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?_(n):null}function k$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 k$1(n)}}function b$1(n){(!n.__d&&(n.__d=!0)&&t$1.push(n)&&!g$1.__r++||o$1!==l$1.debounceRendering)&&((o$1=l$1.debounceRendering)||setTimeout)(g$1);}function g$1(){for(var n;g$1.__r=t$1.length;)n=t$1.sort(function(n,l){return n.__v.__b-l.__v.__b}),t$1=[],n.some(function(n){var l,u,i,t,o,r;n.__d&&(o=(t=(l=n).__v).__e,(r=l.__P)&&(u=[],(i=s({},t)).__v=t.__v+1,j$1(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?_(t):o,t.__h),z$1(u,t),t.__e!=o&&k$1(t)));});}function w$1(n,l,u,i,t,o,r,c,s,a){var h,y,d,k,b,g,w,x=i&&i.__k||e$1,C=x.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(k=u.__k[h]=null==(k=l[h])||"boolean"==typeof k?null:"string"==typeof k||"number"==typeof k||"bigint"==typeof k?v$1(null,k,null,null,k):Array.isArray(k)?v$1(p$1,{children:k},null,null,null):k.__b>0?v$1(k.type,k.props,k.key,k.ref?k.ref:null,k.__v):k)){if(k.__=u,k.__b=u.__b+1,null===(d=x[h])||d&&k.key==d.key&&k.type===d.type)x[h]=void 0;else for(y=0;y<C;y++){if((d=x[y])&&k.key==d.key&&k.type===d.type){x[y]=void 0;break}d=null;}j$1(n,k,d=d||f$1,t,o,r,c,s,a),b=k.__e,(y=k.ref)&&d.ref!=y&&(w||(w=[]),d.ref&&w.push(d.ref,null,k),w.push(y,k.__c||b,k)),null!=b?(null==g&&(g=b),"function"==typeof k.type&&k.__k===d.__k?k.__d=s=m$1(k,s,n):s=A(n,k,d,x,b,s),"function"==typeof u.type&&(u.__d=s)):s&&d.__e==s&&s.parentNode!=n&&(s=_(d));}for(u.__e=g,h=C;h--;)null!=x[h]&&N(x[h],x[h]);if(w)for(h=0;h<w.length;h++)M(w[h],w[++h],w[++h]);}function m$1(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l="function"==typeof i.type?m$1(i,l,u):A(u,i,i,t,i.__e,l));return l}function A(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else {for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=2)if(f==t)break n;n.insertBefore(t,o),r=o;}return void 0!==r?r:t.nextSibling}function C(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||H(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||H(n,o,l[o],u[o],i);}function $(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||c$1.test(l)?u:u+"px";}function H(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||$(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||$(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?T$1:I,o):n.removeEventListener(l,o?T$1:I,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||!1===u&&-1==l.indexOf("-")?n.removeAttribute(l):n.setAttribute(l,u));}}function I(n){this.l[n.type+!1](l$1.event?l$1.event(n):n);}function T$1(n){this.l[n.type+!0](l$1.event?l$1.event(n):n);}function j$1(n,u,i,t,o,r,f,e,c){var a,h,v,y,_,k,b,g,m,x,A,C,$,H,I,T=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(a=l$1.__b)&&a(u);try{n:if("function"==typeof T){if(g=u.props,m=(a=T.contextType)&&t[a.__c],x=a?m?m.props.value:a.__:t,i.__c?b=(h=u.__c=i.__c).__=h.__E:("prototype"in T&&T.prototype.render?u.__c=h=new T(g,x):(u.__c=h=new d$1(g,x),h.constructor=T,h.render=O),m&&m.sub(h),h.props=g,h.state||(h.state={}),h.context=x,h.__n=t,v=h.__d=!0,h.__h=[],h._sb=[]),null==h.__s&&(h.__s=h.state),null!=T.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=s({},h.__s)),s(h.__s,T.getDerivedStateFromProps(g,h.__s))),y=h.props,_=h.state,v)null==T.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(null==T.getDerivedStateFromProps&&g!==y&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(g,x),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(g,h.__s,x)||u.__v===i.__v){for(h.props=g,h.state=h.__s,u.__v!==i.__v&&(h.__d=!1),h.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u);}),A=0;A<h._sb.length;A++)h.__h.push(h._sb[A]);h._sb=[],h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(g,h.__s,x),null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(y,_,k);});}if(h.context=x,h.props=g,h.__v=u,h.__P=n,C=l$1.__r,$=0,"prototype"in T&&T.prototype.render){for(h.state=h.__s,h.__d=!1,C&&C(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,C&&C(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&&(t=s(s({},t),h.getChildContext())),v||null==h.getSnapshotBeforeUpdate||(k=h.getSnapshotBeforeUpdate(y,_)),I=null!=a&&a.type===p$1&&null==a.key?a.props.children:a,w$1(n,Array.isArray(I)?I:[I],u,i,t,o,r,f,e,c),h.base=u.__e,u.__h=null,h.__h.length&&f.push(h),b&&(h.__E=h.__=null),h.__e=!1;}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=L(i.__e,u,i,t,o,r,f,c);(a=l$1.diffed)&&a(u);}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l$1.__e(n,u,i);}}function z$1(n,u){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 L(l,u,i,t,o,r,e,c){var s,h,v,y=i.props,p=u.props,d=u.type,k=0;if("svg"===d&&(o=!0),null!=r)for(;k<r.length;k++)if((s=r[k])&&"setAttribute"in s==!!d&&(d?s.localName===d:3===s.nodeType)){l=s,r[k]=null;break}if(null==l){if(null===d)return document.createTextNode(p);l=o?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,p.is&&p),r=null,c=!1;}if(null===d)y===p||c&&l.data===p||(l.data=p);else {if(r=r&&n.call(l.childNodes),h=(y=i.props||f$1).dangerouslySetInnerHTML,v=p.dangerouslySetInnerHTML,!c){if(null!=r)for(y={},k=0;k<l.attributes.length;k++)y[l.attributes[k].name]=l.attributes[k].value;(v||h)&&(v&&(h&&v.__html==h.__html||v.__html===l.innerHTML)||(l.innerHTML=v&&v.__html||""));}if(C(l,p,y,o,c),v)u.__k=[];else if(k=u.props.children,w$1(l,Array.isArray(k)?k:[k],u,i,t,o&&"foreignObject"!==d,r,e,r?r[0]:i.__k&&_(i,0),c),null!=r)for(k=r.length;k--;)null!=r[k]&&a$1(r[k]);c||("value"in p&&void 0!==(k=p.value)&&(k!==l.value||"progress"===d&&!k||"option"===d&&k!==y.value)&&H(l,"value",k,y.value,!1),"checked"in p&&void 0!==(k=p.checked)&&k!==l.checked&&H(l,"checked",k,y.checked,!1));}return l}function M(n,u,i){try{"function"==typeof n?n(u):n.current=u;}catch(n){l$1.__e(n,i);}}function N(n,u,i){var t,o;if(l$1.unmount&&l$1.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||M(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount();}catch(n){l$1.__e(n,u);}t.base=t.__P=null,n.__c=void 0;}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&N(t[o],u,i||"function"!=typeof n.type);i||null==n.__e||a$1(n.__e),n.__=n.__e=n.__d=void 0;}function O(n,l,u){return this.constructor(n,u)}function P(u,i,t){var o,r,e;l$1.__&&l$1.__(u,i),r=(o="function"==typeof t)?null:t&&t.__k||i.__k,e=[],j$1(i,u=(!o&&t||i).__k=h$1(p$1,null,[u]),r||f$1,f$1,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n.call(i.childNodes):null,e,!o&&t?t:r?r.__e:i.firstChild,o),z$1(e,u);}n=e$1.slice,l$1={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l;}throw n}},u$1=0,d$1.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=s({},this.state),"function"==typeof n&&(n=n(s({},u),this.props)),n&&s(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),b$1(this));},d$1.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),b$1(this));},d$1.prototype.render=p$1,t$1=[],g$1.__r=0;
|
|
12
12
|
|
|
13
|
-
var t,r,u,i,o=0,f=[],c=[],e=l$1.__b,a=l$1.__r,v=l$1.diffed,l=l$1.__c,m=l$1.unmount;function d(t,u){l$1.__h&&l$1.__h(r,t,o||u),o=0;var i=r.__H||(r.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:c}),i.__[t]}function p(n){return o=1,y
|
|
13
|
+
var t,r,u,i,o=0,f=[],c=[],e=l$1.__b,a=l$1.__r,v=l$1.diffed,l=l$1.__c,m=l$1.unmount;function d(t,u){l$1.__h&&l$1.__h(r,t,o||u),o=0;var i=r.__H||(r.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:c}),i.__[t]}function p(n){return o=1,y(B,n)}function y(n,u,i){var o=d(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):B(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)){r.u=!0;var f=r.shouldComponentUpdate;r.shouldComponentUpdate=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 !f||f.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)&&(!f||f.call(this,n,t,r))};}return o.__N||o.__}function h(u,i){var o=d(t++,3);!l$1.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r.__H.__h.push(o));}function F(n,r){var u=d(t++,7);return z(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function T(n,t){return o=8,F(function(){return n},t)}function b(){for(var t;t=f.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(k),t.__H.__h.forEach(w),t.__H.__h=[];}catch(r){t.__H.__h=[],l$1.__e(r,t.__v);}}l$1.__b=function(n){"function"!=typeof n.type||n.__m||null===n.__?n.__m||(n.__m=n.__&&n.__.__m?n.__.__m:""):n.__m=(n.__&&n.__.__m?n.__.__m:"")+(n.__&&n.__.__k?n.__.__k.indexOf(n):0),r=null,e&&e(n);},l$1.__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.__V=c,n.__N=n.i=void 0;})):(i.__h.forEach(k),i.__h.forEach(w),i.__h=[])),u=r;},l$1.diffed=function(t){v&&v(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f.push(o)&&i===l$1.requestAnimationFrame||((i=l$1.requestAnimationFrame)||j)(b)),o.__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;},l$1.__c=function(t,r){r.some(function(t){try{t.__h.forEach(k),t.__h=t.__h.filter(function(n){return !n.__||w(n)});}catch(u){r.some(function(n){n.__h&&(n.__h=[]);}),r=[],l$1.__e(u,t.__v);}}),l&&l(t,r);},l$1.unmount=function(t){m&&m(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{k(n);}catch(n){r=n;}}),u.__H=void 0,r&&l$1.__e(r,u.__v));};var g="function"==typeof requestAnimationFrame;function j(n){var t,r=function(){clearTimeout(u),g&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,100);g&&(t=requestAnimationFrame(r));}function k(n){var t=r,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r=t;}function w(n){var t=r;n.__c=n.__(),r=t;}function z(n,t){return !n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function B(n,t){return "function"==typeof t?t(n):t}
|
|
14
14
|
|
|
15
15
|
var index_es6 = /*#__PURE__*/Object.freeze({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
16
|
+
__proto__: null,
|
|
17
|
+
BUILD_VERSION: BUILD_VERSION,
|
|
18
|
+
Component: d$1,
|
|
19
|
+
Fragment: p$1,
|
|
20
|
+
PKG_NAME: PKG_NAME,
|
|
21
|
+
PKG_VERSION: PKG_VERSION,
|
|
22
|
+
createElement: h$1,
|
|
23
|
+
h: h$1,
|
|
24
|
+
render: P,
|
|
25
|
+
useCallback: T,
|
|
26
|
+
useEffect: h,
|
|
27
|
+
useMemo: F,
|
|
28
|
+
useReducer: y,
|
|
29
|
+
useState: p
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
var pi = Math.PI,
|
|
33
|
-
tau = 2 * pi,
|
|
34
|
-
epsilon = 1e-6,
|
|
35
|
-
tauEpsilon = tau - epsilon;
|
|
36
|
-
|
|
37
|
-
function Path() {
|
|
38
|
-
this._x0 = this._y0 = // start of current subpath
|
|
39
|
-
this._x1 = this._y1 = null; // end of current subpath
|
|
40
|
-
this._ = "";
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function path() {
|
|
44
|
-
return new Path;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
Path.prototype = path.prototype = {
|
|
48
|
-
constructor: Path,
|
|
49
|
-
moveTo: function(x, y) {
|
|
50
|
-
this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y);
|
|
51
|
-
},
|
|
52
|
-
closePath: function() {
|
|
53
|
-
if (this._x1 !== null) {
|
|
54
|
-
this._x1 = this._x0, this._y1 = this._y0;
|
|
55
|
-
this._ += "Z";
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
lineTo: function(x, y) {
|
|
59
|
-
this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y);
|
|
60
|
-
},
|
|
61
|
-
quadraticCurveTo: function(x1, y1, x, y) {
|
|
62
|
-
this._ += "Q" + (+x1) + "," + (+y1) + "," + (this._x1 = +x) + "," + (this._y1 = +y);
|
|
63
|
-
},
|
|
64
|
-
bezierCurveTo: function(x1, y1, x2, y2, x, y) {
|
|
65
|
-
this._ += "C" + (+x1) + "," + (+y1) + "," + (+x2) + "," + (+y2) + "," + (this._x1 = +x) + "," + (this._y1 = +y);
|
|
66
|
-
},
|
|
67
|
-
arcTo: function(x1, y1, x2, y2, r) {
|
|
68
|
-
x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
|
|
69
|
-
var x0 = this._x1,
|
|
70
|
-
y0 = this._y1,
|
|
71
|
-
x21 = x2 - x1,
|
|
72
|
-
y21 = y2 - y1,
|
|
73
|
-
x01 = x0 - x1,
|
|
74
|
-
y01 = y0 - y1,
|
|
75
|
-
l01_2 = x01 * x01 + y01 * y01;
|
|
76
|
-
|
|
77
|
-
// Is the radius negative? Error.
|
|
78
|
-
if (r < 0) throw new Error("negative radius: " + r);
|
|
79
|
-
|
|
80
|
-
// Is this path empty? Move to (x1,y1).
|
|
81
|
-
if (this._x1 === null) {
|
|
82
|
-
this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Or, is (x1,y1) coincident with (x0,y0)? Do nothing.
|
|
86
|
-
else if (!(l01_2 > epsilon));
|
|
87
|
-
|
|
88
|
-
// Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?
|
|
89
|
-
// Equivalently, is (x1,y1) coincident with (x2,y2)?
|
|
90
|
-
// Or, is the radius zero? Line to (x1,y1).
|
|
91
|
-
else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {
|
|
92
|
-
this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// Otherwise, draw an arc!
|
|
96
|
-
else {
|
|
97
|
-
var x20 = x2 - x0,
|
|
98
|
-
y20 = y2 - y0,
|
|
99
|
-
l21_2 = x21 * x21 + y21 * y21,
|
|
100
|
-
l20_2 = x20 * x20 + y20 * y20,
|
|
101
|
-
l21 = Math.sqrt(l21_2),
|
|
102
|
-
l01 = Math.sqrt(l01_2),
|
|
103
|
-
l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),
|
|
104
|
-
t01 = l / l01,
|
|
105
|
-
t21 = l / l21;
|
|
106
|
-
|
|
107
|
-
// If the start tangent is not coincident with (x0,y0), line to.
|
|
108
|
-
if (Math.abs(t01 - 1) > epsilon) {
|
|
109
|
-
this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
this._ += "A" + r + "," + r + ",0,0," + (+(y01 * x20 > x01 * y20)) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21);
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
arc: function(x, y, r, a0, a1, ccw) {
|
|
116
|
-
x = +x, y = +y, r = +r, ccw = !!ccw;
|
|
117
|
-
var dx = r * Math.cos(a0),
|
|
118
|
-
dy = r * Math.sin(a0),
|
|
119
|
-
x0 = x + dx,
|
|
120
|
-
y0 = y + dy,
|
|
121
|
-
cw = 1 ^ ccw,
|
|
122
|
-
da = ccw ? a0 - a1 : a1 - a0;
|
|
123
|
-
|
|
124
|
-
// Is the radius negative? Error.
|
|
125
|
-
if (r < 0) throw new Error("negative radius: " + r);
|
|
126
|
-
|
|
127
|
-
// Is this path empty? Move to (x0,y0).
|
|
128
|
-
if (this._x1 === null) {
|
|
129
|
-
this._ += "M" + x0 + "," + y0;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).
|
|
133
|
-
else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {
|
|
134
|
-
this._ += "L" + x0 + "," + y0;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// Is this arc empty? We’re done.
|
|
138
|
-
if (!r) return;
|
|
139
|
-
|
|
140
|
-
// Does the angle go the wrong way? Flip the direction.
|
|
141
|
-
if (da < 0) da = da % tau + tau;
|
|
142
|
-
|
|
143
|
-
// Is this a complete circle? Draw two arcs to complete the circle.
|
|
144
|
-
if (da > tauEpsilon) {
|
|
145
|
-
this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Is this arc non-empty? Draw an arc!
|
|
149
|
-
else if (da > epsilon) {
|
|
150
|
-
this._ += "A" + r + "," + r + ",0," + (+(da >= pi)) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1));
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
rect: function(x, y, w, h) {
|
|
154
|
-
this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + (+w) + "v" + (+h) + "h" + (-w) + "Z";
|
|
155
|
-
},
|
|
156
|
-
toString: function() {
|
|
157
|
-
return this._;
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
function constant(x) {
|
|
162
|
-
return function constant() {
|
|
163
|
-
return x;
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function Linear(context) {
|
|
168
|
-
this._context = context;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
Linear.prototype = {
|
|
172
|
-
areaStart: function() {
|
|
173
|
-
this._line = 0;
|
|
174
|
-
},
|
|
175
|
-
areaEnd: function() {
|
|
176
|
-
this._line = NaN;
|
|
177
|
-
},
|
|
178
|
-
lineStart: function() {
|
|
179
|
-
this._point = 0;
|
|
180
|
-
},
|
|
181
|
-
lineEnd: function() {
|
|
182
|
-
if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
|
|
183
|
-
this._line = 1 - this._line;
|
|
184
|
-
},
|
|
185
|
-
point: function(x, y) {
|
|
186
|
-
x = +x, y = +y;
|
|
187
|
-
switch (this._point) {
|
|
188
|
-
case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
|
|
189
|
-
case 1: this._point = 2; // proceed
|
|
190
|
-
default: this._context.lineTo(x, y); break;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
function curveLinear(context) {
|
|
196
|
-
return new Linear(context);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
function x(p) {
|
|
200
|
-
return p[0];
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
function y(p) {
|
|
204
|
-
return p[1];
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
function d3Line() {
|
|
208
|
-
var x$1 = x,
|
|
209
|
-
y$1 = y,
|
|
210
|
-
defined = constant(true),
|
|
211
|
-
context = null,
|
|
212
|
-
curve = curveLinear,
|
|
213
|
-
output = null;
|
|
214
|
-
|
|
215
|
-
function line(data) {
|
|
216
|
-
var i,
|
|
217
|
-
n = data.length,
|
|
218
|
-
d,
|
|
219
|
-
defined0 = false,
|
|
220
|
-
buffer;
|
|
221
|
-
|
|
222
|
-
if (context == null) output = curve(buffer = path());
|
|
223
|
-
|
|
224
|
-
for (i = 0; i <= n; ++i) {
|
|
225
|
-
if (!(i < n && defined(d = data[i], i, data)) === defined0) {
|
|
226
|
-
if (defined0 = !defined0) output.lineStart();
|
|
227
|
-
else output.lineEnd();
|
|
228
|
-
}
|
|
229
|
-
if (defined0) output.point(+x$1(d, i, data), +y$1(d, i, data));
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
if (buffer) return output = null, buffer + "" || null;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
line.x = function(_) {
|
|
236
|
-
return arguments.length ? (x$1 = typeof _ === "function" ? _ : constant(+_), line) : x$1;
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
line.y = function(_) {
|
|
240
|
-
return arguments.length ? (y$1 = typeof _ === "function" ? _ : constant(+_), line) : y$1;
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
line.defined = function(_) {
|
|
244
|
-
return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), line) : defined;
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
line.curve = function(_) {
|
|
248
|
-
return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
line.context = function(_) {
|
|
252
|
-
return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
return line;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
function point(that, x, y) {
|
|
259
|
-
that._context.bezierCurveTo(
|
|
260
|
-
(2 * that._x0 + that._x1) / 3,
|
|
261
|
-
(2 * that._y0 + that._y1) / 3,
|
|
262
|
-
(that._x0 + 2 * that._x1) / 3,
|
|
263
|
-
(that._y0 + 2 * that._y1) / 3,
|
|
264
|
-
(that._x0 + 4 * that._x1 + x) / 6,
|
|
265
|
-
(that._y0 + 4 * that._y1 + y) / 6
|
|
266
|
-
);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
function Basis(context) {
|
|
270
|
-
this._context = context;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
Basis.prototype = {
|
|
274
|
-
areaStart: function() {
|
|
275
|
-
this._line = 0;
|
|
276
|
-
},
|
|
277
|
-
areaEnd: function() {
|
|
278
|
-
this._line = NaN;
|
|
279
|
-
},
|
|
280
|
-
lineStart: function() {
|
|
281
|
-
this._x0 = this._x1 =
|
|
282
|
-
this._y0 = this._y1 = NaN;
|
|
283
|
-
this._point = 0;
|
|
284
|
-
},
|
|
285
|
-
lineEnd: function() {
|
|
286
|
-
switch (this._point) {
|
|
287
|
-
case 3: point(this, this._x1, this._y1); // proceed
|
|
288
|
-
case 2: this._context.lineTo(this._x1, this._y1); break;
|
|
289
|
-
}
|
|
290
|
-
if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
|
|
291
|
-
this._line = 1 - this._line;
|
|
292
|
-
},
|
|
293
|
-
point: function(x, y) {
|
|
294
|
-
x = +x, y = +y;
|
|
295
|
-
switch (this._point) {
|
|
296
|
-
case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
|
|
297
|
-
case 1: this._point = 2; break;
|
|
298
|
-
case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // proceed
|
|
299
|
-
default: point(this, x, y); break;
|
|
300
|
-
}
|
|
301
|
-
this._x0 = this._x1, this._x1 = x;
|
|
302
|
-
this._y0 = this._y1, this._y1 = y;
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
function d3CurveBasis(context) {
|
|
307
|
-
return new Basis(context);
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
var line = d3Line()
|
|
311
|
-
.x(function (d) { return d[0]; })
|
|
312
|
-
.y(function (d) { return d[1]; })
|
|
313
|
-
.curve(d3CurveBasis);
|
|
314
|
-
function calcArc(points, curveDepth) {
|
|
315
|
-
if (points.length === 2 && curveDepth) {
|
|
316
|
-
var dx = points[0][0] - points[1][0];
|
|
317
|
-
var dy = points[0][1] - points[1][1];
|
|
318
|
-
var dist = Math.sqrt(dx * dx + dy * dy);
|
|
319
|
-
if (dist) {
|
|
320
|
-
var midX = (points[0][0] + points[1][0]) / 2 - dy * curveDepth / 100;
|
|
321
|
-
var midY = (points[0][1] + points[1][1]) / 2 + dx * curveDepth / 100;
|
|
322
|
-
return [points[0], [midX, midY], points[1]];
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
return points;
|
|
326
|
-
}
|
|
327
|
-
var Edge = function (_a) {
|
|
328
|
-
var _b = _a.points, points = _b === void 0 ? [] : _b, _c = _a.curveDepth, curveDepth = _c === void 0 ? 16 : _c, _d = _a.stroke, stroke = _d === void 0 ? "black" : _d, strokeDasharray = _a.strokeDasharray;
|
|
329
|
-
var d = F(function () {
|
|
330
|
-
return line(calcArc(points, curveDepth));
|
|
331
|
-
}, [curveDepth, points]);
|
|
332
|
-
return h$1("path", { stroke: stroke, "stroke-dasharray": strokeDasharray, d: d });
|
|
333
|
-
};
|
|
334
|
-
|
|
335
|
-
var ImageChar = function (_a) {
|
|
336
|
-
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;
|
|
337
|
-
var renderChar = F(function () {
|
|
338
|
-
return fontFamily === "FontAwesome" ? Utility.faChar(char) : char;
|
|
339
|
-
}, [char, fontFamily]);
|
|
340
|
-
return h$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);
|
|
341
|
-
};
|
|
342
|
-
|
|
343
32
|
/******************************************************************************
|
|
344
33
|
Copyright (c) Microsoft Corporation.
|
|
345
34
|
|
|
@@ -393,6 +82,14 @@ function __metadata(metadataKey, metadataValue) {
|
|
|
393
82
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
394
83
|
}
|
|
395
84
|
|
|
85
|
+
var ImageChar = function (_a) {
|
|
86
|
+
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;
|
|
87
|
+
var renderChar = F(function () {
|
|
88
|
+
return fontFamily === "FontAwesome" ? Utility.faChar(char) : char;
|
|
89
|
+
}, [char, fontFamily]);
|
|
90
|
+
return h$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);
|
|
91
|
+
};
|
|
92
|
+
|
|
396
93
|
var Circle = function (_a) {
|
|
397
94
|
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;
|
|
398
95
|
return h$1("circle", { r: radius, fill: fill, stroke: stroke, "stroke-width": strokeWidth, "shape-rendering": shapeRendering });
|
|
@@ -433,6 +130,79 @@ var Icons = function (_a) {
|
|
|
433
130
|
return h$1(p$1, null, IconComponents);
|
|
434
131
|
};
|
|
435
132
|
|
|
133
|
+
var TextLine = function (_a) {
|
|
134
|
+
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;
|
|
135
|
+
return h$1("text", { "font-family": fontFamily, "font-size": "".concat(height, "px"), "text-anchor": anchor, "dominant-baseline": baseline, fill: fill }, text);
|
|
136
|
+
};
|
|
137
|
+
var Text = function (_a) {
|
|
138
|
+
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;
|
|
139
|
+
var _e = p(0), totalWidth = _e[0], setTotalWidthUpdate = _e[1];
|
|
140
|
+
var _f = p(0), totalHeight = _f[0], setTotalHeightUpdate = _f[1];
|
|
141
|
+
h(function () {
|
|
142
|
+
onSizeUpdate && onSizeUpdate({ width: totalWidth, height: totalHeight });
|
|
143
|
+
}, [totalWidth, totalHeight, onSizeUpdate]);
|
|
144
|
+
var parts = F(function () {
|
|
145
|
+
return text.split("\n");
|
|
146
|
+
}, [text]);
|
|
147
|
+
var ts = F(function () {
|
|
148
|
+
return Utility.textSize(parts, fontFamily, height);
|
|
149
|
+
}, [fontFamily, height, parts]);
|
|
150
|
+
setTotalWidthUpdate(ts.width);
|
|
151
|
+
setTotalHeightUpdate(parts.length * (height + 2) - 2);
|
|
152
|
+
var yOffset = -(totalHeight / 2) + (height / 2);
|
|
153
|
+
var TextLines = F(function () {
|
|
154
|
+
return parts.map(function (p, i) {
|
|
155
|
+
return h$1("g", { key: i, transform: "translate(0 ".concat(yOffset + i * (height + 2), ")") },
|
|
156
|
+
h$1(TextLine, { text: p, height: height, fontFamily: fontFamily, fill: fill }));
|
|
157
|
+
});
|
|
158
|
+
}, [fill, fontFamily, height, parts, yOffset]);
|
|
159
|
+
return h$1(p$1, null, TextLines);
|
|
160
|
+
};
|
|
161
|
+
var TextBox = function (_a) {
|
|
162
|
+
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;
|
|
163
|
+
var _k = p(0), textWidth = _k[0], setTextWidthUpdate = _k[1];
|
|
164
|
+
var _l = p(0), textHeight = _l[0], setTextHeightUpdate = _l[1];
|
|
165
|
+
h(function () {
|
|
166
|
+
onSizeUpdate && onSizeUpdate({ width: textWidth, height: textHeight });
|
|
167
|
+
}, [textWidth, textHeight, onSizeUpdate]);
|
|
168
|
+
var onTextSizeUpdate = T(function (size) {
|
|
169
|
+
setTextWidthUpdate(size.width);
|
|
170
|
+
setTextHeightUpdate(size.height);
|
|
171
|
+
}, []);
|
|
172
|
+
var w = textWidth + padding * 2 + strokeWidth;
|
|
173
|
+
var h$2 = textHeight + padding * 2 + strokeWidth;
|
|
174
|
+
var textOffsetY = Math.floor(height / 10);
|
|
175
|
+
return h$1(p$1, null,
|
|
176
|
+
h$1(Rectangle, { width: w, height: h$2, fill: fill, stroke: stroke, strokeWidth: strokeWidth, cornerRadius: cornerRadius }),
|
|
177
|
+
h$1("g", { transform: "translate(0 ".concat(textOffsetY, ")") },
|
|
178
|
+
h$1(Text, { text: text, fontFamily: fontFamily, height: height, fill: textFill, onSizeUpdate: onTextSizeUpdate })));
|
|
179
|
+
};
|
|
180
|
+
var LabelledRect = function (_a) {
|
|
181
|
+
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;
|
|
182
|
+
return h$1(p$1, null,
|
|
183
|
+
h$1(Rectangle, { width: width, height: height, fill: fill, stroke: stroke, strokeWidth: strokeWidth, cornerRadius: cornerRadius }),
|
|
184
|
+
h$1("g", { transform: "translate(".concat(-(width / 2) + padding, " ").concat(-(height / 2) + padding, ")") },
|
|
185
|
+
h$1(TextLine, { text: text, fontFamily: fontFamily, height: fontSize, fill: textFill, anchor: "start", baseline: "hanging" })));
|
|
186
|
+
};
|
|
187
|
+
var IconLabelledRect = function (_a) {
|
|
188
|
+
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;
|
|
189
|
+
return h$1(p$1, null,
|
|
190
|
+
h$1(Rectangle, { width: width, height: height, fill: fill, stroke: stroke, strokeWidth: strokeWidth, cornerRadius: cornerRadius }),
|
|
191
|
+
h$1("g", { transform: "translate(".concat(-(width / 2) + padding, " ").concat(-(height / 2) + padding, ")") },
|
|
192
|
+
h$1(Icon, { shape: "square", imageFontFamily: iconFontFamily, imageChar: icon, height: height, fill: fill, imageCharFill: textFill })),
|
|
193
|
+
h$1("g", { transform: "translate(".concat(-(width / 2) + (padding * 2) + height, " ").concat(-(height / 2) + padding, ")") },
|
|
194
|
+
h$1(TextLine, { text: text, fontFamily: fontFamily, height: fontSize, fill: textFill, anchor: "start", baseline: "hanging" })));
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
var Edge = function (_a) {
|
|
198
|
+
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;
|
|
199
|
+
return h$1(p$1, null,
|
|
200
|
+
h$1("path", { d: path, stroke: stroke, style: { strokeWidth: strokeWidth, strokeDasharray: strokeDasharray } }),
|
|
201
|
+
label && labelPos && labelPos.length === 2 ?
|
|
202
|
+
h$1("g", { transform: "translate(".concat(labelPos[0], " ").concat(labelPos[1], ")") },
|
|
203
|
+
h$1(Text, { text: label, fill: labelFill, height: labelHeight })) : undefined);
|
|
204
|
+
};
|
|
205
|
+
|
|
436
206
|
function render(C, props, parent, replaceNode) {
|
|
437
207
|
P(h$1(C, props), parent, replaceNode);
|
|
438
208
|
}
|
|
@@ -500,70 +270,6 @@ var SVGAdapter = /** @class */ (function (_super) {
|
|
|
500
270
|
return SVGAdapter;
|
|
501
271
|
}(SVGWidget));
|
|
502
272
|
|
|
503
|
-
var TextLine = function (_a) {
|
|
504
|
-
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;
|
|
505
|
-
return h$1("text", { "font-family": fontFamily, "font-size": "".concat(height, "px"), "text-anchor": anchor, "dominant-baseline": baseline, fill: fill }, text);
|
|
506
|
-
};
|
|
507
|
-
var Text = function (_a) {
|
|
508
|
-
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;
|
|
509
|
-
var _e = p(0), totalWidth = _e[0], setTotalWidthUpdate = _e[1];
|
|
510
|
-
var _f = p(0), totalHeight = _f[0], setTotalHeightUpdate = _f[1];
|
|
511
|
-
h(function () {
|
|
512
|
-
onSizeUpdate && onSizeUpdate({ width: totalWidth, height: totalHeight });
|
|
513
|
-
}, [totalWidth, totalHeight, onSizeUpdate]);
|
|
514
|
-
var parts = F(function () {
|
|
515
|
-
return text.split("\n");
|
|
516
|
-
}, [text]);
|
|
517
|
-
var ts = F(function () {
|
|
518
|
-
return Utility.textSize(parts, fontFamily, height);
|
|
519
|
-
}, [fontFamily, height, parts]);
|
|
520
|
-
setTotalWidthUpdate(ts.width);
|
|
521
|
-
setTotalHeightUpdate(parts.length * (height + 2) - 2);
|
|
522
|
-
var yOffset = -(totalHeight / 2) + (height / 2);
|
|
523
|
-
var TextLines = F(function () {
|
|
524
|
-
return parts.map(function (p, i) {
|
|
525
|
-
return h$1("g", { key: i, transform: "translate(0 ".concat(yOffset + i * (height + 2), ")") },
|
|
526
|
-
h$1(TextLine, { text: p, height: height, fontFamily: fontFamily, fill: fill }));
|
|
527
|
-
});
|
|
528
|
-
}, [fill, fontFamily, height, parts, yOffset]);
|
|
529
|
-
return h$1(p$1, null, TextLines);
|
|
530
|
-
};
|
|
531
|
-
var TextBox = function (_a) {
|
|
532
|
-
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;
|
|
533
|
-
var _k = p(0), textWidth = _k[0], setTextWidthUpdate = _k[1];
|
|
534
|
-
var _l = p(0), textHeight = _l[0], setTextHeightUpdate = _l[1];
|
|
535
|
-
h(function () {
|
|
536
|
-
onSizeUpdate && onSizeUpdate({ width: textWidth, height: textHeight });
|
|
537
|
-
}, [textWidth, textHeight, onSizeUpdate]);
|
|
538
|
-
var onTextSizeUpdate = T(function (size) {
|
|
539
|
-
setTextWidthUpdate(size.width);
|
|
540
|
-
setTextHeightUpdate(size.height);
|
|
541
|
-
}, []);
|
|
542
|
-
var w = textWidth + padding * 2 + strokeWidth;
|
|
543
|
-
var h$2 = textHeight + padding * 2 + strokeWidth;
|
|
544
|
-
var textOffsetY = Math.floor(height / 10);
|
|
545
|
-
return h$1(p$1, null,
|
|
546
|
-
h$1(Rectangle, { width: w, height: h$2, fill: fill, stroke: stroke, strokeWidth: strokeWidth, cornerRadius: cornerRadius }),
|
|
547
|
-
h$1("g", { transform: "translate(0 ".concat(textOffsetY, ")") },
|
|
548
|
-
h$1(Text, { text: text, fontFamily: fontFamily, height: height, fill: textFill, onSizeUpdate: onTextSizeUpdate })));
|
|
549
|
-
};
|
|
550
|
-
var LabelledRect = function (_a) {
|
|
551
|
-
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;
|
|
552
|
-
return h$1(p$1, null,
|
|
553
|
-
h$1(Rectangle, { width: width, height: height, fill: fill, stroke: stroke, strokeWidth: strokeWidth, cornerRadius: cornerRadius }),
|
|
554
|
-
h$1("g", { transform: "translate(".concat(-(width / 2) + padding, " ").concat(-(height / 2) + padding, ")") },
|
|
555
|
-
h$1(TextLine, { text: text, fontFamily: fontFamily, height: fontSize, fill: textFill, anchor: "start", baseline: "hanging" })));
|
|
556
|
-
};
|
|
557
|
-
var IconLabelledRect = function (_a) {
|
|
558
|
-
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;
|
|
559
|
-
return h$1(p$1, null,
|
|
560
|
-
h$1(Rectangle, { width: width, height: height, fill: fill, stroke: stroke, strokeWidth: strokeWidth, cornerRadius: cornerRadius }),
|
|
561
|
-
h$1("g", { transform: "translate(".concat(-(width / 2) + padding, " ").concat(-(height / 2) + padding, ")") },
|
|
562
|
-
h$1(Icon, { shape: "square", imageFontFamily: iconFontFamily, imageChar: icon, height: height, fill: fill, imageCharFill: textFill })),
|
|
563
|
-
h$1("g", { transform: "translate(".concat(-(width / 2) + (padding * 2) + height, " ").concat(-(height / 2) + padding, ")") },
|
|
564
|
-
h$1(TextLine, { text: text, fontFamily: fontFamily, height: fontSize, fill: textFill, anchor: "start", baseline: "hanging" })));
|
|
565
|
-
};
|
|
566
|
-
|
|
567
273
|
var Annotations = function (_a) {
|
|
568
274
|
var x = _a.x, y = _a.y, _b = _a.annotationIDs, annotationIDs = _b === void 0 ? [] : _b, _c = _a.stepSize, stepSize = _c === void 0 ? -16 : _c;
|
|
569
275
|
var IconComponents = annotationIDs.map(function (id, i) { return h$1("g", { key: id, transform: "translate(".concat(x + i * stepSize, " ").concat(y, ")") },
|