@unovis/react 1.0.0-beta.2 → 1.0.0-beta.4

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 (95) hide show
  1. package/components/area/index.d.ts +10 -10
  2. package/components/area/index.js +8 -6
  3. package/components/area/index.js.map +1 -1
  4. package/components/axis/index.d.ts +10 -10
  5. package/components/axis/index.js +8 -6
  6. package/components/axis/index.js.map +1 -1
  7. package/components/brush/index.d.ts +10 -10
  8. package/components/brush/index.js +8 -6
  9. package/components/brush/index.js.map +1 -1
  10. package/components/chord-diagram/index.d.ts +13 -13
  11. package/components/crosshair/index.d.ts +10 -10
  12. package/components/crosshair/index.js +8 -6
  13. package/components/crosshair/index.js.map +1 -1
  14. package/components/donut/index.d.ts +10 -10
  15. package/components/donut/index.js +8 -6
  16. package/components/donut/index.js.map +1 -1
  17. package/components/free-brush/index.d.ts +10 -10
  18. package/components/free-brush/index.js +8 -6
  19. package/components/free-brush/index.js.map +1 -1
  20. package/components/graph/index.d.ts +10 -10
  21. package/components/graph/index.js +8 -6
  22. package/components/graph/index.js.map +1 -1
  23. package/components/grouped-bar/index.d.ts +10 -10
  24. package/components/grouped-bar/index.js +8 -6
  25. package/components/grouped-bar/index.js.map +1 -1
  26. package/components/line/index.d.ts +10 -10
  27. package/components/line/index.js +8 -6
  28. package/components/line/index.js.map +1 -1
  29. package/components/sankey/index.d.ts +10 -10
  30. package/components/sankey/index.js +8 -6
  31. package/components/sankey/index.js.map +1 -1
  32. package/components/scatter/index.d.ts +10 -10
  33. package/components/scatter/index.js +8 -6
  34. package/components/scatter/index.js.map +1 -1
  35. package/components/stacked-bar/index.d.ts +10 -10
  36. package/components/stacked-bar/index.js +8 -6
  37. package/components/stacked-bar/index.js.map +1 -1
  38. package/components/timeline/index.d.ts +10 -10
  39. package/components/timeline/index.js +8 -6
  40. package/components/timeline/index.js.map +1 -1
  41. package/components/tooltip/index.d.ts +10 -10
  42. package/components/tooltip/index.js +8 -6
  43. package/components/tooltip/index.js.map +1 -1
  44. package/components/topojson-map/index.d.ts +14 -14
  45. package/components/topojson-map/index.js +8 -6
  46. package/components/topojson-map/index.js.map +1 -1
  47. package/components/xy-labels/index.d.ts +10 -10
  48. package/components/xy-labels/index.js +8 -6
  49. package/components/xy-labels/index.js.map +1 -1
  50. package/components.d.ts +19 -19
  51. package/composites/time-series/index.d.ts +54 -54
  52. package/composites/time-series/style.d.ts +3 -3
  53. package/composites.d.ts +1 -1
  54. package/containers/single-container/index.d.ts +6 -6
  55. package/containers/xy-container/index.d.ts +8 -8
  56. package/containers.d.ts +2 -2
  57. package/html-components/bullet-legend/index.d.ts +3 -3
  58. package/html-components/leaflet-flow-map/index.d.ts +15 -15
  59. package/html-components/leaflet-map/index.d.ts +12 -12
  60. package/index.d.ts +3 -3
  61. package/package.json +5 -3
  62. package/types/dom.d.ts +3 -3
  63. package/utils/react.d.ts +4 -4
  64. package/utils/react.js +1 -1
  65. package/utils/react.js.map +1 -1
  66. package/src/components/area/index.d.ts +0 -10
  67. package/src/components/axis/index.d.ts +0 -10
  68. package/src/components/brush/index.d.ts +0 -10
  69. package/src/components/chord-diagram/index.d.ts +0 -13
  70. package/src/components/crosshair/index.d.ts +0 -10
  71. package/src/components/donut/index.d.ts +0 -10
  72. package/src/components/free-brush/index.d.ts +0 -10
  73. package/src/components/graph/index.d.ts +0 -10
  74. package/src/components/grouped-bar/index.d.ts +0 -10
  75. package/src/components/line/index.d.ts +0 -10
  76. package/src/components/sankey/index.d.ts +0 -10
  77. package/src/components/scatter/index.d.ts +0 -10
  78. package/src/components/stacked-bar/index.d.ts +0 -10
  79. package/src/components/timeline/index.d.ts +0 -10
  80. package/src/components/tooltip/index.d.ts +0 -10
  81. package/src/components/topojson-map/index.d.ts +0 -14
  82. package/src/components/xy-labels/index.d.ts +0 -10
  83. package/src/components.d.ts +0 -19
  84. package/src/composites/time-series/index.d.ts +0 -54
  85. package/src/composites/time-series/style.d.ts +0 -3
  86. package/src/composites.d.ts +0 -1
  87. package/src/containers/single-container/index.d.ts +0 -6
  88. package/src/containers/xy-container/index.d.ts +0 -8
  89. package/src/containers.d.ts +0 -2
  90. package/src/html-components/bullet-legend/index.d.ts +0 -3
  91. package/src/html-components/leaflet-flow-map/index.d.ts +0 -15
  92. package/src/html-components/leaflet-map/index.d.ts +0 -12
  93. package/src/index.d.ts +0 -3
  94. package/src/types/dom.d.ts +0 -3
  95. package/src/utils/react.d.ts +0 -4
@@ -1,22 +1,24 @@
1
- import React, { useRef, useEffect, useImperativeHandle } from 'react';
1
+ import React, { useRef, useState, 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
8
  useEffect(() => {
8
- var _a;
9
9
  const element = ref.current;
10
- (_a = element.__component__) === null || _a === void 0 ? void 0 : _a.destroy();
11
- element.__component__ = new GroupedBar(props);
10
+ const hasAlreadyBeenInitialized = element.__component__;
11
+ const c = element.__component__ || new GroupedBar(props);
12
+ setComponent(c);
13
+ element.__component__ = c;
14
+ return () => hasAlreadyBeenInitialized && c.destroy();
12
15
  }, []);
13
16
  useEffect(() => {
14
- const component = ref.current.__component__;
15
17
  if (props.data)
16
18
  component === null || component === void 0 ? void 0 : component.setData(props.data);
17
19
  component === null || component === void 0 ? void 0 : component.setConfig(props);
18
20
  });
19
- useImperativeHandle(fRef, () => ({ component: ref.current.__component__ }));
21
+ useImperativeHandle(fRef, () => ({ component }), [component]);
20
22
  return React.createElement("vis-component", { ref: ref });
21
23
  }
22
24
  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 } 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\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<GroupedBar<Datum>>)\n element.__component__?.destroy() // Destroy component if exists already (to comply with React 18 strict mode, which renders components twice in dev mode)\n element.__component__ = new GroupedBar(props)\n // We don't have a clean up function because the component will be destroyed by its container (e.g. XYContainer or SingleContainer)\n }, [])\n\n // On Props Update\n useEffect(() => {\n const component = (ref.current as VisComponentElement<GroupedBar<Datum>>).__component__\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component: (ref.current as VisComponentElement<GroupedBar<Datum>>).__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;IAGhE,SAAS,CAAC,MAAK;;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAAkD,CAAA;AACvE,QAAA,CAAA,EAAA,GAAA,OAAO,CAAC,aAAa,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,OAAO,EAAE,CAAA;QAChC,OAAO,CAAC,aAAa,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAA;KAE9C,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,SAAS,GAAI,GAAG,CAAC,OAAkD,CAAC,aAAa,CAAA;QACvF,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,EAAG,GAAG,CAAC,OAAkD,CAAC,aAAa,EAAE,CAAC,CAAC,CAAA;AACvH,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 [component, setComponent] = useState<GroupedBar<Datum>>()\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<GroupedBar<Datum>>)\n\n // React 18 in Strict Mode renders components twice. At the same time, a Container that contains this component\n // (e.g. XYContainer) will be updated only after the first render. So we need to make sure that the component will\n // be initialized only once and won't get destroyed after the first render\n const hasAlreadyBeenInitialized = element.__component__\n const c = element.__component__ || new GroupedBar<Datum>(props)\n setComponent(c)\n element.__component__ = c\n\n return () => hasAlreadyBeenInitialized && 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;AAKvE,QAAA,MAAM,yBAAyB,GAAG,OAAO,CAAC,aAAa,CAAA;QACvD,MAAM,CAAC,GAAG,OAAO,CAAC,aAAa,IAAI,IAAI,UAAU,CAAQ,KAAK,CAAC,CAAA;QAC/D,YAAY,CAAC,CAAC,CAAC,CAAA;AACf,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;QAEzB,OAAO,MAAM,yBAAyB,IAAI,CAAC,CAAC,OAAO,EAAE,CAAA;KACtD,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,10 +1,10 @@
1
- import { Ref } from 'react';
2
- import { Line, LineConfigInterface } from '@unovis/ts';
3
- export declare type VisLineRef<Datum> = {
4
- component: Line<Datum>;
5
- };
6
- export declare type VisLineProps<Datum> = LineConfigInterface<Datum> & {
7
- data?: Datum[];
8
- ref?: Ref<VisLineRef<Datum>>;
9
- };
10
- export declare const VisLine: (<Datum>(props: VisLineProps<Datum>) => JSX.Element | null);
1
+ import { Ref } from 'react';
2
+ import { Line, LineConfigInterface } from '@unovis/ts';
3
+ export declare type VisLineRef<Datum> = {
4
+ component?: Line<Datum>;
5
+ };
6
+ export declare type VisLineProps<Datum> = LineConfigInterface<Datum> & {
7
+ data?: Datum[];
8
+ ref?: Ref<VisLineRef<Datum>>;
9
+ };
10
+ export declare const VisLine: (<Datum>(props: VisLineProps<Datum>) => JSX.Element | null);
@@ -1,22 +1,24 @@
1
- import React, { useRef, useEffect, useImperativeHandle } from 'react';
1
+ import React, { useRef, useState, 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
8
  useEffect(() => {
8
- var _a;
9
9
  const element = ref.current;
10
- (_a = element.__component__) === null || _a === void 0 ? void 0 : _a.destroy();
11
- element.__component__ = new Line(props);
10
+ const hasAlreadyBeenInitialized = element.__component__;
11
+ const c = element.__component__ || new Line(props);
12
+ setComponent(c);
13
+ element.__component__ = c;
14
+ return () => hasAlreadyBeenInitialized && c.destroy();
12
15
  }, []);
13
16
  useEffect(() => {
14
- const component = ref.current.__component__;
15
17
  if (props.data)
16
18
  component === null || component === void 0 ? void 0 : component.setData(props.data);
17
19
  component === null || component === void 0 ? void 0 : component.setConfig(props);
18
20
  });
19
- useImperativeHandle(fRef, () => ({ component: ref.current.__component__ }));
21
+ useImperativeHandle(fRef, () => ({ component }), [component]);
20
22
  return React.createElement("vis-component", { ref: ref });
21
23
  }
22
24
  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 } 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\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Line<Datum>>)\n element.__component__?.destroy() // Destroy component if exists already (to comply with React 18 strict mode, which renders components twice in dev mode)\n element.__component__ = new Line(props)\n // We don't have a clean up function because the component will be destroyed by its container (e.g. XYContainer or SingleContainer)\n }, [])\n\n // On Props Update\n useEffect(() => {\n const component = (ref.current as VisComponentElement<Line<Datum>>).__component__\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component: (ref.current as VisComponentElement<Line<Datum>>).__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;IAG1D,SAAS,CAAC,MAAK;;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAA4C,CAAA;AACjE,QAAA,CAAA,EAAA,GAAA,OAAO,CAAC,aAAa,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,OAAO,EAAE,CAAA;QAChC,OAAO,CAAC,aAAa,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAA;KAExC,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,SAAS,GAAI,GAAG,CAAC,OAA4C,CAAC,aAAa,CAAA;QACjF,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,EAAG,GAAG,CAAC,OAA4C,CAAC,aAAa,EAAE,CAAC,CAAC,CAAA;AACjH,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 [component, setComponent] = useState<Line<Datum>>()\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Line<Datum>>)\n\n // React 18 in Strict Mode renders components twice. At the same time, a Container that contains this component\n // (e.g. XYContainer) will be updated only after the first render. So we need to make sure that the component will\n // be initialized only once and won't get destroyed after the first render\n const hasAlreadyBeenInitialized = element.__component__\n const c = element.__component__ || new Line<Datum>(props)\n setComponent(c)\n element.__component__ = c\n\n return () => hasAlreadyBeenInitialized && 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;AAKjE,QAAA,MAAM,yBAAyB,GAAG,OAAO,CAAC,aAAa,CAAA;QACvD,MAAM,CAAC,GAAG,OAAO,CAAC,aAAa,IAAI,IAAI,IAAI,CAAQ,KAAK,CAAC,CAAA;QACzD,YAAY,CAAC,CAAC,CAAC,CAAA;AACf,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;QAEzB,OAAO,MAAM,yBAAyB,IAAI,CAAC,CAAC,OAAO,EAAE,CAAA;KACtD,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,10 +1,10 @@
1
- import { Ref } from 'react';
2
- import { Sankey, SankeyConfigInterface, SankeyInputNode, SankeyInputLink } from '@unovis/ts';
3
- export declare type VisSankeyRef<N extends SankeyInputNode, L extends SankeyInputLink> = {
4
- component: Sankey<N, L>;
5
- };
6
- export declare type VisSankeyProps<N extends SankeyInputNode, L extends SankeyInputLink> = SankeyConfigInterface<N, L> & {
7
- data?: any;
8
- ref?: Ref<VisSankeyRef<N, L>>;
9
- };
10
- export declare const VisSankey: (<N extends SankeyInputNode, L extends SankeyInputLink>(props: VisSankeyProps<N, L>) => JSX.Element | null);
1
+ import { Ref } from 'react';
2
+ import { Sankey, SankeyConfigInterface, SankeyInputNode, SankeyInputLink } from '@unovis/ts';
3
+ export declare type VisSankeyRef<N extends SankeyInputNode, L extends SankeyInputLink> = {
4
+ component?: Sankey<N, L>;
5
+ };
6
+ export declare type VisSankeyProps<N extends SankeyInputNode, L extends SankeyInputLink> = SankeyConfigInterface<N, L> & {
7
+ data?: any;
8
+ ref?: Ref<VisSankeyRef<N, L>>;
9
+ };
10
+ export declare const VisSankey: (<N extends SankeyInputNode, L extends SankeyInputLink>(props: VisSankeyProps<N, L>) => JSX.Element | null);
@@ -1,22 +1,24 @@
1
- import React, { useRef, useEffect, useImperativeHandle } from 'react';
1
+ import React, { useRef, useState, 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
8
  useEffect(() => {
8
- var _a;
9
9
  const element = ref.current;
10
- (_a = element.__component__) === null || _a === void 0 ? void 0 : _a.destroy();
11
- element.__component__ = new Sankey(props);
10
+ const hasAlreadyBeenInitialized = element.__component__;
11
+ const c = element.__component__ || new Sankey(props);
12
+ setComponent(c);
13
+ element.__component__ = c;
14
+ return () => hasAlreadyBeenInitialized && c.destroy();
12
15
  }, []);
13
16
  useEffect(() => {
14
- const component = ref.current.__component__;
15
17
  if (props.data)
16
18
  component === null || component === void 0 ? void 0 : component.setData(props.data);
17
19
  component === null || component === void 0 ? void 0 : component.setConfig(props);
18
20
  });
19
- useImperativeHandle(fRef, () => ({ component: ref.current.__component__ }));
21
+ useImperativeHandle(fRef, () => ({ component }), [component]);
20
22
  return React.createElement("vis-component", { ref: ref });
21
23
  }
22
24
  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 } 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\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Sankey<N, L>>)\n element.__component__?.destroy() // Destroy component if exists already (to comply with React 18 strict mode, which renders components twice in dev mode)\n element.__component__ = new Sankey(props)\n // We don't have a clean up function because the component will be destroyed by its container (e.g. XYContainer or SingleContainer)\n }, [])\n\n // On Props Update\n useEffect(() => {\n const component = (ref.current as VisComponentElement<Sankey<N, L>>).__component__\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component: (ref.current as VisComponentElement<Sankey<N, L>>).__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;IAG3D,SAAS,CAAC,MAAK;;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAA6C,CAAA;AAClE,QAAA,CAAA,EAAA,GAAA,OAAO,CAAC,aAAa,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,OAAO,EAAE,CAAA;QAChC,OAAO,CAAC,aAAa,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,CAAA;KAE1C,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,SAAS,GAAI,GAAG,CAAC,OAA6C,CAAC,aAAa,CAAA;QAClF,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,EAAG,GAAG,CAAC,OAA6C,CAAC,aAAa,EAAE,CAAC,CAAC,CAAA;AAClH,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 [component, setComponent] = useState<Sankey<N, L>>()\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Sankey<N, L>>)\n\n // React 18 in Strict Mode renders components twice. At the same time, a Container that contains this component\n // (e.g. XYContainer) will be updated only after the first render. So we need to make sure that the component will\n // be initialized only once and won't get destroyed after the first render\n const hasAlreadyBeenInitialized = element.__component__\n const c = element.__component__ || new Sankey<N, L>(props)\n setComponent(c)\n element.__component__ = c\n\n return () => hasAlreadyBeenInitialized && 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;AAKlE,QAAA,MAAM,yBAAyB,GAAG,OAAO,CAAC,aAAa,CAAA;QACvD,MAAM,CAAC,GAAG,OAAO,CAAC,aAAa,IAAI,IAAI,MAAM,CAAO,KAAK,CAAC,CAAA;QAC1D,YAAY,CAAC,CAAC,CAAC,CAAA;AACf,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;QAEzB,OAAO,MAAM,yBAAyB,IAAI,CAAC,CAAC,OAAO,EAAE,CAAA;KACtD,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,10 +1,10 @@
1
- import { Ref } from 'react';
2
- import { Scatter, ScatterConfigInterface } from '@unovis/ts';
3
- export declare type VisScatterRef<Datum> = {
4
- component: Scatter<Datum>;
5
- };
6
- export declare type VisScatterProps<Datum> = ScatterConfigInterface<Datum> & {
7
- data?: Datum[];
8
- ref?: Ref<VisScatterRef<Datum>>;
9
- };
10
- export declare const VisScatter: (<Datum>(props: VisScatterProps<Datum>) => JSX.Element | null);
1
+ import { Ref } from 'react';
2
+ import { Scatter, ScatterConfigInterface } from '@unovis/ts';
3
+ export declare type VisScatterRef<Datum> = {
4
+ component?: Scatter<Datum>;
5
+ };
6
+ export declare type VisScatterProps<Datum> = ScatterConfigInterface<Datum> & {
7
+ data?: Datum[];
8
+ ref?: Ref<VisScatterRef<Datum>>;
9
+ };
10
+ export declare const VisScatter: (<Datum>(props: VisScatterProps<Datum>) => JSX.Element | null);
@@ -1,22 +1,24 @@
1
- import React, { useRef, useEffect, useImperativeHandle } from 'react';
1
+ import React, { useRef, useState, 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
8
  useEffect(() => {
8
- var _a;
9
9
  const element = ref.current;
10
- (_a = element.__component__) === null || _a === void 0 ? void 0 : _a.destroy();
11
- element.__component__ = new Scatter(props);
10
+ const hasAlreadyBeenInitialized = element.__component__;
11
+ const c = element.__component__ || new Scatter(props);
12
+ setComponent(c);
13
+ element.__component__ = c;
14
+ return () => hasAlreadyBeenInitialized && c.destroy();
12
15
  }, []);
13
16
  useEffect(() => {
14
- const component = ref.current.__component__;
15
17
  if (props.data)
16
18
  component === null || component === void 0 ? void 0 : component.setData(props.data);
17
19
  component === null || component === void 0 ? void 0 : component.setConfig(props);
18
20
  });
19
- useImperativeHandle(fRef, () => ({ component: ref.current.__component__ }));
21
+ useImperativeHandle(fRef, () => ({ component }), [component]);
20
22
  return React.createElement("vis-component", { ref: ref });
21
23
  }
22
24
  const VisScatter = React.memo(React.forwardRef(VisScatterFC), arePropsEqual);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/scatter/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef } from 'react'\nimport { Scatter, ScatterConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisScatterRef<Datum> = {\n component: Scatter<Datum>;\n}\n\nexport type VisScatterProps<Datum> = ScatterConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisScatterRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisScatterFC<Datum> (props: VisScatterProps<Datum>, fRef: ForwardedRef<VisScatterRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<Scatter<Datum>>>(null)\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Scatter<Datum>>)\n element.__component__?.destroy() // Destroy component if exists already (to comply with React 18 strict mode, which renders components twice in dev mode)\n element.__component__ = new Scatter(props)\n // We don't have a clean up function because the component will be destroyed by its container (e.g. XYContainer or SingleContainer)\n }, [])\n\n // On Props Update\n useEffect(() => {\n const component = (ref.current as VisComponentElement<Scatter<Datum>>).__component__\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component: (ref.current as VisComponentElement<Scatter<Datum>>).__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 VisScatter: (<Datum>(props: VisScatterProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisScatterFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,YAAY,CAAS,KAA6B,EAAE,IAAwC,EAAA;AACnG,IAAA,MAAM,GAAG,GAAG,MAAM,CAAsC,IAAI,CAAC,CAAA;IAG7D,SAAS,CAAC,MAAK;;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAA+C,CAAA;AACpE,QAAA,CAAA,EAAA,GAAA,OAAO,CAAC,aAAa,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,OAAO,EAAE,CAAA;QAChC,OAAO,CAAC,aAAa,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC,CAAA;KAE3C,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,SAAS,GAAI,GAAG,CAAC,OAA+C,CAAC,aAAa,CAAA;QACpF,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,EAAG,GAAG,CAAC,OAA+C,CAAC,aAAa,EAAE,CAAC,CAAC,CAAA;AACpH,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,UAAU,GAAmE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,aAAa;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/scatter/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Scatter, ScatterConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisScatterRef<Datum> = {\n component?: Scatter<Datum>;\n}\n\nexport type VisScatterProps<Datum> = ScatterConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisScatterRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisScatterFC<Datum> (props: VisScatterProps<Datum>, fRef: ForwardedRef<VisScatterRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<Scatter<Datum>>>(null)\n const [component, setComponent] = useState<Scatter<Datum>>()\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Scatter<Datum>>)\n\n // React 18 in Strict Mode renders components twice. At the same time, a Container that contains this component\n // (e.g. XYContainer) will be updated only after the first render. So we need to make sure that the component will\n // be initialized only once and won't get destroyed after the first render\n const hasAlreadyBeenInitialized = element.__component__\n const c = element.__component__ || new Scatter<Datum>(props)\n setComponent(c)\n element.__component__ = c\n\n return () => hasAlreadyBeenInitialized && 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 VisScatter: (<Datum>(props: VisScatterProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisScatterFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,YAAY,CAAS,KAA6B,EAAE,IAAwC,EAAA;AACnG,IAAA,MAAM,GAAG,GAAG,MAAM,CAAsC,IAAI,CAAC,CAAA;IAC7D,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,EAAkB,CAAA;IAG5D,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAA+C,CAAA;AAKpE,QAAA,MAAM,yBAAyB,GAAG,OAAO,CAAC,aAAa,CAAA;QACvD,MAAM,CAAC,GAAG,OAAO,CAAC,aAAa,IAAI,IAAI,OAAO,CAAQ,KAAK,CAAC,CAAA;QAC5D,YAAY,CAAC,CAAC,CAAC,CAAA;AACf,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;QAEzB,OAAO,MAAM,yBAAyB,IAAI,CAAC,CAAC,OAAO,EAAE,CAAA;KACtD,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,UAAU,GAAmE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,aAAa;;;;"}
@@ -1,10 +1,10 @@
1
- import { Ref } from 'react';
2
- import { StackedBar, StackedBarConfigInterface } from '@unovis/ts';
3
- export declare type VisStackedBarRef<Datum> = {
4
- component: StackedBar<Datum>;
5
- };
6
- export declare type VisStackedBarProps<Datum> = StackedBarConfigInterface<Datum> & {
7
- data?: Datum[];
8
- ref?: Ref<VisStackedBarRef<Datum>>;
9
- };
10
- export declare const VisStackedBar: (<Datum>(props: VisStackedBarProps<Datum>) => JSX.Element | null);
1
+ import { Ref } from 'react';
2
+ import { StackedBar, StackedBarConfigInterface } from '@unovis/ts';
3
+ export declare type VisStackedBarRef<Datum> = {
4
+ component?: StackedBar<Datum>;
5
+ };
6
+ export declare type VisStackedBarProps<Datum> = StackedBarConfigInterface<Datum> & {
7
+ data?: Datum[];
8
+ ref?: Ref<VisStackedBarRef<Datum>>;
9
+ };
10
+ export declare const VisStackedBar: (<Datum>(props: VisStackedBarProps<Datum>) => JSX.Element | null);
@@ -1,22 +1,24 @@
1
- import React, { useRef, useEffect, useImperativeHandle } from 'react';
1
+ import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
2
2
  import { StackedBar } from '@unovis/ts';
3
3
  import { arePropsEqual } from '../../utils/react.js';
4
4
 
5
5
  function VisStackedBarFC(props, fRef) {
6
6
  const ref = useRef(null);
7
+ const [component, setComponent] = useState();
7
8
  useEffect(() => {
8
- var _a;
9
9
  const element = ref.current;
10
- (_a = element.__component__) === null || _a === void 0 ? void 0 : _a.destroy();
11
- element.__component__ = new StackedBar(props);
10
+ const hasAlreadyBeenInitialized = element.__component__;
11
+ const c = element.__component__ || new StackedBar(props);
12
+ setComponent(c);
13
+ element.__component__ = c;
14
+ return () => hasAlreadyBeenInitialized && c.destroy();
12
15
  }, []);
13
16
  useEffect(() => {
14
- const component = ref.current.__component__;
15
17
  if (props.data)
16
18
  component === null || component === void 0 ? void 0 : component.setData(props.data);
17
19
  component === null || component === void 0 ? void 0 : component.setConfig(props);
18
20
  });
19
- useImperativeHandle(fRef, () => ({ component: ref.current.__component__ }));
21
+ useImperativeHandle(fRef, () => ({ component }), [component]);
20
22
  return React.createElement("vis-component", { ref: ref });
21
23
  }
22
24
  const VisStackedBar = React.memo(React.forwardRef(VisStackedBarFC), arePropsEqual);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/stacked-bar/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef } from 'react'\nimport { StackedBar, StackedBarConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisStackedBarRef<Datum> = {\n component: StackedBar<Datum>;\n}\n\nexport type VisStackedBarProps<Datum> = StackedBarConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisStackedBarRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisStackedBarFC<Datum> (props: VisStackedBarProps<Datum>, fRef: ForwardedRef<VisStackedBarRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<StackedBar<Datum>>>(null)\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<StackedBar<Datum>>)\n element.__component__?.destroy() // Destroy component if exists already (to comply with React 18 strict mode, which renders components twice in dev mode)\n element.__component__ = new StackedBar(props)\n // We don't have a clean up function because the component will be destroyed by its container (e.g. XYContainer or SingleContainer)\n }, [])\n\n // On Props Update\n useEffect(() => {\n const component = (ref.current as VisComponentElement<StackedBar<Datum>>).__component__\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component: (ref.current as VisComponentElement<StackedBar<Datum>>).__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 VisStackedBar: (<Datum>(props: VisStackedBarProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisStackedBarFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,eAAe,CAAS,KAAgC,EAAE,IAA2C,EAAA;AAC5G,IAAA,MAAM,GAAG,GAAG,MAAM,CAAyC,IAAI,CAAC,CAAA;IAGhE,SAAS,CAAC,MAAK;;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAAkD,CAAA;AACvE,QAAA,CAAA,EAAA,GAAA,OAAO,CAAC,aAAa,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,OAAO,EAAE,CAAA;QAChC,OAAO,CAAC,aAAa,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAA;KAE9C,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,SAAS,GAAI,GAAG,CAAC,OAAkD,CAAC,aAAa,CAAA;QACvF,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,EAAG,GAAG,CAAC,OAAkD,CAAC,aAAa,EAAE,CAAC,CAAC,CAAA;AACvH,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/stacked-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 { StackedBar, StackedBarConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisStackedBarRef<Datum> = {\n component?: StackedBar<Datum>;\n}\n\nexport type VisStackedBarProps<Datum> = StackedBarConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisStackedBarRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisStackedBarFC<Datum> (props: VisStackedBarProps<Datum>, fRef: ForwardedRef<VisStackedBarRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<StackedBar<Datum>>>(null)\n const [component, setComponent] = useState<StackedBar<Datum>>()\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<StackedBar<Datum>>)\n\n // React 18 in Strict Mode renders components twice. At the same time, a Container that contains this component\n // (e.g. XYContainer) will be updated only after the first render. So we need to make sure that the component will\n // be initialized only once and won't get destroyed after the first render\n const hasAlreadyBeenInitialized = element.__component__\n const c = element.__component__ || new StackedBar<Datum>(props)\n setComponent(c)\n element.__component__ = c\n\n return () => hasAlreadyBeenInitialized && 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 VisStackedBar: (<Datum>(props: VisStackedBarProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisStackedBarFC), 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;AAKvE,QAAA,MAAM,yBAAyB,GAAG,OAAO,CAAC,aAAa,CAAA;QACvD,MAAM,CAAC,GAAG,OAAO,CAAC,aAAa,IAAI,IAAI,UAAU,CAAQ,KAAK,CAAC,CAAA;QAC/D,YAAY,CAAC,CAAC,CAAC,CAAA;AACf,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;QAEzB,OAAO,MAAM,yBAAyB,IAAI,CAAC,CAAC,OAAO,EAAE,CAAA;KACtD,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,10 +1,10 @@
1
- import { Ref } from 'react';
2
- import { Timeline, TimelineConfigInterface } from '@unovis/ts';
3
- export declare type VisTimelineRef<Datum> = {
4
- component: Timeline<Datum>;
5
- };
6
- export declare type VisTimelineProps<Datum> = TimelineConfigInterface<Datum> & {
7
- data?: Datum[];
8
- ref?: Ref<VisTimelineRef<Datum>>;
9
- };
10
- export declare const VisTimeline: (<Datum>(props: VisTimelineProps<Datum>) => JSX.Element | null);
1
+ import { Ref } from 'react';
2
+ import { Timeline, TimelineConfigInterface } from '@unovis/ts';
3
+ export declare type VisTimelineRef<Datum> = {
4
+ component?: Timeline<Datum>;
5
+ };
6
+ export declare type VisTimelineProps<Datum> = TimelineConfigInterface<Datum> & {
7
+ data?: Datum[];
8
+ ref?: Ref<VisTimelineRef<Datum>>;
9
+ };
10
+ export declare const VisTimeline: (<Datum>(props: VisTimelineProps<Datum>) => JSX.Element | null);
@@ -1,22 +1,24 @@
1
- import React, { useRef, useEffect, useImperativeHandle } from 'react';
1
+ import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
2
2
  import { Timeline } from '@unovis/ts';
3
3
  import { arePropsEqual } from '../../utils/react.js';
4
4
 
5
5
  function VisTimelineFC(props, fRef) {
6
6
  const ref = useRef(null);
7
+ const [component, setComponent] = useState();
7
8
  useEffect(() => {
8
- var _a;
9
9
  const element = ref.current;
10
- (_a = element.__component__) === null || _a === void 0 ? void 0 : _a.destroy();
11
- element.__component__ = new Timeline(props);
10
+ const hasAlreadyBeenInitialized = element.__component__;
11
+ const c = element.__component__ || new Timeline(props);
12
+ setComponent(c);
13
+ element.__component__ = c;
14
+ return () => hasAlreadyBeenInitialized && c.destroy();
12
15
  }, []);
13
16
  useEffect(() => {
14
- const component = ref.current.__component__;
15
17
  if (props.data)
16
18
  component === null || component === void 0 ? void 0 : component.setData(props.data);
17
19
  component === null || component === void 0 ? void 0 : component.setConfig(props);
18
20
  });
19
- useImperativeHandle(fRef, () => ({ component: ref.current.__component__ }));
21
+ useImperativeHandle(fRef, () => ({ component }), [component]);
20
22
  return React.createElement("vis-component", { ref: ref });
21
23
  }
22
24
  const VisTimeline = React.memo(React.forwardRef(VisTimelineFC), arePropsEqual);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/timeline/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef } from 'react'\nimport { Timeline, TimelineConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisTimelineRef<Datum> = {\n component: Timeline<Datum>;\n}\n\nexport type VisTimelineProps<Datum> = TimelineConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisTimelineRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisTimelineFC<Datum> (props: VisTimelineProps<Datum>, fRef: ForwardedRef<VisTimelineRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<Timeline<Datum>>>(null)\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Timeline<Datum>>)\n element.__component__?.destroy() // Destroy component if exists already (to comply with React 18 strict mode, which renders components twice in dev mode)\n element.__component__ = new Timeline(props)\n // We don't have a clean up function because the component will be destroyed by its container (e.g. XYContainer or SingleContainer)\n }, [])\n\n // On Props Update\n useEffect(() => {\n const component = (ref.current as VisComponentElement<Timeline<Datum>>).__component__\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component: (ref.current as VisComponentElement<Timeline<Datum>>).__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 VisTimeline: (<Datum>(props: VisTimelineProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisTimelineFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,aAAa,CAAS,KAA8B,EAAE,IAAyC,EAAA;AACtG,IAAA,MAAM,GAAG,GAAG,MAAM,CAAuC,IAAI,CAAC,CAAA;IAG9D,SAAS,CAAC,MAAK;;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAAgD,CAAA;AACrE,QAAA,CAAA,EAAA,GAAA,OAAO,CAAC,aAAa,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,OAAO,EAAE,CAAA;QAChC,OAAO,CAAC,aAAa,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAA;KAE5C,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,SAAS,GAAI,GAAG,CAAC,OAAgD,CAAC,aAAa,CAAA;QACrF,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,EAAG,GAAG,CAAC,OAAgD,CAAC,aAAa,EAAE,CAAC,CAAC,CAAA;AACrH,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,WAAW,GAAoE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,aAAa;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/timeline/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Timeline, TimelineConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisTimelineRef<Datum> = {\n component?: Timeline<Datum>;\n}\n\nexport type VisTimelineProps<Datum> = TimelineConfigInterface<Datum> & {\n data?: Datum[];\n ref?: Ref<VisTimelineRef<Datum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisTimelineFC<Datum> (props: VisTimelineProps<Datum>, fRef: ForwardedRef<VisTimelineRef<Datum>>): JSX.Element {\n const ref = useRef<VisComponentElement<Timeline<Datum>>>(null)\n const [component, setComponent] = useState<Timeline<Datum>>()\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Timeline<Datum>>)\n\n // React 18 in Strict Mode renders components twice. At the same time, a Container that contains this component\n // (e.g. XYContainer) will be updated only after the first render. So we need to make sure that the component will\n // be initialized only once and won't get destroyed after the first render\n const hasAlreadyBeenInitialized = element.__component__\n const c = element.__component__ || new Timeline<Datum>(props)\n setComponent(c)\n element.__component__ = c\n\n return () => hasAlreadyBeenInitialized && 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 VisTimeline: (<Datum>(props: VisTimelineProps<Datum>) => JSX.Element | null) = React.memo(React.forwardRef(VisTimelineFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,aAAa,CAAS,KAA8B,EAAE,IAAyC,EAAA;AACtG,IAAA,MAAM,GAAG,GAAG,MAAM,CAAuC,IAAI,CAAC,CAAA;IAC9D,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,EAAmB,CAAA;IAG7D,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAAgD,CAAA;AAKrE,QAAA,MAAM,yBAAyB,GAAG,OAAO,CAAC,aAAa,CAAA;QACvD,MAAM,CAAC,GAAG,OAAO,CAAC,aAAa,IAAI,IAAI,QAAQ,CAAQ,KAAK,CAAC,CAAA;QAC7D,YAAY,CAAC,CAAC,CAAC,CAAA;AACf,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;QAEzB,OAAO,MAAM,yBAAyB,IAAI,CAAC,CAAC,OAAO,EAAE,CAAA;KACtD,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,WAAW,GAAoE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,aAAa;;;;"}
@@ -1,10 +1,10 @@
1
- import { Ref } from 'react';
2
- import { Tooltip, TooltipConfigInterface } from '@unovis/ts';
3
- export declare type VisTooltipRef = {
4
- component: Tooltip;
5
- };
6
- export declare type VisTooltipProps = TooltipConfigInterface & {
7
- data?: null;
8
- ref?: Ref<VisTooltipRef>;
9
- };
10
- export declare const VisTooltip: ((props: VisTooltipProps) => JSX.Element | null);
1
+ import { Ref } from 'react';
2
+ import { Tooltip, TooltipConfigInterface } from '@unovis/ts';
3
+ export declare type VisTooltipRef = {
4
+ component?: Tooltip;
5
+ };
6
+ export declare type VisTooltipProps = TooltipConfigInterface & {
7
+ data?: null;
8
+ ref?: Ref<VisTooltipRef>;
9
+ };
10
+ export declare const VisTooltip: ((props: VisTooltipProps) => JSX.Element | null);
@@ -1,20 +1,22 @@
1
- import React, { useRef, useEffect, useImperativeHandle } from 'react';
1
+ import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
2
2
  import { Tooltip } from '@unovis/ts';
3
3
  import { arePropsEqual } from '../../utils/react.js';
4
4
 
5
5
  function VisTooltipFC(props, fRef) {
6
6
  const ref = useRef(null);
7
+ const [component, setComponent] = useState();
7
8
  useEffect(() => {
8
- var _a;
9
9
  const element = ref.current;
10
- (_a = element.__component__) === null || _a === void 0 ? void 0 : _a.destroy();
11
- element.__component__ = new Tooltip(props);
10
+ const hasAlreadyBeenInitialized = element.__component__;
11
+ const c = element.__component__ || new Tooltip(props);
12
+ setComponent(c);
13
+ element.__component__ = c;
14
+ return () => hasAlreadyBeenInitialized && c.destroy();
12
15
  }, []);
13
16
  useEffect(() => {
14
- const component = ref.current.__component__;
15
17
  component === null || component === void 0 ? void 0 : component.setConfig(props);
16
18
  });
17
- useImperativeHandle(fRef, () => ({ component: ref.current.__component__ }));
19
+ useImperativeHandle(fRef, () => ({ component }), [component]);
18
20
  return React.createElement("vis-tooltip", { ref: ref });
19
21
  }
20
22
  const VisTooltip = React.memo(React.forwardRef(VisTooltipFC), arePropsEqual);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/tooltip/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef } from 'react'\nimport { Tooltip, TooltipConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisTooltipRef = {\n component: Tooltip;\n}\n\nexport type VisTooltipProps = TooltipConfigInterface & {\n data?: null;\n ref?: Ref<VisTooltipRef>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisTooltipFC (props: VisTooltipProps, fRef: ForwardedRef<VisTooltipRef>): JSX.Element {\n const ref = useRef<VisComponentElement<Tooltip>>(null)\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Tooltip>)\n element.__component__?.destroy() // Destroy component if exists already (to comply with React 18 strict mode, which renders components twice in dev mode)\n element.__component__ = new Tooltip(props)\n // We don't have a clean up function because the component will be destroyed by its container (e.g. XYContainer or SingleContainer)\n }, [])\n\n // On Props Update\n useEffect(() => {\n const component = (ref.current as VisComponentElement<Tooltip>).__component__\n\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component: (ref.current as VisComponentElement<Tooltip>).__component__ }))\n return <vis-tooltip 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 VisTooltip: ((props: VisTooltipProps) => JSX.Element | null) = React.memo(React.forwardRef(VisTooltipFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,YAAY,CAAE,KAAsB,EAAE,IAAiC,EAAA;AAC9E,IAAA,MAAM,GAAG,GAAG,MAAM,CAA+B,IAAI,CAAC,CAAA;IAGtD,SAAS,CAAC,MAAK;;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAAwC,CAAA;AAC7D,QAAA,CAAA,EAAA,GAAA,OAAO,CAAC,aAAa,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,OAAO,EAAE,CAAA;QAChC,OAAO,CAAC,aAAa,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC,CAAA;KAE3C,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,SAAS,GAAI,GAAG,CAAC,OAAwC,CAAC,aAAa,CAAA;QAE7E,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,EAAG,GAAG,CAAC,OAAwC,CAAC,aAAa,EAAE,CAAC,CAAC,CAAA;AAC7G,IAAA,OAAO,KAAa,CAAA,aAAA,CAAA,aAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AAClC,CAAC;AAIY,MAAA,UAAU,GAAqD,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,aAAa;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/tooltip/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { Tooltip, TooltipConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisTooltipRef = {\n component?: Tooltip;\n}\n\nexport type VisTooltipProps = TooltipConfigInterface & {\n data?: null;\n ref?: Ref<VisTooltipRef>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisTooltipFC (props: VisTooltipProps, fRef: ForwardedRef<VisTooltipRef>): JSX.Element {\n const ref = useRef<VisComponentElement<Tooltip>>(null)\n const [component, setComponent] = useState<Tooltip>()\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<Tooltip>)\n\n // React 18 in Strict Mode renders components twice. At the same time, a Container that contains this component\n // (e.g. XYContainer) will be updated only after the first render. So we need to make sure that the component will\n // be initialized only once and won't get destroyed after the first render\n const hasAlreadyBeenInitialized = element.__component__\n const c = element.__component__ || new Tooltip(props)\n setComponent(c)\n element.__component__ = c\n\n return () => hasAlreadyBeenInitialized && c.destroy()\n }, [])\n\n // On Props Update\n useEffect(() => {\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component }), [component])\n return <vis-tooltip 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 VisTooltip: ((props: VisTooltipProps) => JSX.Element | null) = React.memo(React.forwardRef(VisTooltipFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,YAAY,CAAE,KAAsB,EAAE,IAAiC,EAAA;AAC9E,IAAA,MAAM,GAAG,GAAG,MAAM,CAA+B,IAAI,CAAC,CAAA;IACtD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,EAAW,CAAA;IAGrD,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAAwC,CAAA;AAK7D,QAAA,MAAM,yBAAyB,GAAG,OAAO,CAAC,aAAa,CAAA;QACvD,MAAM,CAAC,GAAG,OAAO,CAAC,aAAa,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,CAAA;QACrD,YAAY,CAAC,CAAC,CAAC,CAAA;AACf,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;QAEzB,OAAO,MAAM,yBAAyB,IAAI,CAAC,CAAC,OAAO,EAAE,CAAA;KACtD,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;QACb,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,KAAa,CAAA,aAAA,CAAA,aAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AAClC,CAAC;AAIY,MAAA,UAAU,GAAqD,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,aAAa;;;;"}
@@ -1,14 +1,14 @@
1
- import { Ref } from 'react';
2
- import { TopoJSONMap, TopoJSONMapConfigInterface } from '@unovis/ts';
3
- export declare type VisTopoJSONMapRef<AreaDatum, PointDatum, LinkDatum> = {
4
- component: TopoJSONMap<AreaDatum, PointDatum, LinkDatum>;
5
- };
6
- export declare type VisTopoJSONMapProps<AreaDatum, PointDatum, LinkDatum> = TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum> & {
7
- data?: {
8
- areas?: AreaDatum[];
9
- points?: PointDatum[];
10
- links?: LinkDatum[];
11
- };
12
- ref?: Ref<VisTopoJSONMapRef<AreaDatum, PointDatum, LinkDatum>>;
13
- };
14
- export declare const VisTopoJSONMap: (<AreaDatum, PointDatum, LinkDatum>(props: VisTopoJSONMapProps<AreaDatum, PointDatum, LinkDatum>) => JSX.Element | null);
1
+ import { Ref } from 'react';
2
+ import { TopoJSONMap, TopoJSONMapConfigInterface } from '@unovis/ts';
3
+ export declare type VisTopoJSONMapRef<AreaDatum, PointDatum, LinkDatum> = {
4
+ component?: TopoJSONMap<AreaDatum, PointDatum, LinkDatum>;
5
+ };
6
+ export declare type VisTopoJSONMapProps<AreaDatum, PointDatum, LinkDatum> = TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum> & {
7
+ data?: {
8
+ areas?: AreaDatum[];
9
+ points?: PointDatum[];
10
+ links?: LinkDatum[];
11
+ };
12
+ ref?: Ref<VisTopoJSONMapRef<AreaDatum, PointDatum, LinkDatum>>;
13
+ };
14
+ export declare const VisTopoJSONMap: (<AreaDatum, PointDatum, LinkDatum>(props: VisTopoJSONMapProps<AreaDatum, PointDatum, LinkDatum>) => JSX.Element | null);
@@ -1,22 +1,24 @@
1
- import React, { useRef, useEffect, useImperativeHandle } from 'react';
1
+ import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
2
2
  import { TopoJSONMap } from '@unovis/ts';
3
3
  import { arePropsEqual } from '../../utils/react.js';
4
4
 
5
5
  function VisTopoJSONMapFC(props, fRef) {
6
6
  const ref = useRef(null);
7
+ const [component, setComponent] = useState();
7
8
  useEffect(() => {
8
- var _a;
9
9
  const element = ref.current;
10
- (_a = element.__component__) === null || _a === void 0 ? void 0 : _a.destroy();
11
- element.__component__ = new TopoJSONMap(props);
10
+ const hasAlreadyBeenInitialized = element.__component__;
11
+ const c = element.__component__ || new TopoJSONMap(props);
12
+ setComponent(c);
13
+ element.__component__ = c;
14
+ return () => hasAlreadyBeenInitialized && c.destroy();
12
15
  }, []);
13
16
  useEffect(() => {
14
- const component = ref.current.__component__;
15
17
  if (props.data)
16
18
  component === null || component === void 0 ? void 0 : component.setData(props.data);
17
19
  component === null || component === void 0 ? void 0 : component.setConfig(props);
18
20
  });
19
- useImperativeHandle(fRef, () => ({ component: ref.current.__component__ }));
21
+ useImperativeHandle(fRef, () => ({ component }), [component]);
20
22
  return React.createElement("vis-component", { ref: ref });
21
23
  }
22
24
  const VisTopoJSONMap = React.memo(React.forwardRef(VisTopoJSONMapFC), arePropsEqual);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/topojson-map/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef } from 'react'\nimport { TopoJSONMap, TopoJSONMapConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisTopoJSONMapRef<AreaDatum, PointDatum, LinkDatum> = {\n component: TopoJSONMap<AreaDatum, PointDatum, LinkDatum>;\n}\n\nexport type VisTopoJSONMapProps<AreaDatum, PointDatum, LinkDatum> = TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum> & {\n data?: {areas?: AreaDatum[]; points?: PointDatum[]; links?: LinkDatum[]};\n ref?: Ref<VisTopoJSONMapRef<AreaDatum, PointDatum, LinkDatum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisTopoJSONMapFC<AreaDatum, PointDatum, LinkDatum> (props: VisTopoJSONMapProps<AreaDatum, PointDatum, LinkDatum>, fRef: ForwardedRef<VisTopoJSONMapRef<AreaDatum, PointDatum, LinkDatum>>): JSX.Element {\n const ref = useRef<VisComponentElement<TopoJSONMap<AreaDatum, PointDatum, LinkDatum>>>(null)\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<TopoJSONMap<AreaDatum, PointDatum, LinkDatum>>)\n element.__component__?.destroy() // Destroy component if exists already (to comply with React 18 strict mode, which renders components twice in dev mode)\n element.__component__ = new TopoJSONMap(props)\n // We don't have a clean up function because the component will be destroyed by its container (e.g. XYContainer or SingleContainer)\n }, [])\n\n // On Props Update\n useEffect(() => {\n const component = (ref.current as VisComponentElement<TopoJSONMap<AreaDatum, PointDatum, LinkDatum>>).__component__\n if (props.data) component?.setData(props.data)\n component?.setConfig(props)\n })\n\n useImperativeHandle(fRef, () => ({ component: (ref.current as VisComponentElement<TopoJSONMap<AreaDatum, PointDatum, LinkDatum>>).__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 VisTopoJSONMap: (<AreaDatum, PointDatum, LinkDatum>(props: VisTopoJSONMapProps<AreaDatum, PointDatum, LinkDatum>) => JSX.Element | null) = React.memo(React.forwardRef(VisTopoJSONMapFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,gBAAgB,CAAoC,KAA4D,EAAE,IAAuE,EAAA;AAChM,IAAA,MAAM,GAAG,GAAG,MAAM,CAAqE,IAAI,CAAC,CAAA;IAG5F,SAAS,CAAC,MAAK;;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAA8E,CAAA;AACnG,QAAA,CAAA,EAAA,GAAA,OAAO,CAAC,aAAa,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,OAAO,EAAE,CAAA;QAChC,OAAO,CAAC,aAAa,GAAG,IAAI,WAAW,CAAC,KAAK,CAAC,CAAA;KAE/C,EAAE,EAAE,CAAC,CAAA;IAGN,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,SAAS,GAAI,GAAG,CAAC,OAA8E,CAAC,aAAa,CAAA;QACnH,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,EAAG,GAAG,CAAC,OAA8E,CAAC,aAAa,EAAE,CAAC,CAAC,CAAA;AACnJ,IAAA,OAAO,KAAe,CAAA,aAAA,CAAA,eAAA,EAAA,EAAA,GAAG,EAAE,GAAG,GAAI,CAAA;AACpC,CAAC;AAIY,MAAA,cAAc,GAA6H,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,aAAa;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/topojson-map/index.tsx"],"sourcesContent":["// !!! This code was automatically generated. You should not change it !!!\nimport React, { ForwardedRef, Ref, useImperativeHandle, useEffect, useRef, useState } from 'react'\nimport { TopoJSONMap, TopoJSONMapConfigInterface } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisTopoJSONMapRef<AreaDatum, PointDatum, LinkDatum> = {\n component?: TopoJSONMap<AreaDatum, PointDatum, LinkDatum>;\n}\n\nexport type VisTopoJSONMapProps<AreaDatum, PointDatum, LinkDatum> = TopoJSONMapConfigInterface<AreaDatum, PointDatum, LinkDatum> & {\n data?: {areas?: AreaDatum[]; points?: PointDatum[]; links?: LinkDatum[]};\n ref?: Ref<VisTopoJSONMapRef<AreaDatum, PointDatum, LinkDatum>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisTopoJSONMapFC<AreaDatum, PointDatum, LinkDatum> (props: VisTopoJSONMapProps<AreaDatum, PointDatum, LinkDatum>, fRef: ForwardedRef<VisTopoJSONMapRef<AreaDatum, PointDatum, LinkDatum>>): JSX.Element {\n const ref = useRef<VisComponentElement<TopoJSONMap<AreaDatum, PointDatum, LinkDatum>>>(null)\n const [component, setComponent] = useState<TopoJSONMap<AreaDatum, PointDatum, LinkDatum>>()\n\n // On Mount\n useEffect(() => {\n const element = (ref.current as VisComponentElement<TopoJSONMap<AreaDatum, PointDatum, LinkDatum>>)\n\n // React 18 in Strict Mode renders components twice. At the same time, a Container that contains this component\n // (e.g. XYContainer) will be updated only after the first render. So we need to make sure that the component will\n // be initialized only once and won't get destroyed after the first render\n const hasAlreadyBeenInitialized = element.__component__\n const c = element.__component__ || new TopoJSONMap<AreaDatum, PointDatum, LinkDatum>(props)\n setComponent(c)\n element.__component__ = c\n\n return () => hasAlreadyBeenInitialized && 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 VisTopoJSONMap: (<AreaDatum, PointDatum, LinkDatum>(props: VisTopoJSONMapProps<AreaDatum, PointDatum, LinkDatum>) => JSX.Element | null) = React.memo(React.forwardRef(VisTopoJSONMapFC), arePropsEqual)\n"],"names":[],"mappings":";;;;AAoBA,SAAS,gBAAgB,CAAoC,KAA4D,EAAE,IAAuE,EAAA;AAChM,IAAA,MAAM,GAAG,GAAG,MAAM,CAAqE,IAAI,CAAC,CAAA;IAC5F,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,EAAiD,CAAA;IAG3F,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAI,GAAG,CAAC,OAA8E,CAAA;AAKnG,QAAA,MAAM,yBAAyB,GAAG,OAAO,CAAC,aAAa,CAAA;QACvD,MAAM,CAAC,GAAG,OAAO,CAAC,aAAa,IAAI,IAAI,WAAW,CAAmC,KAAK,CAAC,CAAA;QAC3F,YAAY,CAAC,CAAC,CAAC,CAAA;AACf,QAAA,OAAO,CAAC,aAAa,GAAG,CAAC,CAAA;QAEzB,OAAO,MAAM,yBAAyB,IAAI,CAAC,CAAC,OAAO,EAAE,CAAA;KACtD,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,cAAc,GAA6H,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,aAAa;;;;"}