@semcore/mini-chart 16.1.1-prerelease.5 → 17.0.0-prerelease.17

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 (47) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/README.md +4 -4
  3. package/lib/cjs/component/score/Donut.js +84 -96
  4. package/lib/cjs/component/score/Donut.js.map +1 -1
  5. package/lib/cjs/component/score/Line.js +104 -108
  6. package/lib/cjs/component/score/Line.js.map +1 -1
  7. package/lib/cjs/component/score/Line.types.js.map +1 -1
  8. package/lib/cjs/component/score/index.js +3 -3
  9. package/lib/cjs/component/trend/Bar.js +83 -96
  10. package/lib/cjs/component/trend/Bar.js.map +1 -1
  11. package/lib/cjs/component/trend/Line.js +114 -135
  12. package/lib/cjs/component/trend/Line.js.map +1 -1
  13. package/lib/cjs/component/trend/Trend.js +43 -65
  14. package/lib/cjs/component/trend/Trend.js.map +1 -1
  15. package/lib/cjs/component/trend/index.js +4 -4
  16. package/lib/cjs/index.js +3 -3
  17. package/lib/cjs/index.js.map +1 -1
  18. package/lib/cjs/utils/ScoreDonutUtils.js +48 -75
  19. package/lib/cjs/utils/ScoreDonutUtils.js.map +1 -1
  20. package/lib/es6/component/score/Donut.js +80 -93
  21. package/lib/es6/component/score/Donut.js.map +1 -1
  22. package/lib/es6/component/score/Line.js +99 -103
  23. package/lib/es6/component/score/Line.js.map +1 -1
  24. package/lib/es6/component/score/Line.types.js.map +1 -1
  25. package/lib/es6/component/trend/Bar.js +78 -91
  26. package/lib/es6/component/trend/Bar.js.map +1 -1
  27. package/lib/es6/component/trend/Line.js +109 -130
  28. package/lib/es6/component/trend/Line.js.map +1 -1
  29. package/lib/es6/component/trend/Trend.js +41 -64
  30. package/lib/es6/component/trend/Trend.js.map +1 -1
  31. package/lib/es6/index.js +8 -8
  32. package/lib/es6/index.js.map +1 -1
  33. package/lib/es6/utils/ScoreDonutUtils.js +43 -71
  34. package/lib/es6/utils/ScoreDonutUtils.js.map +1 -1
  35. package/lib/esm/component/score/Donut.mjs +80 -79
  36. package/lib/esm/component/score/Line.mjs +100 -91
  37. package/lib/esm/component/trend/Bar.mjs +79 -82
  38. package/lib/esm/component/trend/Line.mjs +110 -116
  39. package/lib/esm/component/trend/Trend.mjs +41 -61
  40. package/lib/esm/index.mjs +1 -1
  41. package/lib/esm/utils/ScoreDonutUtils.mjs +43 -71
  42. package/lib/types/component/score/Donut.d.ts +7 -12
  43. package/lib/types/component/score/Line.types.d.ts +8 -6
  44. package/lib/types/component/trend/Bar.d.ts +2 -8
  45. package/lib/types/component/trend/Line.d.ts +6 -10
  46. package/lib/types/component/trend/Trend.d.ts +3 -3
  47. package/package.json +5 -5
@@ -1,9 +1,6 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
- var ScoreDonutUtils = /* @__PURE__ */ (function() {
5
- function ScoreDonutUtils2(value, isSemiDonut) {
6
- _classCallCheck(this, ScoreDonutUtils2);
2
+ class ScoreDonutUtils {
3
+ constructor(value, isSemiDonut) {
7
4
  _defineProperty(this, "isSemiDonut", void 0);
8
5
  _defineProperty(this, "value", void 0);
9
6
  _defineProperty(this, "radius", void 0);
@@ -11,72 +8,47 @@ var ScoreDonutUtils = /* @__PURE__ */ (function() {
11
8
  this.radius = isSemiDonut ? 9 : 10;
12
9
  this.value = Math.max(Math.min(value, 100), 0);
13
10
  }
14
- return _createClass(ScoreDonutUtils2, [{
15
- key: "viewBox",
16
- get: function get() {
17
- return this.isSemiDonut ? "0 0 24 12" : "0 0 24 24";
18
- }
19
- }, {
20
- key: "strokeWidth",
21
- get: function get() {
22
- return this.isSemiDonut ? 6 : 4;
23
- }
24
- }, {
25
- key: "fullLength",
26
- get: function get() {
27
- return this.isSemiDonut ? Math.PI * this.radius : 2 * Math.PI * this.radius;
28
- }
29
- }, {
30
- key: "point",
31
- get: function get() {
32
- return this.isSemiDonut ? this.fullLength / (100 / 3) : this.fullLength / 100;
33
- }
34
- }, {
35
- key: "valueLength",
36
- get: function get() {
37
- return this.fullLength * (this.value / 100);
38
- }
39
- }, {
40
- key: "animatedValueLength",
41
- get: function get() {
42
- return Math.min(this.valueLength, this.fullLength - this.startMargin - this.endMargin);
43
- }
44
- }, {
45
- key: "startMargin",
46
- get: function get() {
47
- var margin = 0;
48
- if (this.value > 0) margin = this.point;
49
- return margin;
50
- }
51
- }, {
52
- key: "endMargin",
53
- get: function get() {
54
- var margin = 0;
55
- if (!this.isSemiDonut && this.value > 0) margin = this.point;
56
- return margin;
57
- }
58
- }, {
59
- key: "baseOffset",
60
- get: function get() {
61
- return -1 * (this.valueLength + this.startMargin);
62
- }
63
- }, {
64
- key: "baseLength",
65
- get: function get() {
66
- return Math.max(this.fullLength - this.valueLength - this.startMargin - this.endMargin, 0);
67
- }
68
- }, {
69
- key: "animatedBaseLengthFrom",
70
- get: function get() {
71
- return this.fullLength - this.startMargin - this.endMargin;
72
- }
73
- }, {
74
- key: "animatedBaseLengthTo",
75
- get: function get() {
76
- return this.fullLength - this.valueLength - this.startMargin - this.endMargin;
77
- }
78
- }]);
79
- })();
11
+ get viewBox() {
12
+ return this.isSemiDonut ? "0 0 24 12" : "0 0 24 24";
13
+ }
14
+ get strokeWidth() {
15
+ return this.isSemiDonut ? 6 : 4;
16
+ }
17
+ get fullLength() {
18
+ return this.isSemiDonut ? Math.PI * this.radius : 2 * Math.PI * this.radius;
19
+ }
20
+ get point() {
21
+ return this.isSemiDonut ? this.fullLength / (100 / 3) : this.fullLength / 100;
22
+ }
23
+ get valueLength() {
24
+ return this.fullLength * (this.value / 100);
25
+ }
26
+ get animatedValueLength() {
27
+ return Math.min(this.valueLength, this.fullLength - this.startMargin - this.endMargin);
28
+ }
29
+ get startMargin() {
30
+ let margin = 0;
31
+ if (this.value > 0) margin = this.point;
32
+ return margin;
33
+ }
34
+ get endMargin() {
35
+ let margin = 0;
36
+ if (!this.isSemiDonut && this.value > 0) margin = this.point;
37
+ return margin;
38
+ }
39
+ get baseOffset() {
40
+ return -1 * (this.valueLength + this.startMargin);
41
+ }
42
+ get baseLength() {
43
+ return Math.max(this.fullLength - this.valueLength - this.startMargin - this.endMargin, 0);
44
+ }
45
+ get animatedBaseLengthFrom() {
46
+ return this.fullLength - this.startMargin - this.endMargin;
47
+ }
48
+ get animatedBaseLengthTo() {
49
+ return this.fullLength - this.valueLength - this.startMargin - this.endMargin;
50
+ }
51
+ }
80
52
  export {
81
53
  ScoreDonutUtils
82
54
  };
@@ -1,14 +1,9 @@
1
- import { type ComponentType } from '@semcore/core';
2
- import resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';
3
- import { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';
4
- import { type BoxProps } from '@semcore/flex-box';
1
+ import { type BoxProps } from '@semcore/base-components';
5
2
  import type { CommonScoreProps } from './Score';
6
3
  export type ScoreDonutProps = BoxProps & CommonScoreProps;
7
- type Enhances = {
8
- resolveColor: ReturnType<typeof resolveColorEnhance>;
9
- duration: ReturnType<typeof cssVariableEnhance>;
10
- isSemiDonut?: true;
11
- };
12
- export declare const ScoreDonut: ComponentType<ScoreDonutProps, {}, {}, Enhances>;
13
- export declare const ScoreSemiDonut: ComponentType<ScoreDonutProps, {}, {}, Enhances>;
14
- export {};
4
+ export declare const ScoreDonut: import("@semcore/core").Intergalactic.Component<"svg", ScoreDonutProps, {}, readonly [<T extends {}>(props: T) => T & {
5
+ duration: string;
6
+ }, (props: any) => any]>;
7
+ export declare const ScoreSemiDonut: import("@semcore/core").Intergalactic.Component<"svg", ScoreDonutProps, {}, readonly [<T extends {}>(props: T) => T & {
8
+ duration: string;
9
+ }, (props: any) => any]>;
@@ -1,6 +1,6 @@
1
- import type { Intergalactic, ComponentType } from '@semcore/core';
1
+ import type { BoxProps, Box } from '@semcore/base-components';
2
+ import type { Intergalactic } from '@semcore/core';
2
3
  import type resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';
3
- import type { BoxProps, Box } from '@semcore/flex-box';
4
4
  import type React from 'react';
5
5
  import type { CommonScoreProps } from './Score';
6
6
  type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N ? Acc[number] : Enumerate<N, [...Acc, Acc['length']]>;
@@ -39,10 +39,12 @@ type CustomRenderScoreProps = {
39
39
  children: SegmentComponent[];
40
40
  };
41
41
  export type ScoreLineGaugeProps = BoxProps & Intergalactic.InternalTypings.EfficientOmit<CommonScoreProps, 'value' | 'color'> & (ValuedScoreProps | CustomRenderScoreProps);
42
- export type Enhances = {
43
- resolveColor: ReturnType<typeof resolveColorEnhance>;
44
- };
45
- export type ScoreLineComponent = ComponentType<ScoreLineGaugeProps, {}, {}, Enhances> & {
42
+ export type Enhances = [
43
+ () => {
44
+ resolveColor: ReturnType<typeof resolveColorEnhance>;
45
+ }
46
+ ];
47
+ export type ScoreLineComponent = Intergalactic.Component<'svg', ScoreLineGaugeProps, {}, Enhances> & {
46
48
  Segment: Intergalactic.Component<typeof Box, SegmentProps>;
47
49
  };
48
50
  export {};
@@ -1,5 +1,3 @@
1
- import { type ComponentType } from '@semcore/core';
2
- import resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';
3
1
  import { type CommonTrendProps } from './Trend';
4
2
  type BarItem = {
5
3
  /**
@@ -17,10 +15,6 @@ export type TrendBarProps = CommonTrendProps & {
17
15
  */
18
16
  data: BarItem[];
19
17
  };
20
- type Enhances = {
21
- resolveColor: ReturnType<typeof resolveColorEnhance>;
22
- isHistogram?: true;
23
- };
24
- export declare const TrendBar: ComponentType<TrendBarProps, {}, {}, Enhances>;
25
- export declare const TrendHistogram: ComponentType<TrendBarProps, {}, {}, Enhances>;
18
+ export declare const TrendBar: import("@semcore/core").Intergalactic.Component<"svg", TrendBarProps, {}, readonly [(props: any) => any]>;
19
+ export declare const TrendHistogram: import("@semcore/core").Intergalactic.Component<"svg", TrendBarProps, {}, readonly [(props: any) => any]>;
26
20
  export {};
@@ -1,5 +1,3 @@
1
- import { type ComponentType } from '@semcore/core';
2
- import resolveColorEnhance from '@semcore/core/lib/utils/enhances/resolveColorEnhance';
3
1
  import { type CommonTrendProps } from './Trend';
4
2
  export type TrendLineProps = CommonTrendProps & {
5
3
  /**
@@ -19,11 +17,9 @@ export type TrendLineProps = CommonTrendProps & {
19
17
  */
20
18
  lastPointRadius?: number;
21
19
  };
22
- type Enhances = {
23
- uid: string;
24
- resolveColor: ReturnType<typeof resolveColorEnhance>;
25
- withArea?: true;
26
- };
27
- export declare const TrendLine: ComponentType<TrendLineProps, {}, {}, Enhances>;
28
- export declare const TrendArea: ComponentType<TrendLineProps, {}, {}, Enhances>;
29
- export {};
20
+ export declare const TrendLine: import("@semcore/core").Intergalactic.Component<"svg", TrendLineProps, {}, readonly [(props: any) => any, (props: any) => {
21
+ uid: ReturnType<typeof import("@semcore/core/lib/utils/uniqueID").useUID>;
22
+ }]>;
23
+ export declare const TrendArea: import("@semcore/core").Intergalactic.Component<"svg", TrendLineProps, {}, readonly [(props: any) => any, (props: any) => {
24
+ uid: ReturnType<typeof import("@semcore/core/lib/utils/uniqueID").useUID>;
25
+ }]>;
@@ -1,5 +1,5 @@
1
+ import type { BoxProps } from '@semcore/base-components';
1
2
  import { Component } from '@semcore/core';
2
- import type { BoxProps } from '@semcore/flex-box';
3
3
  import React from 'react';
4
4
  export type CommonTrendProps = BoxProps & {
5
5
  /**
@@ -17,10 +17,10 @@ export type CommonTrendProps = BoxProps & {
17
17
  */
18
18
  data: any[];
19
19
  };
20
- export declare abstract class Trend<P extends CommonTrendProps, E extends readonly ((...args: any[]) => any)[]> extends Component<P, {}, {
20
+ export declare abstract class Trend<P extends CommonTrendProps, E extends readonly ((...args: any[]) => any)[]> extends Component<P, E, Readonly<{}>, {
21
21
  width: number;
22
22
  height: number;
23
- }, E> {
23
+ }> {
24
24
  state: {
25
25
  width: number;
26
26
  height: number;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/mini-chart",
3
3
  "description": "Semrush MiniChart Component",
4
- "version": "16.1.1-prerelease.5",
4
+ "version": "17.0.0-prerelease.17",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -14,8 +14,7 @@
14
14
  "types": "./lib/types/index.d.ts"
15
15
  },
16
16
  "peerDependencies": {
17
- "@semcore/base-components": "^16.4.1-prerelease.5",
18
- "@semcore/flex-box": "^16.0.11-prerelease.5"
17
+ "@semcore/base-components": "^17.0.0-prerelease.17"
19
18
  },
20
19
  "repository": {
21
20
  "type": "git",
@@ -23,8 +22,9 @@
23
22
  "directory": "semcore/mini-chart"
24
23
  },
25
24
  "devDependencies": {
26
- "@semcore/core": "16.5.1-prerelease.5",
27
- "@semcore/testing-utils": "1.0.0"
25
+ "@semcore/testing-utils": "1.0.0",
26
+ "@semcore/core": "17.0.0-prerelease.17",
27
+ "@semcore/base-components": "17.0.0-prerelease.17"
28
28
  },
29
29
  "scripts": {
30
30
  "build": "pnpm semcore-builder --source=ts && pnpm vite build"