@validationcloud/fractal-ui 1.51.0 → 1.53.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/dist/assets/vc-logo.svg.js +4 -0
- package/dist/components/echarts-renderer/calculate-title-layout.d.ts +8 -0
- package/dist/components/echarts-renderer/calculate-title-layout.js +72 -0
- package/dist/components/echarts-renderer/calculate-title-layout.test.d.ts +1 -0
- package/dist/components/echarts-renderer/detect-horizontal-bars.d.ts +13 -0
- package/dist/components/echarts-renderer/detect-horizontal-bars.js +13 -0
- package/dist/components/echarts-renderer/mavrik-chart.d.ts +19 -0
- package/dist/components/echarts-renderer/mavrik-chart.js +12 -0
- package/dist/components/echarts-renderer/mavrik-theme-horizontal.json.d.ts +277 -0
- package/dist/components/echarts-renderer/mavrik-theme-horizontal.json.js +33 -0
- package/dist/components/echarts-renderer/mavrik-theme.d.ts +246 -0
- package/dist/components/echarts-renderer/mavrik-theme.js +18 -6
- package/dist/components/echarts-renderer/mavrik-theme.json.d.ts +15 -7
- package/dist/components/echarts-renderer/mavrik-theme.json.js +18 -18
- package/dist/components/echarts-renderer/sanitize-chart-options.d.ts +6 -0
- package/dist/components/echarts-renderer/sanitize-chart-options.js +9 -0
- package/dist/components/echarts-renderer/use-chart-instance.d.ts +0 -1
- package/dist/components/echarts-renderer/use-chart-instance.js +54 -37
- package/dist/components/echarts-renderer/watermark-graphic.d.ts +12 -0
- package/dist/components/echarts-renderer/watermark-graphic.js +25 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +57 -54
- package/dist/lib/render-chart-to-image.js +36 -19
- package/dist/lib/render-mavrik-chart-to-image.d.ts +33 -0
- package/package.json +19 -15
package/dist/index.js
CHANGED
|
@@ -2,68 +2,71 @@ import { AnimatedLoader as t } from "./components/animated-loader/animated-loade
|
|
|
2
2
|
import { Badge as p } from "./components/badge/badge.js";
|
|
3
3
|
import { Box as x } from "./components/box/box.js";
|
|
4
4
|
import { Button as n } from "./components/button/button.js";
|
|
5
|
-
import { EChartsRenderer as
|
|
5
|
+
import { EChartsRenderer as i } from "./components/echarts-renderer/echarts-renderer.js";
|
|
6
6
|
import { EChartsThemeOption as u, isEChartsThemeOption as h } from "./components/echarts-renderer/echarts-theme-option.js";
|
|
7
|
-
import { EChartsChartOption as
|
|
7
|
+
import { EChartsChartOption as C, isEChartsChartOption as l } from "./components/echarts-renderer/echarts-chart-option.js";
|
|
8
8
|
import { useChartInstance as T } from "./components/echarts-renderer/use-chart-instance.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
9
|
+
import { MavrikChart as E } from "./components/echarts-renderer/mavrik-chart.js";
|
|
10
|
+
import { MAVRIK_THEME as B, MAVRIK_THEME_HORIZONTAL as g } from "./components/echarts-renderer/mavrik-theme.js";
|
|
11
|
+
import { ClientModal as O } from "./components/client-modal/client-modal.js";
|
|
12
|
+
import { CopyButton as A } from "./components/copy-button/copy-button.js";
|
|
13
|
+
import { DecoratedIcon as P } from "./components/decorated-icon/decorated-icon.js";
|
|
14
|
+
import { DropdownMenu as v, DropdownMenuItem as H } from "./components/dropdown-menu/dropdown-menu.js";
|
|
15
|
+
import { ErrorBoundary as _ } from "./components/error-boundary/error-boundary.js";
|
|
16
|
+
import { ScrollArea as y } from "./components/scroll-area/index.js";
|
|
17
|
+
import { Icon as N } from "./components/icon/icon.js";
|
|
18
|
+
import { IconButton as V } from "./components/icon-button/icon-button.js";
|
|
19
|
+
import { InputButton as F } from "./components/input-button/input-button.js";
|
|
20
|
+
import { MountSvgSprite as j } from "./components/mount-svg-sprite/mount-svg-sprite.js";
|
|
21
|
+
import { NotFoundComponent as z } from "./components/not-found-component/not-found-component.js";
|
|
22
|
+
import { PagePadding as J } from "./components/page-padding/page-padding.js";
|
|
23
|
+
import { ProtocolLogo as W } from "./components/protocol-logo/protocol-logo.js";
|
|
24
|
+
import { Skeleton as Y } from "./components/skeleton/skeleton.js";
|
|
25
|
+
import { Switch as oo } from "./components/switch/switch.js";
|
|
26
|
+
import { TextInput as to } from "./components/text-input/text-input.js";
|
|
27
|
+
import { Tooltip as po } from "./components/tooltip/tooltip.js";
|
|
28
|
+
import { TooltipProvider as xo } from "./components/tooltip-provider/tooltip-provider.js";
|
|
29
|
+
import { TouchTarget as no } from "./components/touch-target/touch-target.js";
|
|
30
|
+
import { twMerge as io } from "./lib/tailwind-merge.js";
|
|
31
|
+
import { UserDropdown as ho } from "./components/user-dropdown/user-dropdown.js";
|
|
32
|
+
import { UserDropdownMobile as Co } from "./components/user-dropdown-mobile/user-dropdown-mobile.js";
|
|
33
|
+
import { useScrollToBottom as Mo } from "./hooks/use-scroll-to-bottom.js";
|
|
33
34
|
export {
|
|
34
35
|
t as AnimatedLoader,
|
|
35
36
|
p as Badge,
|
|
36
37
|
x as Box,
|
|
37
38
|
n as Button,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
O as ClientModal,
|
|
40
|
+
A as CopyButton,
|
|
41
|
+
P as DecoratedIcon,
|
|
42
|
+
v as DropdownMenu,
|
|
43
|
+
H as DropdownMenuItem,
|
|
44
|
+
C as EChartsChartOption,
|
|
45
|
+
i as EChartsRenderer,
|
|
45
46
|
u as EChartsThemeOption,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
W as
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
47
|
+
_ as ErrorBoundary,
|
|
48
|
+
N as Icon,
|
|
49
|
+
V as IconButton,
|
|
50
|
+
F as InputButton,
|
|
51
|
+
B as MAVRIK_THEME,
|
|
52
|
+
g as MAVRIK_THEME_HORIZONTAL,
|
|
53
|
+
E as MavrikChart,
|
|
54
|
+
j as MountSvgSprite,
|
|
55
|
+
z as NotFoundComponent,
|
|
56
|
+
J as PagePadding,
|
|
57
|
+
W as ProtocolLogo,
|
|
58
|
+
y as ScrollArea,
|
|
59
|
+
Y as Skeleton,
|
|
60
|
+
oo as Switch,
|
|
61
|
+
to as TextInput,
|
|
62
|
+
po as Tooltip,
|
|
63
|
+
xo as TooltipProvider,
|
|
64
|
+
no as TouchTarget,
|
|
65
|
+
ho as UserDropdown,
|
|
66
|
+
Co as UserDropdownMobile,
|
|
67
|
+
l as isEChartsChartOption,
|
|
65
68
|
h as isEChartsThemeOption,
|
|
66
|
-
|
|
69
|
+
io as twMerge,
|
|
67
70
|
T as useChartInstance,
|
|
68
|
-
|
|
71
|
+
Mo as useScrollToBottom
|
|
69
72
|
};
|
|
@@ -1,34 +1,51 @@
|
|
|
1
|
-
import { createCanvas as
|
|
2
|
-
import { randomUUID as
|
|
3
|
-
import { createRequire as
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { createCanvas as u } from "canvas";
|
|
2
|
+
import { randomUUID as l } from "node:crypto";
|
|
3
|
+
import { createRequire as d } from "node:module";
|
|
4
|
+
import { calculateTitleLayout as O } from "../components/echarts-renderer/calculate-title-layout.js";
|
|
5
|
+
import { addWatermarkToOptions as y } from "../components/echarts-renderer/watermark-graphic.js";
|
|
6
|
+
const T = d(import.meta.url), b = /* @__PURE__ */ new Set([
|
|
7
|
+
"aria",
|
|
8
|
+
// Tries to set DOM attributes which node-canvas doesn't implement
|
|
9
|
+
"toolbox",
|
|
10
|
+
// Export/zoom/reset buttons - not useful in static image
|
|
11
|
+
"dataZoom",
|
|
12
|
+
// Interactive range slider
|
|
13
|
+
"brush",
|
|
14
|
+
// Selection tool
|
|
15
|
+
"axisPointer"
|
|
16
|
+
// Crosshair on hover
|
|
17
|
+
]);
|
|
18
|
+
function j(r) {
|
|
6
19
|
if (!r || typeof r != "object" || Array.isArray(r))
|
|
7
20
|
return { animation: !1 };
|
|
8
|
-
const
|
|
9
|
-
|
|
21
|
+
const t = Object.fromEntries(
|
|
22
|
+
Object.entries(r).filter(([e]) => !b.has(e))
|
|
23
|
+
);
|
|
24
|
+
return t.animation = !1, t;
|
|
10
25
|
}
|
|
11
|
-
function
|
|
26
|
+
function g({
|
|
12
27
|
option: r,
|
|
13
|
-
theme:
|
|
14
|
-
width:
|
|
15
|
-
height:
|
|
28
|
+
theme: t,
|
|
29
|
+
width: e = 800,
|
|
30
|
+
height: o = 600,
|
|
16
31
|
devicePixelRatio: c = 2
|
|
17
32
|
}) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
33
|
+
const n = T("echarts");
|
|
34
|
+
let a;
|
|
35
|
+
t && typeof t == "object" && (a = `theme-${l()}`, n.registerTheme(a, t));
|
|
36
|
+
const i = u(e, o), s = n.init(i, a, {
|
|
21
37
|
renderer: "canvas",
|
|
22
38
|
devicePixelRatio: c,
|
|
23
|
-
width:
|
|
24
|
-
height:
|
|
39
|
+
width: e,
|
|
40
|
+
height: o
|
|
25
41
|
});
|
|
26
42
|
try {
|
|
27
|
-
|
|
43
|
+
const m = j(r), f = O(m, e, t), p = y(f);
|
|
44
|
+
return s.setOption(p), i.toBuffer("image/png");
|
|
28
45
|
} finally {
|
|
29
|
-
|
|
46
|
+
s.dispose();
|
|
30
47
|
}
|
|
31
48
|
}
|
|
32
49
|
export {
|
|
33
|
-
|
|
50
|
+
g as renderChartToImage
|
|
34
51
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { EChartsOption } from 'echarts';
|
|
2
|
+
export interface RenderMavrikChartToImageOptions {
|
|
3
|
+
option: EChartsOption;
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
devicePixelRatio?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Renders an ECharts chart to a PNG image buffer using the Mavrik theme.
|
|
10
|
+
*
|
|
11
|
+
* Automatically selects the correct theme variant based on chart type:
|
|
12
|
+
* - Vertical bars: gradient flows top-to-bottom
|
|
13
|
+
* - Horizontal bars: gradient flows left-to-right
|
|
14
|
+
*
|
|
15
|
+
* For custom themes, use renderChartToImage directly.
|
|
16
|
+
*
|
|
17
|
+
* @param options - Chart configuration and rendering options
|
|
18
|
+
* @returns PNG image buffer
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const buffer = renderMavrikChartToImage({
|
|
23
|
+
* option: {
|
|
24
|
+
* xAxis: { type: 'category', data: ['Mon', 'Tue', 'Wed'] },
|
|
25
|
+
* yAxis: { type: 'value' },
|
|
26
|
+
* series: [{ data: [120, 200, 150], type: 'bar' }]
|
|
27
|
+
* },
|
|
28
|
+
* width: 800,
|
|
29
|
+
* height: 600
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function renderMavrikChartToImage({ option, width, height, devicePixelRatio, }: RenderMavrikChartToImageOptions): Buffer;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@validationcloud/fractal-ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.53.0",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"url": "https://github.com/validationcloud/fractal-ui/issues"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
+
"prebuild": "pnpm run generate:theme",
|
|
20
21
|
"build": "vite build",
|
|
21
22
|
"lint": "eslint",
|
|
22
23
|
"storybook": "storybook dev -p 6006",
|
|
@@ -25,7 +26,8 @@
|
|
|
25
26
|
"format:check": "prettier --check .",
|
|
26
27
|
"typecheck": "tsc -b --noEmit",
|
|
27
28
|
"test": "vitest run",
|
|
28
|
-
"prepublishOnly": "pnpm build"
|
|
29
|
+
"prepublishOnly": "pnpm build",
|
|
30
|
+
"generate:theme": "node --experimental-transform-types scripts/generate-mavrik-theme.ts"
|
|
29
31
|
},
|
|
30
32
|
"exports": {
|
|
31
33
|
".": {
|
|
@@ -38,7 +40,7 @@
|
|
|
38
40
|
},
|
|
39
41
|
"./tailwind.css": "./dist/styles/tailwind.css"
|
|
40
42
|
},
|
|
41
|
-
"packageManager": "pnpm@10.
|
|
43
|
+
"packageManager": "pnpm@10.25.0",
|
|
42
44
|
"engines": {
|
|
43
45
|
"node": ">=22.14.0"
|
|
44
46
|
},
|
|
@@ -51,37 +53,39 @@
|
|
|
51
53
|
"zod": "^4"
|
|
52
54
|
},
|
|
53
55
|
"devDependencies": {
|
|
54
|
-
"@eslint/compat": "^
|
|
56
|
+
"@eslint/compat": "^2.0.0",
|
|
55
57
|
"@eslint/js": "^9.39.1",
|
|
56
|
-
"@storybook/addon-docs": "^10.
|
|
57
|
-
"@storybook/addon-onboarding": "^10.
|
|
58
|
-
"@storybook/react-vite": "^10.
|
|
58
|
+
"@storybook/addon-docs": "^10.1.5",
|
|
59
|
+
"@storybook/addon-onboarding": "^10.1.5",
|
|
60
|
+
"@storybook/react-vite": "^10.1.5",
|
|
59
61
|
"@tailwindcss/postcss": "^4",
|
|
60
62
|
"@trivago/prettier-plugin-sort-imports": "^6.0.0",
|
|
63
|
+
"@types/culori": "^4.0.1",
|
|
61
64
|
"@types/node": "^24",
|
|
62
65
|
"@types/react": "^19",
|
|
63
66
|
"@types/react-dom": "^19",
|
|
64
|
-
"@vitejs/plugin-react": "^5.1.
|
|
67
|
+
"@vitejs/plugin-react": "^5.1.2",
|
|
65
68
|
"canvas": "^3.2.0",
|
|
69
|
+
"culori": "^4.0.2",
|
|
66
70
|
"echarts": "^6.0.0",
|
|
67
71
|
"eslint": "^9.39.1",
|
|
68
72
|
"eslint-config-prettier": "^10.1.8",
|
|
69
73
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
70
74
|
"eslint-plugin-react-refresh": "^0.4.24",
|
|
71
|
-
"eslint-plugin-storybook": "^10.
|
|
75
|
+
"eslint-plugin-storybook": "^10.1.5",
|
|
72
76
|
"globals": "^16.5.0",
|
|
73
77
|
"postcss": "^8.5.6",
|
|
74
|
-
"prettier": "3.
|
|
75
|
-
"prettier-plugin-tailwindcss": "^0.7.
|
|
78
|
+
"prettier": "3.7.4",
|
|
79
|
+
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
76
80
|
"rollup-plugin-analyzer": "^4.0.0",
|
|
77
81
|
"rollup-plugin-copy": "^3.5.0",
|
|
78
82
|
"rollup-preserve-directives": "^1.1.3",
|
|
79
83
|
"semantic-release": "^25.0.2",
|
|
80
|
-
"storybook": "^10.
|
|
81
|
-
"tailwindcss": "^4.1.
|
|
84
|
+
"storybook": "^10.1.5",
|
|
85
|
+
"tailwindcss": "^4.1.17",
|
|
82
86
|
"typescript": "^5",
|
|
83
|
-
"typescript-eslint": "^8.
|
|
84
|
-
"vite": "^7.
|
|
87
|
+
"typescript-eslint": "^8.49.0",
|
|
88
|
+
"vite": "^7.2.7",
|
|
85
89
|
"vite-plugin-dts": "^4.5.4",
|
|
86
90
|
"vitest": "^4.0.15"
|
|
87
91
|
},
|