@unovis/react 1.1.0-beta.3 → 1.1.0-beta.5

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 (59) hide show
  1. package/components/area/index.js +9 -5
  2. package/components/area/index.js.map +1 -1
  3. package/components/axis/index.js +9 -5
  4. package/components/axis/index.js.map +1 -1
  5. package/components/brush/index.js +9 -5
  6. package/components/brush/index.js.map +1 -1
  7. package/components/chord-diagram/index.js +30 -0
  8. package/components/chord-diagram/index.js.map +1 -0
  9. package/components/crosshair/index.js +9 -5
  10. package/components/crosshair/index.js.map +1 -1
  11. package/components/donut/index.js +9 -5
  12. package/components/donut/index.js.map +1 -1
  13. package/components/free-brush/index.js +9 -5
  14. package/components/free-brush/index.js.map +1 -1
  15. package/components/graph/index.js +9 -5
  16. package/components/graph/index.js.map +1 -1
  17. package/components/grouped-bar/index.js +9 -5
  18. package/components/grouped-bar/index.js.map +1 -1
  19. package/components/line/index.js +9 -5
  20. package/components/line/index.js.map +1 -1
  21. package/components/sankey/index.js +9 -5
  22. package/components/sankey/index.js.map +1 -1
  23. package/components/scatter/index.js +9 -5
  24. package/components/scatter/index.js.map +1 -1
  25. package/components/stacked-bar/index.js +9 -5
  26. package/components/stacked-bar/index.js.map +1 -1
  27. package/components/timeline/index.js +9 -5
  28. package/components/timeline/index.js.map +1 -1
  29. package/components/tooltip/index.js +9 -5
  30. package/components/tooltip/index.js.map +1 -1
  31. package/components/topojson-map/index.js +9 -5
  32. package/components/topojson-map/index.js.map +1 -1
  33. package/components/xy-labels/index.js +9 -5
  34. package/components/xy-labels/index.js.map +1 -1
  35. package/components.d.ts +3 -2
  36. package/composites/time-series/index.js +4 -5
  37. package/composites/time-series/index.js.map +1 -1
  38. package/composites/time-series/style.module.css.js +8 -0
  39. package/composites/time-series/style.module.css.js.map +1 -0
  40. package/containers/single-container/index.d.ts +3 -1
  41. package/containers/single-container/index.js +2 -1
  42. package/containers/single-container/index.js.map +1 -1
  43. package/containers/xy-container/index.d.ts +2 -1
  44. package/containers/xy-container/index.js +2 -1
  45. package/containers/xy-container/index.js.map +1 -1
  46. package/external/style-inject/dist/style-inject.es.js +29 -0
  47. package/external/style-inject/dist/style-inject.es.js.map +1 -0
  48. package/html-components/leaflet-flow-map/index.d.ts +2 -1
  49. package/html-components/leaflet-flow-map/index.js +1 -1
  50. package/html-components/leaflet-flow-map/index.js.map +1 -1
  51. package/html-components/leaflet-map/index.d.ts +2 -1
  52. package/html-components/leaflet-map/index.js +1 -1
  53. package/html-components/leaflet-map/index.js.map +1 -1
  54. package/index.js +2 -1
  55. package/index.js.map +1 -1
  56. package/package.json +4 -4
  57. package/composites/time-series/style.d.ts +0 -3
  58. package/composites/time-series/style.js +0 -21
  59. package/composites/time-series/style.js.map +0 -1
@@ -1,23 +1,27 @@
1
- import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
1
+ import React, { useRef, useEffect, useImperativeHandle } from 'react';
2
2
  import { Area } from '@unovis/ts';
3
3
  import { arePropsEqual } from '../../utils/react.js';
4
4
 
5
5
  function VisAreaFC(props, fRef) {
6
6
  const ref = useRef(null);
7
- const [component, setComponent] = useState();
7
+ const componentRef = useRef(undefined);
8
8
  useEffect(() => {
9
9
  const element = ref.current;
10
10
  const c = new Area(props);
11
- setComponent(c);
11
+ componentRef.current = c;
12
12
  element.__component__ = c;
13
- return () => c.destroy();
13
+ return () => {
14
+ componentRef.current = undefined;
15
+ c.destroy();
16
+ };
14
17
  }, []);
15
18
  useEffect(() => {
19
+ const component = componentRef.current;
16
20
  if (props.data)
17
21
  component === null || component === void 0 ? void 0 : component.setData(props.data);
18
22
  component === null || component === void 0 ? void 0 : component.setConfig(props);
19
23
  });
20
- useImperativeHandle(fRef, () => ({ component }), [component]);
24
+ useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current]);
21
25
  return React.createElement("vis-component", { ref: ref });
22
26
  }
23
27
  const VisArea = React.memo(React.forwardRef(VisAreaFC), arePropsEqual);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/area/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Area, AreaConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisAreaRef<Datum> = {\n component?: Area<Datum>;\n}\n\nexport type VisAreaProps<Datum> = AreaConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisAreaRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisAreaFC<Datum> (props: VisAreaProps<Datum>, fRef: ForwardedRef<VisAreaRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<Area<Datum>>>(null)\n const [component, setComponent] = useState<Area<Datum>>()\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Area<Datum>>)\n\n const c = new Area<Datum>(props)\n setComponent(c)\n element.__component__ = c\n\n return () => c.destroy()\n }, [])\n\n // On Props Update\n useEffect(() => {\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component }), [component])\n return <vis-component ref={ref} />\n}\n\n// We export a memoized component to avoid unnecessary re-renders\n// and define its type explicitly to help react-docgen-typescript to extract information about props\nexport const VisArea: (<Datum>(props: VisAreaProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisAreaFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,SAAS,CAAS,KAA0B,EAAE,IAAqC,EAAA;AAC1F,IAAA,MAAM,GAAG,GAAG,MAAM,CAAmC,IAAI,CAAC,CAAA;IAC1D,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,EAAe,CAAA;IAGzD,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAA4C,CAAA;AAEjE,QAAA,MAAM,CAAC,GAAG,IAAI,IAAI,CAAQ,KAAK,CAAC,CAAA;QAChC,YAAY,CAAC,CAAC,CAAC,CAAA;AACf,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;AAEzB,QAAA,OAAO,MAAM,CAAC,CAAC,OAAO,EAAE,CAAA;KACzB,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;QACb,IAAI,KAAK,CAAC,IAAI;YAAE,SAAS,KAAA,IAAA,IAAT,SAAS,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAT,SAAS,CAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC9C,SAAS,KAAA,IAAA,IAAT,SAAS,KAAT,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,SAAS,CAAE,SAAS,CAAC,KAAK,CAAC,CAAA;AAC7B,KAAC,CAAC,CAAA;AAEF,IAAA,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAA;AAC7D,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,OAAO,GAAgE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,aAAa;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/area/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Area, AreaConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisAreaRef<Datum> = {\n component?: Area<Datum>;\n}\n\nexport type VisAreaProps<Datum> = AreaConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisAreaRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisAreaFC<Datum> (props: VisAreaProps<Datum>, fRef: ForwardedRef<VisAreaRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<Area<Datum>>>(null)\n const componentRef = useRef<Area<Datum> | undefined>(undefined)\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Area<Datum>>)\n\n const c = new Area<Datum>(props)\n componentRef.current = c\n element.__component__ = c\n\n return () => {\n componentRef.current = undefined\n c.destroy()\n }\n }, [])\n\n // On Props Update\n useEffect(() => {\n const component = componentRef.current\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current])\n return <vis-component ref={ref} />\n}\n\n// We export a memoized component to avoid unnecessary re-renders\n// and define its type explicitly to help react-docgen-typescript to extract information about props\nexport const VisArea: (<Datum>(props: VisAreaProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisAreaFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,SAAS,CAAS,KAA0B,EAAE,IAAqC,EAAA;AAC1F,IAAA,MAAM,GAAG,GAAG,MAAM,CAAmC,IAAI,CAAC,CAAA;AAC1D,IAAA,MAAM,YAAY,GAAG,MAAM,CAA0B,SAAS,CAAC,CAAA;IAG/D,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAA4C,CAAA;AAEjE,QAAA,MAAM,CAAC,GAAG,IAAI,IAAI,CAAQ,KAAK,CAAC,CAAA;AAChC,QAAA,YAAY,CAAC,OAAO,GAAG,CAAC,CAAA;AACxB,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;AAEzB,QAAA,OAAO,MAAK;AACV,YAAA,YAAY,CAAC,OAAO,GAAG,SAAS,CAAA;YAChC,CAAC,CAAC,OAAO,EAAE,CAAA;AACb,SAAC,CAAA;KACF,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAA;QACtC,IAAI,KAAK,CAAC,IAAI;YAAE,SAAS,KAAA,IAAA,IAAT,SAAS,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAT,SAAS,CAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC9C,SAAS,KAAA,IAAA,IAAT,SAAS,KAAT,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,SAAS,CAAE,SAAS,CAAC,KAAK,CAAC,CAAA;AAC7B,KAAC,CAAC,CAAA;IAEF,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAA;AAC9F,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,OAAO,GAAgE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,aAAa;;;;"}
@@ -1,23 +1,27 @@
1
- import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
1
+ import React, { useRef, useEffect, useImperativeHandle } from 'react';
2
2
  import { Axis } from '@unovis/ts';
3
3
  import { arePropsEqual } from '../../utils/react.js';
4
4
 
5
5
  function VisAxisFC(props, fRef) {
6
6
  const ref = useRef(null);
7
- const [component, setComponent] = useState();
7
+ const componentRef = useRef(undefined);
8
8
  useEffect(() => {
9
9
  const element = ref.current;
10
10
  const c = new Axis(props);
11
- setComponent(c);
11
+ componentRef.current = c;
12
12
  element.__component__ = c;
13
- return () => c.destroy();
13
+ return () => {
14
+ componentRef.current = undefined;
15
+ c.destroy();
16
+ };
14
17
  }, []);
15
18
  useEffect(() => {
19
+ const component = componentRef.current;
16
20
  if (props.data)
17
21
  component === null || component === void 0 ? void 0 : component.setData(props.data);
18
22
  component === null || component === void 0 ? void 0 : component.setConfig(props);
19
23
  });
20
- useImperativeHandle(fRef, () => ({ component }), [component]);
24
+ useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current]);
21
25
  return React.createElement("vis-axis", { ref: ref });
22
26
  }
23
27
  const VisAxis = React.memo(React.forwardRef(VisAxisFC), arePropsEqual);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/axis/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Axis, AxisConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisAxisRef<Datum> = {\n component?: Axis<Datum>;\n}\n\nexport type VisAxisProps<Datum> = AxisConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisAxisRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisAxisFC<Datum> (props: VisAxisProps<Datum>, fRef: ForwardedRef<VisAxisRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<Axis<Datum>>>(null)\n const [component, setComponent] = useState<Axis<Datum>>()\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Axis<Datum>>)\n\n const c = new Axis<Datum>(props)\n setComponent(c)\n element.__component__ = c\n\n return () => c.destroy()\n }, [])\n\n // On Props Update\n useEffect(() => {\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component }), [component])\n return <vis-axis ref={ref} />\n}\n\n// We export a memoized component to avoid unnecessary re-renders\n// and define its type explicitly to help react-docgen-typescript to extract information about props\nexport const VisAxis: (<Datum>(props: VisAxisProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisAxis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esContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Axis, AxisConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisAxisRef<Datum> = {\n component?: Axis<Datum>;\n}\n\nexport type VisAxisProps<Datum> = AxisConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisAxisRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisAxisFC<Datum> (props: VisAxisProps<Datum>, fRef: ForwardedRef<VisAxisRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<Axis<Datum>>>(null)\n const componentRef = useRef<Axis<Datum> | undefined>(undefined)\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Axis<Datum>>)\n\n const c = new Axis<Datum>(props)\n componentRef.current = c\n element.__component__ = c\n\n return () => {\n componentRef.current = undefined\n c.destroy()\n }\n }, [])\n\n // On Props Update\n useEffect(() => {\n const component = componentRef.current\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current])\n return <vis-axis ref={ref} />\n}\n\n// We export a memoized component to avoid unnecessary re-renders\n// and define its type explicitly to help react-docgen-typescript to extract information about props\nexport const VisAxis: (<Datum>(props: VisAxisProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisAxisFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,SAAS,CAAS,KAA0B,EAAE,IAAqC,EAAA;AAC1F,IAAA,MAAM,GAAG,GAAG,MAAM,CAAmC,IAAI,CAAC,CAAA;AAC1D,IAAA,MAAM,YAAY,GAAG,MAAM,CAA0B,SAAS,CAAC,CAAA;IAG/D,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAA4C,CAAA;AAEjE,QAAA,MAAM,CAAC,GAAG,IAAI,IAAI,CAAQ,KAAK,CAAC,CAAA;AAChC,QAAA,YAAY,CAAC,OAAO,GAAG,CAAC,CAAA;AACxB,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;AAEzB,QAAA,OAAO,MAAK;AACV,YAAA,YAAY,CAAC,OAAO,GAAG,SAAS,CAAA;YAChC,CAAC,CAAC,OAAO,EAAE,CAAA;AACb,SAAC,CAAA;KACF,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAA;QACtC,IAAI,KAAK,CAAC,IAAI;YAAE,SAAS,KAAA,IAAA,IAAT,SAAS,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAT,SAAS,CAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC9C,SAAS,KAAA,IAAA,IAAT,SAAS,KAAT,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,SAAS,CAAE,SAAS,CAAC,KAAK,CAAC,CAAA;AAC7B,KAAC,CAAC,CAAA;IAEF,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAA;AAC9F,IAAA,OAAO,KAAU,CAAA,aAAA,CAAA,UAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AAC/B,CAAC;AAIY,MAAA,OAAO,GAAgE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,aAAa;;;;"}
@@ -1,23 +1,27 @@
1
- import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
1
+ import React, { useRef, useEffect, useImperativeHandle } from 'react';
2
2
  import { Brush } from '@unovis/ts';
3
3
  import { arePropsEqual } from '../../utils/react.js';
4
4
 
5
5
  function VisBrushFC(props, fRef) {
6
6
  const ref = useRef(null);
7
- const [component, setComponent] = useState();
7
+ const componentRef = useRef(undefined);
8
8
  useEffect(() => {
9
9
  const element = ref.current;
10
10
  const c = new Brush(props);
11
- setComponent(c);
11
+ componentRef.current = c;
12
12
  element.__component__ = c;
13
- return () => c.destroy();
13
+ return () => {
14
+ componentRef.current = undefined;
15
+ c.destroy();
16
+ };
14
17
  }, []);
15
18
  useEffect(() => {
19
+ const component = componentRef.current;
16
20
  if (props.data)
17
21
  component === null || component === void 0 ? void 0 : component.setData(props.data);
18
22
  component === null || component === void 0 ? void 0 : component.setConfig(props);
19
23
  });
20
- useImperativeHandle(fRef, () => ({ component }), [component]);
24
+ useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current]);
21
25
  return React.createElement("vis-component", { ref: ref });
22
26
  }
23
27
  const VisBrush = React.memo(React.forwardRef(VisBrushFC), arePropsEqual);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/brush/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Brush, BrushConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisBrushRef<Datum> = {\n component?: Brush<Datum>;\n}\n\nexport type VisBrushProps<Datum> = BrushConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisBrushRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisBrushFC<Datum> (props: VisBrushProps<Datum>, fRef: ForwardedRef<VisBrushRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<Brush<Datum>>>(null)\n const [component, setComponent] = useState<Brush<Datum>>()\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Brush<Datum>>)\n\n const c = new Brush<Datum>(props)\n setComponent(c)\n element.__component__ = c\n\n return () => c.destroy()\n }, [])\n\n // On Props Update\n useEffect(() => {\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component }), [component])\n return <vis-component ref={ref} />\n}\n\n// We export a memoized component to avoid unnecessary re-renders\n// and define its type explicitly to help react-docgen-typescript to extract information about props\nexport const VisBrush: (<Datum>(props: VisBrushProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisBrushFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,UAAU,CAAS,KAA2B,EAAE,IAAsC,EAAA;AAC7F,IAAA,MAAM,GAAG,GAAG,MAAM,CAAoC,IAAI,CAAC,CAAA;IAC3D,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,EAAgB,CAAA;IAG1D,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAA6C,CAAA;AAElE,QAAA,MAAM,CAAC,GAAG,IAAI,KAAK,CAAQ,KAAK,CAAC,CAAA;QACjC,YAAY,CAAC,CAAC,CAAC,CAAA;AACf,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;AAEzB,QAAA,OAAO,MAAM,CAAC,CAAC,OAAO,EAAE,CAAA;KACzB,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;QACb,IAAI,KAAK,CAAC,IAAI;YAAE,SAAS,KAAA,IAAA,IAAT,SAAS,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAT,SAAS,CAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC9C,SAAS,KAAA,IAAA,IAAT,SAAS,KAAT,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,SAAS,CAAE,SAAS,CAAC,KAAK,CAAC,CAAA;AAC7B,KAAC,CAAC,CAAA;AAEF,IAAA,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAA;AAC7D,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,QAAQ,GAAiE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,aAAa;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/brush/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Brush, BrushConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisBrushRef<Datum> = {\n component?: Brush<Datum>;\n}\n\nexport type VisBrushProps<Datum> = BrushConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisBrushRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisBrushFC<Datum> (props: VisBrushProps<Datum>, fRef: ForwardedRef<VisBrushRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<Brush<Datum>>>(null)\n const componentRef = useRef<Brush<Datum> | undefined>(undefined)\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Brush<Datum>>)\n\n const c = new Brush<Datum>(props)\n componentRef.current = c\n element.__component__ = c\n\n return () => {\n componentRef.current = undefined\n c.destroy()\n }\n }, [])\n\n // On Props Update\n useEffect(() => {\n const component = componentRef.current\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current])\n return <vis-component ref={ref} />\n}\n\n// We export a memoized component to avoid unnecessary re-renders\n// and define its type explicitly to help react-docgen-typescript to extract information about props\nexport const VisBrush: (<Datum>(props: VisBrushProps<Datum>) => JSX.Element | null) = React.memo(React.for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;AACpC,CAAC;AAIY,MAAA,QAAQ,GAAiE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,aAAa;;;;"}
@@ -0,0 +1,30 @@
1
+ import React, { useRef, useEffect, useImperativeHandle } from 'react';
2
+ import { ChordDiagram } from '@unovis/ts';
3
+ import { arePropsEqual } from '../../utils/react.js';
4
+
5
+ function VisChordDiagramFC(props, fRef) {
6
+ const ref = useRef(null);
7
+ const componentRef = useRef(undefined);
8
+ useEffect(() => {
9
+ const element = ref.current;
10
+ const c = new ChordDiagram(props);
11
+ componentRef.current = c;
12
+ element.__component__ = c;
13
+ return () => {
14
+ componentRef.current = undefined;
15
+ c.destroy();
16
+ };
17
+ }, []);
18
+ useEffect(() => {
19
+ const component = componentRef.current;
20
+ if (props.data)
21
+ component === null || component === void 0 ? void 0 : component.setData(props.data);
22
+ component === null || component === void 0 ? void 0 : component.setConfig(props);
23
+ });
24
+ useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current]);
25
+ return React.createElement("vis-component", { ref: ref });
26
+ }
27
+ const VisChordDiagram = React.memo(React.forwardRef(VisChordDiagramFC), arePropsEqual);
28
+
29
+ export { VisChordDiagram };
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/chord-diagram/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { ChordDiagram, ChordDiagramConfigInterface, ChordInputNode, ChordInputLink } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisChordDiagramRef<N extends ChordInputNode, L extends ChordInputLink> = {\n component?: ChordDiagram<N, L>;\n}\n\nexport type VisChordDiagramProps<N extends ChordInputNode, L extends ChordInputLink> = ChordDiagramConfigInterface<N, L> & {\n data?: { nodes: N[]; links?: L[] };\n ref?: Ref<VisChordDiagramRef<N, L>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisChordDiagramFC<N extends ChordInputNode, L extends ChordInputLink> (props: VisChordDiagramProps<N, L>, fRef: ForwardedRef<VisChordDiagramRef<N, L>>): JSX.Element {\n const ref = useRef<VisComponentElement<ChordDiagram<N, L>>>(null)\n const componentRef = useRef<ChordDiagram<N, L> | undefined>(undefined)\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<ChordDiagram<N, L>>)\n\n const c = new ChordDiagram<N, L>(props)\n componentRef.current = c\n element.__component__ = c\n\n return () => {\n componentRef.current = undefined\n c.destroy()\n }\n }, [])\n\n // On Props Update\n useEffect(() => {\n const component = componentRef.current\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current])\n return <vis-component ref={ref} />\n}\n\n// We export a memoized component to avoid unnecessary re-renders\n// and define its type explicitly to help react-docgen-typescript to extract information about props\nexport const VisChordDiagram: (<N extends ChordInputNode, L extends ChordInputLink>(props: VisChordDiagramProps<N, L>) => JSX.Element | null) = React.memo(React.forwardRef(VisChordDiagramFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,iBAAiB,CAAsD,KAAiC,EAAE,IAA4C,EAAA;AAC7J,IAAA,MAAM,GAAG,GAAG,MAAM,CAA0C,IAAI,CAAC,CAAA;AACjE,IAAA,MAAM,YAAY,GAAG,MAAM,CAAiC,SAAS,CAAC,CAAA;IAGtE,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAAmD,CAAA;AAExE,QAAA,MAAM,CAAC,GAAG,IAAI,YAAY,CAAO,KAAK,CAAC,CAAA;AACvC,QAAA,YAAY,CAAC,OAAO,GAAG,CAAC,CAAA;AACxB,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;AAEzB,QAAA,OAAO,MAAK;AACV,YAAA,YAAY,CAAC,OAAO,GAAG,SAAS,CAAA;YAChC,CAAC,CAAC,OAAO,EAAE,CAAA;AACb,SAAC,CAAA;KACF,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAA;QACtC,IAAI,KAAK,CAAC,IAAI;YAAE,SAAS,KAAA,IAAA,IAAT,SAAS,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAT,SAAS,CAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC9C,SAAS,KAAA,IAAA,IAAT,SAAS,KAAT,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,SAAS,CAAE,SAAS,CAAC,KAAK,CAAC,CAAA;AAC7B,KAAC,CAAC,CAAA;IAEF,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAA;AAC9F,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,eAAe,GAAoH,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,aAAa;;;;"}
@@ -1,23 +1,27 @@
1
- import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
1
+ import React, { useRef, useEffect, useImperativeHandle } from 'react';
2
2
  import { Crosshair } from '@unovis/ts';
3
3
  import { arePropsEqual } from '../../utils/react.js';
4
4
 
5
5
  function VisCrosshairFC(props, fRef) {
6
6
  const ref = useRef(null);
7
- const [component, setComponent] = useState();
7
+ const componentRef = useRef(undefined);
8
8
  useEffect(() => {
9
9
  const element = ref.current;
10
10
  const c = new Crosshair(props);
11
- setComponent(c);
11
+ componentRef.current = c;
12
12
  element.__component__ = c;
13
- return () => c.destroy();
13
+ return () => {
14
+ componentRef.current = undefined;
15
+ c.destroy();
16
+ };
14
17
  }, []);
15
18
  useEffect(() => {
19
+ const component = componentRef.current;
16
20
  if (props.data)
17
21
  component === null || component === void 0 ? void 0 : component.setData(props.data);
18
22
  component === null || component === void 0 ? void 0 : component.setConfig(props);
19
23
  });
20
- useImperativeHandle(fRef, () => ({ component }), [component]);
24
+ useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current]);
21
25
  return React.createElement("vis-crosshair", { ref: ref });
22
26
  }
23
27
  const VisCrosshair = React.memo(React.forwardRef(VisCrosshairFC), arePropsEqual);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/crosshair/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Crosshair, CrosshairConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisCrosshairRef<Datum> = {\n component?: Crosshair<Datum>;\n}\n\nexport type VisCrosshairProps<Datum> = CrosshairConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisCrosshairRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisCrosshairFC<Datum> (props: VisCrosshairProps<Datum>, fRef: ForwardedRef<VisCrosshairRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<Crosshair<Datum>>>(null)\n const [component, setComponent] = useState<Crosshair<Datum>>()\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Crosshair<Datum>>)\n\n const c = new Crosshair<Datum>(props)\n setComponent(c)\n element.__component__ = c\n\n return () => c.destroy()\n }, [])\n\n // On Props Update\n useEffect(() => {\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component }), [component])\n return <vis-crosshair ref={ref} />\n}\n\n// We export a memoized component to avoid unnecessary re-renders\n// and define its type explicitly to help react-docgen-typescript to extract information about props\nexport const VisCrosshair: (<Datum>(props: VisCrosshairProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisCrosshairFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,cAAc,CAAS,KAA+B,EAAE,IAA0C,EAAA;AACzG,IAAA,MAAM,GAAG,GAAG,MAAM,CAAwC,IAAI,CAAC,CAAA;IAC/D,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,EAAoB,CAAA;IAG9D,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAAiD,CAAA;AAEtE,QAAA,MAAM,CAAC,GAAG,IAAI,SAAS,CAAQ,KAAK,CAAC,CAAA;QACrC,YAAY,CAAC,CAAC,CAAC,CAAA;AACf,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;AAEzB,QAAA,OAAO,MAAM,CAAC,CAAC,OAAO,EAAE,CAAA;KACzB,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;QACb,IAAI,KAAK,CAAC,IAAI;YAAE,SAAS,KAAA,IAAA,IAAT,SAAS,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAT,SAAS,CAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC9C,SAAS,KAAA,IAAA,IAAT,SAAS,KAAT,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,SAAS,CAAE,SAAS,CAAC,KAAK,CAAC,CAAA;AAC7B,KAAC,CAAC,CAAA;AAEF,IAAA,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAA;AAC7D,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,YAAY,GAAqE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,aAAa;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/crosshair/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Crosshair, CrosshairConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisCrosshairRef<Datum> = {\n component?: Crosshair<Datum>;\n}\n\nexport type VisCrosshairProps<Datum> = CrosshairConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisCrosshairRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisCrosshairFC<Datum> (props: VisCrosshairProps<Datum>, fRef: ForwardedRef<VisCrosshairRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<Crosshair<Datum>>>(null)\n const componentRef = useRef<Crosshair<Datum> | undefined>(undefined)\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Crosshair<Datum>>)\n\n const c = new Crosshair<Datum>(props)\n componentRef.current = c\n element.__component__ = c\n\n return () => {\n componentRef.current = undefined\n c.destroy()\n }\n }, [])\n\n // On Props Update\n useEffect(() => {\n const component = componentRef.current\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current])\n return <vis-crosshair ref={ref} />\n}\n\n// We export a memoized component to avoid unnecessary re-renders\n// and define its type explicitly to help react-docgen-typescript to extract information about props\nexport const VisCrosshair: (<Datum>(props: VisCrosshairProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisCrosshairFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,cAAc,CAAS,KAA+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AU,CAAC,cAAc,CAAC,EAAE,aAAa;;;;"}
@@ -1,23 +1,27 @@
1
- import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
1
+ import React, { useRef, useEffect, useImperativeHandle } from 'react';
2
2
  import { Donut } from '@unovis/ts';
3
3
  import { arePropsEqual } from '../../utils/react.js';
4
4
 
5
5
  function VisDonutFC(props, fRef) {
6
6
  const ref = useRef(null);
7
- const [component, setComponent] = useState();
7
+ const componentRef = useRef(undefined);
8
8
  useEffect(() => {
9
9
  const element = ref.current;
10
10
  const c = new Donut(props);
11
- setComponent(c);
11
+ componentRef.current = c;
12
12
  element.__component__ = c;
13
- return () => c.destroy();
13
+ return () => {
14
+ componentRef.current = undefined;
15
+ c.destroy();
16
+ };
14
17
  }, []);
15
18
  useEffect(() => {
19
+ const component = componentRef.current;
16
20
  if (props.data)
17
21
  component === null || component === void 0 ? void 0 : component.setData(props.data);
18
22
  component === null || component === void 0 ? void 0 : component.setConfig(props);
19
23
  });
20
- useImperativeHandle(fRef, () => ({ component }), [component]);
24
+ useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current]);
21
25
  return React.createElement("vis-component", { ref: ref });
22
26
  }
23
27
  const VisDonut = React.memo(React.forwardRef(VisDonutFC), arePropsEqual);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/donut/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Donut, DonutConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisDonutRef<Datum> = {\n component?: Donut<Datum>;\n}\n\nexport type VisDonutProps<Datum> = DonutConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisDonutRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisDonutFC<Datum> (props: VisDonutProps<Datum>, fRef: ForwardedRef<VisDonutRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<Donut<Datum>>>(null)\n const [component, setComponent] = useState<Donut<Datum>>()\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Donut<Datum>>)\n\n const c = new Donut<Datum>(props)\n setComponent(c)\n element.__component__ = c\n\n return () => c.destroy()\n }, [])\n\n // On Props Update\n useEffect(() => {\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component }), [component])\n return <vis-component ref={ref} />\n}\n\n// We export a memoized component to avoid unnecessary re-renders\n// and define its type explicitly to help react-docgen-typescript to extract information about props\nexport const VisDonut: (<Datum>(props: VisDonutProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisDonutFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,UAAU,CAAS,KAA2B,EAAE,IAAsC,EAAA;AAC7F,IAAA,MAAM,GAAG,GAAG,MAAM,CAAoC,IAAI,CAAC,CAAA;IAC3D,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,EAAgB,CAAA;IAG1D,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAA6C,CAAA;AAElE,QAAA,MAAM,CAAC,GAAG,IAAI,KAAK,CAAQ,KAAK,CAAC,CAAA;QACjC,YAAY,CAAC,CAAC,CAAC,CAAA;AACf,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;AAEzB,QAAA,OAAO,MAAM,CAAC,CAAC,OAAO,EAAE,CAAA;KACzB,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;QACb,IAAI,KAAK,CAAC,IAAI;YAAE,SAAS,KAAA,IAAA,IAAT,SAAS,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAT,SAAS,CAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC9C,SAAS,KAAA,IAAA,IAAT,SAAS,KAAT,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,SAAS,CAAE,SAAS,CAAC,KAAK,CAAC,CAAA;AAC7B,KAAC,CAAC,CAAA;AAEF,IAAA,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAA;AAC7D,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,QAAQ,GAAiE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,aAAa;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/donut/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Donut, DonutConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisDonutRef<Datum> = {\n component?: Donut<Datum>;\n}\n\nexport type VisDonutProps<Datum> = DonutConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisDonutRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisDonutFC<Datum> (props: VisDonutProps<Datum>, fRef: ForwardedRef<VisDonutRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<Donut<Datum>>>(null)\n const componentRef = useRef<Donut<Datum> | undefined>(undefined)\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Donut<Datum>>)\n\n const c = new Donut<Datum>(props)\n componentRef.current = c\n element.__component__ = c\n\n return () => {\n componentRef.current = undefined\n c.destroy()\n }\n }, [])\n\n // On Props Update\n useEffect(() => {\n const component = componentRef.current\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current])\n return <vis-component ref={ref} />\n}\n\n// We export a memoized component to avoid unnecessary re-renders\n// and define its type explicitly to help react-docgen-typescript to extract information about props\nexport const VisDonut: (<Datum>(props: VisDonutProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisDonutFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,UAAU,CAAS,KAA2B,EAAE,IAAsC,EAAA;AAC7F,IAAA,MAAM,GAAG,GAAG,MAAM,CAAoC,IAAI,CAAC,CAAA;AAC3D,IAAA,MAAM,YAAY,GAAG,MAAM,CAA2B,SAAS,CAAC,CAAA;IAGhE,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAA6C,CAAA;AAElE,QAAA,MAAM,CAAC,GAAG,IAAI,KAAK,CAAQ,KAAK,CAAC,CAAA;AACjC,QAAA,YAAY,CAAC,OAAO,GAAG,CAAC,CAAA;AACxB,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;AAEzB,QAAA,OAAO,MAAK;AACV,YAAA,YAAY,CAAC,OAAO,GAAG,SAAS,CAAA;YAChC,CAAC,CAAC,OAAO,EAAE,CAAA;AACb,SAAC,CAAA;KACF,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAA;QACtC,IAAI,KAAK,CAAC,IAAI;YAAE,SAAS,KAAA,IAAA,IAAT,SAAS,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAT,SAAS,CAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC9C,SAAS,KAAA,IAAA,IAAT,SAAS,KAAT,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,SAAS,CAAE,SAAS,CAAC,KAAK,CAAC,CAAA;AAC7B,KAAC,CAAC,CAAA;IAEF,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAA;AAC9F,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,QAAQ,GAAiE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,aAAa;;;;"}
@@ -1,23 +1,27 @@
1
- import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
1
+ import React, { useRef, useEffect, useImperativeHandle } from 'react';
2
2
  import { FreeBrush } from '@unovis/ts';
3
3
  import { arePropsEqual } from '../../utils/react.js';
4
4
 
5
5
  function VisFreeBrushFC(props, fRef) {
6
6
  const ref = useRef(null);
7
- const [component, setComponent] = useState();
7
+ const componentRef = useRef(undefined);
8
8
  useEffect(() => {
9
9
  const element = ref.current;
10
10
  const c = new FreeBrush(props);
11
- setComponent(c);
11
+ componentRef.current = c;
12
12
  element.__component__ = c;
13
- return () => c.destroy();
13
+ return () => {
14
+ componentRef.current = undefined;
15
+ c.destroy();
16
+ };
14
17
  }, []);
15
18
  useEffect(() => {
19
+ const component = componentRef.current;
16
20
  if (props.data)
17
21
  component === null || component === void 0 ? void 0 : component.setData(props.data);
18
22
  component === null || component === void 0 ? void 0 : component.setConfig(props);
19
23
  });
20
- useImperativeHandle(fRef, () => ({ component }), [component]);
24
+ useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current]);
21
25
  return React.createElement("vis-component", { ref: ref });
22
26
  }
23
27
  const VisFreeBrush = React.memo(React.forwardRef(VisFreeBrushFC), arePropsEqual);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/free-brush/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { FreeBrush, FreeBrushConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisFreeBrushRef<Datum> = {\n component?: FreeBrush<Datum>;\n}\n\nexport type VisFreeBrushProps<Datum> = FreeBrushConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisFreeBrushRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisFreeBrushFC<Datum> (props: VisFreeBrushProps<Datum>, fRef: ForwardedRef<VisFreeBrushRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<FreeBrush<Datum>>>(null)\n const [component, setComponent] = useState<FreeBrush<Datum>>()\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<FreeBrush<Datum>>)\n\n const c = new FreeBrush<Datum>(props)\n setComponent(c)\n element.__component__ = c\n\n return () => c.destroy()\n }, [])\n\n // On Props Update\n useEffect(() => {\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component }), [component])\n return <vis-component ref={ref} />\n}\n\n// We export a memoized component to avoid unnecessary re-renders\n// and define its type explicitly to help react-docgen-typescript to extract information about props\nexport const VisFreeBrush: (<Datum>(props: VisFreeBrushProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisFreeBrushFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,cAAc,CAAS,KAA+B,EAAE,IAA0C,EAAA;AACzG,IAAA,MAAM,GAAG,GAAG,MAAM,CAAwC,IAAI,CAAC,CAAA;IAC/D,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,EAAoB,CAAA;IAG9D,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAAiD,CAAA;AAEtE,QAAA,MAAM,CAAC,GAAG,IAAI,SAAS,CAAQ,KAAK,CAAC,CAAA;QACrC,YAAY,CAAC,CAAC,CAAC,CAAA;AACf,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;AAEzB,QAAA,OAAO,MAAM,CAAC,CAAC,OAAO,EAAE,CAAA;KACzB,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;QACb,IAAI,KAAK,CAAC,IAAI;YAAE,SAAS,KAAA,IAAA,IAAT,SAAS,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAT,SAAS,CAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC9C,SAAS,KAAA,IAAA,IAAT,SAAS,KAAT,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,SAAS,CAAE,SAAS,CAAC,KAAK,CAAC,CAAA;AAC7B,KAAC,CAAC,CAAA;AAEF,IAAA,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAA;AAC7D,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,YAAY,GAAqE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,aAAa;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/free-brush/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { FreeBrush, FreeBrushConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisFreeBrushRef<Datum> = {\n component?: FreeBrush<Datum>;\n}\n\nexport type VisFreeBrushProps<Datum> = FreeBrushConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisFreeBrushRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisFreeBrushFC<Datum> (props: VisFreeBrushProps<Datum>, fRef: ForwardedRef<VisFreeBrushRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<FreeBrush<Datum>>>(null)\n const componentRef = useRef<FreeBrush<Datum> | undefined>(undefined)\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<FreeBrush<Datum>>)\n\n const c = new FreeBrush<Datum>(props)\n componentRef.current = c\n element.__component__ = c\n\n return () => {\n componentRef.current = undefined\n c.destroy()\n }\n }, [])\n\n // On Props Update\n useEffect(() => {\n const component = componentRef.current\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current])\n return <vis-component ref={ref} />\n}\n\n// We export a memoized component to avoid unnecessary re-renders\n// and define its type explicitly to help react-docgen-typescript to extract information about props\nexport const VisFreeBrush: (<Datum>(props: VisFreeBrushProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisFreeBrushFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,cAAc,CAAS,KAA+B,EAAE,IAA0C,EAAA;AACzG,IAAA,MAAM,GAAG,GAAG,MAAM,CAAwC,IAAI,CAAC,CAAA;AAC/D,IAAA,MAAM,YAAY,GAAG,MAAM,CAA+B,SAAS,CAAC,CAAA;IAGpE,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAAiD,CAAA;AAEtE,QAAA,MAAM,CAAC,GAAG,IAAI,SAAS,CAAQ,KAAK,CAAC,CAAA;AACrC,QAAA,YAAY,CAAC,OAAO,GAAG,CAAC,CAAA;AACxB,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;AAEzB,QAAA,OAAO,MAAK;AACV,YAAA,YAAY,CAAC,OAAO,GAAG,SAAS,CAAA;YAChC,CAAC,CAAC,OAAO,EAAE,CAAA;AACb,SAAC,CAAA;KACF,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAA;QACtC,IAAI,KAAK,CAAC,IAAI;YAAE,SAAS,KAAA,IAAA,IAAT,SAAS,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAT,SAAS,CAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC9C,SAAS,KAAA,IAAA,IAAT,SAAS,KAAT,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,SAAS,CAAE,SAAS,CAAC,KAAK,CAAC,CAAA;AAC7B,KAAC,CAAC,CAAA;IAEF,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAA;AAC9F,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,YAAY,GAAqE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,aAAa;;;;"}
@@ -1,23 +1,27 @@
1
- import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
1
+ import React, { useRef, useEffect, useImperativeHandle } from 'react';
2
2
  import { Graph } from '@unovis/ts';
3
3
  import { arePropsEqual } from '../../utils/react.js';
4
4
 
5
5
  function VisGraphFC(props, fRef) {
6
6
  const ref = useRef(null);
7
- const [component, setComponent] = useState();
7
+ const componentRef = useRef(undefined);
8
8
  useEffect(() => {
9
9
  const element = ref.current;
10
10
  const c = new Graph(props);
11
- setComponent(c);
11
+ componentRef.current = c;
12
12
  element.__component__ = c;
13
- return () => c.destroy();
13
+ return () => {
14
+ componentRef.current = undefined;
15
+ c.destroy();
16
+ };
14
17
  }, []);
15
18
  useEffect(() => {
19
+ const component = componentRef.current;
16
20
  if (props.data)
17
21
  component === null || component === void 0 ? void 0 : component.setData(props.data);
18
22
  component === null || component === void 0 ? void 0 : component.setConfig(props);
19
23
  });
20
- useImperativeHandle(fRef, () => ({ component }), [component]);
24
+ useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current]);
21
25
  return React.createElement("vis-component", { ref: ref });
22
26
  }
23
27
  const VisGraph = React.memo(React.forwardRef(VisGraphFC), arePropsEqual);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/graph/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Graph, GraphConfigInterface, GraphInputNode, GraphInputLink } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisGraphRef<N extends GraphInputNode, L extends GraphInputLink> = {\n component?: Graph<N, L>;\n}\n\nexport type VisGraphProps<N extends GraphInputNode, L extends GraphInputLink> = GraphConfigInterface<N, L> & {\n data?: any;\n ref?: Ref<VisGraphRef<N, L>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisGraphFC<N extends GraphInputNode, L extends GraphInputLink> (props: VisGraphProps<N, L>, fRef: ForwardedRef<VisGraphRef<N, L>>): JSX.Element {\n const ref = useRef<VisComponentElement<Graph<N, L>>>(null)\n const [component, setComponent] = useState<Graph<N, L>>()\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Graph<N, L>>)\n\n const c = new Graph<N, L>(props)\n setComponent(c)\n element.__component__ = c\n\n return () => c.destroy()\n }, [])\n\n // On Props Update\n useEffect(() => {\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component }), [component])\n return <vis-component ref={ref} />\n}\n\n// We export a memoized component to avoid unnecessary re-renders\n// and define its type explicitly to help react-docgen-typescript to extract information about props\nexport const VisGraph: (<N extends GraphInputNode, L extends GraphInputLink>(props: VisGraphProps<N, L>) => JSX.Element | null) = React.memo(React.forwardRef(VisGraphFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,UAAU,CAAsD,KAA0B,EAAE,IAAqC,EAAA;AACxI,IAAA,MAAM,GAAG,GAAG,MAAM,CAAmC,IAAI,CAAC,CAAA;IAC1D,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,EAAe,CAAA;IAGzD,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAA4C,CAAA;AAEjE,QAAA,MAAM,CAAC,GAAG,IAAI,KAAK,CAAO,KAAK,CAAC,CAAA;QAChC,YAAY,CAAC,CAAC,CAAC,CAAA;AACf,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;AAEzB,QAAA,OAAO,MAAM,CAAC,CAAC,OAAO,EAAE,CAAA;KACzB,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;QACb,IAAI,KAAK,CAAC,IAAI;YAAE,SAAS,KAAA,IAAA,IAAT,SAAS,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAT,SAAS,CAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC9C,SAAS,KAAA,IAAA,IAAT,SAAS,KAAT,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,SAAS,CAAE,SAAS,CAAC,KAAK,CAAC,CAAA;AAC7B,KAAC,CAAC,CAAA;AAEF,IAAA,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAA;AAC7D,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,QAAQ,GAA6G,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,aAAa;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/graph/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Graph, GraphConfigInterface, GraphInputNode, GraphInputLink } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisGraphRef<N extends GraphInputNode, L extends GraphInputLink> = {\n component?: Graph<N, L>;\n}\n\nexport type VisGraphProps<N extends GraphInputNode, L extends GraphInputLink> = GraphConfigInterface<N, L> & {\n data?: any;\n ref?: Ref<VisGraphRef<N, L>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisGraphFC<N extends GraphInputNode, L extends GraphInputLink> (props: VisGraphProps<N, L>, fRef: ForwardedRef<VisGraphRef<N, L>>): JSX.Element {\n const ref = useRef<VisComponentElement<Graph<N, L>>>(null)\n const componentRef = useRef<Graph<N, L> | undefined>(undefined)\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Graph<N, L>>)\n\n const c = new Graph<N, L>(props)\n componentRef.current = c\n element.__component__ = c\n\n return () => {\n componentRef.current = undefined\n c.destroy()\n }\n }, [])\n\n // On Props Update\n useEffect(() => {\n const component = componentRef.current\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current])\n return <vis-component ref={ref} />\n}\n\n// We export a memoized component to avoid unnecessary re-renders\n// and define its type explicitly to help react-docgen-typescript to extract information about props\nexport const VisGraph: (<N extends GraphInputNode, L extends GraphInputLink>(props: VisGraphProps<N, L>) => JSX.Element | null) = React.memo(React.forwardRef(VisGraphFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,UAAU,CAAsD,KAA0B,EAAE,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,UAAU,CAAC,EAAE,aAAa;;;;"}
@@ -1,23 +1,27 @@
1
- import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
1
+ import React, { useRef, useEffect, useImperativeHandle } from 'react';
2
2
  import { GroupedBar } from '@unovis/ts';
3
3
  import { arePropsEqual } from '../../utils/react.js';
4
4
 
5
5
  function VisGroupedBarFC(props, fRef) {
6
6
  const ref = useRef(null);
7
- const [component, setComponent] = useState();
7
+ const componentRef = useRef(undefined);
8
8
  useEffect(() => {
9
9
  const element = ref.current;
10
10
  const c = new GroupedBar(props);
11
- setComponent(c);
11
+ componentRef.current = c;
12
12
  element.__component__ = c;
13
- return () => c.destroy();
13
+ return () => {
14
+ componentRef.current = undefined;
15
+ c.destroy();
16
+ };
14
17
  }, []);
15
18
  useEffect(() => {
19
+ const component = componentRef.current;
16
20
  if (props.data)
17
21
  component === null || component === void 0 ? void 0 : component.setData(props.data);
18
22
  component === null || component === void 0 ? void 0 : component.setConfig(props);
19
23
  });
20
- useImperativeHandle(fRef, () => ({ component }), [component]);
24
+ useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current]);
21
25
  return React.createElement("vis-component", { ref: ref });
22
26
  }
23
27
  const VisGroupedBar = React.memo(React.forwardRef(VisGroupedBarFC), arePropsEqual);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/grouped-bar/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { GroupedBar, GroupedBarConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisGroupedBarRef<Datum> = {\n component?: GroupedBar<Datum>;\n}\n\nexport type VisGroupedBarProps<Datum> = GroupedBarConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisGroupedBarRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisGroupedBarFC<Datum> (props: VisGroupedBarProps<Datum>, fRef: ForwardedRef<VisGroupedBarRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<GroupedBar<Datum>>>(null)\n const [component, setComponent] = useState<GroupedBar<Datum>>()\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<GroupedBar<Datum>>)\n\n const c = new GroupedBar<Datum>(props)\n setComponent(c)\n element.__component__ = c\n\n return () => c.destroy()\n }, [])\n\n // On Props Update\n useEffect(() => {\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component }), [component])\n return <vis-component ref={ref} />\n}\n\n// We export a memoized component to avoid unnecessary re-renders\n// and define its type explicitly to help react-docgen-typescript to extract information about props\nexport const VisGroupedBar: (<Datum>(props: VisGroupedBarProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisGroupedBarFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,eAAe,CAAS,KAAgC,EAAE,IAA2C,EAAA;AAC5G,IAAA,MAAM,GAAG,GAAG,MAAM,CAAyC,IAAI,CAAC,CAAA;IAChE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,EAAqB,CAAA;IAG/D,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAAkD,CAAA;AAEvE,QAAA,MAAM,CAAC,GAAG,IAAI,UAAU,CAAQ,KAAK,CAAC,CAAA;QACtC,YAAY,CAAC,CAAC,CAAC,CAAA;AACf,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;AAEzB,QAAA,OAAO,MAAM,CAAC,CAAC,OAAO,EAAE,CAAA;KACzB,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;QACb,IAAI,KAAK,CAAC,IAAI;YAAE,SAAS,KAAA,IAAA,IAAT,SAAS,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAT,SAAS,CAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC9C,SAAS,KAAA,IAAA,IAAT,SAAS,KAAT,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,SAAS,CAAE,SAAS,CAAC,KAAK,CAAC,CAAA;AAC7B,KAAC,CAAC,CAAA;AAEF,IAAA,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAA;AAC7D,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,aAAa,GAAsE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,aAAa;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/grouped-bar/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { GroupedBar, GroupedBarConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisGroupedBarRef<Datum> = {\n component?: GroupedBar<Datum>;\n}\n\nexport type VisGroupedBarProps<Datum> = GroupedBarConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisGroupedBarRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisGroupedBarFC<Datum> (props: VisGroupedBarProps<Datum>, fRef: ForwardedRef<VisGroupedBarRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<GroupedBar<Datum>>>(null)\n const componentRef = useRef<GroupedBar<Datum> | undefined>(undefined)\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<GroupedBar<Datum>>)\n\n const c = new GroupedBar<Datum>(props)\n componentRef.current = c\n element.__component__ = c\n\n return () => {\n componentRef.current = undefined\n c.destroy()\n }\n }, [])\n\n // On Props Update\n useEffect(() => {\n const component = componentRef.current\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current])\n return <vis-component ref={ref} />\n}\n\n// We export a memoized component to avoid unnecessary re-renders\n// and define its type explicitly to help react-docgen-typescript to extract information about props\nexport const VisGroupedBar: (<Datum>(props: VisGroupedBarProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisGroupedBarFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,eAAe,CAAS,KAAgC,EAAE,IAA2C,EAAA;AAC5G,IAAA,MAAM,GAAG,GAAG,MAAM,CAAyC,IAAI,CAAC,CAAA;AAChE,IAAA,MAAM,YAAY,GAAG,MAAM,CAAgC,SAAS,CAAC,CAAA;IAGrE,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAAkD,CAAA;AAEvE,QAAA,MAAM,CAAC,GAAG,IAAI,UAAU,CAAQ,KAAK,CAAC,CAAA;AACtC,QAAA,YAAY,CAAC,OAAO,GAAG,CAAC,CAAA;AACxB,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;AAEzB,QAAA,OAAO,MAAK;AACV,YAAA,YAAY,CAAC,OAAO,GAAG,SAAS,CAAA;YAChC,CAAC,CAAC,OAAO,EAAE,CAAA;AACb,SAAC,CAAA;KACF,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAA;QACtC,IAAI,KAAK,CAAC,IAAI;YAAE,SAAS,KAAA,IAAA,IAAT,SAAS,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAT,SAAS,CAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC9C,SAAS,KAAA,IAAA,IAAT,SAAS,KAAT,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,SAAS,CAAE,SAAS,CAAC,KAAK,CAAC,CAAA;AAC7B,KAAC,CAAC,CAAA;IAEF,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAA;AAC9F,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,aAAa,GAAsE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,aAAa;;;;"}
@@ -1,23 +1,27 @@
1
- import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
1
+ import React, { useRef, useEffect, useImperativeHandle } from 'react';
2
2
  import { Line } from '@unovis/ts';
3
3
  import { arePropsEqual } from '../../utils/react.js';
4
4
 
5
5
  function VisLineFC(props, fRef) {
6
6
  const ref = useRef(null);
7
- const [component, setComponent] = useState();
7
+ const componentRef = useRef(undefined);
8
8
  useEffect(() => {
9
9
  const element = ref.current;
10
10
  const c = new Line(props);
11
- setComponent(c);
11
+ componentRef.current = c;
12
12
  element.__component__ = c;
13
- return () => c.destroy();
13
+ return () => {
14
+ componentRef.current = undefined;
15
+ c.destroy();
16
+ };
14
17
  }, []);
15
18
  useEffect(() => {
19
+ const component = componentRef.current;
16
20
  if (props.data)
17
21
  component === null || component === void 0 ? void 0 : component.setData(props.data);
18
22
  component === null || component === void 0 ? void 0 : component.setConfig(props);
19
23
  });
20
- useImperativeHandle(fRef, () => ({ component }), [component]);
24
+ useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current]);
21
25
  return React.createElement("vis-component", { ref: ref });
22
26
  }
23
27
  const VisLine = React.memo(React.forwardRef(VisLineFC), arePropsEqual);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/line/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Line, LineConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisLineRef<Datum> = {\n component?: Line<Datum>;\n}\n\nexport type VisLineProps<Datum> = LineConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisLineRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisLineFC<Datum> (props: VisLineProps<Datum>, fRef: ForwardedRef<VisLineRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<Line<Datum>>>(null)\n const [component, setComponent] = useState<Line<Datum>>()\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Line<Datum>>)\n\n const c = new Line<Datum>(props)\n setComponent(c)\n element.__component__ = c\n\n return () => c.destroy()\n }, [])\n\n // On Props Update\n useEffect(() => {\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component }), [component])\n return <vis-component ref={ref} />\n}\n\n// We export a memoized component to avoid unnecessary re-renders\n// and define its type explicitly to help react-docgen-typescript to extract information about props\nexport const VisLine: (<Datum>(props: VisLineProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisLineFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,SAAS,CAAS,KAA0B,EAAE,IAAqC,EAAA;AAC1F,IAAA,MAAM,GAAG,GAAG,MAAM,CAAmC,IAAI,CAAC,CAAA;IAC1D,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,EAAe,CAAA;IAGzD,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAA4C,CAAA;AAEjE,QAAA,MAAM,CAAC,GAAG,IAAI,IAAI,CAAQ,KAAK,CAAC,CAAA;QAChC,YAAY,CAAC,CAAC,CAAC,CAAA;AACf,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;AAEzB,QAAA,OAAO,MAAM,CAAC,CAAC,OAAO,EAAE,CAAA;KACzB,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;QACb,IAAI,KAAK,CAAC,IAAI;YAAE,SAAS,KAAA,IAAA,IAAT,SAAS,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAT,SAAS,CAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC9C,SAAS,KAAA,IAAA,IAAT,SAAS,KAAT,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,SAAS,CAAE,SAAS,CAAC,KAAK,CAAC,CAAA;AAC7B,KAAC,CAAC,CAAA;AAEF,IAAA,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAA;AAC7D,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,OAAO,GAAgE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,aAAa;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/line/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Line, LineConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisLineRef<Datum> = {\n component?: Line<Datum>;\n}\n\nexport type VisLineProps<Datum> = LineConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisLineRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisLineFC<Datum> (props: VisLineProps<Datum>, fRef: ForwardedRef<VisLineRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<Line<Datum>>>(null)\n const componentRef = useRef<Line<Datum> | undefined>(undefined)\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Line<Datum>>)\n\n const c = new Line<Datum>(props)\n componentRef.current = c\n element.__component__ = c\n\n return () => {\n componentRef.current = undefined\n c.destroy()\n }\n }, [])\n\n // On Props Update\n useEffect(() => {\n const component = componentRef.current\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current])\n return <vis-component ref={ref} />\n}\n\n// We export a memoized component to avoid unnecessary re-renders\n// and define its type explicitly to help react-docgen-typescript to extract information about props\nexport const VisLine: (<Datum>(props: VisLineProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisLineFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,SAAS,CAAS,KAA0B,EAAE,IAAqC,EAAA;AAC1F,IAAA,MAAM,GAAG,GAAG,MAAM,CAAmC,IAAI,CAAC,CAAA;AAC1D,IAAA,MAAM,YAAY,GAAG,MAAM,CAA0B,SAAS,CAAC,CAAA;IAG/D,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAA4C,CAAA;AAEjE,QAAA,MAAM,CAAC,GAAG,IAAI,IAAI,CAAQ,KAAK,CAAC,CAAA;AAChC,QAAA,YAAY,CAAC,OAAO,GAAG,CAAC,CAAA;AACxB,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;AAEzB,QAAA,OAAO,MAAK;AACV,YAAA,YAAY,CAAC,OAAO,GAAG,SAAS,CAAA;YAChC,CAAC,CAAC,OAAO,EAAE,CAAA;AACb,SAAC,CAAA;KACF,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAA;QACtC,IAAI,KAAK,CAAC,IAAI;YAAE,SAAS,KAAA,IAAA,IAAT,SAAS,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAT,SAAS,CAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC9C,SAAS,KAAA,IAAA,IAAT,SAAS,KAAT,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,SAAS,CAAE,SAAS,CAAC,KAAK,CAAC,CAAA;AAC7B,KAAC,CAAC,CAAA;IAEF,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAA;AAC9F,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,OAAO,GAAgE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,aAAa;;;;"}
@@ -1,23 +1,27 @@
1
- import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
1
+ import React, { useRef, useEffect, useImperativeHandle } from 'react';
2
2
  import { Sankey } from '@unovis/ts';
3
3
  import { arePropsEqual } from '../../utils/react.js';
4
4
 
5
5
  function VisSankeyFC(props, fRef) {
6
6
  const ref = useRef(null);
7
- const [component, setComponent] = useState();
7
+ const componentRef = useRef(undefined);
8
8
  useEffect(() => {
9
9
  const element = ref.current;
10
10
  const c = new Sankey(props);
11
- setComponent(c);
11
+ componentRef.current = c;
12
12
  element.__component__ = c;
13
- return () => c.destroy();
13
+ return () => {
14
+ componentRef.current = undefined;
15
+ c.destroy();
16
+ };
14
17
  }, []);
15
18
  useEffect(() => {
19
+ const component = componentRef.current;
16
20
  if (props.data)
17
21
  component === null || component === void 0 ? void 0 : component.setData(props.data);
18
22
  component === null || component === void 0 ? void 0 : component.setConfig(props);
19
23
  });
20
- useImperativeHandle(fRef, () => ({ component }), [component]);
24
+ useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current]);
21
25
  return React.createElement("vis-component", { ref: ref });
22
26
  }
23
27
  const VisSankey = React.memo(React.forwardRef(VisSankeyFC), arePropsEqual);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/sankey/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Sankey, SankeyConfigInterface, SankeyInputNode, SankeyInputLink } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisSankeyRef<N extends SankeyInputNode, L extends SankeyInputLink> = {\n component?: Sankey<N, L>;\n}\n\nexport type VisSankeyProps<N extends SankeyInputNode, L extends SankeyInputLink> = SankeyConfigInterface<N, L> & {\n data?: any;\n ref?: Ref<VisSankeyRef<N, L>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisSankeyFC<N extends SankeyInputNode, L extends SankeyInputLink> (props: VisSankeyProps<N, L>, fRef: ForwardedRef<VisSankeyRef<N, L>>): JSX.Element {\n const ref = useRef<VisComponentElement<Sankey<N, L>>>(null)\n const [component, setComponent] = useState<Sankey<N, L>>()\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Sankey<N, L>>)\n\n const c = new Sankey<N, L>(props)\n setComponent(c)\n element.__component__ = c\n\n return () => c.destroy()\n }, [])\n\n // On Props Update\n useEffect(() => {\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component }), [component])\n return <vis-component ref={ref} />\n}\n\n// We export a memoized component to avoid unnecessary re-renders\n// and define its type explicitly to help react-docgen-typescript to extract information about props\nexport const VisSankey: (<N extends SankeyInputNode, L extends SankeyInputLink>(props: VisSankeyProps<N, L>) => JSX.Element | null) = React.memo(React.forwardRef(VisSankeyFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,WAAW,CAAwD,KAA2B,EAAE,IAAsC,EAAA;AAC7I,IAAA,MAAM,GAAG,GAAG,MAAM,CAAoC,IAAI,CAAC,CAAA;IAC3D,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,EAAgB,CAAA;IAG1D,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAA6C,CAAA;AAElE,QAAA,MAAM,CAAC,GAAG,IAAI,MAAM,CAAO,KAAK,CAAC,CAAA;QACjC,YAAY,CAAC,CAAC,CAAC,CAAA;AACf,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;AAEzB,QAAA,OAAO,MAAM,CAAC,CAAC,OAAO,EAAE,CAAA;KACzB,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;QACb,IAAI,KAAK,CAAC,IAAI;YAAE,SAAS,KAAA,IAAA,IAAT,SAAS,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAT,SAAS,CAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC9C,SAAS,KAAA,IAAA,IAAT,SAAS,KAAT,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,SAAS,CAAE,SAAS,CAAC,KAAK,CAAC,CAAA;AAC7B,KAAC,CAAC,CAAA;AAEF,IAAA,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAA;AAC7D,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,SAAS,GAAgH,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,aAAa;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/sankey/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Sankey, SankeyConfigInterface, SankeyInputNode, SankeyInputLink } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisSankeyRef<N extends SankeyInputNode, L extends SankeyInputLink> = {\n component?: Sankey<N, L>;\n}\n\nexport type VisSankeyProps<N extends SankeyInputNode, L extends SankeyInputLink> = SankeyConfigInterface<N, L> & {\n data?: any;\n ref?: Ref<VisSankeyRef<N, L>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisSankeyFC<N extends SankeyInputNode, L extends SankeyInputLink> (props: VisSankeyProps<N, L>, fRef: ForwardedRef<VisSankeyRef<N, L>>): JSX.Element {\n const ref = useRef<VisComponentElement<Sankey<N, L>>>(null)\n const componentRef = useRef<Sankey<N, L> | undefined>(undefined)\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Sankey<N, L>>)\n\n const c = new Sankey<N, L>(props)\n componentRef.current = c\n element.__component__ = c\n\n return () => {\n componentRef.current = undefined\n c.destroy()\n }\n }, [])\n\n // On Props Update\n useEffect(() => {\n const component = componentRef.current\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current])\n return <vis-component ref={ref} />\n}\n\n// We export a memoized component to avoid unnecessary re-renders\n// and define its type explicitly to help react-docgen-typescript to extract information about props\nexport const VisSankey: (<N extends SankeyInputNode, L extends SankeyInputLink>(props: VisSankeyProps<N, L>) => JSX.Element | null) = React.memo(React.forwardRef(VisSankeyFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,WAAW,CAAw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AC,UAAU,CAAC,WAAW,CAAC,EAAE,aAAa;;;;"}
@@ -1,23 +1,27 @@
1
- import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
1
+ import React, { useRef, useEffect, useImperativeHandle } from 'react';
2
2
  import { Scatter } from '@unovis/ts';
3
3
  import { arePropsEqual } from '../../utils/react.js';
4
4
 
5
5
  function VisScatterFC(props, fRef) {
6
6
  const ref = useRef(null);
7
- const [component, setComponent] = useState();
7
+ const componentRef = useRef(undefined);
8
8
  useEffect(() => {
9
9
  const element = ref.current;
10
10
  const c = new Scatter(props);
11
- setComponent(c);
11
+ componentRef.current = c;
12
12
  element.__component__ = c;
13
- return () => c.destroy();
13
+ return () => {
14
+ componentRef.current = undefined;
15
+ c.destroy();
16
+ };
14
17
  }, []);
15
18
  useEffect(() => {
19
+ const component = componentRef.current;
16
20
  if (props.data)
17
21
  component === null || component === void 0 ? void 0 : component.setData(props.data);
18
22
  component === null || component === void 0 ? void 0 : component.setConfig(props);
19
23
  });
20
- useImperativeHandle(fRef, () => ({ component }), [component]);
24
+ useImperativeHandle(fRef, () => ({ component: componentRef.current }), [componentRef.current]);
21
25
  return React.createElement("vis-component", { ref: ref });
22
26
  }
23
27
  const VisScatter = React.memo(React.forwardRef(VisScatterFC), arePropsEqual);