layerchart 2.0.0-next.55 → 2.0.0-next.56

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 (54) hide show
  1. package/dist/bench/ComposableLineChart.svelte +1 -1
  2. package/dist/bench/GeoBench.svelte +1 -8
  3. package/dist/components/AnnotationRange.svelte +3 -1
  4. package/dist/components/Arc.svelte +1 -3
  5. package/dist/components/ArcLabel.svelte.test.js +7 -7
  6. package/dist/components/Bar.svelte +4 -2
  7. package/dist/components/BoxPlot.svelte +4 -12
  8. package/dist/components/Cell.svelte +13 -8
  9. package/dist/components/Chart.svelte +69 -26
  10. package/dist/components/ChartChildren.svelte +22 -4
  11. package/dist/components/Circle.svelte +34 -12
  12. package/dist/components/ClipPath.svelte +3 -9
  13. package/dist/components/Ellipse.svelte +27 -6
  14. package/dist/components/GeoLegend.svelte +1 -3
  15. package/dist/components/GeoPoint.svelte +25 -3
  16. package/dist/components/GeoSpline.svelte +1 -4
  17. package/dist/components/GeoTile.svelte +8 -4
  18. package/dist/components/Group.svelte +11 -5
  19. package/dist/components/Highlight.svelte +3 -3
  20. package/dist/components/Image.svelte +42 -30
  21. package/dist/components/Labels.svelte +2 -4
  22. package/dist/components/Line.svelte +7 -6
  23. package/dist/components/LinearGradient.svelte +8 -4
  24. package/dist/components/Link.svelte +0 -1
  25. package/dist/components/Marker.svelte +9 -1
  26. package/dist/components/Path.svelte +43 -23
  27. package/dist/components/Pattern.svelte +101 -5
  28. package/dist/components/Pattern.svelte.d.ts +3 -1
  29. package/dist/components/Pie.svelte +2 -6
  30. package/dist/components/RadialGradient.svelte +8 -4
  31. package/dist/components/Rect.svelte +29 -12
  32. package/dist/components/Spline.svelte +22 -4
  33. package/dist/components/Text.svelte +9 -5
  34. package/dist/components/Trail.svelte +19 -7
  35. package/dist/components/Vector.svelte +37 -14
  36. package/dist/components/Violin.svelte +1 -2
  37. package/dist/components/charts/ArcChart.svelte +8 -5
  38. package/dist/components/charts/AreaChart.svelte +6 -1
  39. package/dist/components/charts/BarChart.svelte +3 -1
  40. package/dist/components/charts/LineChart.svelte +6 -1
  41. package/dist/components/charts/PieChart.svelte +10 -3
  42. package/dist/components/tooltip/Tooltip.svelte +2 -8
  43. package/dist/contexts/chart.d.ts +1 -1
  44. package/dist/contexts/chart.js +3 -1
  45. package/dist/server/TestBarChart.svelte +28 -28
  46. package/dist/server/TestLineChart.svelte +28 -28
  47. package/dist/server/index.js +1 -1
  48. package/dist/states/brush.svelte.js +16 -13
  49. package/dist/states/chart.svelte.test.js +24 -19
  50. package/dist/states/geo.svelte.js +1 -4
  51. package/dist/states/series.svelte.js +1 -1
  52. package/dist/utils/canvas.js +7 -4
  53. package/dist/utils/trail.js +3 -4
  54. package/package.json +1 -1
@@ -57,10 +57,7 @@ export class GeoState {
57
57
  ]);
58
58
  }
59
59
  if (this.transformState?.mode === 'projection' && this.transformApply.translate) {
60
- _projection.translate([
61
- this.transformState.translate.x,
62
- this.transformState.translate.y,
63
- ]);
60
+ _projection.translate([this.transformState.translate.x, this.transformState.translate.y]);
64
61
  }
65
62
  }
66
63
  // Apply center
@@ -214,7 +214,7 @@ export class SeriesState {
214
214
  * Check if the series is the default
215
215
  */
216
216
  get isDefaultSeries() {
217
- return this.#series.length === 0 || (this.#series.length === 1 && this.#series[0].key === 'default');
217
+ return (this.#series.length === 0 || (this.#series.length === 1 && this.#series[0].key === 'default'));
218
218
  }
219
219
  /**
220
220
  * Check if series is highlighted
@@ -196,8 +196,10 @@ function render(ctx, render, styleOptions = {}, { applyText, } = {}) {
196
196
  for (const attr of paintOrder) {
197
197
  if (attr === 'fill') {
198
198
  const fill = styleOptions.styles?.fill &&
199
- ((typeof CanvasGradient !== 'undefined' && styleOptions.styles?.fill instanceof CanvasGradient) ||
200
- (typeof CanvasPattern !== 'undefined' && styleOptions.styles?.fill instanceof CanvasPattern) ||
199
+ ((typeof CanvasGradient !== 'undefined' &&
200
+ styleOptions.styles?.fill instanceof CanvasGradient) ||
201
+ (typeof CanvasPattern !== 'undefined' &&
202
+ styleOptions.styles?.fill instanceof CanvasPattern) ||
201
203
  !styleOptions.styles?.fill?.includes('var'))
202
204
  ? styleOptions.styles.fill
203
205
  : resolvedStyles?.fill;
@@ -213,7 +215,8 @@ function render(ctx, render, styleOptions = {}, { applyText, } = {}) {
213
215
  }
214
216
  else if (attr === 'stroke') {
215
217
  const stroke = styleOptions.styles?.stroke &&
216
- ((typeof CanvasGradient !== 'undefined' && styleOptions.styles?.stroke instanceof CanvasGradient) ||
218
+ ((typeof CanvasGradient !== 'undefined' &&
219
+ styleOptions.styles?.stroke instanceof CanvasGradient) ||
217
220
  !styleOptions.styles?.stroke?.includes('var'))
218
221
  ? styleOptions.styles?.stroke
219
222
  : resolvedStyles?.stroke;
@@ -337,7 +340,7 @@ export function clearCanvasContext(ctx, options) {
337
340
  @see: https://web.dev/articles/canvas-hidipi
338
341
  */
339
342
  export function scaleCanvas(ctx, width, height) {
340
- const devicePixelRatio = typeof window !== 'undefined' ? (window.devicePixelRatio || 1) : 1;
343
+ const devicePixelRatio = typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1;
341
344
  ctx.canvas.width = width * devicePixelRatio;
342
345
  ctx.canvas.height = height * devicePixelRatio;
343
346
  ctx.canvas.style.width = `${width}px`;
@@ -88,9 +88,7 @@ function trailPathButt(points) {
88
88
  const dirPrev = hasPrev
89
89
  ? normalize(curr.x - prev.x, curr.y - prev.y)
90
90
  : normalize(next.x - curr.x, next.y - curr.y);
91
- const dirNext = hasNext
92
- ? normalize(next.x - curr.x, next.y - curr.y)
93
- : dirPrev;
91
+ const dirNext = hasNext ? normalize(next.x - curr.x, next.y - curr.y) : dirPrev;
94
92
  // Perpendicular normals (rotate 90° CCW)
95
93
  const normPrev = [-dirPrev[1], dirPrev[0]];
96
94
  const normNext = [-dirNext[1], dirNext[0]];
@@ -296,7 +294,8 @@ function interpolateRadii(original, dense) {
296
294
  // Cumulative arc-length of original points
297
295
  const origCum = [0];
298
296
  for (let i = 1; i < original.length; i++) {
299
- origCum.push(origCum[i - 1] + Math.hypot(original[i].x - original[i - 1].x, original[i].y - original[i - 1].y));
297
+ origCum.push(origCum[i - 1] +
298
+ Math.hypot(original[i].x - original[i - 1].x, original[i].y - original[i - 1].y));
300
299
  }
301
300
  const origTotal = origCum[origCum.length - 1] || 1;
302
301
  // Cumulative arc-length of dense points
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "license": "MIT",
6
6
  "repository": "techniq/layerchart",
7
7
  "homepage": "https://layerchart.com",
8
- "version": "2.0.0-next.55",
8
+ "version": "2.0.0-next.56",
9
9
  "devDependencies": {
10
10
  "@changesets/cli": "^2.30.0",
11
11
  "@napi-rs/canvas": "^0.1.97",