@pushwoosh/kit-charts 0.4.2 → 0.4.4

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.
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
+ import { useCallback, useEffect, useMemo, useState } from 'react';
3
3
  import { Grid, XAxis, XAxisLine, YAxis } from './Axes';
4
4
  import { ChartErrorBoundary } from './ChartErrorBoundary';
5
5
  import { Legend } from './Legend';
@@ -211,12 +211,10 @@ function ChartBody({
211
211
  hidden
212
212
  }) : null, [zoomed, canvas, registry, hidden]);
213
213
  const anyShown = built?.series.some(series => !series.hidden) ?? false;
214
- const lastShown = useRef(null);
215
- useEffect(() => {
216
- if (built && anyShown) {
217
- lastShown.current = built;
218
- }
219
- }, [built, anyShown]);
214
+ const [lastShown, setLastShown] = useState(null);
215
+ if (built && anyShown && built !== lastShown) {
216
+ setLastShown(built);
217
+ }
220
218
  // Switching off the last series must not reshape the axes under it: the plot
221
219
  // holds the geometry of the last state that had something on show, so the series
222
220
  // fades out where it stood instead of jumping to a rescaled axis first.
@@ -224,7 +222,7 @@ function ChartBody({
224
222
  if (anyShown || !built) {
225
223
  return built;
226
224
  }
227
- const frozen = lastShown.current;
225
+ const frozen = lastShown;
228
226
  if (!frozen) {
229
227
  return built;
230
228
  }
@@ -237,7 +235,7 @@ function ChartBody({
237
235
  legend: built.legend,
238
236
  titles: built.titles
239
237
  };
240
- }, [built, anyShown]);
238
+ }, [built, anyShown, lastShown]);
241
239
  const contextFor = useCallback(series => {
242
240
  if (!model) {
243
241
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/kit-charts",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "Small React chart library on SVG, with a Highcharts-shaped configuration model",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -25,12 +25,21 @@
25
25
  "access": "public",
26
26
  "directory": "dist"
27
27
  },
28
+ "pushwoosh": {
29
+ "cdn": {
30
+ "path": "kit-charts",
31
+ "dir": "cdn-dist",
32
+ "importMap": [
33
+ "@pushwoosh/kit-charts"
34
+ ]
35
+ }
36
+ },
28
37
  "dependencies": {
29
- "@pushwoosh/kit-constants": "^3.0.0"
38
+ "@pushwoosh/kit-constants": "^3.1.1"
30
39
  },
31
40
  "devDependencies": {
32
- "@pushwoosh/frontend-builder-engine": "^4.0.0",
33
- "@pushwoosh/kit-typography": "^2.0.0",
41
+ "@pushwoosh/frontend-builder-engine": "^5.3.1",
42
+ "@pushwoosh/kit-typography": "^2.1.1",
34
43
  "@testing-library/dom": "^10.4.2",
35
44
  "@testing-library/jest-dom": "^6.9.1",
36
45
  "@testing-library/react": "^16.3.0",
@@ -54,7 +63,7 @@
54
63
  },
55
64
  "scripts": {
56
65
  "start": "pnpm run playground",
57
- "build": "pushwoosh-engine lib:build && cp ai-documentation.md LICENSE dist/",
66
+ "build": "pushwoosh-engine lib:build && `pushwoosh-engine app:command:build` && cp ai-documentation.md LICENSE dist/",
58
67
  "playground": "`pushwoosh-engine lib:command:playground`",
59
68
  "check": "pnpm run check:lint && pnpm run check:types",
60
69
  "check:lint": "echo \"Run check:lint\" && NODE_ENV=production eslint ./src ./playground ./tests",