@tradingaction/core 2.0.12 → 2.0.13

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 (57) hide show
  1. package/LICENSE +24 -24
  2. package/README.md +5 -5
  3. package/lib/CanvasContainer.d.ts +19 -19
  4. package/lib/CanvasContainer.js +27 -27
  5. package/lib/Chart.d.ts +32 -32
  6. package/lib/Chart.js +56 -56
  7. package/lib/Chart.js.map +1 -1
  8. package/lib/ChartCanvas.d.ts +235 -235
  9. package/lib/ChartCanvas.js +770 -770
  10. package/lib/ChartCanvas.js.map +1 -1
  11. package/lib/EventCapture.d.ts +131 -131
  12. package/lib/EventCapture.js +488 -488
  13. package/lib/GenericChartComponent.d.ts +21 -21
  14. package/lib/GenericChartComponent.js +74 -74
  15. package/lib/GenericComponent.d.ts +81 -81
  16. package/lib/GenericComponent.js +354 -354
  17. package/lib/GenericComponent.js.map +1 -1
  18. package/lib/MoreProps.d.ts +16 -16
  19. package/lib/MoreProps.js +1 -1
  20. package/lib/index.d.ts +7 -7
  21. package/lib/index.js +7 -7
  22. package/lib/useEvent.d.ts +1 -1
  23. package/lib/useEvent.js +12 -12
  24. package/lib/utils/ChartDataUtil.d.ts +49 -49
  25. package/lib/utils/ChartDataUtil.js +204 -204
  26. package/lib/utils/PureComponent.d.ts +4 -4
  27. package/lib/utils/PureComponent.js +9 -9
  28. package/lib/utils/accumulatingWindow.d.ts +15 -15
  29. package/lib/utils/accumulatingWindow.js +97 -97
  30. package/lib/utils/barWidth.d.ts +15 -15
  31. package/lib/utils/barWidth.js +26 -26
  32. package/lib/utils/closestItem.d.ts +5 -5
  33. package/lib/utils/closestItem.js +44 -44
  34. package/lib/utils/evaluator.d.ts +7 -7
  35. package/lib/utils/evaluator.js +93 -93
  36. package/lib/utils/identity.d.ts +1 -1
  37. package/lib/utils/identity.js +1 -1
  38. package/lib/utils/index.d.ts +46 -46
  39. package/lib/utils/index.js +125 -125
  40. package/lib/utils/noop.d.ts +1 -1
  41. package/lib/utils/noop.js +2 -2
  42. package/lib/utils/shallowEqual.d.ts +1 -1
  43. package/lib/utils/shallowEqual.js +21 -21
  44. package/lib/utils/slidingWindow.d.ts +19 -19
  45. package/lib/utils/slidingWindow.js +108 -108
  46. package/lib/utils/strokeDasharray.d.ts +3 -3
  47. package/lib/utils/strokeDasharray.js +36 -36
  48. package/lib/utils/zipper.d.ts +7 -7
  49. package/lib/utils/zipper.js +35 -35
  50. package/lib/zoom/index.d.ts +1 -1
  51. package/lib/zoom/index.js +1 -1
  52. package/lib/zoom/zoomBehavior.d.ts +10 -10
  53. package/lib/zoom/zoomBehavior.js +17 -17
  54. package/package.json +2 -2
  55. package/src/Chart.tsx +2 -2
  56. package/src/ChartCanvas.tsx +1 -1
  57. package/src/GenericComponent.tsx +1 -0
@@ -1,36 +1,36 @@
1
- /* an extension to d3.zip so we call a function instead of an array */
2
- import { min } from "d3-array";
3
- import { identity } from "./identity";
4
- export default function zipper() {
5
- let combine = identity;
6
- function zip() {
7
- var _a;
8
- const n = arguments.length;
9
- if (n === 0) {
10
- return [];
11
- }
12
- const m = (_a = min(arguments, d3_zipLength)) !== null && _a !== void 0 ? _a : 0;
13
- const zips = new Array(m);
14
- for (let i = -1; ++i < m;) {
15
- // tslint:disable-next-line: no-shadowed-variable
16
- for (let j = -1, zip = (zips[i] = new Array(n)); ++j < n;) {
17
- zip[j] = arguments[j][i];
18
- }
19
- // @ts-ignore
20
- zips[i] = combine.apply(this, zips[i]);
21
- }
22
- return zips;
23
- }
24
- function d3_zipLength(d) {
25
- return d.length;
26
- }
27
- zip.combine = function (x) {
28
- if (!arguments.length) {
29
- return combine;
30
- }
31
- combine = x;
32
- return zip;
33
- };
34
- return zip;
35
- }
1
+ /* an extension to d3.zip so we call a function instead of an array */
2
+ import { min } from "d3-array";
3
+ import { identity } from "./identity";
4
+ export default function zipper() {
5
+ let combine = identity;
6
+ function zip() {
7
+ var _a;
8
+ const n = arguments.length;
9
+ if (n === 0) {
10
+ return [];
11
+ }
12
+ const m = (_a = min(arguments, d3_zipLength)) !== null && _a !== void 0 ? _a : 0;
13
+ const zips = new Array(m);
14
+ for (let i = -1; ++i < m;) {
15
+ // tslint:disable-next-line: no-shadowed-variable
16
+ for (let j = -1, zip = (zips[i] = new Array(n)); ++j < n;) {
17
+ zip[j] = arguments[j][i];
18
+ }
19
+ // @ts-ignore
20
+ zips[i] = combine.apply(this, zips[i]);
21
+ }
22
+ return zips;
23
+ }
24
+ function d3_zipLength(d) {
25
+ return d.length;
26
+ }
27
+ zip.combine = function (x) {
28
+ if (!arguments.length) {
29
+ return combine;
30
+ }
31
+ combine = x;
32
+ return zip;
33
+ };
34
+ return zip;
35
+ }
36
36
  //# sourceMappingURL=zipper.js.map
@@ -1 +1 @@
1
- export * from "./zoomBehavior";
1
+ export * from "./zoomBehavior";
package/lib/zoom/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./zoomBehavior";
1
+ export * from "./zoomBehavior";
2
2
  //# sourceMappingURL=index.js.map
@@ -1,10 +1,10 @@
1
- import { ScaleContinuousNumeric, ScaleTime } from "d3-scale";
2
- export interface IZoomAnchorOptions<TData, TXAxis extends number | Date> {
3
- readonly plotData: TData[];
4
- readonly mouseXY: number[];
5
- readonly xAccessor: (data: TData) => TXAxis;
6
- readonly xScale: ScaleContinuousNumeric<number, number> | ScaleTime<number, number>;
7
- }
8
- export declare const mouseBasedZoomAnchor: <TData, TXAxis extends number | Date>(options: IZoomAnchorOptions<TData, TXAxis>) => TXAxis;
9
- export declare const lastVisibleItemBasedZoomAnchor: <TData, TXAxis extends number | Date>(options: IZoomAnchorOptions<TData, TXAxis>) => TXAxis;
10
- export declare const rightDomainBasedZoomAnchor: <TData, TXAxis extends number | Date>(options: IZoomAnchorOptions<TData, TXAxis>) => number | Date;
1
+ import { ScaleContinuousNumeric, ScaleTime } from "d3-scale";
2
+ export interface IZoomAnchorOptions<TData, TXAxis extends number | Date> {
3
+ readonly plotData: TData[];
4
+ readonly mouseXY: number[];
5
+ readonly xAccessor: (data: TData) => TXAxis;
6
+ readonly xScale: ScaleContinuousNumeric<number, number> | ScaleTime<number, number>;
7
+ }
8
+ export declare const mouseBasedZoomAnchor: <TData, TXAxis extends number | Date>(options: IZoomAnchorOptions<TData, TXAxis>) => TXAxis;
9
+ export declare const lastVisibleItemBasedZoomAnchor: <TData, TXAxis extends number | Date>(options: IZoomAnchorOptions<TData, TXAxis>) => TXAxis;
10
+ export declare const rightDomainBasedZoomAnchor: <TData, TXAxis extends number | Date>(options: IZoomAnchorOptions<TData, TXAxis>) => number | Date;
@@ -1,18 +1,18 @@
1
- import { getCurrentItem } from "../utils/ChartDataUtil";
2
- import { last } from "../utils/index";
3
- export const mouseBasedZoomAnchor = (options) => {
4
- const { xScale, xAccessor, mouseXY, plotData } = options;
5
- const currentItem = getCurrentItem(xScale, xAccessor, mouseXY, plotData);
6
- return xAccessor(currentItem);
7
- };
8
- export const lastVisibleItemBasedZoomAnchor = (options) => {
9
- const { xAccessor, plotData } = options;
10
- const lastItem = last(plotData);
11
- return xAccessor(lastItem);
12
- };
13
- export const rightDomainBasedZoomAnchor = (options) => {
14
- const { xScale } = options;
15
- const [, end] = xScale.domain();
16
- return end;
17
- };
1
+ import { getCurrentItem } from "../utils/ChartDataUtil";
2
+ import { last } from "../utils/index";
3
+ export const mouseBasedZoomAnchor = (options) => {
4
+ const { xScale, xAccessor, mouseXY, plotData } = options;
5
+ const currentItem = getCurrentItem(xScale, xAccessor, mouseXY, plotData);
6
+ return xAccessor(currentItem);
7
+ };
8
+ export const lastVisibleItemBasedZoomAnchor = (options) => {
9
+ const { xAccessor, plotData } = options;
10
+ const lastItem = last(plotData);
11
+ return xAccessor(lastItem);
12
+ };
13
+ export const rightDomainBasedZoomAnchor = (options) => {
14
+ const { xScale } = options;
15
+ const [, end] = xScale.domain();
16
+ return end;
17
+ };
18
18
  //# sourceMappingURL=zoomBehavior.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tradingaction/core",
3
- "version": "2.0.12",
3
+ "version": "2.0.13",
4
4
  "description": "Core code for react-financial-charts",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -48,5 +48,5 @@
48
48
  "react": "^16.0.0 || ^17.0.0 || ^18.0.0",
49
49
  "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0"
50
50
  },
51
- "gitHead": "44e3702def777700ad4732c08f15c0c345c0c3b9"
51
+ "gitHead": "9c9bc635a2291c8da0e1dd5befa4000e96d83119"
52
52
  }
package/src/Chart.tsx CHANGED
@@ -59,7 +59,7 @@ export const Chart = React.memo((props: React.PropsWithChildren<ChartProps>) =>
59
59
  }
60
60
 
61
61
  const { currentCharts } = moreProps;
62
- if (currentCharts.indexOf(id) > -1) {
62
+ if (currentCharts?.indexOf(id) > -1) {
63
63
  onContextMenu(e, moreProps);
64
64
  }
65
65
 
@@ -71,7 +71,7 @@ export const Chart = React.memo((props: React.PropsWithChildren<ChartProps>) =>
71
71
  }
72
72
 
73
73
  const { currentCharts } = moreProps;
74
- if (currentCharts.indexOf(id) > -1) {
74
+ if (currentCharts?.indexOf(id) > -1) {
75
75
  onDoubleClick(e, moreProps);
76
76
  }
77
77
 
@@ -427,7 +427,7 @@ export class ChartCanvas<TXAxis extends number | Date> extends React.Component<
427
427
  > {
428
428
  public static defaultProps = {
429
429
  clamp: false,
430
- className: "react-financial-charts",
430
+ className: "react-financial-charts-ta",
431
431
  defaultFocus: true,
432
432
  disablePan: false,
433
433
  disableInteraction: false,
@@ -46,6 +46,7 @@ interface GenericComponentProps {
46
46
  readonly onHover?: (e: React.MouseEvent, moreProps: any) => void;
47
47
  readonly onUnHover?: (e: React.MouseEvent, moreProps: any) => void;
48
48
  readonly selected?: boolean;
49
+ // readonly key?: string;//debug
49
50
  }
50
51
 
51
52
  interface GenericComponentState {