@semcore/d3-chart 2.2.4 → 2.3.0-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 (213) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/lib/cjs/Area.js +16 -9
  3. package/lib/cjs/Area.js.map +1 -1
  4. package/lib/cjs/Axis.js +56 -17
  5. package/lib/cjs/Axis.js.map +1 -1
  6. package/lib/cjs/Bar.js +20 -9
  7. package/lib/cjs/Bar.js.map +1 -1
  8. package/lib/cjs/Bubble.js +20 -11
  9. package/lib/cjs/Bubble.js.map +1 -1
  10. package/lib/cjs/ClipPath.js +1 -0
  11. package/lib/cjs/ClipPath.js.map +1 -1
  12. package/lib/cjs/Donut.js +22 -12
  13. package/lib/cjs/Donut.js.map +1 -1
  14. package/lib/cjs/Dots.js +10 -9
  15. package/lib/cjs/Dots.js.map +1 -1
  16. package/lib/cjs/GroupBar.js +12 -8
  17. package/lib/cjs/GroupBar.js.map +1 -1
  18. package/lib/cjs/HorizontalBar.js +20 -9
  19. package/lib/cjs/HorizontalBar.js.map +1 -1
  20. package/lib/cjs/Hover.js +8 -4
  21. package/lib/cjs/Hover.js.map +1 -1
  22. package/lib/cjs/Line.js +15 -9
  23. package/lib/cjs/Line.js.map +1 -1
  24. package/lib/cjs/Plot.js +46 -8
  25. package/lib/cjs/Plot.js.map +1 -1
  26. package/lib/cjs/RadialTree.js +25 -13
  27. package/lib/cjs/RadialTree.js.map +1 -1
  28. package/lib/cjs/ReferenceLine.js +10 -10
  29. package/lib/cjs/ScatterPlot.js +17 -8
  30. package/lib/cjs/ScatterPlot.js.map +1 -1
  31. package/lib/cjs/StackBar.js +12 -8
  32. package/lib/cjs/StackBar.js.map +1 -1
  33. package/lib/cjs/StackedArea.js +8 -7
  34. package/lib/cjs/StackedArea.js.map +1 -1
  35. package/lib/cjs/Tooltip.js +8 -8
  36. package/lib/cjs/Venn.js +25 -9
  37. package/lib/cjs/Venn.js.map +1 -1
  38. package/lib/cjs/a11y/PlotA11yModule.js +185 -0
  39. package/lib/cjs/a11y/PlotA11yModule.js.map +1 -0
  40. package/lib/cjs/a11y/PlotA11yView.js +285 -0
  41. package/lib/cjs/a11y/PlotA11yView.js.map +1 -0
  42. package/lib/cjs/a11y/bezier.js +44 -0
  43. package/lib/cjs/a11y/bezier.js.map +1 -0
  44. package/lib/cjs/a11y/datasets/charts-a11y.js +591 -0
  45. package/lib/cjs/a11y/datasets/charts-a11y.js.map +1 -0
  46. package/lib/cjs/a11y/datasets/gold.json +7961 -0
  47. package/lib/cjs/a11y/datasets/imdb.json +10002 -0
  48. package/lib/cjs/a11y/datasets/readme.md +5 -0
  49. package/lib/cjs/a11y/datasets/stores.json +6274 -0
  50. package/lib/cjs/a11y/datasets/titanic.json +5436 -0
  51. package/lib/cjs/a11y/focus.js +57 -0
  52. package/lib/cjs/a11y/focus.js.map +1 -0
  53. package/lib/cjs/a11y/hints.js +141 -0
  54. package/lib/cjs/a11y/hints.js.map +1 -0
  55. package/lib/cjs/a11y/insights.js +785 -0
  56. package/lib/cjs/a11y/insights.js.map +1 -0
  57. package/lib/cjs/a11y/intl.js +31 -0
  58. package/lib/cjs/a11y/intl.js.map +1 -0
  59. package/lib/cjs/a11y/locale.js +48 -0
  60. package/lib/cjs/a11y/locale.js.map +1 -0
  61. package/lib/cjs/a11y/serialize.js +439 -0
  62. package/lib/cjs/a11y/serialize.js.map +1 -0
  63. package/lib/cjs/a11y/summarize.js +21 -0
  64. package/lib/cjs/a11y/summarize.js.map +1 -0
  65. package/lib/cjs/a11y/translations/module/de.json +5 -0
  66. package/lib/cjs/a11y/translations/module/en.json +5 -0
  67. package/lib/cjs/a11y/translations/module/es.json +5 -0
  68. package/lib/cjs/a11y/translations/module/fr.json +5 -0
  69. package/lib/cjs/a11y/translations/module/it.json +5 -0
  70. package/lib/cjs/a11y/translations/module/ja.json +5 -0
  71. package/lib/cjs/a11y/translations/module/ko.json +5 -0
  72. package/lib/cjs/a11y/translations/module/pt.json +5 -0
  73. package/lib/cjs/a11y/translations/module/tr.json +5 -0
  74. package/lib/cjs/a11y/translations/module/translations.js +46 -0
  75. package/lib/cjs/a11y/translations/module/translations.js.map +1 -0
  76. package/lib/cjs/a11y/translations/module/vi.json +5 -0
  77. package/lib/cjs/a11y/translations/module/zh.json +5 -0
  78. package/lib/cjs/a11y/translations/view/de.json +42 -0
  79. package/lib/cjs/a11y/translations/view/en.csv +41 -0
  80. package/lib/cjs/a11y/translations/view/en.json +42 -0
  81. package/lib/cjs/a11y/translations/view/es.json +42 -0
  82. package/lib/cjs/a11y/translations/view/fr.json +42 -0
  83. package/lib/cjs/a11y/translations/view/it.json +42 -0
  84. package/lib/cjs/a11y/translations/view/ja.json +42 -0
  85. package/lib/cjs/a11y/translations/view/ko.json +42 -0
  86. package/lib/cjs/a11y/translations/view/pt.json +42 -0
  87. package/lib/cjs/a11y/translations/view/tr.json +42 -0
  88. package/lib/cjs/a11y/translations/view/translations.js +46 -0
  89. package/lib/cjs/a11y/translations/view/translations.js.map +1 -0
  90. package/lib/cjs/a11y/translations/view/vi.json +42 -0
  91. package/lib/cjs/a11y/translations/view/zh.json +42 -0
  92. package/lib/cjs/createElement.js +3 -1
  93. package/lib/cjs/createElement.js.map +1 -1
  94. package/lib/cjs/style/plot.shadow.css +10 -0
  95. package/lib/cjs/style/plotA11yModule.shadow.css +13 -0
  96. package/lib/cjs/style/plotA11yView.shadow.css +39 -0
  97. package/lib/cjs/types/Plot.d.ts +75 -0
  98. package/lib/cjs/utils.js +9 -1
  99. package/lib/cjs/utils.js.map +1 -1
  100. package/lib/es6/Area.js +16 -9
  101. package/lib/es6/Area.js.map +1 -1
  102. package/lib/es6/Axis.js +56 -17
  103. package/lib/es6/Axis.js.map +1 -1
  104. package/lib/es6/Bar.js +20 -9
  105. package/lib/es6/Bar.js.map +1 -1
  106. package/lib/es6/Bubble.js +20 -11
  107. package/lib/es6/Bubble.js.map +1 -1
  108. package/lib/es6/ClipPath.js +1 -0
  109. package/lib/es6/ClipPath.js.map +1 -1
  110. package/lib/es6/Donut.js +22 -12
  111. package/lib/es6/Donut.js.map +1 -1
  112. package/lib/es6/Dots.js +10 -9
  113. package/lib/es6/Dots.js.map +1 -1
  114. package/lib/es6/GroupBar.js +12 -8
  115. package/lib/es6/GroupBar.js.map +1 -1
  116. package/lib/es6/HorizontalBar.js +20 -9
  117. package/lib/es6/HorizontalBar.js.map +1 -1
  118. package/lib/es6/Hover.js +8 -4
  119. package/lib/es6/Hover.js.map +1 -1
  120. package/lib/es6/Line.js +15 -9
  121. package/lib/es6/Line.js.map +1 -1
  122. package/lib/es6/Plot.js +48 -9
  123. package/lib/es6/Plot.js.map +1 -1
  124. package/lib/es6/RadialTree.js +25 -13
  125. package/lib/es6/RadialTree.js.map +1 -1
  126. package/lib/es6/ReferenceLine.js +10 -10
  127. package/lib/es6/ScatterPlot.js +17 -8
  128. package/lib/es6/ScatterPlot.js.map +1 -1
  129. package/lib/es6/StackBar.js +12 -8
  130. package/lib/es6/StackBar.js.map +1 -1
  131. package/lib/es6/StackedArea.js +8 -7
  132. package/lib/es6/StackedArea.js.map +1 -1
  133. package/lib/es6/Tooltip.js +8 -8
  134. package/lib/es6/Venn.js +25 -9
  135. package/lib/es6/Venn.js.map +1 -1
  136. package/lib/es6/a11y/PlotA11yModule.js +160 -0
  137. package/lib/es6/a11y/PlotA11yModule.js.map +1 -0
  138. package/lib/es6/a11y/PlotA11yView.js +254 -0
  139. package/lib/es6/a11y/PlotA11yView.js.map +1 -0
  140. package/lib/es6/a11y/bezier.js +35 -0
  141. package/lib/es6/a11y/bezier.js.map +1 -0
  142. package/lib/es6/a11y/datasets/charts-a11y.js +590 -0
  143. package/lib/es6/a11y/datasets/charts-a11y.js.map +1 -0
  144. package/lib/es6/a11y/datasets/gold.json +7961 -0
  145. package/lib/es6/a11y/datasets/imdb.json +10002 -0
  146. package/lib/es6/a11y/datasets/readme.md +5 -0
  147. package/lib/es6/a11y/datasets/stores.json +6274 -0
  148. package/lib/es6/a11y/datasets/titanic.json +5436 -0
  149. package/lib/es6/a11y/focus.js +48 -0
  150. package/lib/es6/a11y/focus.js.map +1 -0
  151. package/lib/es6/a11y/hints.js +123 -0
  152. package/lib/es6/a11y/hints.js.map +1 -0
  153. package/lib/es6/a11y/insights.js +779 -0
  154. package/lib/es6/a11y/insights.js.map +1 -0
  155. package/lib/es6/a11y/intl.js +18 -0
  156. package/lib/es6/a11y/intl.js.map +1 -0
  157. package/lib/es6/a11y/locale.js +36 -0
  158. package/lib/es6/a11y/locale.js.map +1 -0
  159. package/lib/es6/a11y/serialize.js +423 -0
  160. package/lib/es6/a11y/serialize.js.map +1 -0
  161. package/lib/es6/a11y/summarize.js +10 -0
  162. package/lib/es6/a11y/summarize.js.map +1 -0
  163. package/lib/es6/a11y/translations/module/de.json +5 -0
  164. package/lib/es6/a11y/translations/module/en.json +5 -0
  165. package/lib/es6/a11y/translations/module/es.json +5 -0
  166. package/lib/es6/a11y/translations/module/fr.json +5 -0
  167. package/lib/es6/a11y/translations/module/it.json +5 -0
  168. package/lib/es6/a11y/translations/module/ja.json +5 -0
  169. package/lib/es6/a11y/translations/module/ko.json +5 -0
  170. package/lib/es6/a11y/translations/module/pt.json +5 -0
  171. package/lib/es6/a11y/translations/module/tr.json +5 -0
  172. package/lib/es6/a11y/translations/module/translations.js +25 -0
  173. package/lib/es6/a11y/translations/module/translations.js.map +1 -0
  174. package/lib/es6/a11y/translations/module/vi.json +5 -0
  175. package/lib/es6/a11y/translations/module/zh.json +5 -0
  176. package/lib/es6/a11y/translations/view/de.json +42 -0
  177. package/lib/es6/a11y/translations/view/en.csv +41 -0
  178. package/lib/es6/a11y/translations/view/en.json +42 -0
  179. package/lib/es6/a11y/translations/view/es.json +42 -0
  180. package/lib/es6/a11y/translations/view/fr.json +42 -0
  181. package/lib/es6/a11y/translations/view/it.json +42 -0
  182. package/lib/es6/a11y/translations/view/ja.json +42 -0
  183. package/lib/es6/a11y/translations/view/ko.json +42 -0
  184. package/lib/es6/a11y/translations/view/pt.json +42 -0
  185. package/lib/es6/a11y/translations/view/tr.json +42 -0
  186. package/lib/es6/a11y/translations/view/translations.js +25 -0
  187. package/lib/es6/a11y/translations/view/translations.js.map +1 -0
  188. package/lib/es6/a11y/translations/view/vi.json +42 -0
  189. package/lib/es6/a11y/translations/view/zh.json +42 -0
  190. package/lib/es6/createElement.js +3 -1
  191. package/lib/es6/createElement.js.map +1 -1
  192. package/lib/es6/style/plot.shadow.css +10 -0
  193. package/lib/es6/style/plotA11yModule.shadow.css +13 -0
  194. package/lib/es6/style/plotA11yView.shadow.css +39 -0
  195. package/lib/es6/types/Plot.d.ts +75 -0
  196. package/lib/es6/utils.js +5 -0
  197. package/lib/es6/utils.js.map +1 -1
  198. package/lib/types/Plot.d.ts +75 -0
  199. package/lib/types/a11y/PlotA11yModule.d.ts +12 -0
  200. package/lib/types/a11y/PlotA11yView.d.ts +3 -0
  201. package/lib/types/a11y/bezier.d.ts +8 -0
  202. package/lib/types/a11y/datasets/charts-a11y.d.ts +0 -0
  203. package/lib/types/a11y/focus.d.ts +5 -0
  204. package/lib/types/a11y/hints.d.ts +99 -0
  205. package/lib/types/a11y/insights.d.ts +54 -0
  206. package/lib/types/a11y/intl.d.ts +8 -0
  207. package/lib/types/a11y/locale.d.ts +3 -0
  208. package/lib/types/a11y/serialize.d.ts +16 -0
  209. package/lib/types/a11y/summarize.d.ts +2 -0
  210. package/lib/types/a11y/translations/module/translations.d.ts +5 -0
  211. package/lib/types/a11y/translations/view/translations.d.ts +5 -0
  212. package/lib/types/utils.d.ts +1 -0
  213. package/package.json +2 -1
@@ -0,0 +1,99 @@
1
+ import { SerializableDataType } from './insights';
2
+ declare type DeepPartial<T> = T extends object ? {
3
+ [P in keyof T]?: DeepPartial<T[P]>;
4
+ } : T;
5
+ export declare type DataStructureHints = {
6
+ fields: {
7
+ verticalAxes: Set<string | number>;
8
+ horizontalAxes: Set<string | number>;
9
+ valueAxes: Set<string | number>;
10
+ values: Set<string | number>;
11
+ };
12
+ groups: Set<string | number>;
13
+ axesTitle: {
14
+ vertical: string | null;
15
+ horizontal: string | null;
16
+ };
17
+ titles: {
18
+ verticalAxes: {
19
+ [dataKey: string | number]: string;
20
+ };
21
+ getVerticalAxesTitle: null | ((dataKey: string | number) => string);
22
+ horizontalAxes: {
23
+ [dataKey: string | number]: string;
24
+ };
25
+ getHorizontalAxesTitle: null | ((dataKey: string | number) => string);
26
+ valuesAxes: {
27
+ [dataKey: string | number]: string;
28
+ };
29
+ getValueAxesTitle: null | ((dataKey: string | number) => string);
30
+ };
31
+ grid: {
32
+ verticalAxes: number | null;
33
+ horizontalAxes: number | null;
34
+ };
35
+ pointsDensity: {
36
+ verticalAxes: number;
37
+ horizontalAxes: number;
38
+ } | null;
39
+ dataType: SerializableDataType | null;
40
+ };
41
+ export declare type DataSummarizationConfig = {
42
+ trendTangens: {
43
+ static: number;
44
+ weak: number;
45
+ medium: number;
46
+ strong: number;
47
+ };
48
+ movingAverage: {
49
+ longSize: number | undefined;
50
+ shortSize: number | undefined;
51
+ notableDiff: number | undefined;
52
+ };
53
+ dataType: SerializableDataType | undefined;
54
+ clustersGridSize: number | undefined;
55
+ maxListSymbols: number;
56
+ datesWithTime: boolean | undefined;
57
+ clustersLimit: number;
58
+ valuesLimit: number;
59
+ groupsLimit: number;
60
+ disable: boolean;
61
+ override: string | undefined;
62
+ };
63
+ export declare type PartialDataSummarizationConfig = DeepPartial<DataSummarizationConfig>;
64
+ export declare const makeDataHintsContainer: () => DataStructureHints;
65
+ export declare const makeDataHintsHandlers: (mutableContainer: DataStructureHints) => {
66
+ specifyDataRowFields: (x?: string | undefined, y?: string | undefined, value?: string | undefined) => void;
67
+ setupGrid: (direction: 'vertical' | 'horizontal', size: number) => void;
68
+ establishDataType: (dataType: SerializableDataType) => void;
69
+ describeValueEntity: (dataKey: string | number, readableName: string) => void;
70
+ describeGroupedValues: (groupKey: string | number, dataKey: string | number) => void;
71
+ labelKey: (axes: 'vertical' | 'horizontal' | 'value', dataKey: string | number, label: string) => void;
72
+ addKeyLabelGetter: (axes: 'vertical' | 'horizontal' | 'value', getter: (dataKey: string | number) => string) => void;
73
+ setTitle: (describedDataAxes: 'vertical' | 'horizontal', title: string) => void;
74
+ setPointsDensity: (horizontalAxes: number, verticalAxes: number) => void;
75
+ };
76
+ export declare type DataHintsHandler = ReturnType<typeof makeDataHintsHandlers>;
77
+ export declare const makeDataSummarizationConfig: (config?: {
78
+ trendTangens?: {
79
+ static?: number | undefined;
80
+ weak?: number | undefined;
81
+ medium?: number | undefined;
82
+ strong?: number | undefined;
83
+ } | undefined;
84
+ movingAverage?: {
85
+ longSize?: number | undefined;
86
+ shortSize?: number | undefined;
87
+ notableDiff?: number | undefined;
88
+ } | undefined;
89
+ dataType?: SerializableDataType | undefined;
90
+ clustersGridSize?: number | undefined;
91
+ maxListSymbols?: number | undefined;
92
+ datesWithTime?: boolean | undefined;
93
+ clustersLimit?: number | undefined;
94
+ valuesLimit?: number | undefined;
95
+ groupsLimit?: number | undefined;
96
+ disable?: boolean | undefined;
97
+ override?: string | undefined;
98
+ } | undefined) => DataSummarizationConfig;
99
+ export {};
@@ -0,0 +1,54 @@
1
+ import { DataStructureHints, DataSummarizationConfig } from './hints';
2
+ export declare type TrendNode = {
3
+ type: 'trend';
4
+ priority: number;
5
+ change: {
6
+ from: number;
7
+ to: number;
8
+ strength: 'strong-reduction' | 'reduction' | 'weak-reduction' | 'static' | 'weak-growth' | 'growth' | 'strong-growth';
9
+ };
10
+ from: unknown;
11
+ to: unknown;
12
+ dataKey: string | number;
13
+ };
14
+ export declare type GeneralTrendNode = Omit<TrendNode, 'type'> & {
15
+ type: 'general-trend';
16
+ };
17
+ export declare type ComparisonNode = {
18
+ type: 'comparison';
19
+ label?: string;
20
+ priority: number;
21
+ values: {
22
+ value: unknown;
23
+ label: string;
24
+ }[];
25
+ };
26
+ declare type ClusterRelativeSize = 'significantly-smaller' | 'smaller' | 'slightly-smaller' | 'average' | 'slightly-bigger' | 'bigger' | 'significantly-bigger';
27
+ export declare type ClusterNode = {
28
+ type: 'cluster';
29
+ priority: number;
30
+ size: number;
31
+ labels: unknown[];
32
+ center: {
33
+ x: number;
34
+ xLabel: string | number;
35
+ y: number;
36
+ yLabel: string | number;
37
+ };
38
+ relativeSize: ClusterRelativeSize;
39
+ };
40
+ export declare type Insight = TrendNode | GeneralTrendNode | ComparisonNode | ClusterNode;
41
+ export declare type SerializableDataType = 'time-series' | 'points-cloud' | 'values-set' | 'grouped-values';
42
+ export declare type AnalyzedData = {
43
+ insights: Insight[];
44
+ dataType: SerializableDataType;
45
+ dataRange: {
46
+ from: string | number | Date;
47
+ to: string | number | Date;
48
+ label: string | number | null;
49
+ }[];
50
+ dataTitle: string | null;
51
+ entitiesCount: number;
52
+ };
53
+ export declare const extractDataInsights: (data: Record<string, unknown>[] | Record<string, unknown>, hints: DataStructureHints, config: DataSummarizationConfig) => AnalyzedData;
54
+ export {};
@@ -0,0 +1,8 @@
1
+ import { IntlShape } from '@formatjs/intl';
2
+ import { translations as defaultTranslations } from './translations/view/translations';
3
+ export declare type Intl = IntlShape<typeof defaultTranslations[keyof typeof defaultTranslations]>;
4
+ export declare const getIntl: (locale: string, translations?: {
5
+ [locale: string]: {
6
+ [message: string]: string;
7
+ };
8
+ }) => Intl;
@@ -0,0 +1,3 @@
1
+ export declare const normalizeLocale: (providedLocale: string, translations?: {
2
+ [locale: string]: {};
3
+ }) => string | null;
@@ -0,0 +1,16 @@
1
+ import { AnalyzedData } from './insights';
2
+ import { DataSummarizationConfig } from './hints';
3
+ import { Intl } from './intl';
4
+ export declare const formatValue: (intl: Intl, value: unknown, { siblingsTimeMark, maxListSymbols, datesWithTime, }?: {
5
+ siblingsTimeMark?: unknown;
6
+ maxListSymbols?: number | undefined;
7
+ datesWithTime?: boolean | undefined;
8
+ }) => string;
9
+ export declare const serialize: ({ insights, dataType, dataRange, dataTitle, entitiesCount }: AnalyzedData, { datesWithTime, maxListSymbols, clustersLimit, valuesLimit, groupsLimit, }: DataSummarizationConfig, { locale, translations, }: {
10
+ locale: string;
11
+ translations?: {
12
+ [locale: string]: {
13
+ [messageId: string]: string;
14
+ };
15
+ } | undefined;
16
+ }) => string | null;
@@ -0,0 +1,2 @@
1
+ import { DataStructureHints, DataSummarizationConfig } from './hints';
2
+ export declare const summarize: (data: Record<string, unknown>[] | Record<string, unknown>, hints: DataStructureHints, config: DataSummarizationConfig, locale: NavigatorLanguage['language']) => string | null;
@@ -0,0 +1,5 @@
1
+ export declare const translations: {
2
+ [locale: string]: {
3
+ [message: string]: string;
4
+ };
5
+ };
@@ -0,0 +1,5 @@
1
+ export declare const translations: {
2
+ [locale: string]: {
3
+ [message: string]: string;
4
+ };
5
+ };
@@ -25,3 +25,4 @@ export declare const roundedPath: (x: number, y: number, w: number, h: number, r
25
25
  export declare const getBandwidth: <Scale extends ScaleBand<{}>>(scale: Scale) => number;
26
26
  export declare const memoize: <Func extends (...args: any[]) => any>(func: Func) => Func;
27
27
  export declare const measureText: (text: string, fontSize?: number | undefined) => number;
28
+ export declare const uniqueId: (prefix?: string) => string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/d3-chart",
3
3
  "description": "SEMRush D3 Chart Component",
4
- "version": "2.2.4",
4
+ "version": "2.3.0-1",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -13,6 +13,7 @@
13
13
  "test": "jest"
14
14
  },
15
15
  "dependencies": {
16
+ "@formatjs/intl": "2.3.0",
16
17
  "@semcore/animation": "^1",
17
18
  "@semcore/flex-box": "^4",
18
19
  "@semcore/popper": "^4.9",