three-render-objects 1.33.2 → 1.35.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.
package/README.md CHANGED
@@ -86,7 +86,7 @@ new ThreeRenderObjects(<domElement>, { configOptions })
86
86
  | <b>hoverOrderComparator</b>([<i>fn</i>]) | Getter/setter for the comparator function to use when hovering over multiple objects under the same line of sight. This function can be used to prioritize hovering some objects over others. | By default, hovering priority is based solely on camera proximity (closest object wins). |
87
87
  | <b>hoverFilter</b>([<i>fn</i>]) | Getter/setter for the filter function that defines whether an object is eligible for hovering and other interactions. This function receives an object as sole argument and should return a `boolean` value | `() => true` |
88
88
  | <b>lineHoverPrecision</b>([<i>int</i>]) | Getter/setter for the precision to use when detecting hover events over [Line](https://threejs.org/docs/#api/objects/Line) objects. | 1 |
89
- | <b>tooltipContent</b>([<i>str</i> or <i>fn</i>]) | Object accessor function or attribute for label (shown in tooltip). Supports plain text or HTML content. ||
89
+ | <b>tooltipContent</b>([<i>str</i> or <i>fn</i>]) | Object accessor function or attribute for label (shown in tooltip). Supports plain text, HTML string content, an [HTML element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement) or [React JSX](https://react.dev/learn/writing-markup-with-jsx). ||
90
90
  | <b>enablePointerInteraction([<i>boolean</i>]) | Getter/setter for whether to enable the mouse tracking events. This activates an internal tracker of the canvas mouse position and enables the functionality of object hover/click and tooltip labels, at the cost of performance. If you're looking for maximum gain in your render performance it's recommended to switch off this property. | `true` |
91
91
  | <b>hoverDuringDrag([<i>boolean</i>]) | Getter/setter for whether to trigger hover events while using the controls via pointer dragging.| `false` |
92
92
  | <b>clickAfterDrag([<i>boolean</i>]) | Getter/setter for whether to trigger a click event after dragging using the controls.| `false` |
@@ -3,6 +3,7 @@ import { TrackballControls } from 'three/examples/jsm/controls/TrackballControls
3
3
  import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
4
4
  import { FlyControls } from 'three/examples/jsm/controls/FlyControls.js';
5
5
  import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.js';
6
+ import { ReactHTMLElement } from 'react';
6
7
 
7
8
  interface ConfigOptions {
8
9
  controlType?: 'trackball' | 'orbit' | 'fly';
@@ -67,8 +68,8 @@ declare class ThreeRenderObjectsGeneric<ChainableInstance> {
67
68
  hoverFilter(filterFn: (obj: Object3D) => boolean): ChainableInstance;
68
69
  lineHoverPrecision(): number;
69
70
  lineHoverPrecision(precision: number): ChainableInstance;
70
- tooltipContent(): Obj3DAccessor<string>;
71
- tooltipContent(contentAccessor: Obj3DAccessor<string>): ChainableInstance;
71
+ tooltipContent(): Obj3DAccessor<string | HTMLElement | ReactHTMLElement<HTMLElement> | boolean>;
72
+ tooltipContent(contentAccessor: Obj3DAccessor<string | HTMLElement | ReactHTMLElement<HTMLElement> | boolean>): ChainableInstance;
72
73
  enablePointerInteraction(): boolean;
73
74
  enablePointerInteraction(enable: boolean): ChainableInstance;
74
75
  hoverDuringDrag(): boolean;
@@ -1,4 +1,4 @@
1
- // Version 1.33.2 three-render-objects - https://github.com/vasturiano/three-render-objects
1
+ // Version 1.35.0 three-render-objects - https://github.com/vasturiano/three-render-objects
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('three')) :
4
4
  typeof define === 'function' && define.amd ? define(['three'], factory) :
@@ -46,8 +46,8 @@
46
46
  function _arrayWithoutHoles(r) {
47
47
  if (Array.isArray(r)) return _arrayLikeToArray$2(r);
48
48
  }
49
- function _defineProperty(e, r, t) {
50
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
49
+ function _defineProperty$1(e, r, t) {
50
+ return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, {
51
51
  value: t,
52
52
  enumerable: true,
53
53
  configurable: true,
@@ -93,7 +93,7 @@
93
93
  function _toConsumableArray(r) {
94
94
  return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray$2(r) || _nonIterableSpread();
95
95
  }
96
- function _toPrimitive(t, r) {
96
+ function _toPrimitive$1(t, r) {
97
97
  if ("object" != typeof t || !t) return t;
98
98
  var e = t[Symbol.toPrimitive];
99
99
  if (undefined !== e) {
@@ -103,8 +103,8 @@
103
103
  }
104
104
  return ("string" === r ? String : Number)(t);
105
105
  }
106
- function _toPropertyKey(t) {
107
- var i = _toPrimitive(t, "string");
106
+ function _toPropertyKey$1(t) {
107
+ var i = _toPrimitive$1(t, "string");
108
108
  return "symbol" == typeof i ? i : i + "";
109
109
  }
110
110
  function _unsupportedIterableToArray$2(r, a) {
@@ -77430,6 +77430,8 @@ var<${access}> ${name} : ${structName};`;
77430
77430
  return [event.pageX, event.pageY];
77431
77431
  }
77432
77432
 
77433
+ var n,l,u,t,i,r,o,e,f,c,s,a,p={},v=[],y=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,d=Array.isArray;function w(n,l){for(var u in l)n[u]=l[u];return n}function _(n){n&&n.parentNode&&n.parentNode.removeChild(n);}function g(l,u,t){var i,r,o,e={};for(o in u)"key"==o?i=u[o]:"ref"==o?r=u[o]:e[o]=u[o];if(arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(o in l.defaultProps) undefined===e[o]&&(e[o]=l.defaultProps[o]);return m(l,e,i,r,null)}function m(n,t,i,r,o){var e={type:n,props:t,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:undefined,__v:null==o?++u:o,__i:-1,__u:0};return null==o&&null!=l.vnode&&l.vnode(e),e}function k(n){return n.children}function x(n,l){this.props=n,this.context=l;}function C(n,l){if(null==l)return n.__?C(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?C(n):null}function S(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 S(n)}}function M(n){(!n.__d&&(n.__d=true)&&i.push(n)&&!P.__r++||r!==l.debounceRendering)&&((r=l.debounceRendering)||o)(P);}function P(){var n,u,t,r,o,f,c,s;for(i.sort(e);n=i.shift();)n.__d&&(u=i.length,r=undefined,f=(o=(t=n).__v).__e,c=[],s=[],t.__P&&((r=w({},o)).__v=o.__v+1,l.vnode&&l.vnode(r),j(t.__P,r,o,t.__n,t.__P.namespaceURI,32&o.__u?[f]:null,c,null==f?C(o):f,!!(32&o.__u),s),r.__v=o.__v,r.__.__k[r.__i]=r,z(c,r,s),r.__e!=f&&S(r)),i.length>u&&i.sort(e));P.__r=0;}function $(n,l,u,t,i,r,o,e,f,c,s){var a,h,y,d,w,_,g=t&&t.__k||v,m=l.length;for(f=I(u,l,g,f,m),a=0;a<m;a++)null!=(y=u.__k[a])&&(h=-1===y.__i?p:g[y.__i]||p,y.__i=a,_=j(n,y,h,i,r,o,e,f,c,s),d=y.__e,y.ref&&h.ref!=y.ref&&(h.ref&&V(h.ref,null,y),s.push(y.ref,y.__c||d,y)),null==w&&null!=d&&(w=d),4&y.__u||h.__k===y.__k?f=A(y,f,n):"function"==typeof y.type&&undefined!==_?f=_:d&&(f=d.nextSibling),y.__u&=-7);return u.__e=w,f}function I(n,l,u,t,i){var r,o,e,f,c,s=u.length,a=s,h=0;for(n.__k=new Array(i),r=0;r<i;r++)null!=(o=l[r])&&"boolean"!=typeof o&&"function"!=typeof o?(f=r+h,(o=n.__k[r]="string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?m(null,o,null,null,null):d(o)?m(k,{children:o},null,null,null):undefined===o.constructor&&o.__b>0?m(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=n,o.__b=n.__b+1,e=null,-1!==(c=o.__i=L(o,u,f,a))&&(a--,(e=u[c])&&(e.__u|=2)),null==e||null===e.__v?(-1==c&&h--,"function"!=typeof o.type&&(o.__u|=4)):c!=f&&(c==f-1?h--:c==f+1?h++:(c>f?h--:h++,o.__u|=4))):n.__k[r]=null;if(a)for(r=0;r<s;r++)null!=(e=u[r])&&0==(2&e.__u)&&(e.__e==t&&(t=C(e)),q(e,e));return t}function A(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=A(t[i],l,u));return l}n.__e!=l&&(l&&n.type&&!u.contains(l)&&(l=C(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,r,o=n.key,e=n.type,f=l[u];if(null===f||f&&o==f.key&&e===f.type&&0==(2&f.__u))return u;if(t>(null!=f&&0==(2&f.__u)?1:0))for(i=u-1,r=u+1;i>=0||r<l.length;){if(i>=0){if((f=l[i])&&0==(2&f.__u)&&o==f.key&&e===f.type)return i;i--;}if(r<l.length){if((f=l[r])&&0==(2&f.__u)&&o==f.key&&e===f.type)return r;r++;}}return -1}function T(n,l,u){"-"==l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||y.test(l)?u:u+"px";}function F(n,l,u,t,i){var r;n:if("style"==l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof t&&(n.style.cssText=t=""),t)for(l in t)u&&l in u||T(n.style,l,"");if(u)for(l in u)t&&u[l]===t[l]||T(n.style,l,u[l]);}else if("o"==l[0]&&"n"==l[1])r=l!=(l=l.replace(f,"$1")),l=l.toLowerCase()in n||"onFocusOut"==l||"onFocusIn"==l?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+r]=u,u?t?u.u=t.u:(u.u=c,n.addEventListener(l,r?a:s,r)):n.removeEventListener(l,r?a:s,r);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||false===u&&"-"!=l[4]?n.removeAttribute(l):n.setAttribute(l,"popover"==l&&1==u?"":u));}}function O(n){return function(u){if(this.l){var t=this.l[u.type+n];if(null==u.t)u.t=c++;else if(u.t<t.u)return;return t(l.event?l.event(u):u)}}}function j(n,u,t,i,r,o,e,f,c,s){var a,h,p,v,y,g,m,b,C,S,M,P,I,A,H,L,T,F=u.type;if(undefined!==u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),o=[f=u.__e=t.__e]),(a=l.__b)&&a(u);n:if("function"==typeof F)try{if(b=u.props,C="prototype"in F&&F.prototype.render,S=(a=F.contextType)&&i[a.__c],M=a?S?S.props.value:a.__:i,t.__c?m=(h=u.__c=t.__c).__=h.__E:(C?u.__c=h=new F(b,M):(u.__c=h=new x(b,M),h.constructor=F,h.render=B),S&&S.sub(h),h.props=b,h.state||(h.state={}),h.context=M,h.__n=i,p=h.__d=!0,h.__h=[],h._sb=[]),C&&null==h.__s&&(h.__s=h.state),C&&null!=F.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=w({},h.__s)),w(h.__s,F.getDerivedStateFromProps(b,h.__s))),v=h.props,y=h.state,h.__v=u,p)C&&null==F.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),C&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(C&&null==F.getDerivedStateFromProps&&b!==v&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(b,M),!h.__e&&(null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(b,h.__s,M)||u.__v==t.__v)){for(u.__v!=t.__v&&(h.props=b,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&&e.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(b,h.__s,M),C&&null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(v,y,g);});}if(h.context=M,h.props=b,h.__P=n,h.__e=!1,I=l.__r,A=0,C){for(h.state=h.__s,h.__d=!1,I&&I(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,I&&I(u),a=h.render(h.props,h.state,h.context),h.state=h.__s;}while(h.__d&&++A<25);h.state=h.__s,null!=h.getChildContext&&(i=w(w({},i),h.getChildContext())),C&&!p&&null!=h.getSnapshotBeforeUpdate&&(g=h.getSnapshotBeforeUpdate(v,y)),f=$(n,d(L=null!=a&&a.type===k&&null==a.key?a.props.children:a)?L:[L],u,t,i,r,o,e,f,c,s),h.base=u.__e,u.__u&=-161,h.__h.length&&e.push(h),m&&(h.__E=h.__=null);}catch(n){if(u.__v=null,c||null!=o)if(n.then){for(u.__u|=c?160:128;f&&8==f.nodeType&&f.nextSibling;)f=f.nextSibling;o[o.indexOf(f)]=null,u.__e=f;}else for(T=o.length;T--;)_(o[T]);else u.__e=t.__e,u.__k=t.__k;l.__e(n,u,t);}else null==o&&u.__v==t.__v?(u.__k=t.__k,u.__e=t.__e):f=u.__e=N(t.__e,u,t,i,r,o,e,c,s);return (a=l.diffed)&&a(u),128&u.__u?undefined:f}function z(n,u,t){for(var i=0;i<t.length;i++)V(t[i],t[++i],t[++i]);l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l.__e(n,u.__v);}});}function N(u,t,i,r,o,e,f,c,s){var a,h,v,y,w,g,m,b=i.props,k=t.props,x=t.type;if("svg"==x?o="http://www.w3.org/2000/svg":"math"==x?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=e)for(a=0;a<e.length;a++)if((w=e[a])&&"setAttribute"in w==!!x&&(x?w.localName==x:3==w.nodeType)){u=w,e[a]=null;break}if(null==u){if(null==x)return document.createTextNode(k);u=document.createElementNS(o,x,k.is&&k),c&&(l.__m&&l.__m(t,e),c=false),e=null;}if(null===x)b===k||c&&u.data===k||(u.data=k);else {if(e=e&&n.call(u.childNodes),b=i.props||p,!c&&null!=e)for(b={},a=0;a<u.attributes.length;a++)b[(w=u.attributes[a]).name]=w.value;for(a in b)if(w=b[a],"children"==a);else if("dangerouslySetInnerHTML"==a)v=w;else if(!(a in k)){if("value"==a&&"defaultValue"in k||"checked"==a&&"defaultChecked"in k)continue;F(u,a,null,w,o);}for(a in k)w=k[a],"children"==a?y=w:"dangerouslySetInnerHTML"==a?h=w:"value"==a?g=w:"checked"==a?m=w:c&&"function"!=typeof w||b[a]===w||F(u,a,w,b[a],o);if(h)c||v&&(h.__html===v.__html||h.__html===u.innerHTML)||(u.innerHTML=h.__html),t.__k=[];else if(v&&(u.innerHTML=""),$(u,d(y)?y:[y],t,i,r,"foreignObject"==x?"http://www.w3.org/1999/xhtml":o,e,f,e?e[0]:i.__k&&C(i,0),c,s),null!=e)for(a=e.length;a--;)_(e[a]);c||(a="value","progress"==x&&null==g?u.removeAttribute("value"):undefined!==g&&(g!==u[a]||"progress"==x&&!g||"option"==x&&g!==b[a])&&F(u,a,g,b[a],o),a="checked",undefined!==m&&m!==u[a]&&F(u,a,m,b[a],o));}return u}function V(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.__e(n,t);}}function q(n,u,t){var i,r;if(l.unmount&&l.unmount(n),(i=n.ref)&&(i.current&&i.current!==n.__e||V(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount();}catch(n){l.__e(n,u);}i.base=i.__P=null;}if(i=n.__k)for(r=0;r<i.length;r++)i[r]&&q(i[r],u,t||"function"!=typeof n.type);t||_(n.__e),n.__c=n.__=n.__e=undefined;}function B(n,l,u){return this.constructor(n,u)}function D(u,t,i){var r,o,e,f;t==document&&(t=document.documentElement),l.__&&l.__(u,t),o=(r="function"=="undefined")?null:t.__k,e=[],f=[],j(t,u=(t).__k=g(k,null,[u]),o||p,p,t.namespaceURI,o?null:t.firstChild?n.call(t.childNodes):null,e,o?o.__e:t.firstChild,r,f),z(e,u,f);}function G(l,u,t){var i,r,o,e,f=w({},l.props);for(o in l.type&&l.type.defaultProps&&(e=l.type.defaultProps),u)"key"==o?i=u[o]:"ref"==o?r=u[o]:f[o]=undefined===u[o]&&undefined!==e?e[o]:u[o];return arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),m(l.type,f,i||l.key,r||l.ref,null)}n=v.slice,l={__e:function(n,l,u,t){for(var i,r,o;l=l.__;)if((i=l.__c)&&!i.__)try{if((r=i.constructor)&&null!=r.getDerivedStateFromError&&(i.setState(r.getDerivedStateFromError(n)),o=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),o=i.__d),o)return i.__E=i}catch(l){n=l;}throw n}},u=0,t=function(n){return null!=n&&null==n.constructor},x.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=w({},this.state),"function"==typeof n&&(n=n(w({},u),this.props)),n&&w(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),M(this));},x.prototype.forceUpdate=function(n){this.__v&&(this.__e=true,n&&this.__h.push(n),M(this));},x.prototype.render=k,i=[],o="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,e=function(n,l){return n.__v.__b-l.__v.__b},P.__r=0,f=/(PointerCapture)$|Capture$/i,c=0,s=O(false),a=O(true);
77434
+
77433
77435
  function _arrayLikeToArray(r, a) {
77434
77436
  (null == a || a > r.length) && (a = r.length);
77435
77437
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
@@ -77438,6 +77440,14 @@ var<${access}> ${name} : ${structName};`;
77438
77440
  function _arrayWithHoles(r) {
77439
77441
  if (Array.isArray(r)) return r;
77440
77442
  }
77443
+ function _defineProperty(e, r, t) {
77444
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
77445
+ value: t,
77446
+ enumerable: true,
77447
+ configurable: true,
77448
+ writable: true
77449
+ }) : e[r] = t, e;
77450
+ }
77441
77451
  function _iterableToArrayLimit(r, l) {
77442
77452
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
77443
77453
  if (null != t) {
@@ -77465,9 +77475,44 @@ var<${access}> ${name} : ${structName};`;
77465
77475
  function _nonIterableRest() {
77466
77476
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
77467
77477
  }
77478
+ function ownKeys(e, r) {
77479
+ var t = Object.keys(e);
77480
+ if (Object.getOwnPropertySymbols) {
77481
+ var o = Object.getOwnPropertySymbols(e);
77482
+ r && (o = o.filter(function (r) {
77483
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
77484
+ })), t.push.apply(t, o);
77485
+ }
77486
+ return t;
77487
+ }
77488
+ function _objectSpread2(e) {
77489
+ for (var r = 1; r < arguments.length; r++) {
77490
+ var t = null != arguments[r] ? arguments[r] : {};
77491
+ r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
77492
+ _defineProperty(e, r, t[r]);
77493
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
77494
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
77495
+ });
77496
+ }
77497
+ return e;
77498
+ }
77468
77499
  function _slicedToArray(r, e) {
77469
77500
  return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
77470
77501
  }
77502
+ function _toPrimitive(t, r) {
77503
+ if ("object" != typeof t || !t) return t;
77504
+ var e = t[Symbol.toPrimitive];
77505
+ if (undefined !== e) {
77506
+ var i = e.call(t, r || "default");
77507
+ if ("object" != typeof i) return i;
77508
+ throw new TypeError("@@toPrimitive must return a primitive value.");
77509
+ }
77510
+ return ("string" === r ? String : Number)(t);
77511
+ }
77512
+ function _toPropertyKey(t) {
77513
+ var i = _toPrimitive(t, "string");
77514
+ return "symbol" == typeof i ? i : i + "";
77515
+ }
77471
77516
  function _typeof(o) {
77472
77517
  "@babel/helpers - typeof";
77473
77518
 
@@ -77485,6 +77530,26 @@ var<${access}> ${name} : ${structName};`;
77485
77530
  }
77486
77531
  }
77487
77532
 
77533
+ var _reactElement2VNode = function reactElement2VNode(el) {
77534
+ // Among other things, react VNodes (and all its children) need to have constructor: undefined attributes in order to be recognised, cloneElement (applied recursively) does the necessary conversion
77535
+ if (!(_typeof(el) === 'object')) return el;
77536
+ var res = G(el);
77537
+ if (res.props) {
77538
+ var _res$props;
77539
+ res.props = _objectSpread2({}, res.props);
77540
+ if (res !== null && res !== undefined && (_res$props = res.props) !== null && _res$props !== undefined && _res$props.children) {
77541
+ res.props.children = Array.isArray(res.props.children) ? res.props.children.map(_reactElement2VNode) : _reactElement2VNode(res.props.children);
77542
+ }
77543
+ }
77544
+ return res;
77545
+ };
77546
+ var isReactRenderable = function isReactRenderable(o) {
77547
+ return t(G(o));
77548
+ };
77549
+ var render = function render(jsx, domEl) {
77550
+ return D(_reactElement2VNode(jsx), domEl);
77551
+ };
77552
+
77488
77553
  function styleInject(css, ref) {
77489
77554
  if (ref === undefined) ref = {};
77490
77555
  var insertAt = ref.insertAt;
@@ -77510,7 +77575,7 @@ var<${access}> ${name} : ${structName};`;
77510
77575
  }
77511
77576
  }
77512
77577
 
77513
- var css_248z = ".float-tooltip-kap {\n position: absolute;\n padding: 2px 4px;\n border-radius: 3px;\n font: 12px sans-serif;\n color: #eee;\n background: rgba(0,0,0,0.6);\n pointer-events: none;\n}\n";
77578
+ var css_248z = ".float-tooltip-kap {\n position: absolute;\n width: max-content; /* prevent shrinking near right edge */\n max-width: max(50%, 150px);\n padding: 3px 5px;\n border-radius: 3px;\n font: 12px sans-serif;\n color: #eee;\n background: rgba(0,0,0,0.6);\n pointer-events: none;\n}\n";
77514
77579
  styleInject(css_248z);
77515
77580
 
77516
77581
  var index = index$1({
@@ -77525,6 +77590,9 @@ var<${access}> ${name} : ${structName};`;
77525
77590
  style = _ref$style === undefined ? {} : _ref$style;
77526
77591
  var isD3Selection = !!domNode && _typeof(domNode) === 'object' && !!domNode.node && typeof domNode.node === 'function';
77527
77592
  var el = select(isD3Selection ? domNode.node() : domNode);
77593
+
77594
+ // make sure container is positioned, to provide anchor for tooltip
77595
+ el.style('position') === 'static' && el.style('position', 'relative');
77528
77596
  state.tooltipEl = el.append('div').attr('class', 'float-tooltip-kap');
77529
77597
  Object.entries(style).forEach(function (_ref2) {
77530
77598
  var _ref3 = _slicedToArray(_ref2, 2),
@@ -77533,7 +77601,7 @@ var<${access}> ${name} : ${structName};`;
77533
77601
  return state.tooltipEl.style(k, v);
77534
77602
  });
77535
77603
  state.tooltipEl // start off-screen
77536
- .style('left', '-100000px').style('display', 'none');
77604
+ .style('left', '-10000px').style('display', 'none');
77537
77605
  state.mouseInside = false;
77538
77606
  el.on('mousemove.tooltip', function (ev) {
77539
77607
  state.mouseInside = true;
@@ -77545,7 +77613,7 @@ var<${access}> ${name} : ${structName};`;
77545
77613
  // adjust horizontal position to not exceed canvas boundaries
77546
77614
  .style('transform', "translate(-".concat(mousePos[0] / canvasWidth * 100, "%, ").concat(
77547
77615
  // flip to above if near bottom
77548
- canvasHeight - mousePos[1] < 100 ? 'calc(-100% - 6px)' : '21px', ")"));
77616
+ canvasHeight > 130 && canvasHeight - mousePos[1] < 100 ? 'calc(-100% - 6px)' : '21px', ")"));
77549
77617
  });
77550
77618
  el.on('mouseover.tooltip', function () {
77551
77619
  state.mouseInside = true;
@@ -77558,7 +77626,22 @@ var<${access}> ${name} : ${structName};`;
77558
77626
  },
77559
77627
  update: function update(state) {
77560
77628
  state.tooltipEl.style('display', !!state.content && state.mouseInside ? 'inline' : 'none');
77561
- state.tooltipEl.html(state.content || '');
77629
+ if (!state.content) {
77630
+ state.tooltipEl.text('');
77631
+ } else if (state.content instanceof HTMLElement) {
77632
+ state.tooltipEl.text(''); // empty it
77633
+ state.tooltipEl.append(function () {
77634
+ return state.content;
77635
+ });
77636
+ } else if (typeof state.content === 'string') {
77637
+ state.tooltipEl.html(state.content);
77638
+ } else if (isReactRenderable(state.content)) {
77639
+ state.tooltipEl.text(''); // empty it
77640
+ render(state.content, state.tooltipEl.node());
77641
+ } else {
77642
+ state.tooltipEl.style('display', 'none');
77643
+ console.warn('Tooltip content is invalid, skipping.', state.content, state.content.toString());
77644
+ }
77562
77645
  }
77563
77646
  });
77564
77647
 
@@ -77810,7 +77893,7 @@ var<${access}> ${name} : ${structName};`;
77810
77893
 
77811
77894
  // extract global x,y,z min/max
77812
77895
  return Object.assign.apply(Object, _toConsumableArray(['x', 'y', 'z'].map(function (c) {
77813
- return _defineProperty({}, c, [box.min[c], box.max[c]]);
77896
+ return _defineProperty$1({}, c, [box.min[c], box.max[c]]);
77814
77897
  })));
77815
77898
  },
77816
77899
  getScreenCoords: function getScreenCoords(state, x, y, z) {