@pyreon/charts 0.9.0 → 0.11.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/lib/analysis/index.js.html +1 -1
- package/lib/analysis/manual.js.html +1 -1
- package/lib/{charts-Ckh2qxB5.js → charts-lo2KeDld.js} +164 -164
- package/lib/charts-lo2KeDld.js.map +1 -0
- package/lib/{components-BcPePBeS.js → components-ClWy1Ztp.js} +128 -128
- package/lib/components-ClWy1Ztp.js.map +1 -0
- package/lib/{core-9w0g6EOI.js → core-BiuQ3y-t.js} +11 -11
- package/lib/core-BiuQ3y-t.js.map +1 -0
- package/lib/{createSeriesData-DOHScdgk.js → createSeriesData-BGy-6PqI.js} +6 -6
- package/lib/createSeriesData-BGy-6PqI.js.map +1 -0
- package/lib/{customGraphicKeyframeAnimation-CvkEkSt_.js → customGraphicKeyframeAnimation-BIbJI8ew.js} +61 -61
- package/lib/customGraphicKeyframeAnimation-BIbJI8ew.js.map +1 -0
- package/lib/{graphic-CPJ2K90a.js → graphic-Bt7SEwll.js} +59 -59
- package/lib/graphic-Bt7SEwll.js.map +1 -0
- package/lib/index.js +60 -52
- package/lib/index.js.map +1 -1
- package/lib/manual.js +60 -52
- package/lib/manual.js.map +1 -1
- package/lib/{parseGeoJson-BlBe5Vig.js → parseGeoJson-NjUY1feF.js} +115 -115
- package/lib/parseGeoJson-NjUY1feF.js.map +1 -0
- package/lib/{renderers-Dytryvoy.js → renderers-BnAAXHfG.js} +16 -16
- package/lib/renderers-BnAAXHfG.js.map +1 -0
- package/lib/types/index.d.ts +3 -3
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/manual.d.ts +3 -3
- package/lib/types/manual.d.ts.map +1 -1
- package/package.json +14 -7
- package/src/chart-component.tsx +18 -10
- package/src/index.ts +3 -3
- package/src/loader.ts +70 -73
- package/src/manual.ts +4 -4
- package/src/tests/charts.test.tsx +431 -126
- package/src/types.ts +8 -9
- package/src/use-chart.ts +8 -8
- package/lib/charts-Ckh2qxB5.js.map +0 -1
- package/lib/components-BcPePBeS.js.map +0 -1
- package/lib/core-9w0g6EOI.js.map +0 -1
- package/lib/createSeriesData-DOHScdgk.js.map +0 -1
- package/lib/customGraphicKeyframeAnimation-CvkEkSt_.js.map +0 -1
- package/lib/graphic-CPJ2K90a.js.map +0 -1
- package/lib/parseGeoJson-BlBe5Vig.js.map +0 -1
- package/lib/renderers-Dytryvoy.js.map +0 -1
package/src/types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Props } from
|
|
2
|
-
import type { Signal } from
|
|
3
|
-
import type { ComposeOption, EChartsOption, SetOptionOpts } from
|
|
4
|
-
import type { ECharts } from
|
|
1
|
+
import type { Props } from "@pyreon/core"
|
|
2
|
+
import type { Signal } from "@pyreon/reactivity"
|
|
3
|
+
import type { ComposeOption, EChartsOption, SetOptionOpts } from "echarts"
|
|
4
|
+
import type { ECharts } from "echarts/core"
|
|
5
5
|
|
|
6
6
|
// ─── Re-export ECharts types for consumer convenience ────────────────────────
|
|
7
7
|
|
|
@@ -30,7 +30,7 @@ export type {
|
|
|
30
30
|
TreemapSeriesOption,
|
|
31
31
|
TreeSeriesOption,
|
|
32
32
|
VisualMapComponentOption,
|
|
33
|
-
} from
|
|
33
|
+
} from "echarts"
|
|
34
34
|
export type { ComposeOption, ECharts, EChartsOption, SetOptionOpts }
|
|
35
35
|
|
|
36
36
|
// ─── Event types (duck-typed to avoid echarts dual-package type conflicts) ───
|
|
@@ -60,7 +60,7 @@ export interface UseChartConfig {
|
|
|
60
60
|
/** ECharts theme — 'dark', a registered theme name, or a theme object */
|
|
61
61
|
theme?: string | Record<string, unknown>
|
|
62
62
|
/** Renderer — 'canvas' (default, best performance) or 'svg' */
|
|
63
|
-
renderer?:
|
|
63
|
+
renderer?: "canvas" | "svg"
|
|
64
64
|
/** ECharts locale — 'EN' (default), 'ZH', etc. */
|
|
65
65
|
locale?: string
|
|
66
66
|
/** Whether to replace all options instead of merging — default: false */
|
|
@@ -97,14 +97,13 @@ export interface UseChartResult {
|
|
|
97
97
|
* Props for the <Chart /> component.
|
|
98
98
|
* Generic parameter narrows the option type for exact autocomplete.
|
|
99
99
|
*/
|
|
100
|
-
export interface ChartProps<TOption extends EChartsOption = EChartsOption>
|
|
101
|
-
extends Props {
|
|
100
|
+
export interface ChartProps<TOption extends EChartsOption = EChartsOption> extends Props {
|
|
102
101
|
/** Reactive ECharts option config — fully typed */
|
|
103
102
|
options: () => TOption
|
|
104
103
|
/** ECharts theme */
|
|
105
104
|
theme?: string | Record<string, unknown>
|
|
106
105
|
/** Renderer — 'canvas' (default) or 'svg' */
|
|
107
|
-
renderer?:
|
|
106
|
+
renderer?: "canvas" | "svg"
|
|
108
107
|
/** CSS style for the container div */
|
|
109
108
|
style?: string
|
|
110
109
|
/** CSS class for the container div */
|
package/src/use-chart.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { onUnmount } from
|
|
2
|
-
import { effect, signal } from
|
|
3
|
-
import type { EChartsOption } from
|
|
4
|
-
import { ensureModules } from
|
|
5
|
-
import type { UseChartConfig, UseChartResult } from
|
|
1
|
+
import { onUnmount } from "@pyreon/core"
|
|
2
|
+
import { effect, signal } from "@pyreon/reactivity"
|
|
3
|
+
import type { EChartsOption } from "echarts"
|
|
4
|
+
import { ensureModules } from "./loader"
|
|
5
|
+
import type { UseChartConfig, UseChartResult } from "./types"
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Reactive ECharts hook. Creates a chart instance bound to a container
|
|
@@ -32,11 +32,11 @@ export function useChart<TOption extends EChartsOption = EChartsOption>(
|
|
|
32
32
|
optionsFn: () => TOption,
|
|
33
33
|
config?: UseChartConfig,
|
|
34
34
|
): UseChartResult {
|
|
35
|
-
const instance = signal<import(
|
|
35
|
+
const instance = signal<import("echarts/core").ECharts | null>(null)
|
|
36
36
|
const loading = signal(true)
|
|
37
37
|
const error = signal<Error | null>(null)
|
|
38
38
|
const container = signal<HTMLElement | null>(null)
|
|
39
|
-
const renderer = config?.renderer ??
|
|
39
|
+
const renderer = config?.renderer ?? "canvas"
|
|
40
40
|
|
|
41
41
|
let observer: ResizeObserver | null = null
|
|
42
42
|
let initialized = false
|
|
@@ -64,7 +64,7 @@ export function useChart<TOption extends EChartsOption = EChartsOption>(
|
|
|
64
64
|
if (!container.peek()) return
|
|
65
65
|
|
|
66
66
|
try {
|
|
67
|
-
const chart = core.init(el, config?.theme as
|
|
67
|
+
const chart = core.init(el, (config?.theme ?? null) as string | object | null, {
|
|
68
68
|
renderer,
|
|
69
69
|
...(config?.locale != null ? { locale: config.locale } : {}),
|
|
70
70
|
...(config?.devicePixelRatio != null
|