@eox/chart 0.3.1 → 0.4.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eox/chart",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "devDependencies": {
6
6
  "vite": "^6.0.3"
package/src/main.js CHANGED
@@ -52,6 +52,32 @@ export class EOxChart extends LitElement {
52
52
  this.unstyled = false;
53
53
  }
54
54
 
55
+ _dispatchItemPointerMoveEvent(detail) {
56
+ /**
57
+ * Chart item is hovered. Event detail includes
58
+ * `event` (pointermove event) and `item` (the hovered item on the chart)
59
+ *
60
+ */
61
+ this.dispatchEvent(
62
+ new CustomEvent("pointermove:item", {
63
+ detail,
64
+ }),
65
+ );
66
+ }
67
+
68
+ _dispatchItemClickEvent(detail) {
69
+ /**
70
+ * Chart item is clicked. Event detail includes
71
+ * `event` (click event) and `item` (the clicked item on the chart)
72
+ *
73
+ */
74
+ this.dispatchEvent(
75
+ new CustomEvent("click:item", {
76
+ detail,
77
+ }),
78
+ );
79
+ }
80
+
55
81
  /**
56
82
  * Lifecycle method called when the element is updated
57
83
  *
@@ -22,6 +22,14 @@ const renderChartMethod = (EOxChart, spec, dataValues) => {
22
22
  });
23
23
  res.view.run();
24
24
  }
25
+ res.view.addEventListener("pointermove", (event, item) => {
26
+ if (!item) return;
27
+ EOxChart._dispatchItemPointerMoveEvent({ event, item });
28
+ });
29
+ res.view.addEventListener("click", (event, item) => {
30
+ if (!item) return;
31
+ EOxChart._dispatchItemClickEvent({ event, item });
32
+ });
25
33
  });
26
34
  };
27
35
 
package/types/main.d.ts CHANGED
@@ -50,6 +50,8 @@ export class EOxChart extends LitElement {
50
50
  * @type {Boolean}
51
51
  */
52
52
  unstyled: boolean;
53
+ _dispatchItemPointerMoveEvent(detail: any): void;
54
+ _dispatchItemClickEvent(detail: any): void;
53
55
  /**
54
56
  * Lifecycle method called when the element is updated
55
57
  *
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.js"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH;IACE;;;;;;;;;;;;;;;;MAKE;IAKA;;;;OAIG;IACH,MAFU,OAAO,YAAY,EAAE,iBAAiB,CAE3B;IAErB;;;;OAIG;IACH,YAFU;QAAC,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,0BAA0B,EAAE,UAAU,CAAA;KAAC,CAExD;IAE3B;;;;OAIG;IACH,kBAAqB;IAErB;;;;OAIG;IACH,kBAAqB;IAGvB;;;;OAIG;IACH,2BAFW,OAAO,KAAK,EAAE,cAAc,iBAMtC;IASD;;OAEG;IACH,+CASC;CACF;2BArFgC,KAAK"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.js"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH;IACE;;;;;;;;;;;;;;;;MAKE;IAKA;;;;OAIG;IACH,MAFU,OAAO,YAAY,EAAE,iBAAiB,CAE3B;IAErB;;;;OAIG;IACH,YAFU;QAAC,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,0BAA0B,EAAE,UAAU,CAAA;KAAC,CAExD;IAE3B;;;;OAIG;IACH,kBAAqB;IAErB;;;;OAIG;IACH,kBAAqB;IAGvB,iDAWC;IAED,2CAWC;IAED;;;;OAIG;IACH,2BAFW,OAAO,KAAK,EAAE,cAAc,iBAMtC;IASD;;OAEG;IACH,+CASC;CACF;2BA/GgC,KAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"render-chart.d.ts","sourceRoot":"","sources":["../../../src/methods/render/render-chart.js"],"names":[],"mappings":";AAIA;;;;;;;GAOG;AACH,6CALW,OAAO,YAAY,EAAE,QAAQ,QAC7B,OAAO,YAAY,EAAE,iBAAiB,sCAiBhD"}
1
+ {"version":3,"file":"render-chart.d.ts","sourceRoot":"","sources":["../../../src/methods/render/render-chart.js"],"names":[],"mappings":";AAIA;;;;;;;GAOG;AACH,6CALW,OAAO,YAAY,EAAE,QAAQ,QAC7B,OAAO,YAAY,EAAE,iBAAiB,sCAyBhD"}