@pyreon/charts 0.11.5 → 0.11.6
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/README.md +31 -31
- package/lib/index.js.map +1 -1
- package/lib/manual.js.map +1 -1
- package/lib/types/index.d.ts +2 -2
- package/lib/types/manual.d.ts +2 -2
- package/package.json +18 -18
- package/src/chart-component.tsx +9 -9
- package/src/index.ts +3 -3
- package/src/loader.ts +54 -54
- package/src/manual.ts +4 -9
- package/src/tests/charts.test.tsx +178 -178
- package/src/types.ts +7 -7
- package/src/use-chart.ts +7 -7
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 */
|
|
@@ -103,7 +103,7 @@ export interface ChartProps<TOption extends EChartsOption = EChartsOption> exten
|
|
|
103
103
|
/** ECharts theme */
|
|
104
104
|
theme?: string | Record<string, unknown>
|
|
105
105
|
/** Renderer — 'canvas' (default) or 'svg' */
|
|
106
|
-
renderer?:
|
|
106
|
+
renderer?: 'canvas' | 'svg'
|
|
107
107
|
/** CSS style for the container div */
|
|
108
108
|
style?: string
|
|
109
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
|