@unovis/react 1.0.3-beta.2 → 1.0.3-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.
|
@@ -1,35 +1,46 @@
|
|
|
1
|
-
import React, { useRef,
|
|
1
|
+
import React, { useRef, useEffect } from 'react';
|
|
2
2
|
import { SingleContainer } from '@unovis/ts';
|
|
3
3
|
import { arePropsEqual } from '../../utils/react.js';
|
|
4
4
|
|
|
5
5
|
function VisSingleContainerFC(props) {
|
|
6
6
|
const container = useRef(null);
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const prevPropsRef = useRef({});
|
|
8
|
+
const chartRef = useRef(undefined);
|
|
9
|
+
const dataRef = useRef(undefined);
|
|
9
10
|
const animationFrameRef = useRef(null);
|
|
10
11
|
const getConfig = () => {
|
|
11
12
|
var _a, _b, _c, _d;
|
|
12
13
|
return (Object.assign(Object.assign({}, props), { component: (_b = (_a = container.current) === null || _a === void 0 ? void 0 : _a.querySelector('vis-component')) === null || _b === void 0 ? void 0 : _b.__component__, tooltip: (_d = (_c = container.current) === null || _c === void 0 ? void 0 : _c.querySelector('vis-tooltip')) === null || _d === void 0 ? void 0 : _d.__component__ }));
|
|
13
14
|
};
|
|
14
15
|
useEffect(() => {
|
|
15
|
-
setData(props.data);
|
|
16
16
|
const c = new SingleContainer(container.current, getConfig(), props.data);
|
|
17
|
-
|
|
17
|
+
chartRef.current = c;
|
|
18
|
+
dataRef.current = props.data;
|
|
18
19
|
return () => {
|
|
19
|
-
if (animationFrameRef.current)
|
|
20
|
+
if (animationFrameRef.current) {
|
|
20
21
|
cancelAnimationFrame(animationFrameRef.current);
|
|
22
|
+
animationFrameRef.current = null;
|
|
23
|
+
prevPropsRef.current = {};
|
|
24
|
+
}
|
|
21
25
|
c.destroy();
|
|
22
26
|
};
|
|
23
27
|
}, []);
|
|
24
28
|
useEffect(() => {
|
|
29
|
+
var _a;
|
|
25
30
|
const preventRender = true;
|
|
26
|
-
if (props.data && (props.data !==
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
if (props.data && (props.data !== dataRef.current)) {
|
|
32
|
+
(_a = chartRef.current) === null || _a === void 0 ? void 0 : _a.setData(props.data, preventRender);
|
|
33
|
+
dataRef.current = props.data;
|
|
34
|
+
}
|
|
35
|
+
if (!arePropsEqual(prevPropsRef.current, props)) {
|
|
36
|
+
prevPropsRef.current = props;
|
|
37
|
+
if (animationFrameRef.current)
|
|
38
|
+
cancelAnimationFrame(animationFrameRef.current);
|
|
39
|
+
animationFrameRef.current = requestAnimationFrame(() => {
|
|
40
|
+
var _a;
|
|
41
|
+
(_a = chartRef.current) === null || _a === void 0 ? void 0 : _a.updateContainer(getConfig());
|
|
42
|
+
});
|
|
29
43
|
}
|
|
30
|
-
if (animationFrameRef.current)
|
|
31
|
-
cancelAnimationFrame(animationFrameRef.current);
|
|
32
|
-
animationFrameRef.current = requestAnimationFrame(() => chart === null || chart === void 0 ? void 0 : chart.updateContainer(getConfig()));
|
|
33
44
|
});
|
|
34
45
|
return (React.createElement("div", { ref: container, style: { width: '100%', height: '100%', position: 'relative' } }, props.children));
|
|
35
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/containers/single-container/index.tsx"],"sourcesContent":["// eslint-disable-next-line no-use-before-define\nimport React, { ReactNode, useEffect, useRef, useState, PropsWithChildren } from 'react'\nimport { SingleContainer, SingleContainerConfigInterface, ComponentCore, Tooltip } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisSingleContainerProps<Data> = SingleContainerConfigInterface<Data> & {\n data?: Data;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisSingleContainerFC<Data> (props: PropsWithChildren<VisSingleContainerProps<Data>>): JSX.Element {\n const container = useRef<HTMLDivElement>(null)\n const
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/containers/single-container/index.tsx"],"sourcesContent":["// eslint-disable-next-line no-use-before-define\nimport React, { ReactNode, useEffect, useRef, useState, PropsWithChildren } from 'react'\nimport { SingleContainer, SingleContainerConfigInterface, ComponentCore, Tooltip } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisSingleContainerProps<Data> = SingleContainerConfigInterface<Data> & {\n data?: Data;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction VisSingleContainerFC<Data> (props: PropsWithChildren<VisSingleContainerProps<Data>>): JSX.Element {\n const container = useRef<HTMLDivElement>(null)\n const prevPropsRef = useRef<PropsWithChildren<VisSingleContainerProps<Data>>>({})\n const chartRef = useRef<SingleContainer<Data> | undefined>(undefined)\n const dataRef = useRef<Data | undefined>(undefined)\n const animationFrameRef = useRef<number | null>(null)\n\n const getConfig = (): SingleContainerConfigInterface<Data> => ({\n ...props,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n component: container.current?.querySelector<VisComponentElement<ComponentCore<Data>>>('vis-component')?.__component__,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n tooltip: container.current?.querySelector<VisComponentElement<Tooltip>>('vis-tooltip')?.__component__,\n })\n\n // On Mount\n useEffect(() => {\n const c = new SingleContainer<Data>(container.current as HTMLDivElement, getConfig(), props.data)\n chartRef.current = c\n dataRef.current = props.data\n\n return () => {\n if (animationFrameRef.current) {\n cancelAnimationFrame(animationFrameRef.current)\n animationFrameRef.current = null\n prevPropsRef.current = {}\n }\n c.destroy()\n }\n }, [])\n\n // On Props Update\n useEffect(() => {\n const preventRender = true\n\n // Set new Data without re-render\n if (props.data && (props.data !== dataRef.current)) {\n chartRef.current?.setData(props.data, preventRender)\n dataRef.current = props.data\n }\n\n // Update and render\n // ! Experimental: we use `requestAnimationFrame` to make the wrapper compatible with React 18 Strict Mode.\n // React 18 in Strict Mode renders components twice. At the same time, this container will get updated only after\n // the first render of its children (VisSankey, VisGraph, ...) meaning that their wrong instances (the ones\n // that will be destroyed soon) are stored in the `__component__` property of their elements at that moment.\n // So we delay the container update with `requestAnimationFrame` to wait till the new instances of children\n // components are available at `__component__`.\n if (!arePropsEqual(prevPropsRef.current, props)) { // Checking whether the props have changed do avoid multiple renders\n prevPropsRef.current = props\n if (animationFrameRef.current) cancelAnimationFrame(animationFrameRef.current)\n animationFrameRef.current = requestAnimationFrame(() => {\n chartRef.current?.updateContainer(getConfig())\n })\n }\n })\n\n return (\n <div ref={container} style={{ width: '100%', height: '100%', position: 'relative' }}>\n {props.children}\n </div>\n )\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 VisSingleContainer: (<Data>(props: PropsWithChildren<VisSingleContainerProps<Data>>) => JSX.Element | null) =\n React.memo(VisSingleContainerFC, arePropsEqual)\n"],"names":[],"mappings":";;;;AAeA,SAAS,oBAAoB,CAAQ,KAAuD,EAAA;AAC1F,IAAA,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAA;AAC9C,IAAA,MAAM,YAAY,GAAG,MAAM,CAAmD,EAAE,CAAC,CAAA;AACjF,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAoC,SAAS,CAAC,CAAA;AACrE,IAAA,MAAM,OAAO,GAAG,MAAM,CAAmB,SAAS,CAAC,CAAA;AACnD,IAAA,MAAM,iBAAiB,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAA;IAErD,MAAM,SAAS,GAAG,MAA2C;;AAAC,QAAA,QACzD,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,KAAK,CAER,EAAA,EAAA,SAAS,EAAE,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,SAAS,CAAC,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,aAAa,CAA2C,eAAe,CAAC,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,KAAK,CAAC,IAAI,EAAE,aAAa,CAAC,CAAA;AACpD,YAAA,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,IAAI,CAAA;AAC7B,SAAA;QASD,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;AAC/C,YAAA,YAAY,CAAC,OAAO,GAAG,KAAK,CAAA;YAC5B,IAAI,iBAAiB,CAAC,OAAO;AAAE,gBAAA,oBAAoB,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAA;AAC9E,YAAA,iBAAiB,CAAC,OAAO,GAAG,qBAAqB,CAAC,MAAK;;gBACrD,CAAA,EAAA,GAAA,QAAQ,CAAC,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,eAAe,CAAC,SAAS,EAAE,CAAC,CAAA;AAChD,aAAC,CAAC,CAAA;AACH,SAAA;AACH,KAAC,CAAC,CAAA;IAEF,QACE,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,EAChF,EAAA,KAAK,CAAC,QAAQ,CACX,EACP;AACH,CAAC;AAIM,MAAM,kBAAkB,GAC7B,KAAK,CAAC,IAAI,CAAC,oBAAoB,EAAE,aAAa;;;;"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import React, { useRef,
|
|
1
|
+
import React, { useRef, useEffect } from 'react';
|
|
2
2
|
import { XYContainer, AxisType } from '@unovis/ts';
|
|
3
3
|
import { arePropsEqual } from '../../utils/react.js';
|
|
4
4
|
|
|
5
5
|
function VisXYContainerFC(props) {
|
|
6
6
|
const container = useRef(null);
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const prevPropsRef = useRef({});
|
|
8
|
+
const chartRef = useRef(undefined);
|
|
9
|
+
const dataRef = useRef(undefined);
|
|
9
10
|
const animationFrameRef = useRef(null);
|
|
10
11
|
const getConfig = () => {
|
|
11
12
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
@@ -20,24 +21,34 @@ function VisXYContainerFC(props) {
|
|
|
20
21
|
.find(c => c.config.type === AxisType.Y), margin: { top: 5, left: 5, right: 5, bottom: 5 } }, props));
|
|
21
22
|
};
|
|
22
23
|
useEffect(() => {
|
|
23
|
-
setData(props.data);
|
|
24
24
|
const c = new XYContainer(container.current, getConfig(), props.data);
|
|
25
|
-
|
|
25
|
+
chartRef.current = c;
|
|
26
|
+
dataRef.current = props.data;
|
|
26
27
|
return () => {
|
|
27
|
-
if (animationFrameRef.current)
|
|
28
|
+
if (animationFrameRef.current) {
|
|
28
29
|
cancelAnimationFrame(animationFrameRef.current);
|
|
30
|
+
animationFrameRef.current = null;
|
|
31
|
+
prevPropsRef.current = {};
|
|
32
|
+
}
|
|
29
33
|
c.destroy();
|
|
30
34
|
};
|
|
31
35
|
}, []);
|
|
32
36
|
useEffect(() => {
|
|
37
|
+
var _a;
|
|
33
38
|
const preventRender = true;
|
|
34
|
-
if (props.data && (props.data !==
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
if (props.data && (props.data !== dataRef.current)) {
|
|
40
|
+
(_a = chartRef.current) === null || _a === void 0 ? void 0 : _a.setData(props.data, preventRender);
|
|
41
|
+
dataRef.current = props.data;
|
|
42
|
+
}
|
|
43
|
+
if (!arePropsEqual(prevPropsRef.current, props)) {
|
|
44
|
+
prevPropsRef.current = props;
|
|
45
|
+
if (animationFrameRef.current)
|
|
46
|
+
cancelAnimationFrame(animationFrameRef.current);
|
|
47
|
+
animationFrameRef.current = requestAnimationFrame(() => {
|
|
48
|
+
var _a;
|
|
49
|
+
(_a = chartRef.current) === null || _a === void 0 ? void 0 : _a.updateContainer(getConfig());
|
|
50
|
+
});
|
|
37
51
|
}
|
|
38
|
-
if (animationFrameRef.current)
|
|
39
|
-
cancelAnimationFrame(animationFrameRef.current);
|
|
40
|
-
animationFrameRef.current = requestAnimationFrame(() => chart === null || chart === void 0 ? void 0 : chart.updateContainer(getConfig()));
|
|
41
52
|
});
|
|
42
53
|
return (React.createElement("div", { ref: container, className: props.className }, props.children));
|
|
43
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/containers/xy-container/index.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport React, { ReactNode, useEffect, useRef, useState, PropsWithChildren } from 'react'\nimport { XYContainer, XYContainerConfigInterface, XYComponentCore, Tooltip, Crosshair, Axis, AxisType } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisXYContainerProps<Datum> = XYContainerConfigInterface<Datum> & {\n data?: Datum[];\n className?: string;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function VisXYContainerFC<Datum> (props: PropsWithChildren<VisXYContainerProps<Datum>>): JSX.Element {\n const container = useRef<HTMLDivElement>(null)\n const
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/containers/xy-container/index.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport React, { ReactNode, useEffect, useRef, useState, PropsWithChildren } from 'react'\nimport { XYContainer, XYContainerConfigInterface, XYComponentCore, Tooltip, Crosshair, Axis, AxisType } from '@unovis/ts'\n\n// Utils\nimport { arePropsEqual } from 'src/utils/react'\n\n// Types\nimport { VisComponentElement } from 'src/types/dom'\n\nexport type VisXYContainerProps<Datum> = XYContainerConfigInterface<Datum> & {\n data?: Datum[];\n className?: string;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function VisXYContainerFC<Datum> (props: PropsWithChildren<VisXYContainerProps<Datum>>): JSX.Element {\n const container = useRef<HTMLDivElement>(null)\n const prevPropsRef = useRef<PropsWithChildren<VisXYContainerProps<Datum>>>({})\n const chartRef = useRef<XYContainer<Datum> | undefined>(undefined)\n const dataRef = useRef<Datum[] | undefined>(undefined)\n const animationFrameRef = useRef<number | null>(null)\n\n const getConfig = (): XYContainerConfigInterface<Datum> => ({\n components: Array\n .from(container.current?.querySelectorAll<VisComponentElement<XYComponentCore<Datum>>>('vis-component') ?? [])\n .map(c => c.__component__),\n tooltip: container.current?.querySelector<VisComponentElement<Tooltip>>('vis-tooltip')?.__component__,\n crosshair: container.current?.querySelector<VisComponentElement<Crosshair<Datum>>>('vis-crosshair')?.__component__,\n xAxis: Array\n .from(container.current?.querySelectorAll<VisComponentElement<Axis<Datum>>>('vis-axis') ?? [])\n .map(c => c.__component__)\n .find(c => c.config.type === AxisType.X),\n yAxis: Array\n .from(container.current?.querySelectorAll<VisComponentElement<Axis<Datum>>>('vis-axis') ?? [])\n .map(c => c.__component__)\n .find(c => c.config.type === AxisType.Y),\n margin: { top: 5, left: 5, right: 5, bottom: 5 },\n ...props,\n })\n\n // On Mount\n useEffect(() => {\n const c = new XYContainer<Datum>(container.current as HTMLDivElement, getConfig(), props.data)\n chartRef.current = c\n dataRef.current = props.data\n\n return () => {\n if (animationFrameRef.current) {\n cancelAnimationFrame(animationFrameRef.current)\n animationFrameRef.current = null\n prevPropsRef.current = {}\n }\n c.destroy()\n }\n }, [])\n\n // On Props Update\n useEffect(() => {\n const preventRender = true\n\n // Set new Data without re-render\n if (props.data && (props.data !== dataRef.current)) {\n chartRef.current?.setData(props.data, preventRender)\n dataRef.current = props.data\n }\n\n // Update and render\n // ! Experimental: we use `requestAnimationFrame` to make the wrapper compatible with React 18 Strict Mode.\n // React 18 in Strict Mode renders components twice. At the same time, this container will get updated only after\n // the first render of its children (VisLine, VisArea, ...) meaning that their wrong instances (the ones\n // that will be destroyed soon) are stored in the `__component__` property of their elements at that moment.\n // So we delay the container update with `requestAnimationFrame` to wait till the new instances of children\n // components are available at `__component__`.\n if (!arePropsEqual(prevPropsRef.current, props)) { // Checking whether the props have changed do avoid multiple renders\n prevPropsRef.current = props\n if (animationFrameRef.current) cancelAnimationFrame(animationFrameRef.current)\n animationFrameRef.current = requestAnimationFrame(() => {\n chartRef.current?.updateContainer(getConfig())\n })\n }\n })\n\n return (\n <div ref={container} className={props.className}>\n {props.children}\n </div>\n )\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 VisXYContainer: (<Datum>(props: PropsWithChildren<VisXYContainerProps<Datum>>) => JSX.Element | null) =\n React.memo(VisXYContainerFC, arePropsEqual)\n"],"names":[],"mappings":";;;;AAgBM,SAAU,gBAAgB,CAAS,KAAoD,EAAA;AAC3F,IAAA,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAA;AAC9C,IAAA,MAAM,YAAY,GAAG,MAAM,CAAgD,EAAE,CAAC,CAAA;AAC9E,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAiC,SAAS,CAAC,CAAA;AAClE,IAAA,MAAM,OAAO,GAAG,MAAM,CAAsB,SAAS,CAAC,CAAA;AACtD,IAAA,MAAM,iBAAiB,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAA;IAErD,MAAM,SAAS,GAAG,MAAwC;;QAAC,QAAA,MAAA,CAAA,MAAA,CAAA,EACzD,UAAU,EAAE,KAAK;AACd,iBAAA,IAAI,CAAC,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,SAAS,CAAC,OAAO,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,gBAAgB,CAA8C,eAAe,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,EAAE,CAAC;AAC7G,iBAAA,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC,EAC5B,OAAO,EAAE,MAAA,CAAA,EAAA,GAAA,SAAS,CAAC,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,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AG,KAAK,CAAA;YAC5B,IAAI,iBAAiB,CAAC,OAAO;AAAE,gBAAA,oBAAoB,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAA;AAC9E,YAAA,iBAAiB,CAAC,OAAO,GAAG,qBAAqB,CAAC,MAAK;;gBACrD,CAAA,EAAA,GAAA,QAAQ,CAAC,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,eAAe,CAAC,SAAS,EAAE,CAAC,CAAA;AAChD,aAAC,CAAC,CAAA;AACH,SAAA;AACH,KAAC,CAAC,CAAA;AAEF,IAAA,QACE,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAC5C,EAAA,KAAK,CAAC,QAAQ,CACX,EACP;AACH,CAAC;AAIM,MAAM,cAAc,GACzB,KAAK,CAAC,IAAI,CAAC,gBAAgB,EAAE,aAAa;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unovis/react",
|
|
3
3
|
"description": "Modular data visualization framework for React, Angular, Svelte, and vanilla TypeScript or JavaScript",
|
|
4
|
-
"version": "1.0.3-beta.
|
|
4
|
+
"version": "1.0.3-beta.4",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/f5/unovis.git",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@emotion/css": "^11.7.1",
|
|
39
|
-
"@unovis/ts": "1.0.3-beta.
|
|
39
|
+
"@unovis/ts": "1.0.3-beta.4",
|
|
40
40
|
"react": ">=16.8.0 || ^17 || ^18",
|
|
41
41
|
"react-dom": ">=16.8.0 || ^17 || ^18"
|
|
42
42
|
},
|
package/utils/react.js
CHANGED
|
@@ -2,6 +2,7 @@ import { Children } from 'react';
|
|
|
2
2
|
import _isEqual from 'lodash-es/isEqual.js';
|
|
3
3
|
|
|
4
4
|
function arePropsEqual(prevProps, nextProps) {
|
|
5
|
+
var _a, _b;
|
|
5
6
|
if (typeof prevProps.children !== typeof nextProps.children)
|
|
6
7
|
return false;
|
|
7
8
|
if (prevProps.children && nextProps.children) {
|
|
@@ -10,7 +11,7 @@ function arePropsEqual(prevProps, nextProps) {
|
|
|
10
11
|
if (prevChildren.length !== nextChildren.length)
|
|
11
12
|
return false;
|
|
12
13
|
for (let i = 0; i < nextChildren.length; i += 1) {
|
|
13
|
-
if (!_isEqual(prevChildren[i].props, nextChildren[i].props))
|
|
14
|
+
if (!_isEqual((_a = prevChildren[i]) === null || _a === void 0 ? void 0 : _a.props, (_b = nextChildren[i]) === null || _b === void 0 ? void 0 : _b.props))
|
|
14
15
|
return false;
|
|
15
16
|
}
|
|
16
17
|
}
|
package/utils/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sources":["../../src/utils/react.ts"],"sourcesContent":["import { Children, ReactElement, ReactNode } from 'react'\nimport _isEqual from 'lodash-es/isEqual.js'\n\nexport function arePropsEqual<PropTypes extends { children?: ReactNode }> (prevProps: PropTypes, nextProps: PropTypes): boolean {\n if (typeof prevProps.children !== typeof nextProps.children) return false\n\n if (prevProps.children && nextProps.children) {\n const prevChildren = Children.toArray(prevProps.children) as ReactElement[]\n const nextChildren = Children.toArray(nextProps.children) as ReactElement[]\n if (prevChildren.length !== nextChildren.length) return false\n\n for (let i = 0; i < nextChildren.length; i += 1) {\n if (!_isEqual(prevChildren[i]
|
|
1
|
+
{"version":3,"file":"react.js","sources":["../../src/utils/react.ts"],"sourcesContent":["import { Children, ReactElement, ReactNode } from 'react'\nimport _isEqual from 'lodash-es/isEqual.js'\n\nexport function arePropsEqual<PropTypes extends { children?: ReactNode }> (prevProps: PropTypes, nextProps: PropTypes): boolean {\n if (typeof prevProps.children !== typeof nextProps.children) return false\n\n if (prevProps.children && nextProps.children) {\n const prevChildren = Children.toArray(prevProps.children) as ReactElement[]\n const nextChildren = Children.toArray(nextProps.children) as ReactElement[]\n if (prevChildren.length !== nextChildren.length) return false\n\n for (let i = 0; i < nextChildren.length; i += 1) {\n if (!_isEqual(prevChildren[i]?.props, nextChildren[i]?.props)) return false\n }\n }\n\n const propKeys = Array.from(new Set([...Object.keys(prevProps), ...Object.keys(nextProps)])) as (keyof PropTypes)[]\n for (const key of propKeys) {\n if (key === 'children') continue\n if (!(_isEqual(prevProps[key], nextProps[key]))) return false\n }\n\n return true\n}\n"],"names":[],"mappings":";;;AAGgB,SAAA,aAAa,CAA8C,SAAoB,EAAE,SAAoB,EAAA;;IACnH,IAAI,OAAO,SAAS,CAAC,QAAQ,KAAK,OAAO,SAAS,CAAC,QAAQ;AAAE,QAAA,OAAO,KAAK,CAAA;AAEzE,IAAA,IAAI,SAAS,CAAC,QAAQ,IAAI,SAAS,CAAC,QAAQ,EAAE;QAC5C,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAmB,CAAA;QAC3E,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAmB,CAAA;AAC3E,QAAA,IAAI,YAAY,CAAC,MAAM,KAAK,YAAY,CAAC,MAAM;AAAE,YAAA,OAAO,KAAK,CAAA;AAE7D,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;AAC/C,YAAA,IAAI,CAAC,QAAQ,CAAC,MAAA,YAAY,CAAC,CAAC,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,KAAK,EAAE,MAAA,YAAY,CAAC,CAAC,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,C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