@oliasoft-open-source/charts-library 5.0.1-beta-1 → 5.0.2-beta-1

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.
@@ -1,4 +1,4 @@
1
- import{j as n}from"./jsx-runtime-Y5Ju2SGo.js";import{r as g}from"./index-eCxJ45ll.js";import{B as p}from"./legend-krJw8Ykb.js";import{L as r}from"./line-chart-TEIxShHM.js";import"./legend-context-vqtlaWwg.js";import"./index-B-BONL6g.js";import"./index-BGqSdrBK.js";import"./index-D3-0uUTW.js";import"./get-draggableData-CQpLHCdg.js";const c={data:{datasets:[{label:"Dataset 1",data:[{x:0,y:0},{x:5,y:25}]}]},options:{title:"Chart title",chartStyling:{height:"100%"}}},C={title:"LineChart / Test Cases",component:r,args:{chart:c}},a=()=>{const[t,x]=g.useState(!1);return n.jsxs(n.Fragment,{children:[n.jsx(p,{onClick:()=>x(!t),label:"Toggle size"}),n.jsx("div",{style:{height:t?300:null,width:t?300:null,padding:"var(--padding)",overflow:"auto"},children:n.jsx(r,{chart:c})})]})},e=()=>n.jsx(r,{chart:{data:{datasets:[{label:"Duration %",lineTension:"0",pointHitRadius:10,borderColor:"#dc3912",pointBackgroundColor:"#dc3912",borderWidth:2,pointRadius:4,data:[{x:3,y:0},{x:3,y:100}],yAxisID:"y2"}]},options:{direction:"vertical",axes:{x:[{label:"Duration (TempSim long) [d]",position:"bottom"}],y:[{label:"Probability"},{label:"Percentage [%]"}]},annotations:{annotationsData:[{annotationAxis:"y2",color:"darkgrey",value:16},{displayDragCoordinates:!1,color:"#ff9900",label:"P16",dragAxis:"y",enableDrag:!0,resizable:!1,type:"box",xMax:3,xMin:3,yMax:17,yMin:15,yScaleID:"y2"},{annotationAxis:"y2",color:"darkgrey",value:66},{displayDragCoordinates:!1,color:"#109618",label:"P66",dragAxis:"y",enableDrag:!0,resizable:!1,type:"box",xMax:3,xMin:3,yMax:67,yMin:65,yScaleID:"y2"},{annotationAxis:"y2",color:"darkgrey",value:78},{displayDragCoordinates:!1,color:"#990099",label:"P78",dragAxis:"y",enableDrag:!0,resizable:!1,type:"box",xMax:3,xMin:3,yMax:79,yMin:77,yScaleID:"y2"},{annotationAxis:"y2",color:"darkgrey",value:90},{displayDragCoordinates:!1,color:"#0099c6",label:"P90",dragAxis:"y",enableDrag:!0,resizable:!1,type:"box",xMax:3,xMin:3,yMax:91,yMin:89,yScaleID:"y2"}],enableDragAnnotation:!0,showAnnotations:!0},additionalAxesOptions:{range:{x:{min:3}},chartScaleType:"linear",reverse:!1},graph:{showMinorGridlines:!0},chartStyling:{height:"100%"},chartOptions:{showPoints:!1,enableDragAnnotation:!0}}}});a.__docgenInfo={description:"",methods:[],displayName:"TestLegendDropzoneResizing"};e.__docgenInfo={description:"",methods:[],displayName:"PartialRangeWithSimilarValues"};var o,i,l;a.parameters={...a.parameters,docs:{...(o=a.parameters)==null?void 0:o.docs,source:{originalSource:`() => {
1
+ import{j as n}from"./jsx-runtime-Y5Ju2SGo.js";import{r as g}from"./index-eCxJ45ll.js";import{B as p}from"./legend-krJw8Ykb.js";import{L as r}from"./line-chart-Dv_KrvKB.js";import"./legend-context-vqtlaWwg.js";import"./index-B-BONL6g.js";import"./index-BGqSdrBK.js";import"./index-D3-0uUTW.js";import"./get-draggableData-CQpLHCdg.js";const c={data:{datasets:[{label:"Dataset 1",data:[{x:0,y:0},{x:5,y:25}]}]},options:{title:"Chart title",chartStyling:{height:"100%"}}},C={title:"LineChart / Test Cases",component:r,args:{chart:c}},a=()=>{const[t,x]=g.useState(!1);return n.jsxs(n.Fragment,{children:[n.jsx(p,{onClick:()=>x(!t),label:"Toggle size"}),n.jsx("div",{style:{height:t?300:null,width:t?300:null,padding:"var(--padding)",overflow:"auto"},children:n.jsx(r,{chart:c})})]})},e=()=>n.jsx(r,{chart:{data:{datasets:[{label:"Duration %",lineTension:"0",pointHitRadius:10,borderColor:"#dc3912",pointBackgroundColor:"#dc3912",borderWidth:2,pointRadius:4,data:[{x:3,y:0},{x:3,y:100}],yAxisID:"y2"}]},options:{direction:"vertical",axes:{x:[{label:"Duration (TempSim long) [d]",position:"bottom"}],y:[{label:"Probability"},{label:"Percentage [%]"}]},annotations:{annotationsData:[{annotationAxis:"y2",color:"darkgrey",value:16},{displayDragCoordinates:!1,color:"#ff9900",label:"P16",dragAxis:"y",enableDrag:!0,resizable:!1,type:"box",xMax:3,xMin:3,yMax:17,yMin:15,yScaleID:"y2"},{annotationAxis:"y2",color:"darkgrey",value:66},{displayDragCoordinates:!1,color:"#109618",label:"P66",dragAxis:"y",enableDrag:!0,resizable:!1,type:"box",xMax:3,xMin:3,yMax:67,yMin:65,yScaleID:"y2"},{annotationAxis:"y2",color:"darkgrey",value:78},{displayDragCoordinates:!1,color:"#990099",label:"P78",dragAxis:"y",enableDrag:!0,resizable:!1,type:"box",xMax:3,xMin:3,yMax:79,yMin:77,yScaleID:"y2"},{annotationAxis:"y2",color:"darkgrey",value:90},{displayDragCoordinates:!1,color:"#0099c6",label:"P90",dragAxis:"y",enableDrag:!0,resizable:!1,type:"box",xMax:3,xMin:3,yMax:91,yMin:89,yScaleID:"y2"}],enableDragAnnotation:!0,showAnnotations:!0},additionalAxesOptions:{range:{x:{min:3}},chartScaleType:"linear",reverse:!1},graph:{showMinorGridlines:!0},chartStyling:{height:"100%"},chartOptions:{showPoints:!1,enableDragAnnotation:!0}}}});a.__docgenInfo={description:"",methods:[],displayName:"TestLegendDropzoneResizing"};e.__docgenInfo={description:"",methods:[],displayName:"PartialRangeWithSimilarValues"};var o,i,l;a.parameters={...a.parameters,docs:{...(o=a.parameters)==null?void 0:o.docs,source:{originalSource:`() => {
2
2
  const [isSmall, setIsSmall] = useState(false);
3
3
  return <>
4
4
  <Button onClick={() => setIsSmall(!isSmall)} label="Toggle size" />
@@ -1,3 +1,3 @@
1
- import{j as c}from"./jsx-runtime-Y5Ju2SGo.js";import{r as v}from"./index-eCxJ45ll.js";import{c as p,D as j}from"./DocsRenderer-CFRXHY34-cMkmi-tX.js";import{e as E}from"./index-B-BONL6g.js";import"./preview-BNebtty_.js";import"./iframe-Bj1sRZW3.js";import"./index-BGqSdrBK.js";import"./index-D3-0uUTW.js";import"./index-Dytf1aFS.js";import"./client-9BU5HM4U.js";var g="DARK_MODE";function f(t){"@babel/helpers - typeof";return f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},f(t)}var b;function A(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),e.push.apply(e,n)}return e}function D(t){for(var r=1;r<arguments.length;r++){var e=arguments[r]!=null?arguments[r]:{};r%2?A(Object(e),!0).forEach(function(n){I(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):A(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}function I(t,r,e){return r=M(r),r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function M(t){var r=R(t,"string");return f(r)==="symbol"?r:String(r)}function R(t,r){if(f(t)!=="object"||t===null)return t;var e=t[Symbol.toPrimitive];if(e!==void 0){var n=e.call(t,r);if(f(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function y(t){return L(t)||N(t)||K(t)||x()}function x(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1
+ import{j as c}from"./jsx-runtime-Y5Ju2SGo.js";import{r as v}from"./index-eCxJ45ll.js";import{c as p,D as j}from"./DocsRenderer-CFRXHY34-DKIsUafc.js";import{e as E}from"./index-B-BONL6g.js";import"./preview-DLeQ-_m8.js";import"./iframe-DFPTtPL0.js";import"./index-BGqSdrBK.js";import"./index-D3-0uUTW.js";import"./index-Dytf1aFS.js";import"./client-9BU5HM4U.js";var g="DARK_MODE";function f(t){"@babel/helpers - typeof";return f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},f(t)}var b;function A(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),e.push.apply(e,n)}return e}function D(t){for(var r=1;r<arguments.length;r++){var e=arguments[r]!=null?arguments[r]:{};r%2?A(Object(e),!0).forEach(function(n){I(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):A(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}function I(t,r,e){return r=M(r),r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function M(t){var r=R(t,"string");return f(r)==="symbol"?r:String(r)}function R(t,r){if(f(t)!=="object"||t===null)return t;var e=t[Symbol.toPrimitive];if(e!==void 0){var n=e.call(t,r);if(f(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(t)}function y(t){return L(t)||N(t)||K(t)||x()}function x(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function K(t,r){if(t){if(typeof t=="string")return O(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return O(t,r)}}function N(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function L(t){if(Array.isArray(t))return O(t)}function O(t,r){(r==null||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}const{global:U}=__STORYBOOK_MODULE_GLOBAL__,{STORY_CHANGED:st,SET_STORIES:ct,DOCS_RENDERED:ft}=__STORYBOOK_MODULE_CORE_EVENTS__;var T=U,Y=T.document,h=T.window,C="sb-addon-themes-3";(b=h.matchMedia)===null||b===void 0||b.call(h,"(prefers-color-scheme: dark)");var S={classTarget:"body",dark:p.dark,darkClass:["dark"],light:p.light,lightClass:["light"],stylePreview:!1,userHasExplicitlySetTheTheme:!1},k=function(r){h.localStorage.setItem(C,JSON.stringify(r))},B=function(r,e){var n=e.current,a=e.darkClass,l=a===void 0?S.darkClass:a,o=e.lightClass,i=o===void 0?S.lightClass:o;if(n==="dark"){var u,s;(u=r.classList).remove.apply(u,y(d(i))),(s=r.classList).add.apply(s,y(d(l)))}else{var m,_;(m=r.classList).remove.apply(m,y(d(l))),(_=r.classList).add.apply(_,y(d(i)))}},d=function(r){var e=[];return e.concat(r).map(function(n){return n})},W=function(r){var e=Y.querySelector(r.classTarget);e&&B(e,r)},P=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=h.localStorage.getItem(C);if(typeof e=="string"){var n=JSON.parse(e);return r&&(r.dark&&!E(n.dark,r.dark)&&(n.dark=r.dark,k(n)),r.light&&!E(n.light,r.light)&&(n.light=r.light,k(n))),n}return D(D({},S),r)};W(P());function H(t,r){return q(t)||G(t,r)||$(t,r)||V()}function V(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3
3
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $(t,r){if(t){if(typeof t=="string")return w(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return w(t,r)}}function w(t,r){(r==null||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function G(t,r){var e=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(e!=null){var n,a,l,o,i=[],u=!0,s=!1;try{if(l=(e=e.call(t)).next,r!==0)for(;!(u=(n=l.call(e)).done)&&(i.push(n.value),i.length!==r);u=!0);}catch(m){s=!0,a=m}finally{try{if(!u&&e.return!=null&&(o=e.return(),Object(o)!==o))return}finally{if(s)throw a}}return i}}function q(t){if(Array.isArray(t))return t}const{addons:J,useState:F,useEffect:z}=__STORYBOOK_MODULE_PREVIEW_API__;function Q(){var t=F(P().current==="dark"),r=H(t,2),e=r[0],n=r[1];return z(function(){var a=J.getChannel();return a.on(g,n),function(){return a.off(g,n)}},[]),e}const{definePreview:mt}=__STORYBOOK_MODULE_PREVIEW_API__,yt=[t=>c.jsx(c.Fragment,{children:c.jsx(t,{})}),t=>{const r=Q();return v.useEffect(()=>(document.documentElement.dataset.theme=r?"dark":"default",()=>{delete document.documentElement.dataset.theme}),[r]),c.jsx(t,{})}],X=t=>{const[r,e]=v.useState(!1);return v.useEffect(()=>{const n=a=>e(a);return t.context.channel.on(g,n),()=>{t.context.channel.off(g,n)}},[t.context.channel]),c.jsx(j,{...t,theme:r?p.dark:p.light})},dt={docs:{container:X},darkMode:{current:"light",stylePreview:!0}},pt=["autodocs"];export{yt as decorators,dt as parameters,pt as tags};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./DocsRenderer-CFRXHY34-cMkmi-tX.js","./iframe-Bj1sRZW3.js","./index-eCxJ45ll.js","./jsx-runtime-Y5Ju2SGo.js","./index-BGqSdrBK.js","./index-D3-0uUTW.js","./index-Dytf1aFS.js","./client-9BU5HM4U.js"])))=>i.map(i=>d[i]);
2
- import{_ as o}from"./iframe-Bj1sRZW3.js";var s=Object.defineProperty,i=(e,r)=>{for(var t in r)s(e,t,{get:r[t],enumerable:!0})},n={};i(n,{parameters:()=>d});var _=Object.entries(globalThis.TAGS_OPTIONS??{}).reduce((e,r)=>{let[t,a]=r;return a.excludeFromDocsStories&&(e[t]=!0),e},{}),d={docs:{renderer:async()=>{let{DocsRenderer:e}=await o(async()=>{const{DocsRenderer:r}=await import("./DocsRenderer-CFRXHY34-cMkmi-tX.js").then(t=>t.e);return{DocsRenderer:r}},__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url);return new e},stories:{filter:e=>{var r;return(e.tags||[]).filter(t=>_[t]).length===0&&!((r=e.parameters.docs)!=null&&r.disable)}}}};export{d as parameters};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./DocsRenderer-CFRXHY34-DKIsUafc.js","./iframe-DFPTtPL0.js","./index-eCxJ45ll.js","./jsx-runtime-Y5Ju2SGo.js","./index-BGqSdrBK.js","./index-D3-0uUTW.js","./index-Dytf1aFS.js","./client-9BU5HM4U.js"])))=>i.map(i=>d[i]);
2
+ import{_ as o}from"./iframe-DFPTtPL0.js";var s=Object.defineProperty,i=(e,r)=>{for(var t in r)s(e,t,{get:r[t],enumerable:!0})},n={};i(n,{parameters:()=>d});var _=Object.entries(globalThis.TAGS_OPTIONS??{}).reduce((e,r)=>{let[t,a]=r;return a.excludeFromDocsStories&&(e[t]=!0),e},{}),d={docs:{renderer:async()=>{let{DocsRenderer:e}=await o(async()=>{const{DocsRenderer:r}=await import("./DocsRenderer-CFRXHY34-DKIsUafc.js").then(t=>t.e);return{DocsRenderer:r}},__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url);return new e},stories:{filter:e=>{var r;return(e.tags||[]).filter(t=>_[t]).length===0&&!((r=e.parameters.docs)!=null&&r.disable)}}}};export{d as parameters};
package/dist/iframe.html CHANGED
@@ -509,7 +509,7 @@
509
509
  }
510
510
  </script>
511
511
 
512
- <script type="module" crossorigin src="./assets/iframe-Bj1sRZW3.js"></script>
512
+ <script type="module" crossorigin src="./assets/iframe-DFPTtPL0.js"></script>
513
513
  </head>
514
514
 
515
515
  <body>
package/dist/index.js.js CHANGED
@@ -24335,24 +24335,27 @@ const useChartFunctions = ({
24335
24335
  dispatch({ type: "RESET_AXES_RANGES", payload: { axes: [] } });
24336
24336
  }, [chartRef == null ? void 0 : chartRef.current, dispatch]);
24337
24337
  const onHover = useCallback(
24338
- (hoveredPoint, setHoveredPoint) => {
24338
+ (hoveredPoint, setHoveredPoint, datasets) => {
24339
24339
  return (evt, hoveredItems) => {
24340
+ var _a2, _b2;
24340
24341
  if (!(hoveredItems == null ? void 0 : hoveredItems.length) && onPointUnhover && hoveredPoint) {
24341
24342
  setHoveredPoint(null);
24342
24343
  onPointUnhover(evt);
24344
+ (_a2 = chartRef == null ? void 0 : chartRef.current) == null ? void 0 : _a2.update();
24343
24345
  }
24344
24346
  if ((hoveredItems == null ? void 0 : hoveredItems.length) && onPointHover) {
24345
24347
  const { index: index2, datasetIndex } = hoveredItems[0];
24346
- const dataset = generatedDatasets[datasetIndex];
24348
+ const dataset = datasets[datasetIndex];
24347
24349
  const point = dataset == null ? void 0 : dataset.data[index2];
24348
- if (point && hoveredPoint !== point) {
24350
+ if (point && !isEqual(hoveredPoint, point)) {
24349
24351
  setHoveredPoint(point);
24350
- onPointHover(evt, datasetIndex, index2, generatedDatasets);
24352
+ onPointHover(evt, datasetIndex, index2, datasets);
24353
+ (_b2 = chartRef == null ? void 0 : chartRef.current) == null ? void 0 : _b2.update();
24351
24354
  }
24352
24355
  }
24353
24356
  };
24354
24357
  },
24355
- []
24358
+ [onPointHover, onPointUnhover, generatedDatasets]
24356
24359
  );
24357
24360
  const handleDownload = useCallback(
24358
24361
  () => downloadPgn(chartRef, state),
@@ -24542,6 +24545,9 @@ const AxesOptionsPopover = (optionsPopover) => {
24542
24545
  onUpdateAxes({ axes: formState.localAxes });
24543
24546
  close == null ? void 0 : close();
24544
24547
  }
24548
+ if (depthType && (depthType == null ? void 0 : depthType.setSelectedDepthType)) {
24549
+ depthType == null ? void 0 : depthType.setSelectedDepthType(formState.depthType);
24550
+ }
24545
24551
  };
24546
24552
  const onReset = () => {
24547
24553
  setFormState({
@@ -24620,7 +24626,8 @@ const AxesOptionsPopover = (optionsPopover) => {
24620
24626
  })),
24621
24627
  onSelected: (key) => setFormState((prevState) => ({
24622
24628
  ...prevState,
24623
- depthType: depthType.options[key]
24629
+ depthType: depthType.options[key],
24630
+ edited: true
24624
24631
  })),
24625
24632
  small: true,
24626
24633
  value: depthType.options.indexOf(formState.depthType)
@@ -26009,7 +26016,7 @@ const useChartOptions = ({
26009
26016
  layout: {
26010
26017
  padding: layoutPadding
26011
26018
  },
26012
- onHover: onHover(hoveredPoint, setHoveredPoint),
26019
+ onHover: onHover(hoveredPoint, setHoveredPoint, generatedDatasets),
26013
26020
  maintainAspectRatio: (_a2 = options == null ? void 0 : options.chartStyling) == null ? void 0 : _a2.maintainAspectRatio,
26014
26021
  aspectRatio: ((_b2 = options == null ? void 0 : options.chartStyling) == null ? void 0 : _b2.squareAspectRatio) ? 1 : 0,
26015
26022
  animation: ((_c2 = options == null ? void 0 : options.chartStyling) == null ? void 0 : _c2.performanceMode) ? false : {
@@ -26032,7 +26039,7 @@ const useChartOptions = ({
26032
26039
  events: Object.values(Events)
26033
26040
  };
26034
26041
  },
26035
- [state, options, chartRef]
26042
+ [state, options, chartRef, generatedDatasets]
26036
26043
  );
26037
26044
  };
26038
26045
  const useChartPlugins = ({ options, resetZoom: resetZoom2 }) => {