@visactor/react-vchart 1.9.3 → 1.10.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/cjs/charts/BaseChart.js +28 -21
  2. package/cjs/charts/BaseChart.js.map +1 -1
  3. package/cjs/components/BaseComponent.d.ts +1 -0
  4. package/cjs/components/BaseComponent.js +9 -35
  5. package/cjs/components/BaseComponent.js.map +1 -1
  6. package/cjs/components/Mark.d.ts +4 -14
  7. package/cjs/components/Mark.js +2 -61
  8. package/cjs/components/Mark.js.map +1 -1
  9. package/cjs/context/chart.d.ts +0 -1
  10. package/cjs/context/chart.js.map +1 -1
  11. package/cjs/index.d.ts +1 -1
  12. package/cjs/index.js +1 -1
  13. package/cjs/index.js.map +1 -1
  14. package/cjs/series/Area.d.ts +1 -0
  15. package/cjs/series/Bar.d.ts +1 -0
  16. package/cjs/series/BaseSeries.d.ts +1 -0
  17. package/cjs/series/BaseSeries.js +22 -49
  18. package/cjs/series/BaseSeries.js.map +1 -1
  19. package/cjs/series/BoxPlot.d.ts +1 -0
  20. package/cjs/series/CircularProgress.d.ts +1 -0
  21. package/cjs/series/Dot.d.ts +1 -0
  22. package/cjs/series/Funnel.d.ts +1 -0
  23. package/cjs/series/Line.d.ts +1 -0
  24. package/cjs/series/LinearProgress.d.ts +1 -0
  25. package/cjs/series/Link.d.ts +1 -0
  26. package/cjs/series/Map.d.ts +1 -0
  27. package/cjs/series/Pie.d.ts +1 -0
  28. package/cjs/series/Radar.d.ts +1 -0
  29. package/cjs/series/RangeColumn.d.ts +1 -0
  30. package/cjs/series/Rose.d.ts +1 -0
  31. package/cjs/series/Scatter.d.ts +1 -0
  32. package/cjs/series/Series.d.ts +1 -0
  33. package/cjs/series/WordCloud.d.ts +1 -0
  34. package/esm/charts/BaseChart.js +27 -21
  35. package/esm/charts/BaseChart.js.map +1 -1
  36. package/esm/components/BaseComponent.d.ts +1 -0
  37. package/esm/components/BaseComponent.js +9 -36
  38. package/esm/components/BaseComponent.js.map +1 -1
  39. package/esm/components/Mark.d.ts +4 -14
  40. package/esm/components/Mark.js +2 -39
  41. package/esm/components/Mark.js.map +1 -1
  42. package/esm/context/chart.d.ts +0 -1
  43. package/esm/context/chart.js.map +1 -1
  44. package/esm/index.d.ts +1 -1
  45. package/esm/index.js +1 -1
  46. package/esm/index.js.map +1 -1
  47. package/esm/series/Area.d.ts +1 -0
  48. package/esm/series/Bar.d.ts +1 -0
  49. package/esm/series/BaseSeries.d.ts +1 -0
  50. package/esm/series/BaseSeries.js +22 -50
  51. package/esm/series/BaseSeries.js.map +1 -1
  52. package/esm/series/BoxPlot.d.ts +1 -0
  53. package/esm/series/CircularProgress.d.ts +1 -0
  54. package/esm/series/Dot.d.ts +1 -0
  55. package/esm/series/Funnel.d.ts +1 -0
  56. package/esm/series/Line.d.ts +1 -0
  57. package/esm/series/LinearProgress.d.ts +1 -0
  58. package/esm/series/Link.d.ts +1 -0
  59. package/esm/series/Map.d.ts +1 -0
  60. package/esm/series/Pie.d.ts +1 -0
  61. package/esm/series/Radar.d.ts +1 -0
  62. package/esm/series/RangeColumn.d.ts +1 -0
  63. package/esm/series/Rose.d.ts +1 -0
  64. package/esm/series/Scatter.d.ts +1 -0
  65. package/esm/series/Series.d.ts +1 -0
  66. package/esm/series/WordCloud.d.ts +1 -0
  67. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/series/BaseSeries.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,gBAAgB,MAAM,kBAAkB,CAAC;AAChD,OAAO,EACL,sBAAsB,EAEtB,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAM9B,M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AAO,GAAG,KAAK,CAAC,QAAQ,CAAC;SACnC;aAAM;YACL,MAAM,aAAa,GAAG,WAAW,CAAI,KAAK,EAAE,WAAW,CAAC,CAAC;YAEzD,SAAS,CAAC,aAAa,CAAC,CAAC;YACzB,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE;gBAC/C,UAAU,CAAC,OAAO,GAAG,aAAa,CAAC;gBACnC,eAAe,CAAC,aAAa,CAAC,CAAC;aAChC;SACF;QAED,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;YACnB,OAAO,GAAG,EAAE;gBACV,eAAe,EAAE,CAAC;gBAClB,eAAe,EAAE,CAAC;YACpB,CAAC,CAAC;QACJ,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IAEF,IAAI,CAAC,WAAW,GAAG,aAAa,CAAC;IACjC,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","file":"BaseSeries.js","sourcesContent":["import React from 'react';\nimport { isNil, isEqual, pickWithout } from '@visactor/vutils';\nimport RootChartContext from '../context/chart';\nimport {\n REACT_TO_VCHART_EVENTS,\n EventsProps,\n findEventProps,\n COMMON_EVENTK_KEYS,\n VCHART_TO_REACT_EVENTS\n} from '../eventsUtils';\nimport { uid } from '../util';\n\nexport interface BaseSeriesProps extends EventsProps {\n id?: string | number;\n}\n\nexport const createSeries = <T extends BaseSeriesProps>(componentName: string, markNames: string[], type?: string) => {\n const ignoreKeys = ['id', 'updateId'];\n const notSpecKeys = COMMON_EVENTK_KEYS.concat(ignoreKeys);\n\n const Comp: React.FC<T & { updateId?: number }> = props => {\n const context = React.useContext(RootChartContext);\n\n const id = React.useRef<string | number>(isNil(props.id) ? uid(type ?? 'series') : props.id);\n\n const seriesSpec = React.useRef<Partial<T>>();\n const bindedEvents = React.useRef<Record<string, boolean>>({});\n const updateId = React.useRef<number>(props.updateId);\n\n const handleEvent = (e: any) => {\n const markIds = markNames.map(markName => `${id.current}-${markName}`);\n if (e?.mark && markIds.includes(e.mark.getUserId())) {\n props[VCHART_TO_REACT_EVENTS[e.event.type]](e);\n }\n };\n\n const addMarkEvent = (events: EventsProps) => {\n if (!events || !context.chart) {\n return;\n }\n\n if (bindedEvents) {\n Object.keys(bindedEvents).forEach(eventKey => {\n if (!events[eventKey]) {\n context.chart.off(REACT_TO_VCHART_EVENTS[eventKey], handleEvent);\n }\n bindedEvents.current[eventKey] = false;\n });\n }\n\n Object.keys(events).forEach(eventKey => {\n if (!bindedEvents?.[eventKey]) {\n context.chart.on(REACT_TO_VCHART_EVENTS[eventKey], handleEvent);\n\n if (!bindedEvents) {\n bindedEvents.current = {};\n }\n bindedEvents.current[eventKey] = true;\n }\n });\n };\n\n const removeMarkEvent = () => {\n addMarkEvent({});\n };\n\n const addMarkId = (spec: any) => {\n markNames.forEach(markName => {\n const defaultMarkId = `${id.current}-${markName}`;\n\n if (isNil(spec[markName])) {\n spec[markName] = { id: defaultMarkId };\n } else if (isNil(spec[markName].id)) {\n spec[markName].id = defaultMarkId;\n }\n });\n };\n\n const insertToContext = (props: Partial<T>) => {\n if (context.specFromChildren) {\n if (!context.specFromChildren.series) {\n context.specFromChildren.series = [];\n }\n\n const spec = isNil(type) ? { ...props, id: id.current } : { ...props, id: id.current, type };\n\n addMarkId(spec);\n context.specFromChildren.series.push(spec);\n context.isChildrenUpdated = true;\n }\n };\n\n const updateToContext = (props: Partial<T>) => {\n if (!context.specFromChildren) {\n return;\n }\n\n if (!context.specFromChildren.series) {\n insertToContext(props);\n return;\n }\n\n const series = context.specFromChildren.series;\n const index = series.findIndex((entry: any) => entry.id === id.current);\n\n if (index >= 0) {\n series[index] = isNil(type) ? { ...props, id: id.current } : { ...props, id: id.current, type };\n addMarkId(series[index]);\n } else {\n insertToContext(props);\n }\n context.isChildrenUpdated = true;\n };\n\n const deleteToContext = () => {\n if (!context.specFromChildren) {\n return;\n }\n const series = context.specFromChildren.series ?? [];\n const index = series.findIndex((entry: any) => entry.id === id.current);\n\n if (index >= 0) {\n const newSeries = series.slice(0, index - 1).concat(series.slice(index + 1));\n context.specFromChildren.series = newSeries;\n context.isChildrenUpdated = true;\n }\n };\n\n addMarkEvent(findEventProps(props));\n if (props.updateId !== updateId.current) {\n // chart render\n updateId.current = props.updateId;\n } else {\n const newSeriesSpec = pickWithout<T>(props, notSpecKeys);\n\n addMarkId(newSeriesSpec);\n if (!isEqual(newSeriesSpec, seriesSpec.current)) {\n seriesSpec.current = newSeriesSpec;\n updateToContext(newSeriesSpec);\n }\n }\n\n React.useEffect(() => {\n return () => {\n deleteToContext();\n removeMarkEvent();\n };\n }, []);\n\n return null;\n };\n\n Comp.displayName = componentName;\n return Comp;\n};\n"]}
1
+ {"version":3,"sources":["../src/series/BaseSeries.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,gBAAgB,MAAM,kBAAkB,CAAC;AAChD,OAAO,EACL,sBAAsB,EAEtB,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AAKxB,MAAM,CAAC,MAAM,YAAY,GAAG,CAA4B,aAAqB,EAAE,SAAmB,EAAE,IAAa,EAAE,EAAE;IACnH,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;IACrD,MAAM,WAAW,GAAG,kBAAkB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAE1D,MAAM,SAAS,GAAG,CAAC,IAAS,EAAE,QAAyB,EAAE,EAAE;QACzD,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC3B,MAAM,aAAa,GAAG,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC;YAEhD,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE;gBACzB,IAAI,CAAC,QA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EAAE,mCAAI,SAAS,CAAC,WAAW,CAAC,CAAC;QAEhE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;YACf,aAAqB,CAAC,IAAI,GAAG,IAAI,CAAC;SACpC;QAED,OAAO;YACL,IAAI,EAAE,aAAa;YACnB,QAAQ,EAAE,QAAQ;SACnB,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","file":"BaseSeries.js","sourcesContent":["import React from 'react';\nimport { isNil, pickWithout } from '@visactor/vutils';\nimport RootChartContext from '../context/chart';\nimport {\n REACT_TO_VCHART_EVENTS,\n EventsProps,\n findEventProps,\n COMMON_EVENTK_KEYS,\n VCHART_TO_REACT_EVENTS\n} from '../eventsUtils';\nexport interface BaseSeriesProps extends EventsProps {\n id?: string | number;\n}\n\nexport const createSeries = <T extends BaseSeriesProps>(componentName: string, markNames: string[], type?: string) => {\n const ignoreKeys = ['id', 'updateId', 'componentId'];\n const notSpecKeys = COMMON_EVENTK_KEYS.concat(ignoreKeys);\n\n const addMarkId = (spec: any, seriesId: string | number) => {\n markNames.forEach(markName => {\n const defaultMarkId = `${seriesId}-${markName}`;\n\n if (isNil(spec[markName])) {\n spec[markName] = { id: defaultMarkId };\n } else if (isNil(spec[markName].id)) {\n spec[markName].id = defaultMarkId;\n }\n });\n };\n\n const Comp: React.FC<T & { updateId?: number; componentId?: string }> = props => {\n const context = React.useContext(RootChartContext);\n\n const id = props.id ?? props.componentId;\n const bindedEvents = React.useRef<Record<string, boolean>>({});\n\n const handleEvent = (e: any) => {\n const markIds = markNames.map(markName => `${id}-${markName}`);\n if (e?.mark && markIds.includes(e.mark.getUserId())) {\n props[VCHART_TO_REACT_EVENTS[e.event.type]](e);\n }\n };\n\n const addMarkEvent = (events: EventsProps) => {\n if (!events || !context.chart) {\n return;\n }\n\n if (bindedEvents) {\n Object.keys(bindedEvents).forEach(eventKey => {\n if (!events[eventKey]) {\n context.chart.off(REACT_TO_VCHART_EVENTS[eventKey], handleEvent);\n }\n bindedEvents.current[eventKey] = false;\n });\n }\n\n Object.keys(events).forEach(eventKey => {\n if (!bindedEvents?.[eventKey]) {\n context.chart.on(REACT_TO_VCHART_EVENTS[eventKey], handleEvent);\n\n if (!bindedEvents) {\n bindedEvents.current = {};\n }\n bindedEvents.current[eventKey] = true;\n }\n });\n };\n\n const removeMarkEvent = () => {\n addMarkEvent({});\n };\n\n addMarkEvent(findEventProps(props));\n\n React.useEffect(() => {\n return () => {\n removeMarkEvent();\n bindedEvents.current = {};\n };\n }, []);\n\n return null;\n };\n\n Comp.displayName = componentName;\n (Comp as any).parseSpec = (compProps: T & { updateId?: number; componentId?: string }) => {\n const newSeriesSpec = pickWithout<T>(compProps, notSpecKeys);\n\n addMarkId(newSeriesSpec, compProps.id ?? compProps.componentId);\n\n if (!isNil(type)) {\n (newSeriesSpec as any).type = type;\n }\n\n return {\n spec: newSeriesSpec,\n specName: 'series'\n };\n };\n return Comp;\n};\n"]}
@@ -3,4 +3,5 @@ import type { IBoxPlotSeriesSpec } from '@visactor/vchart';
3
3
  export type BoxPlotProps = BaseSeriesProps & Omit<IBoxPlotSeriesSpec, 'type'>;
4
4
  export declare const BoxPlot: import("react").FC<BaseSeriesProps & Omit<IBoxPlotSeriesSpec, "type"> & {
5
5
  updateId?: number;
6
+ componentId?: string;
6
7
  }>;
@@ -3,4 +3,5 @@ import type { ICircularProgressSeriesSpec } from '@visactor/vchart';
3
3
  export type CircularProgressProps = BaseSeriesProps & Omit<ICircularProgressSeriesSpec, 'type'>;
4
4
  export declare const CircularProgress: import("react").FC<BaseSeriesProps & Omit<ICircularProgressSeriesSpec, "type"> & {
5
5
  updateId?: number;
6
+ componentId?: string;
6
7
  }>;
@@ -3,4 +3,5 @@ import type { IDotSeriesSpec } from '@visactor/vchart';
3
3
  export type DotProps = BaseSeriesProps & Omit<IDotSeriesSpec, 'type'>;
4
4
  export declare const Dot: import("react").FC<BaseSeriesProps & Omit<IDotSeriesSpec, "type"> & {
5
5
  updateId?: number;
6
+ componentId?: string;
6
7
  }>;
@@ -3,4 +3,5 @@ import type { IFunnelSeriesSpec } from '@visactor/vchart';
3
3
  export type FunnelProps = BaseSeriesProps & Omit<IFunnelSeriesSpec, 'type'>;
4
4
  export declare const Funnel: import("react").FC<BaseSeriesProps & Omit<IFunnelSeriesSpec, "type"> & {
5
5
  updateId?: number;
6
+ componentId?: string;
6
7
  }>;
@@ -3,4 +3,5 @@ import type { ILineSeriesSpec } from '@visactor/vchart';
3
3
  export type LineProps = BaseSeriesProps & Omit<ILineSeriesSpec, 'type'>;
4
4
  export declare const Line: import("react").FC<BaseSeriesProps & Omit<ILineSeriesSpec, "type"> & {
5
5
  updateId?: number;
6
+ componentId?: string;
6
7
  }>;
@@ -3,4 +3,5 @@ import type { ILinearProgressSeriesSpec } from '@visactor/vchart';
3
3
  export type LinearProgressProps = BaseSeriesProps & Omit<ILinearProgressSeriesSpec, 'type'>;
4
4
  export declare const LinearProgress: import("react").FC<BaseSeriesProps & Omit<ILinearProgressSeriesSpec, "type"> & {
5
5
  updateId?: number;
6
+ componentId?: string;
6
7
  }>;
@@ -3,4 +3,5 @@ import type { ILinkSeriesSpec } from '@visactor/vchart';
3
3
  export type LinkProps = BaseSeriesProps & Omit<ILinkSeriesSpec, 'type'>;
4
4
  export declare const Link: import("react").FC<BaseSeriesProps & Omit<ILinkSeriesSpec, "type"> & {
5
5
  updateId?: number;
6
+ componentId?: string;
6
7
  }>;
@@ -3,4 +3,5 @@ import type { IMapSeriesSpec } from '@visactor/vchart';
3
3
  export type MapProps = BaseSeriesProps & Omit<IMapSeriesSpec, 'type'>;
4
4
  export declare const Map: import("react").FC<BaseSeriesProps & Omit<IMapSeriesSpec, "type"> & {
5
5
  updateId?: number;
6
+ componentId?: string;
6
7
  }>;
@@ -3,4 +3,5 @@ import type { IPieSeriesSpec } from '@visactor/vchart';
3
3
  export type PieProps = BaseSeriesProps & Omit<IPieSeriesSpec, 'type'>;
4
4
  export declare const Pie: import("react").FC<BaseSeriesProps & Omit<IPieSeriesSpec, "type"> & {
5
5
  updateId?: number;
6
+ componentId?: string;
6
7
  }>;
@@ -3,4 +3,5 @@ import type { IRadarSeriesSpec } from '@visactor/vchart';
3
3
  export type RadarProps = BaseSeriesProps & Omit<IRadarSeriesSpec, 'type'>;
4
4
  export declare const Radar: import("react").FC<BaseSeriesProps & Omit<IRadarSeriesSpec, "type"> & {
5
5
  updateId?: number;
6
+ componentId?: string;
6
7
  }>;
@@ -3,4 +3,5 @@ import type { IRangeColumnSeriesSpec } from '@visactor/vchart';
3
3
  export type RangeColumnProps = BaseSeriesProps & Omit<IRangeColumnSeriesSpec, 'type'>;
4
4
  export declare const RangeColumn: import("react").FC<BaseSeriesProps & Omit<IRangeColumnSeriesSpec, "type"> & {
5
5
  updateId?: number;
6
+ componentId?: string;
6
7
  }>;
@@ -3,4 +3,5 @@ import type { IRoseSeriesSpec } from '@visactor/vchart';
3
3
  export type RoseProps = BaseSeriesProps & Omit<IRoseSeriesSpec, 'type'>;
4
4
  export declare const Rose: import("react").FC<BaseSeriesProps & Omit<IRoseSeriesSpec, "type"> & {
5
5
  updateId?: number;
6
+ componentId?: string;
6
7
  }>;
@@ -3,4 +3,5 @@ import type { IScatterSeriesSpec } from '@visactor/vchart';
3
3
  export type ScatterProps = BaseSeriesProps & Omit<IScatterSeriesSpec, 'type'>;
4
4
  export declare const Scatter: import("react").FC<BaseSeriesProps & Omit<IScatterSeriesSpec, "type"> & {
5
5
  updateId?: number;
6
+ componentId?: string;
6
7
  }>;
@@ -3,4 +3,5 @@ import type { IBarSeriesSpec, IAreaSeriesSpec, IBoxPlotSeriesSpec, ICircularProg
3
3
  export type SeriesProps = (IBarSeriesSpec | IAreaSeriesSpec | IBoxPlotSeriesSpec | ICircularProgressSeriesSpec | IDotSeriesSpec | IFunnelSeriesSpec | ILineSeriesSpec | ILinearProgressSeriesSpec | ILinkSeriesSpec | IMapSeriesSpec | IPieSeriesSpec | IRadarSeriesSpec | IRangeColumnSeriesSpec | IRoseSeriesSpec | IScatterSeriesSpec | IWordCloudSeriesSpec) & BaseSeriesProps;
4
4
  export declare const Series: import("react").FC<SeriesProps & {
5
5
  updateId?: number;
6
+ componentId?: string;
6
7
  }>;
@@ -3,4 +3,5 @@ import type { IWordCloudSeriesSpec } from '@visactor/vchart';
3
3
  export type WordCloudProps = BaseSeriesProps & Omit<IWordCloudSeriesSpec, 'type'>;
4
4
  export declare const WordCloud: import("react").FC<BaseSeriesProps & Omit<IWordCloudSeriesSpec, "type"> & {
5
5
  updateId?: number;
6
+ componentId?: string;
6
7
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/react-vchart",
3
- "version": "1.9.3",
3
+ "version": "1.10.0-alpha.1",
4
4
  "sideEffects": false,
5
5
  "description": "The react version of VChart 4.x",
6
6
  "keywords": [
@@ -23,10 +23,10 @@
23
23
  "dist"
24
24
  ],
25
25
  "dependencies": {
26
- "@visactor/vchart": "1.9.3",
26
+ "@visactor/vchart": "1.10.0-alpha.1",
27
27
  "@visactor/vutils": "~0.17.4",
28
- "@visactor/vrender-core": "0.17.24",
29
- "@visactor/vrender-kits": "0.17.24",
28
+ "@visactor/vrender-core": "0.17.25-alpha.3",
29
+ "@visactor/vrender-kits": "0.17.25-alpha.3",
30
30
  "@visactor/vgrammar-core": "0.11.12",
31
31
  "react-is": "^18.2.0"
32
32
  },
@@ -54,9 +54,9 @@
54
54
  "@types/node": "*",
55
55
  "@vitejs/plugin-react": "3.1.0",
56
56
  "vite": "3.2.6",
57
+ "@internal/ts-config": "0.0.1",
57
58
  "@internal/bundler": "0.0.1",
58
- "@internal/eslint-config": "0.0.1",
59
- "@internal/ts-config": "0.0.1"
59
+ "@internal/eslint-config": "0.0.1"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "react": ">=16.0.0",