@eox/chart 0.3.0 → 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,9 +1,9 @@
1
1
  {
2
2
  "name": "@eox/chart",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "devDependencies": {
6
- "vite": "^5.0.2"
6
+ "vite": "^6.0.3"
7
7
  },
8
8
  "engines": {
9
9
  "npm": ">=8.0.0",
@@ -32,7 +32,7 @@
32
32
  "watch": "vite build --watch"
33
33
  },
34
34
  "dependencies": {
35
- "@eox/elements-utils": "^0.0.1",
35
+ "@eox/elements-utils": "^0.1.5",
36
36
  "deepmerge-ts": "^7.1.3",
37
37
  "lit": "^3.2.0",
38
38
  "vega": "^5.30.0",
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
 
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * @type {import("vega-embed").VisualizationSpec}
3
3
  */
4
- export const DEFAULT_SPEC: any;
4
+ export const DEFAULT_SPEC: import("vega-embed").VisualizationSpec;
5
5
  //# sourceMappingURL=default-spec.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"default-spec.d.ts","sourceRoot":"","sources":["../../src/enums/default-spec.js"],"names":[],"mappings":"AAAA;;GAEG;AACH,+BAOE"}
1
+ {"version":3,"file":"default-spec.d.ts","sourceRoot":"","sources":["../../src/enums/default-spec.js"],"names":[],"mappings":"AAAA;;GAEG;AACH,2BAFU,OAAO,YAAY,EAAE,iBAAiB,CAS9C"}
package/types/main.d.ts CHANGED
@@ -29,7 +29,7 @@ export class EOxChart extends LitElement {
29
29
  *
30
30
  * @type {import("vega-embed").VisualizationSpec}
31
31
  */
32
- spec: any;
32
+ spec: import("vega-embed").VisualizationSpec;
33
33
  /**
34
34
  * Data values passed on runtime. Requires a [named data source](https://vega.github.io/vega-lite/docs/data.html#named) in the provided `spec`
35
35
  *
@@ -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,UAAqB;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"}
@@ -7,5 +7,5 @@ export default renderChartMethod;
7
7
  * @param {Object=} dataValues
8
8
  *
9
9
  */
10
- declare function renderChartMethod(EOxChart: import("../../main").EOxChart, spec: any, dataValues?: any | undefined): void;
10
+ declare function renderChartMethod(EOxChart: import("../../main").EOxChart, spec: import("vega-embed").VisualizationSpec, dataValues?: any | undefined): void;
11
11
  //# sourceMappingURL=render-chart.d.ts.map
@@ -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,iDAkBvC"}
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"}