@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.
Files changed (42) hide show
  1. package/lib/analysis/index.js.html +1 -1
  2. package/lib/analysis/manual.js.html +1 -1
  3. package/lib/{charts-Ckh2qxB5.js → charts-lo2KeDld.js} +164 -164
  4. package/lib/charts-lo2KeDld.js.map +1 -0
  5. package/lib/{components-BcPePBeS.js → components-ClWy1Ztp.js} +128 -128
  6. package/lib/components-ClWy1Ztp.js.map +1 -0
  7. package/lib/{core-9w0g6EOI.js → core-BiuQ3y-t.js} +11 -11
  8. package/lib/core-BiuQ3y-t.js.map +1 -0
  9. package/lib/{createSeriesData-DOHScdgk.js → createSeriesData-BGy-6PqI.js} +6 -6
  10. package/lib/createSeriesData-BGy-6PqI.js.map +1 -0
  11. package/lib/{customGraphicKeyframeAnimation-CvkEkSt_.js → customGraphicKeyframeAnimation-BIbJI8ew.js} +61 -61
  12. package/lib/customGraphicKeyframeAnimation-BIbJI8ew.js.map +1 -0
  13. package/lib/{graphic-CPJ2K90a.js → graphic-Bt7SEwll.js} +59 -59
  14. package/lib/graphic-Bt7SEwll.js.map +1 -0
  15. package/lib/index.js +60 -52
  16. package/lib/index.js.map +1 -1
  17. package/lib/manual.js +60 -52
  18. package/lib/manual.js.map +1 -1
  19. package/lib/{parseGeoJson-BlBe5Vig.js → parseGeoJson-NjUY1feF.js} +115 -115
  20. package/lib/parseGeoJson-NjUY1feF.js.map +1 -0
  21. package/lib/{renderers-Dytryvoy.js → renderers-BnAAXHfG.js} +16 -16
  22. package/lib/renderers-BnAAXHfG.js.map +1 -0
  23. package/lib/types/index.d.ts +3 -3
  24. package/lib/types/index.d.ts.map +1 -1
  25. package/lib/types/manual.d.ts +3 -3
  26. package/lib/types/manual.d.ts.map +1 -1
  27. package/package.json +14 -7
  28. package/src/chart-component.tsx +18 -10
  29. package/src/index.ts +3 -3
  30. package/src/loader.ts +70 -73
  31. package/src/manual.ts +4 -4
  32. package/src/tests/charts.test.tsx +431 -126
  33. package/src/types.ts +8 -9
  34. package/src/use-chart.ts +8 -8
  35. package/lib/charts-Ckh2qxB5.js.map +0 -1
  36. package/lib/components-BcPePBeS.js.map +0 -1
  37. package/lib/core-9w0g6EOI.js.map +0 -1
  38. package/lib/createSeriesData-DOHScdgk.js.map +0 -1
  39. package/lib/customGraphicKeyframeAnimation-CvkEkSt_.js.map +0 -1
  40. package/lib/graphic-CPJ2K90a.js.map +0 -1
  41. package/lib/parseGeoJson-BlBe5Vig.js.map +0 -1
  42. package/lib/renderers-Dytryvoy.js.map +0 -1
package/lib/index.js CHANGED
@@ -3,57 +3,57 @@ import { onUnmount } from "@pyreon/core";
3
3
 
4
4
  //#region src/loader.ts
5
5
  const CHARTS = {
6
- bar: () => import("./charts-Ckh2qxB5.js").then((m) => m.BarChart),
7
- line: () => import("./charts-Ckh2qxB5.js").then((m) => m.LineChart),
8
- pie: () => import("./charts-Ckh2qxB5.js").then((m) => m.PieChart),
9
- scatter: () => import("./charts-Ckh2qxB5.js").then((m) => m.ScatterChart),
10
- radar: () => import("./charts-Ckh2qxB5.js").then((m) => m.RadarChart),
11
- heatmap: () => import("./charts-Ckh2qxB5.js").then((m) => m.HeatmapChart),
12
- treemap: () => import("./charts-Ckh2qxB5.js").then((m) => m.TreemapChart),
13
- sunburst: () => import("./charts-Ckh2qxB5.js").then((m) => m.SunburstChart),
14
- sankey: () => import("./charts-Ckh2qxB5.js").then((m) => m.SankeyChart),
15
- funnel: () => import("./charts-Ckh2qxB5.js").then((m) => m.FunnelChart),
16
- gauge: () => import("./charts-Ckh2qxB5.js").then((m) => m.GaugeChart),
17
- graph: () => import("./charts-Ckh2qxB5.js").then((m) => m.GraphChart),
18
- tree: () => import("./charts-Ckh2qxB5.js").then((m) => m.TreeChart),
19
- boxplot: () => import("./charts-Ckh2qxB5.js").then((m) => m.BoxplotChart),
20
- candlestick: () => import("./charts-Ckh2qxB5.js").then((m) => m.CandlestickChart),
21
- parallel: () => import("./charts-Ckh2qxB5.js").then((m) => m.ParallelChart),
22
- themeRiver: () => import("./charts-Ckh2qxB5.js").then((m) => m.ThemeRiverChart),
23
- effectScatter: () => import("./charts-Ckh2qxB5.js").then((m) => m.EffectScatterChart),
24
- lines: () => import("./charts-Ckh2qxB5.js").then((m) => m.LinesChart),
25
- pictorialBar: () => import("./charts-Ckh2qxB5.js").then((m) => m.PictorialBarChart),
26
- custom: () => import("./charts-Ckh2qxB5.js").then((m) => m.CustomChart),
27
- map: () => import("./charts-Ckh2qxB5.js").then((m) => m.MapChart)
6
+ bar: () => import("./charts-lo2KeDld.js").then((m) => m.BarChart),
7
+ line: () => import("./charts-lo2KeDld.js").then((m) => m.LineChart),
8
+ pie: () => import("./charts-lo2KeDld.js").then((m) => m.PieChart),
9
+ scatter: () => import("./charts-lo2KeDld.js").then((m) => m.ScatterChart),
10
+ radar: () => import("./charts-lo2KeDld.js").then((m) => m.RadarChart),
11
+ heatmap: () => import("./charts-lo2KeDld.js").then((m) => m.HeatmapChart),
12
+ treemap: () => import("./charts-lo2KeDld.js").then((m) => m.TreemapChart),
13
+ sunburst: () => import("./charts-lo2KeDld.js").then((m) => m.SunburstChart),
14
+ sankey: () => import("./charts-lo2KeDld.js").then((m) => m.SankeyChart),
15
+ funnel: () => import("./charts-lo2KeDld.js").then((m) => m.FunnelChart),
16
+ gauge: () => import("./charts-lo2KeDld.js").then((m) => m.GaugeChart),
17
+ graph: () => import("./charts-lo2KeDld.js").then((m) => m.GraphChart),
18
+ tree: () => import("./charts-lo2KeDld.js").then((m) => m.TreeChart),
19
+ boxplot: () => import("./charts-lo2KeDld.js").then((m) => m.BoxplotChart),
20
+ candlestick: () => import("./charts-lo2KeDld.js").then((m) => m.CandlestickChart),
21
+ parallel: () => import("./charts-lo2KeDld.js").then((m) => m.ParallelChart),
22
+ themeRiver: () => import("./charts-lo2KeDld.js").then((m) => m.ThemeRiverChart),
23
+ effectScatter: () => import("./charts-lo2KeDld.js").then((m) => m.EffectScatterChart),
24
+ lines: () => import("./charts-lo2KeDld.js").then((m) => m.LinesChart),
25
+ pictorialBar: () => import("./charts-lo2KeDld.js").then((m) => m.PictorialBarChart),
26
+ custom: () => import("./charts-lo2KeDld.js").then((m) => m.CustomChart),
27
+ map: () => import("./charts-lo2KeDld.js").then((m) => m.MapChart)
28
28
  };
29
29
  const COMPONENTS = {
30
- grid: () => import("./components-BcPePBeS.js").then((m) => m.GridComponent),
31
- xAxis: () => import("./components-BcPePBeS.js").then((m) => m.GridComponent),
32
- yAxis: () => import("./components-BcPePBeS.js").then((m) => m.GridComponent),
33
- polar: () => import("./components-BcPePBeS.js").then((m) => m.PolarComponent),
34
- radar: () => import("./components-BcPePBeS.js").then((m) => m.RadarComponent),
35
- geo: () => import("./components-BcPePBeS.js").then((m) => m.GeoComponent),
36
- tooltip: () => import("./components-BcPePBeS.js").then((m) => m.TooltipComponent),
37
- legend: () => import("./components-BcPePBeS.js").then((m) => m.LegendComponent),
38
- toolbox: () => import("./components-BcPePBeS.js").then((m) => m.ToolboxComponent),
39
- title: () => import("./components-BcPePBeS.js").then((m) => m.TitleComponent),
40
- dataZoom: () => import("./components-BcPePBeS.js").then((m) => m.DataZoomComponent),
41
- visualMap: () => import("./components-BcPePBeS.js").then((m) => m.VisualMapComponent),
42
- timeline: () => import("./components-BcPePBeS.js").then((m) => m.TimelineComponent),
43
- graphic: () => import("./components-BcPePBeS.js").then((m) => m.GraphicComponent),
44
- brush: () => import("./components-BcPePBeS.js").then((m) => m.BrushComponent),
45
- calendar: () => import("./components-BcPePBeS.js").then((m) => m.CalendarComponent),
46
- dataset: () => import("./components-BcPePBeS.js").then((m) => m.DatasetComponent),
47
- aria: () => import("./components-BcPePBeS.js").then((m) => m.AriaComponent)
30
+ grid: () => import("./components-ClWy1Ztp.js").then((m) => m.GridComponent),
31
+ xAxis: () => import("./components-ClWy1Ztp.js").then((m) => m.GridComponent),
32
+ yAxis: () => import("./components-ClWy1Ztp.js").then((m) => m.GridComponent),
33
+ polar: () => import("./components-ClWy1Ztp.js").then((m) => m.PolarComponent),
34
+ radar: () => import("./components-ClWy1Ztp.js").then((m) => m.RadarComponent),
35
+ geo: () => import("./components-ClWy1Ztp.js").then((m) => m.GeoComponent),
36
+ tooltip: () => import("./components-ClWy1Ztp.js").then((m) => m.TooltipComponent),
37
+ legend: () => import("./components-ClWy1Ztp.js").then((m) => m.LegendComponent),
38
+ toolbox: () => import("./components-ClWy1Ztp.js").then((m) => m.ToolboxComponent),
39
+ title: () => import("./components-ClWy1Ztp.js").then((m) => m.TitleComponent),
40
+ dataZoom: () => import("./components-ClWy1Ztp.js").then((m) => m.DataZoomComponent),
41
+ visualMap: () => import("./components-ClWy1Ztp.js").then((m) => m.VisualMapComponent),
42
+ timeline: () => import("./components-ClWy1Ztp.js").then((m) => m.TimelineComponent),
43
+ graphic: () => import("./components-ClWy1Ztp.js").then((m) => m.GraphicComponent),
44
+ brush: () => import("./components-ClWy1Ztp.js").then((m) => m.BrushComponent),
45
+ calendar: () => import("./components-ClWy1Ztp.js").then((m) => m.CalendarComponent),
46
+ dataset: () => import("./components-ClWy1Ztp.js").then((m) => m.DatasetComponent),
47
+ aria: () => import("./components-ClWy1Ztp.js").then((m) => m.AriaComponent)
48
48
  };
49
49
  const SERIES_FEATURES = {
50
- markPoint: () => import("./components-BcPePBeS.js").then((m) => m.MarkPointComponent),
51
- markLine: () => import("./components-BcPePBeS.js").then((m) => m.MarkLineComponent),
52
- markArea: () => import("./components-BcPePBeS.js").then((m) => m.MarkAreaComponent)
50
+ markPoint: () => import("./components-ClWy1Ztp.js").then((m) => m.MarkPointComponent),
51
+ markLine: () => import("./components-ClWy1Ztp.js").then((m) => m.MarkLineComponent),
52
+ markArea: () => import("./components-ClWy1Ztp.js").then((m) => m.MarkAreaComponent)
53
53
  };
54
54
  const RENDERERS = {
55
- canvas: () => import("./renderers-Dytryvoy.js").then((m) => m.CanvasRenderer),
56
- svg: () => import("./renderers-Dytryvoy.js").then((m) => m.SVGRenderer)
55
+ canvas: () => import("./renderers-BnAAXHfG.js").then((m) => m.CanvasRenderer),
56
+ svg: () => import("./renderers-BnAAXHfG.js").then((m) => m.SVGRenderer)
57
57
  };
58
58
  let coreModule = null;
59
59
  let corePromise = null;
@@ -62,7 +62,7 @@ let corePromise = null;
62
62
  */
63
63
  async function getCore() {
64
64
  if (coreModule) return coreModule;
65
- if (!corePromise) corePromise = import("./core-9w0g6EOI.js").then((m) => {
65
+ if (!corePromise) corePromise = import("./core-BiuQ3y-t.js").then((m) => {
66
66
  coreModule = m;
67
67
  return m;
68
68
  });
@@ -89,15 +89,23 @@ async function loadAndRegister(core, key, loader) {
89
89
  async function ensureModules(option, renderer = "canvas") {
90
90
  const core = await getCore();
91
91
  const loads = [];
92
- loads.push(loadAndRegister(core, `renderer:${renderer}`, RENDERERS[renderer]));
92
+ const rendererLoader = RENDERERS[renderer];
93
+ if (rendererLoader) loads.push(loadAndRegister(core, `renderer:${renderer}`, rendererLoader));
93
94
  const rawSeries = option.series;
94
95
  const seriesList = rawSeries ? Array.isArray(rawSeries) ? rawSeries : [rawSeries] : [];
95
96
  for (const s of seriesList) {
96
97
  const type = s.type;
97
- if (type && CHARTS[type]) loads.push(loadAndRegister(core, `chart:${type}`, CHARTS[type]));
98
+ const chartLoader = type ? CHARTS[type] : void 0;
99
+ if (chartLoader) loads.push(loadAndRegister(core, `chart:${type}`, chartLoader));
100
+ }
101
+ for (const key of Object.keys(option)) {
102
+ const compLoader = COMPONENTS[key];
103
+ if (compLoader) loads.push(loadAndRegister(core, `component:${key}`, compLoader));
104
+ }
105
+ for (const s of seriesList) for (const key of Object.keys(s)) {
106
+ const featureLoader = SERIES_FEATURES[key];
107
+ if (featureLoader) loads.push(loadAndRegister(core, `feature:${key}`, featureLoader));
98
108
  }
99
- for (const key of Object.keys(option)) if (COMPONENTS[key]) loads.push(loadAndRegister(core, `component:${key}`, COMPONENTS[key]));
100
- for (const s of seriesList) for (const key of Object.keys(s)) if (SERIES_FEATURES[key]) loads.push(loadAndRegister(core, `feature:${key}`, SERIES_FEATURES[key]));
101
109
  await Promise.all(loads);
102
110
  return core;
103
111
  }
@@ -151,7 +159,7 @@ function useChart(optionsFn, config) {
151
159
  ensureModules(opts, renderer).then((core) => {
152
160
  if (!container.peek()) return;
153
161
  try {
154
- const chart = core.init(el, config?.theme, {
162
+ const chart = core.init(el, config?.theme ?? null, {
155
163
  renderer,
156
164
  ...config?.locale != null ? { locale: config.locale } : {},
157
165
  ...config?.devicePixelRatio != null ? { devicePixelRatio: config.devicePixelRatio } : {},
@@ -210,7 +218,7 @@ function useChart(optionsFn, config) {
210
218
  }
211
219
 
212
220
  //#endregion
213
- //#region ../../node_modules/.bun/@pyreon+core@0.7.5/node_modules/@pyreon/core/lib/jsx-runtime.js
221
+ //#region ../../core/core/lib/jsx-runtime.js
214
222
  /**
215
223
  * Hyperscript function — the compiled output of JSX.
216
224
  * `<div class="x">hello</div>` → `h("div", { class: "x" }, "hello")`
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/loader.ts","../src/use-chart.ts","../../../node_modules/.bun/@pyreon+core@0.7.5/node_modules/@pyreon/core/lib/jsx-runtime.js","../src/chart-component.tsx"],"sourcesContent":["/**\n * Lazy loading and auto-detection for ECharts modules.\n *\n * Maps config keys to ECharts modular imports. Only loads what's needed,\n * caches after first load. The echarts/core module itself is lazy-loaded\n * on first use — zero ECharts bytes until a chart actually renders.\n */\n\n/**\n * Loose option type for internal module analysis.\n * The strict EChartsOption type is used at the consumer-facing API level.\n */\ntype LooseOption = Record<string, unknown> & {\n series?: unknown\n}\n\ntype ModuleLoader = () => Promise<unknown>\n\n// ─── Chart type mapping ─────────────────────────────────────────────────────\n\nconst CHARTS: Record<string, ModuleLoader> = {\n bar: () => import('echarts/charts').then((m) => m.BarChart),\n line: () => import('echarts/charts').then((m) => m.LineChart),\n pie: () => import('echarts/charts').then((m) => m.PieChart),\n scatter: () => import('echarts/charts').then((m) => m.ScatterChart),\n radar: () => import('echarts/charts').then((m) => m.RadarChart),\n heatmap: () => import('echarts/charts').then((m) => m.HeatmapChart),\n treemap: () => import('echarts/charts').then((m) => m.TreemapChart),\n sunburst: () => import('echarts/charts').then((m) => m.SunburstChart),\n sankey: () => import('echarts/charts').then((m) => m.SankeyChart),\n funnel: () => import('echarts/charts').then((m) => m.FunnelChart),\n gauge: () => import('echarts/charts').then((m) => m.GaugeChart),\n graph: () => import('echarts/charts').then((m) => m.GraphChart),\n tree: () => import('echarts/charts').then((m) => m.TreeChart),\n boxplot: () => import('echarts/charts').then((m) => m.BoxplotChart),\n candlestick: () => import('echarts/charts').then((m) => m.CandlestickChart),\n parallel: () => import('echarts/charts').then((m) => m.ParallelChart),\n themeRiver: () => import('echarts/charts').then((m) => m.ThemeRiverChart),\n effectScatter: () =>\n import('echarts/charts').then((m) => m.EffectScatterChart),\n lines: () => import('echarts/charts').then((m) => m.LinesChart),\n pictorialBar: () => import('echarts/charts').then((m) => m.PictorialBarChart),\n custom: () => import('echarts/charts').then((m) => m.CustomChart),\n map: () => import('echarts/charts').then((m) => m.MapChart),\n}\n\n// ─── Component mapping ──────────────────────────────────────────────────────\n\n// Multiple config keys can map to the same component (xAxis/yAxis → Grid)\nconst COMPONENTS: Record<string, ModuleLoader> = {\n grid: () => import('echarts/components').then((m) => m.GridComponent),\n xAxis: () => import('echarts/components').then((m) => m.GridComponent),\n yAxis: () => import('echarts/components').then((m) => m.GridComponent),\n polar: () => import('echarts/components').then((m) => m.PolarComponent),\n radar: () => import('echarts/components').then((m) => m.RadarComponent),\n geo: () => import('echarts/components').then((m) => m.GeoComponent),\n tooltip: () => import('echarts/components').then((m) => m.TooltipComponent),\n legend: () => import('echarts/components').then((m) => m.LegendComponent),\n toolbox: () => import('echarts/components').then((m) => m.ToolboxComponent),\n title: () => import('echarts/components').then((m) => m.TitleComponent),\n dataZoom: () => import('echarts/components').then((m) => m.DataZoomComponent),\n visualMap: () =>\n import('echarts/components').then((m) => m.VisualMapComponent),\n timeline: () => import('echarts/components').then((m) => m.TimelineComponent),\n graphic: () => import('echarts/components').then((m) => m.GraphicComponent),\n brush: () => import('echarts/components').then((m) => m.BrushComponent),\n calendar: () => import('echarts/components').then((m) => m.CalendarComponent),\n dataset: () => import('echarts/components').then((m) => m.DatasetComponent),\n aria: () => import('echarts/components').then((m) => m.AriaComponent),\n}\n\n// Series-level features\nconst SERIES_FEATURES: Record<string, ModuleLoader> = {\n markPoint: () =>\n import('echarts/components').then((m) => m.MarkPointComponent),\n markLine: () => import('echarts/components').then((m) => m.MarkLineComponent),\n markArea: () => import('echarts/components').then((m) => m.MarkAreaComponent),\n}\n\n// ─── Renderers ──────────────────────────────────────────────────────────────\n\nconst RENDERERS: Record<string, ModuleLoader> = {\n canvas: () => import('echarts/renderers').then((m) => m.CanvasRenderer),\n svg: () => import('echarts/renderers').then((m) => m.SVGRenderer),\n}\n\n// ─── Core loading ───────────────────────────────────────────────────────────\n\nlet coreModule: typeof import('echarts/core') | null = null\nlet corePromise: Promise<typeof import('echarts/core')> | null = null\n\n/**\n * Lazily load echarts/core. Cached after first call.\n */\nexport async function getCore(): Promise<typeof import('echarts/core')> {\n if (coreModule) return coreModule\n if (!corePromise) {\n corePromise = import('echarts/core').then((m) => {\n coreModule = m\n return m\n })\n }\n return corePromise\n}\n\n/**\n * Get the cached core module (null if not yet loaded).\n */\nexport function getCoreSync(): typeof import('echarts/core') | null {\n return coreModule\n}\n\n// ─── Module registration ────────────────────────────────────────────────────\n\nconst registered = new Set<string>()\nconst inflight = new Map<string, Promise<void>>()\n\nasync function loadAndRegister(\n core: typeof import('echarts/core'),\n key: string,\n loader: ModuleLoader,\n): Promise<void> {\n if (registered.has(key)) return\n if (inflight.has(key)) return inflight.get(key)\n\n const promise = loader().then((mod) => {\n core.use(mod as any)\n registered.add(key)\n inflight.delete(key)\n })\n inflight.set(key, promise)\n return promise\n}\n\n/**\n * Analyze an ECharts option object and dynamically import only the\n * required chart types, components, and renderer. All imports are\n * cached — subsequent calls with the same types are instant.\n */\nexport async function ensureModules(\n option: LooseOption,\n renderer: 'canvas' | 'svg' = 'canvas',\n): Promise<typeof import('echarts/core')> {\n const core = await getCore()\n const loads: Promise<void>[] = []\n\n // Renderer (always needed)\n loads.push(\n loadAndRegister(core, `renderer:${renderer}`, RENDERERS[renderer]!),\n )\n\n // Normalize series to array for analysis\n const rawSeries = option.series\n const seriesList: Record<string, unknown>[] = rawSeries\n ? ((Array.isArray(rawSeries) ? rawSeries : [rawSeries]) as Record<\n string,\n unknown\n >[])\n : []\n\n // Chart types from series[].type\n for (const s of seriesList) {\n const type = s.type as string | undefined\n if (type && CHARTS[type]) {\n loads.push(loadAndRegister(core, `chart:${type}`, CHARTS[type]!))\n }\n }\n\n // Components from top-level config keys\n for (const key of Object.keys(option)) {\n if (COMPONENTS[key]) {\n loads.push(loadAndRegister(core, `component:${key}`, COMPONENTS[key]!))\n }\n }\n\n // Series-level features (markPoint, markLine, markArea)\n for (const s of seriesList) {\n for (const key of Object.keys(s)) {\n if (SERIES_FEATURES[key]) {\n loads.push(\n loadAndRegister(core, `feature:${key}`, SERIES_FEATURES[key]!),\n )\n }\n }\n }\n\n await Promise.all(loads)\n return core\n}\n\n/**\n * Manually register ECharts modules (for tree-shaking entry point).\n * Call this at app startup instead of relying on auto-detection.\n *\n * @example\n * ```ts\n * import { use } from '@pyreon/charts/manual'\n * import { BarChart } from 'echarts/charts'\n * import { GridComponent, TooltipComponent } from 'echarts/components'\n * import { CanvasRenderer } from 'echarts/renderers'\n *\n * use(BarChart, GridComponent, TooltipComponent, CanvasRenderer)\n * ```\n */\nexport function manualUse(...modules: unknown[]): void {\n const core = getCoreSync()\n if (core) {\n core.use(modules as any)\n } else {\n // Core not loaded yet — queue for when it loads\n getCore().then((c) => c.use(modules as any))\n }\n}\n\n// ─── Reset (for testing) ────────────────────────────────────────────────────\n\nexport function _resetLoader(): void {\n registered.clear()\n inflight.clear()\n coreModule = null\n corePromise = null\n}\n","import { onUnmount } from '@pyreon/core'\nimport { effect, signal } from '@pyreon/reactivity'\nimport type { EChartsOption } from 'echarts'\nimport { ensureModules } from './loader'\nimport type { UseChartConfig, UseChartResult } from './types'\n\n/**\n * Reactive ECharts hook. Creates a chart instance bound to a container\n * element, with automatic module lazy-loading, signal tracking, resize\n * handling, error capture, and cleanup.\n *\n * Generic parameter `TOption` narrows the option type for exact autocomplete.\n * Use `ComposeOption<SeriesUnion>` from ECharts to restrict to specific chart types.\n *\n * @example\n * ```tsx\n * // Default — accepts any ECharts option\n * const chart = useChart(() => ({\n * series: [{ type: 'bar', data: revenue() }],\n * }))\n *\n * // Strict — only bar + line allowed, full autocomplete\n * import type { ComposeOption, BarSeriesOption, LineSeriesOption } from '@pyreon/charts'\n * type MyChartOption = ComposeOption<BarSeriesOption | LineSeriesOption>\n *\n * const chart = useChart<MyChartOption>(() => ({\n * series: [{ type: 'bar', data: revenue() }], // ✓\n * }))\n * ```\n */\nexport function useChart<TOption extends EChartsOption = EChartsOption>(\n optionsFn: () => TOption,\n config?: UseChartConfig,\n): UseChartResult {\n const instance = signal<import('echarts/core').ECharts | null>(null)\n const loading = signal(true)\n const error = signal<Error | null>(null)\n const container = signal<HTMLElement | null>(null)\n const renderer = config?.renderer ?? 'canvas'\n\n let observer: ResizeObserver | null = null\n let initialized = false\n\n // Initialize chart when container is bound\n effect(() => {\n const el = container()\n if (!el || initialized) return\n\n initialized = true\n\n let opts: EChartsOption\n try {\n opts = optionsFn()\n } catch (err) {\n error.set(err instanceof Error ? err : new Error(String(err)))\n loading.set(false)\n return\n }\n\n // Load required ECharts modules, then create chart\n ensureModules(opts as Record<string, unknown>, renderer)\n .then((core) => {\n // Guard: component may have unmounted during async load\n if (!container.peek()) return\n\n try {\n const chart = core.init(el, config?.theme as any, {\n renderer,\n ...(config?.locale != null ? { locale: config.locale } : {}),\n ...(config?.devicePixelRatio != null\n ? { devicePixelRatio: config.devicePixelRatio }\n : {}),\n ...(config?.width != null ? { width: config.width } : {}),\n ...(config?.height != null ? { height: config.height } : {}),\n })\n\n chart.setOption(opts)\n instance.set(chart)\n loading.set(false)\n error.set(null)\n\n config?.onInit?.(chart)\n\n // ResizeObserver for auto-resize\n observer = new ResizeObserver(() => {\n chart.resize()\n })\n observer.observe(el)\n } catch (err) {\n error.set(err instanceof Error ? err : new Error(String(err)))\n loading.set(false)\n }\n })\n .catch((err) => {\n error.set(err instanceof Error ? err : new Error(String(err)))\n loading.set(false)\n })\n })\n\n // Reactive updates — re-run when signals in optionsFn change\n effect(() => {\n const chart = instance()\n if (!chart) return\n\n try {\n const opts = optionsFn()\n chart.setOption(opts, {\n notMerge: config?.notMerge ?? false,\n lazyUpdate: config?.lazyUpdate ?? true,\n })\n error.set(null)\n } catch (err) {\n error.set(err instanceof Error ? err : new Error(String(err)))\n }\n })\n\n // Cleanup on unmount\n onUnmount(() => {\n observer?.disconnect()\n observer = null\n\n const chart = instance.peek()\n if (chart) {\n chart.dispose()\n instance.set(null)\n }\n\n initialized = false\n })\n\n return {\n ref: (el: Element | null) => container.set(el as HTMLElement | null),\n instance,\n loading,\n error,\n resize: () => instance.peek()?.resize(),\n }\n}\n","//#region src/h.ts\n/** Marker for fragment nodes — renders children without a wrapper element */\nconst Fragment = Symbol(\"Pyreon.Fragment\");\n/**\n* Hyperscript function — the compiled output of JSX.\n* `<div class=\"x\">hello</div>` → `h(\"div\", { class: \"x\" }, \"hello\")`\n*\n* Generic on P so TypeScript validates props match the component's signature\n* at the call site, then stores the result in the loosely-typed VNode.\n*/\n/** Shared empty props sentinel — identity-checked in mountElement to skip applyProps. */\nconst EMPTY_PROPS = {};\nfunction h(type, props, ...children) {\n\treturn {\n\t\ttype,\n\t\tprops: props ?? EMPTY_PROPS,\n\t\tchildren: normalizeChildren(children),\n\t\tkey: props?.key ?? null\n\t};\n}\nfunction normalizeChildren(children) {\n\tfor (let i = 0; i < children.length; i++) if (Array.isArray(children[i])) return flattenChildren(children);\n\treturn children;\n}\nfunction flattenChildren(children) {\n\tconst result = [];\n\tfor (const child of children) if (Array.isArray(child)) result.push(...flattenChildren(child));\n\telse result.push(child);\n\treturn result;\n}\n\n//#endregion\n//#region src/jsx-runtime.ts\n/**\n* JSX automatic runtime.\n*\n* When tsconfig has `\"jsxImportSource\": \"@pyreon/core\"`, the TS/bundler compiler\n* rewrites JSX to imports from this file automatically:\n* <div class=\"x\" /> → jsx(\"div\", { class: \"x\" })\n*/\nfunction jsx(type, props, key) {\n\tconst { children, ...rest } = props;\n\tconst propsWithKey = key != null ? {\n\t\t...rest,\n\t\tkey\n\t} : rest;\n\tif (typeof type === \"function\") return h(type, children !== void 0 ? {\n\t\t...propsWithKey,\n\t\tchildren\n\t} : propsWithKey);\n\treturn h(type, propsWithKey, ...children === void 0 ? [] : Array.isArray(children) ? children : [children]);\n}\nconst jsxs = jsx;\n\n//#endregion\nexport { Fragment, jsx, jsxs };\n//# sourceMappingURL=jsx-runtime.js.map","import type { VNodeChild } from '@pyreon/core'\nimport { effect } from '@pyreon/reactivity'\nimport type { EChartsOption } from 'echarts'\nimport type { ChartProps } from './types'\nimport { useChart } from './use-chart'\n\n/**\n * Reactive chart component. Wraps useChart in a div with automatic\n * event binding.\n *\n * @example\n * ```tsx\n * // Default — any chart type\n * <Chart\n * options={() => ({\n * series: [{ type: 'bar', data: revenue() }],\n * tooltip: {},\n * })}\n * style=\"height: 400px\"\n * />\n *\n * // Strict — only specific chart types\n * import type { ComposeOption, BarSeriesOption } from '@pyreon/charts'\n * <Chart<ComposeOption<BarSeriesOption>>\n * options={() => ({\n * series: [{ type: 'bar', data: revenue() }],\n * })}\n * style=\"height: 400px\"\n * />\n * ```\n */\nexport function Chart<TOption extends EChartsOption = EChartsOption>(\n props: ChartProps<TOption>,\n): VNodeChild {\n const chart = useChart(props.options, {\n ...(props.theme != null ? { theme: props.theme } : {}),\n ...(props.renderer != null ? { renderer: props.renderer } : {}),\n })\n\n // Bind events when instance is ready\n effect(() => {\n const inst = chart.instance()\n if (!inst) return\n\n // Handlers are duck-typed ChartEventParams — cast needed because\n // echarts/core and echarts export incompatible private class types\n if (props.onClick) inst.on('click', props.onClick as any)\n if (props.onMouseover) inst.on('mouseover', props.onMouseover as any)\n if (props.onMouseout) inst.on('mouseout', props.onMouseout as any)\n })\n\n return () => <div ref={chart.ref} style={props.style} class={props.class} />\n}\n"],"x_google_ignoreList":[2],"mappings":";;;;AAoBA,MAAM,SAAuC;CAC3C,WAAW,OAAO,wBAAkB,MAAM,MAAM,EAAE,SAAS;CAC3D,YAAY,OAAO,wBAAkB,MAAM,MAAM,EAAE,UAAU;CAC7D,WAAW,OAAO,wBAAkB,MAAM,MAAM,EAAE,SAAS;CAC3D,eAAe,OAAO,wBAAkB,MAAM,MAAM,EAAE,aAAa;CACnE,aAAa,OAAO,wBAAkB,MAAM,MAAM,EAAE,WAAW;CAC/D,eAAe,OAAO,wBAAkB,MAAM,MAAM,EAAE,aAAa;CACnE,eAAe,OAAO,wBAAkB,MAAM,MAAM,EAAE,aAAa;CACnE,gBAAgB,OAAO,wBAAkB,MAAM,MAAM,EAAE,cAAc;CACrE,cAAc,OAAO,wBAAkB,MAAM,MAAM,EAAE,YAAY;CACjE,cAAc,OAAO,wBAAkB,MAAM,MAAM,EAAE,YAAY;CACjE,aAAa,OAAO,wBAAkB,MAAM,MAAM,EAAE,WAAW;CAC/D,aAAa,OAAO,wBAAkB,MAAM,MAAM,EAAE,WAAW;CAC/D,YAAY,OAAO,wBAAkB,MAAM,MAAM,EAAE,UAAU;CAC7D,eAAe,OAAO,wBAAkB,MAAM,MAAM,EAAE,aAAa;CACnE,mBAAmB,OAAO,wBAAkB,MAAM,MAAM,EAAE,iBAAiB;CAC3E,gBAAgB,OAAO,wBAAkB,MAAM,MAAM,EAAE,cAAc;CACrE,kBAAkB,OAAO,wBAAkB,MAAM,MAAM,EAAE,gBAAgB;CACzE,qBACE,OAAO,wBAAkB,MAAM,MAAM,EAAE,mBAAmB;CAC5D,aAAa,OA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1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/loader.ts","../src/use-chart.ts","../../../core/core/lib/jsx-runtime.js","../src/chart-component.tsx"],"sourcesContent":["/**\n * Lazy loading and auto-detection for ECharts modules.\n *\n * Maps config keys to ECharts modular imports. Only loads what's needed,\n * caches after first load. The echarts/core module itself is lazy-loaded\n * on first use — zero ECharts bytes until a chart actually renders.\n */\n\n/**\n * Loose option type for internal module analysis.\n * The strict EChartsOption type is used at the consumer-facing API level.\n */\ntype LooseOption = Record<string, unknown> & {\n series?: unknown\n}\n\ntype ModuleLoader = () => Promise<unknown>\n\n/** The argument type that `echarts/core.use()` accepts. */\ntype EChartsUseArg = Parameters<typeof import(\"echarts/core\").use>[0]\n\n// ─── Chart type mapping ─────────────────────────────────────────────────────\n\nconst CHARTS: Record<string, ModuleLoader> = {\n bar: () => import(\"echarts/charts\").then((m) => m.BarChart),\n line: () => import(\"echarts/charts\").then((m) => m.LineChart),\n pie: () => import(\"echarts/charts\").then((m) => m.PieChart),\n scatter: () => import(\"echarts/charts\").then((m) => m.ScatterChart),\n radar: () => import(\"echarts/charts\").then((m) => m.RadarChart),\n heatmap: () => import(\"echarts/charts\").then((m) => m.HeatmapChart),\n treemap: () => import(\"echarts/charts\").then((m) => m.TreemapChart),\n sunburst: () => import(\"echarts/charts\").then((m) => m.SunburstChart),\n sankey: () => import(\"echarts/charts\").then((m) => m.SankeyChart),\n funnel: () => import(\"echarts/charts\").then((m) => m.FunnelChart),\n gauge: () => import(\"echarts/charts\").then((m) => m.GaugeChart),\n graph: () => import(\"echarts/charts\").then((m) => m.GraphChart),\n tree: () => import(\"echarts/charts\").then((m) => m.TreeChart),\n boxplot: () => import(\"echarts/charts\").then((m) => m.BoxplotChart),\n candlestick: () => import(\"echarts/charts\").then((m) => m.CandlestickChart),\n parallel: () => import(\"echarts/charts\").then((m) => m.ParallelChart),\n themeRiver: () => import(\"echarts/charts\").then((m) => m.ThemeRiverChart),\n effectScatter: () => import(\"echarts/charts\").then((m) => m.EffectScatterChart),\n lines: () => import(\"echarts/charts\").then((m) => m.LinesChart),\n pictorialBar: () => import(\"echarts/charts\").then((m) => m.PictorialBarChart),\n custom: () => import(\"echarts/charts\").then((m) => m.CustomChart),\n map: () => import(\"echarts/charts\").then((m) => m.MapChart),\n}\n\n// ─── Component mapping ──────────────────────────────────────────────────────\n\n// Multiple config keys can map to the same component (xAxis/yAxis → Grid)\nconst COMPONENTS: Record<string, ModuleLoader> = {\n grid: () => import(\"echarts/components\").then((m) => m.GridComponent),\n xAxis: () => import(\"echarts/components\").then((m) => m.GridComponent),\n yAxis: () => import(\"echarts/components\").then((m) => m.GridComponent),\n polar: () => import(\"echarts/components\").then((m) => m.PolarComponent),\n radar: () => import(\"echarts/components\").then((m) => m.RadarComponent),\n geo: () => import(\"echarts/components\").then((m) => m.GeoComponent),\n tooltip: () => import(\"echarts/components\").then((m) => m.TooltipComponent),\n legend: () => import(\"echarts/components\").then((m) => m.LegendComponent),\n toolbox: () => import(\"echarts/components\").then((m) => m.ToolboxComponent),\n title: () => import(\"echarts/components\").then((m) => m.TitleComponent),\n dataZoom: () => import(\"echarts/components\").then((m) => m.DataZoomComponent),\n visualMap: () => import(\"echarts/components\").then((m) => m.VisualMapComponent),\n timeline: () => import(\"echarts/components\").then((m) => m.TimelineComponent),\n graphic: () => import(\"echarts/components\").then((m) => m.GraphicComponent),\n brush: () => import(\"echarts/components\").then((m) => m.BrushComponent),\n calendar: () => import(\"echarts/components\").then((m) => m.CalendarComponent),\n dataset: () => import(\"echarts/components\").then((m) => m.DatasetComponent),\n aria: () => import(\"echarts/components\").then((m) => m.AriaComponent),\n}\n\n// Series-level features\nconst SERIES_FEATURES: Record<string, ModuleLoader> = {\n markPoint: () => import(\"echarts/components\").then((m) => m.MarkPointComponent),\n markLine: () => import(\"echarts/components\").then((m) => m.MarkLineComponent),\n markArea: () => import(\"echarts/components\").then((m) => m.MarkAreaComponent),\n}\n\n// ─── Renderers ──────────────────────────────────────────────────────────────\n\nconst RENDERERS: Record<string, ModuleLoader> = {\n canvas: () => import(\"echarts/renderers\").then((m) => m.CanvasRenderer),\n svg: () => import(\"echarts/renderers\").then((m) => m.SVGRenderer),\n}\n\n// ─── Core loading ───────────────────────────────────────────────────────────\n\nlet coreModule: typeof import(\"echarts/core\") | null = null\nlet corePromise: Promise<typeof import(\"echarts/core\")> | null = null\n\n/**\n * Lazily load echarts/core. Cached after first call.\n */\nexport async function getCore(): Promise<typeof import(\"echarts/core\")> {\n if (coreModule) return coreModule\n if (!corePromise) {\n corePromise = import(\"echarts/core\").then((m) => {\n coreModule = m\n return m\n })\n }\n return corePromise\n}\n\n/**\n * Get the cached core module (null if not yet loaded).\n */\nexport function getCoreSync(): typeof import(\"echarts/core\") | null {\n return coreModule\n}\n\n// ─── Module registration ────────────────────────────────────────────────────\n\nconst registered = new Set<string>()\nconst inflight = new Map<string, Promise<void>>()\n\nasync function loadAndRegister(\n core: typeof import(\"echarts/core\"),\n key: string,\n loader: ModuleLoader,\n): Promise<void> {\n if (registered.has(key)) return\n if (inflight.has(key)) return inflight.get(key)\n\n const promise = loader().then((mod) => {\n core.use(mod as EChartsUseArg)\n registered.add(key)\n inflight.delete(key)\n })\n inflight.set(key, promise)\n return promise\n}\n\n/**\n * Analyze an ECharts option object and dynamically import only the\n * required chart types, components, and renderer. All imports are\n * cached — subsequent calls with the same types are instant.\n */\nexport async function ensureModules(\n option: LooseOption,\n renderer: \"canvas\" | \"svg\" = \"canvas\",\n): Promise<typeof import(\"echarts/core\")> {\n const core = await getCore()\n const loads: Promise<void>[] = []\n\n // Renderer (always needed)\n const rendererLoader = RENDERERS[renderer]\n if (rendererLoader) loads.push(loadAndRegister(core, `renderer:${renderer}`, rendererLoader))\n\n // Normalize series to array for analysis\n const rawSeries = option.series\n const seriesList: Record<string, unknown>[] = rawSeries\n ? ((Array.isArray(rawSeries) ? rawSeries : [rawSeries]) as Record<string, unknown>[])\n : []\n\n // Chart types from series[].type\n for (const s of seriesList) {\n const type = s.type as string | undefined\n const chartLoader = type ? CHARTS[type] : undefined\n if (chartLoader) {\n loads.push(loadAndRegister(core, `chart:${type}`, chartLoader))\n }\n }\n\n // Components from top-level config keys\n for (const key of Object.keys(option)) {\n const compLoader = COMPONENTS[key]\n if (compLoader) {\n loads.push(loadAndRegister(core, `component:${key}`, compLoader))\n }\n }\n\n // Series-level features (markPoint, markLine, markArea)\n for (const s of seriesList) {\n for (const key of Object.keys(s)) {\n const featureLoader = SERIES_FEATURES[key]\n if (featureLoader) {\n loads.push(loadAndRegister(core, `feature:${key}`, featureLoader))\n }\n }\n }\n\n await Promise.all(loads)\n return core\n}\n\n/**\n * Manually register ECharts modules (for tree-shaking entry point).\n * Call this at app startup instead of relying on auto-detection.\n *\n * @example\n * ```ts\n * import { use } from '@pyreon/charts/manual'\n * import { BarChart } from 'echarts/charts'\n * import { GridComponent, TooltipComponent } from 'echarts/components'\n * import { CanvasRenderer } from 'echarts/renderers'\n *\n * use(BarChart, GridComponent, TooltipComponent, CanvasRenderer)\n * ```\n */\nexport function manualUse(...modules: unknown[]): void {\n const core = getCoreSync()\n if (core) {\n core.use(modules as EChartsUseArg)\n } else {\n // Core not loaded yet — queue for when it loads\n getCore().then((c) => c.use(modules as any))\n }\n}\n\n// ─── Reset (for testing) ────────────────────────────────────────────────────\n\nexport function _resetLoader(): void {\n registered.clear()\n inflight.clear()\n coreModule = null\n corePromise = null\n}\n","import { onUnmount } from \"@pyreon/core\"\nimport { effect, signal } from \"@pyreon/reactivity\"\nimport type { EChartsOption } from \"echarts\"\nimport { ensureModules } from \"./loader\"\nimport type { UseChartConfig, UseChartResult } from \"./types\"\n\n/**\n * Reactive ECharts hook. Creates a chart instance bound to a container\n * element, with automatic module lazy-loading, signal tracking, resize\n * handling, error capture, and cleanup.\n *\n * Generic parameter `TOption` narrows the option type for exact autocomplete.\n * Use `ComposeOption<SeriesUnion>` from ECharts to restrict to specific chart types.\n *\n * @example\n * ```tsx\n * // Default — accepts any ECharts option\n * const chart = useChart(() => ({\n * series: [{ type: 'bar', data: revenue() }],\n * }))\n *\n * // Strict — only bar + line allowed, full autocomplete\n * import type { ComposeOption, BarSeriesOption, LineSeriesOption } from '@pyreon/charts'\n * type MyChartOption = ComposeOption<BarSeriesOption | LineSeriesOption>\n *\n * const chart = useChart<MyChartOption>(() => ({\n * series: [{ type: 'bar', data: revenue() }], // ✓\n * }))\n * ```\n */\nexport function useChart<TOption extends EChartsOption = EChartsOption>(\n optionsFn: () => TOption,\n config?: UseChartConfig,\n): UseChartResult {\n const instance = signal<import(\"echarts/core\").ECharts | null>(null)\n const loading = signal(true)\n const error = signal<Error | null>(null)\n const container = signal<HTMLElement | null>(null)\n const renderer = config?.renderer ?? \"canvas\"\n\n let observer: ResizeObserver | null = null\n let initialized = false\n\n // Initialize chart when container is bound\n effect(() => {\n const el = container()\n if (!el || initialized) return\n\n initialized = true\n\n let opts: EChartsOption\n try {\n opts = optionsFn()\n } catch (err) {\n error.set(err instanceof Error ? err : new Error(String(err)))\n loading.set(false)\n return\n }\n\n // Load required ECharts modules, then create chart\n ensureModules(opts as Record<string, unknown>, renderer)\n .then((core) => {\n // Guard: component may have unmounted during async load\n if (!container.peek()) return\n\n try {\n const chart = core.init(el, (config?.theme ?? null) as string | object | null, {\n renderer,\n ...(config?.locale != null ? { locale: config.locale } : {}),\n ...(config?.devicePixelRatio != null\n ? { devicePixelRatio: config.devicePixelRatio }\n : {}),\n ...(config?.width != null ? { width: config.width } : {}),\n ...(config?.height != null ? { height: config.height } : {}),\n })\n\n chart.setOption(opts)\n instance.set(chart)\n loading.set(false)\n error.set(null)\n\n config?.onInit?.(chart)\n\n // ResizeObserver for auto-resize\n observer = new ResizeObserver(() => {\n chart.resize()\n })\n observer.observe(el)\n } catch (err) {\n error.set(err instanceof Error ? err : new Error(String(err)))\n loading.set(false)\n }\n })\n .catch((err) => {\n error.set(err instanceof Error ? err : new Error(String(err)))\n loading.set(false)\n })\n })\n\n // Reactive updates — re-run when signals in optionsFn change\n effect(() => {\n const chart = instance()\n if (!chart) return\n\n try {\n const opts = optionsFn()\n chart.setOption(opts, {\n notMerge: config?.notMerge ?? false,\n lazyUpdate: config?.lazyUpdate ?? true,\n })\n error.set(null)\n } catch (err) {\n error.set(err instanceof Error ? err : new Error(String(err)))\n }\n })\n\n // Cleanup on unmount\n onUnmount(() => {\n observer?.disconnect()\n observer = null\n\n const chart = instance.peek()\n if (chart) {\n chart.dispose()\n instance.set(null)\n }\n\n initialized = false\n })\n\n return {\n ref: (el: Element | null) => container.set(el as HTMLElement | null),\n instance,\n loading,\n error,\n resize: () => instance.peek()?.resize(),\n }\n}\n","//#region src/h.ts\n/** Marker for fragment nodes — renders children without a wrapper element */\nconst Fragment = Symbol(\"Pyreon.Fragment\");\n/**\n* Hyperscript function — the compiled output of JSX.\n* `<div class=\"x\">hello</div>` → `h(\"div\", { class: \"x\" }, \"hello\")`\n*\n* Generic on P so TypeScript validates props match the component's signature\n* at the call site, then stores the result in the loosely-typed VNode.\n*/\n/** Shared empty props sentinel — identity-checked in mountElement to skip applyProps. */\nconst EMPTY_PROPS = {};\nfunction h(type, props, ...children) {\n\treturn {\n\t\ttype,\n\t\tprops: props ?? EMPTY_PROPS,\n\t\tchildren: normalizeChildren(children),\n\t\tkey: props?.key ?? null\n\t};\n}\nfunction normalizeChildren(children) {\n\tfor (let i = 0; i < children.length; i++) if (Array.isArray(children[i])) return flattenChildren(children);\n\treturn children;\n}\nfunction flattenChildren(children) {\n\tconst result = [];\n\tfor (const child of children) if (Array.isArray(child)) result.push(...flattenChildren(child));\n\telse result.push(child);\n\treturn result;\n}\n\n//#endregion\n//#region src/jsx-runtime.ts\n/**\n* JSX automatic runtime.\n*\n* When tsconfig has `\"jsxImportSource\": \"@pyreon/core\"`, the TS/bundler compiler\n* rewrites JSX to imports from this file automatically:\n* <div class=\"x\" /> → jsx(\"div\", { class: \"x\" })\n*/\nfunction jsx(type, props, key) {\n\tconst { children, ...rest } = props;\n\tconst propsWithKey = key != null ? {\n\t\t...rest,\n\t\tkey\n\t} : rest;\n\tif (typeof type === \"function\") return h(type, children !== void 0 ? {\n\t\t...propsWithKey,\n\t\tchildren\n\t} : propsWithKey);\n\treturn h(type, propsWithKey, ...children === void 0 ? [] : Array.isArray(children) ? children : [children]);\n}\nconst jsxs = jsx;\n\n//#endregion\nexport { Fragment, jsx, jsxs };\n//# sourceMappingURL=jsx-runtime.js.map","import type { VNodeChild } from \"@pyreon/core\"\nimport { effect } from \"@pyreon/reactivity\"\nimport type { EChartsOption } from \"echarts\"\nimport type { ECElementEvent } from \"echarts/core\"\nimport type { ChartProps } from \"./types\"\nimport { useChart } from \"./use-chart\"\n\n/**\n * Handler type that bridges our duck-typed ChartEventParams with\n * echarts' internal ECElementEvent. Used for event binding casts.\n */\ntype ECHandler = (params: ECElementEvent) => boolean | undefined\n\n/**\n * Reactive chart component. Wraps useChart in a div with automatic\n * event binding.\n *\n * @example\n * ```tsx\n * // Default — any chart type\n * <Chart\n * options={() => ({\n * series: [{ type: 'bar', data: revenue() }],\n * tooltip: {},\n * })}\n * style=\"height: 400px\"\n * />\n *\n * // Strict — only specific chart types\n * import type { ComposeOption, BarSeriesOption } from '@pyreon/charts'\n * <Chart<ComposeOption<BarSeriesOption>>\n * options={() => ({\n * series: [{ type: 'bar', data: revenue() }],\n * })}\n * style=\"height: 400px\"\n * />\n * ```\n */\nexport function Chart<TOption extends EChartsOption = EChartsOption>(\n props: ChartProps<TOption>,\n): VNodeChild {\n const chart = useChart(props.options, {\n ...(props.theme != null ? { theme: props.theme } : {}),\n ...(props.renderer != null ? { renderer: props.renderer } : {}),\n })\n\n // Bind events when instance is ready\n effect(() => {\n const inst = chart.instance()\n if (!inst) return\n\n // Handlers are duck-typed ChartEventParams — cast through unknown\n // to ECHandler because echarts/core and echarts export incompatible\n // private class types for ECElementEvent.\n if (props.onClick) inst.on(\"click\", props.onClick as unknown as ECHandler)\n if (props.onMouseover) inst.on(\"mouseover\", props.onMouseover as unknown as ECHandler)\n if (props.onMouseout) inst.on(\"mouseout\", props.onMouseout as unknown as ECHandler)\n })\n\n return () => <div ref={chart.ref} style={props.style} class={props.class} />\n}\n"],"mappings":";;;;AAuBA,MAAM,SAAuC;CAC3C,WAAW,OAAO,wBAAkB,MAAM,MAAM,EAAE,SAAS;CAC3D,YAAY,OAAO,wBAAkB,MAAM,MAAM,EAAE,UAAU;CAC7D,WAAW,OAAO,wBAAkB,MAAM,MAAM,EAAE,SAAS;CAC3D,eAAe,OAAO,wBAAkB,MAAM,MAAM,EAAE,aAAa;CACnE,aAAa,OAAO,wBAAkB,MAAM,MAAM,EAAE,WAAW;CAC/D,eAAe,OAAO,wBAAkB,MAAM,MAAM,EAAE,aAAa;CACnE,eAAe,OAAO,wBAAkB,MAAM,MAAM,EAAE,aAAa;CACnE,gBAAgB,OAAO,wBAAkB,MAAM,MAAM,EAAE,cAAc;CACrE,cAAc,OAAO,wBAAkB,MAAM,MAAM,EAAE,YAAY;CACjE,cAAc,OAAO,wBAAkB,MAAM,MAAM,EAAE,YAAY;CACjE,aAAa,OAAO,wBAAkB,MAAM,MAAM,EAAE,WAAW;CAC/D,aAAa,OAAO,wBAAkB,MAAM,MAAM,EAAE,WAAW;CAC/D,YAAY,OAAO,wBAAkB,MAAM,MAAM,EAAE,UAAU;CAC7D,eAAe,OAAO,wBAAkB,MAAM,MAAM,EAAE,aAAa;CACnE,mBAAmB,OAAO,wBAAkB,MAAM,MAAM,EAAE,iBAAiB;CAC3E,gBAAgB,OAAO,wBAAkB,MAAM,MAAM,EAAE,cAAc;CACrE,kBAAkB,OAAO,wBAAkB,MAAM,MAAM,EAAE,gBAAgB;CACzE,qBAAqB,OAAO,wBAAkB,MAAM,MAAM,EAAE,mBAAmB;CAC/E,aAAa,OAAO,wBAAkB,MAAM,MAAM,EAAE,WAAW;CAC/D,oBAAoB,OAAO,wBAAkB,MAAM,MAAM,EAAE,kBAAkB;CAC7E,cAAc,OAAO,wBAAkB,MAAM,MAAM,EAAE,YAAY;CACjE,WAA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ount } from "@pyreon/core";
3
3
 
4
4
  //#region src/loader.ts
5
5
  const CHARTS = {
6
- bar: () => import("./charts-Ckh2qxB5.js").then((m) => m.BarChart),
7
- line: () => import("./charts-Ckh2qxB5.js").then((m) => m.LineChart),
8
- pie: () => import("./charts-Ckh2qxB5.js").then((m) => m.PieChart),
9
- scatter: () => import("./charts-Ckh2qxB5.js").then((m) => m.ScatterChart),
10
- radar: () => import("./charts-Ckh2qxB5.js").then((m) => m.RadarChart),
11
- heatmap: () => import("./charts-Ckh2qxB5.js").then((m) => m.HeatmapChart),
12
- treemap: () => import("./charts-Ckh2qxB5.js").then((m) => m.TreemapChart),
13
- sunburst: () => import("./charts-Ckh2qxB5.js").then((m) => m.SunburstChart),
14
- sankey: () => import("./charts-Ckh2qxB5.js").then((m) => m.SankeyChart),
15
- funnel: () => import("./charts-Ckh2qxB5.js").then((m) => m.FunnelChart),
16
- gauge: () => import("./charts-Ckh2qxB5.js").then((m) => m.GaugeChart),
17
- graph: () => import("./charts-Ckh2qxB5.js").then((m) => m.GraphChart),
18
- tree: () => import("./charts-Ckh2qxB5.js").then((m) => m.TreeChart),
19
- boxplot: () => import("./charts-Ckh2qxB5.js").then((m) => m.BoxplotChart),
20
- candlestick: () => import("./charts-Ckh2qxB5.js").then((m) => m.CandlestickChart),
21
- parallel: () => import("./charts-Ckh2qxB5.js").then((m) => m.ParallelChart),
22
- themeRiver: () => import("./charts-Ckh2qxB5.js").then((m) => m.ThemeRiverChart),
23
- effectScatter: () => import("./charts-Ckh2qxB5.js").then((m) => m.EffectScatterChart),
24
- lines: () => import("./charts-Ckh2qxB5.js").then((m) => m.LinesChart),
25
- pictorialBar: () => import("./charts-Ckh2qxB5.js").then((m) => m.PictorialBarChart),
26
- custom: () => import("./charts-Ckh2qxB5.js").then((m) => m.CustomChart),
27
- map: () => import("./charts-Ckh2qxB5.js").then((m) => m.MapChart)
6
+ bar: () => import("./charts-lo2KeDld.js").then((m) => m.BarChart),
7
+ line: () => import("./charts-lo2KeDld.js").then((m) => m.LineChart),
8
+ pie: () => import("./charts-lo2KeDld.js").then((m) => m.PieChart),
9
+ scatter: () => import("./charts-lo2KeDld.js").then((m) => m.ScatterChart),
10
+ radar: () => import("./charts-lo2KeDld.js").then((m) => m.RadarChart),
11
+ heatmap: () => import("./charts-lo2KeDld.js").then((m) => m.HeatmapChart),
12
+ treemap: () => import("./charts-lo2KeDld.js").then((m) => m.TreemapChart),
13
+ sunburst: () => import("./charts-lo2KeDld.js").then((m) => m.SunburstChart),
14
+ sankey: () => import("./charts-lo2KeDld.js").then((m) => m.SankeyChart),
15
+ funnel: () => import("./charts-lo2KeDld.js").then((m) => m.FunnelChart),
16
+ gauge: () => import("./charts-lo2KeDld.js").then((m) => m.GaugeChart),
17
+ graph: () => import("./charts-lo2KeDld.js").then((m) => m.GraphChart),
18
+ tree: () => import("./charts-lo2KeDld.js").then((m) => m.TreeChart),
19
+ boxplot: () => import("./charts-lo2KeDld.js").then((m) => m.BoxplotChart),
20
+ candlestick: () => import("./charts-lo2KeDld.js").then((m) => m.CandlestickChart),
21
+ parallel: () => import("./charts-lo2KeDld.js").then((m) => m.ParallelChart),
22
+ themeRiver: () => import("./charts-lo2KeDld.js").then((m) => m.ThemeRiverChart),
23
+ effectScatter: () => import("./charts-lo2KeDld.js").then((m) => m.EffectScatterChart),
24
+ lines: () => import("./charts-lo2KeDld.js").then((m) => m.LinesChart),
25
+ pictorialBar: () => import("./charts-lo2KeDld.js").then((m) => m.PictorialBarChart),
26
+ custom: () => import("./charts-lo2KeDld.js").then((m) => m.CustomChart),
27
+ map: () => import("./charts-lo2KeDld.js").then((m) => m.MapChart)
28
28
  };
29
29
  const COMPONENTS = {
30
- grid: () => import("./components-BcPePBeS.js").then((m) => m.GridComponent),
31
- xAxis: () => import("./components-BcPePBeS.js").then((m) => m.GridComponent),
32
- yAxis: () => import("./components-BcPePBeS.js").then((m) => m.GridComponent),
33
- polar: () => import("./components-BcPePBeS.js").then((m) => m.PolarComponent),
34
- radar: () => import("./components-BcPePBeS.js").then((m) => m.RadarComponent),
35
- geo: () => import("./components-BcPePBeS.js").then((m) => m.GeoComponent),
36
- tooltip: () => import("./components-BcPePBeS.js").then((m) => m.TooltipComponent),
37
- legend: () => import("./components-BcPePBeS.js").then((m) => m.LegendComponent),
38
- toolbox: () => import("./components-BcPePBeS.js").then((m) => m.ToolboxComponent),
39
- title: () => import("./components-BcPePBeS.js").then((m) => m.TitleComponent),
40
- dataZoom: () => import("./components-BcPePBeS.js").then((m) => m.DataZoomComponent),
41
- visualMap: () => import("./components-BcPePBeS.js").then((m) => m.VisualMapComponent),
42
- timeline: () => import("./components-BcPePBeS.js").then((m) => m.TimelineComponent),
43
- graphic: () => import("./components-BcPePBeS.js").then((m) => m.GraphicComponent),
44
- brush: () => import("./components-BcPePBeS.js").then((m) => m.BrushComponent),
45
- calendar: () => import("./components-BcPePBeS.js").then((m) => m.CalendarComponent),
46
- dataset: () => import("./components-BcPePBeS.js").then((m) => m.DatasetComponent),
47
- aria: () => import("./components-BcPePBeS.js").then((m) => m.AriaComponent)
30
+ grid: () => import("./components-ClWy1Ztp.js").then((m) => m.GridComponent),
31
+ xAxis: () => import("./components-ClWy1Ztp.js").then((m) => m.GridComponent),
32
+ yAxis: () => import("./components-ClWy1Ztp.js").then((m) => m.GridComponent),
33
+ polar: () => import("./components-ClWy1Ztp.js").then((m) => m.PolarComponent),
34
+ radar: () => import("./components-ClWy1Ztp.js").then((m) => m.RadarComponent),
35
+ geo: () => import("./components-ClWy1Ztp.js").then((m) => m.GeoComponent),
36
+ tooltip: () => import("./components-ClWy1Ztp.js").then((m) => m.TooltipComponent),
37
+ legend: () => import("./components-ClWy1Ztp.js").then((m) => m.LegendComponent),
38
+ toolbox: () => import("./components-ClWy1Ztp.js").then((m) => m.ToolboxComponent),
39
+ title: () => import("./components-ClWy1Ztp.js").then((m) => m.TitleComponent),
40
+ dataZoom: () => import("./components-ClWy1Ztp.js").then((m) => m.DataZoomComponent),
41
+ visualMap: () => import("./components-ClWy1Ztp.js").then((m) => m.VisualMapComponent),
42
+ timeline: () => import("./components-ClWy1Ztp.js").then((m) => m.TimelineComponent),
43
+ graphic: () => import("./components-ClWy1Ztp.js").then((m) => m.GraphicComponent),
44
+ brush: () => import("./components-ClWy1Ztp.js").then((m) => m.BrushComponent),
45
+ calendar: () => import("./components-ClWy1Ztp.js").then((m) => m.CalendarComponent),
46
+ dataset: () => import("./components-ClWy1Ztp.js").then((m) => m.DatasetComponent),
47
+ aria: () => import("./components-ClWy1Ztp.js").then((m) => m.AriaComponent)
48
48
  };
49
49
  const SERIES_FEATURES = {
50
- markPoint: () => import("./components-BcPePBeS.js").then((m) => m.MarkPointComponent),
51
- markLine: () => import("./components-BcPePBeS.js").then((m) => m.MarkLineComponent),
52
- markArea: () => import("./components-BcPePBeS.js").then((m) => m.MarkAreaComponent)
50
+ markPoint: () => import("./components-ClWy1Ztp.js").then((m) => m.MarkPointComponent),
51
+ markLine: () => import("./components-ClWy1Ztp.js").then((m) => m.MarkLineComponent),
52
+ markArea: () => import("./components-ClWy1Ztp.js").then((m) => m.MarkAreaComponent)
53
53
  };
54
54
  const RENDERERS = {
55
- canvas: () => import("./renderers-Dytryvoy.js").then((m) => m.CanvasRenderer),
56
- svg: () => import("./renderers-Dytryvoy.js").then((m) => m.SVGRenderer)
55
+ canvas: () => import("./renderers-BnAAXHfG.js").then((m) => m.CanvasRenderer),
56
+ svg: () => import("./renderers-BnAAXHfG.js").then((m) => m.SVGRenderer)
57
57
  };
58
58
  let coreModule = null;
59
59
  let corePromise = null;
@@ -62,7 +62,7 @@ let corePromise = null;
62
62
  */
63
63
  async function getCore() {
64
64
  if (coreModule) return coreModule;
65
- if (!corePromise) corePromise = import("./core-9w0g6EOI.js").then((m) => {
65
+ if (!corePromise) corePromise = import("./core-BiuQ3y-t.js").then((m) => {
66
66
  coreModule = m;
67
67
  return m;
68
68
  });
@@ -95,15 +95,23 @@ async function loadAndRegister(core, key, loader) {
95
95
  async function ensureModules(option, renderer = "canvas") {
96
96
  const core = await getCore();
97
97
  const loads = [];
98
- loads.push(loadAndRegister(core, `renderer:${renderer}`, RENDERERS[renderer]));
98
+ const rendererLoader = RENDERERS[renderer];
99
+ if (rendererLoader) loads.push(loadAndRegister(core, `renderer:${renderer}`, rendererLoader));
99
100
  const rawSeries = option.series;
100
101
  const seriesList = rawSeries ? Array.isArray(rawSeries) ? rawSeries : [rawSeries] : [];
101
102
  for (const s of seriesList) {
102
103
  const type = s.type;
103
- if (type && CHARTS[type]) loads.push(loadAndRegister(core, `chart:${type}`, CHARTS[type]));
104
+ const chartLoader = type ? CHARTS[type] : void 0;
105
+ if (chartLoader) loads.push(loadAndRegister(core, `chart:${type}`, chartLoader));
106
+ }
107
+ for (const key of Object.keys(option)) {
108
+ const compLoader = COMPONENTS[key];
109
+ if (compLoader) loads.push(loadAndRegister(core, `component:${key}`, compLoader));
110
+ }
111
+ for (const s of seriesList) for (const key of Object.keys(s)) {
112
+ const featureLoader = SERIES_FEATURES[key];
113
+ if (featureLoader) loads.push(loadAndRegister(core, `feature:${key}`, featureLoader));
104
114
  }
105
- for (const key of Object.keys(option)) if (COMPONENTS[key]) loads.push(loadAndRegister(core, `component:${key}`, COMPONENTS[key]));
106
- for (const s of seriesList) for (const key of Object.keys(s)) if (SERIES_FEATURES[key]) loads.push(loadAndRegister(core, `feature:${key}`, SERIES_FEATURES[key]));
107
115
  await Promise.all(loads);
108
116
  return core;
109
117
  }
@@ -176,7 +184,7 @@ function useChart(optionsFn, config) {
176
184
  ensureModules(opts, renderer).then((core) => {
177
185
  if (!container.peek()) return;
178
186
  try {
179
- const chart = core.init(el, config?.theme, {
187
+ const chart = core.init(el, config?.theme ?? null, {
180
188
  renderer,
181
189
  ...config?.locale != null ? { locale: config.locale } : {},
182
190
  ...config?.devicePixelRatio != null ? { devicePixelRatio: config.devicePixelRatio } : {},
@@ -235,7 +243,7 @@ function useChart(optionsFn, config) {
235
243
  }
236
244
 
237
245
  //#endregion
238
- //#region ../../node_modules/.bun/@pyreon+core@0.7.5/node_modules/@pyreon/core/lib/jsx-runtime.js
246
+ //#region ../../core/core/lib/jsx-runtime.js
239
247
  /**
240
248
  * Hyperscript function — the compiled output of JSX.
241
249
  * `<div class="x">hello</div>` → `h("div", { class: "x" }, "hello")`
package/lib/manual.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"manual.js","names":[],"sources":["../src/loader.ts","../src/use-chart.ts","../../../node_modules/.bun/@pyreon+core@0.7.5/node_modules/@pyreon/core/lib/jsx-runtime.js","../src/chart-component.tsx"],"sourcesContent":["/**\n * Lazy loading and auto-detection for ECharts modules.\n *\n * Maps config keys to ECharts modular imports. Only loads what's needed,\n * caches after first load. The echarts/core module itself is lazy-loaded\n * on first use — zero ECharts bytes until a chart actually renders.\n */\n\n/**\n * Loose option type for internal module analysis.\n * The strict EChartsOption type is used at the consumer-facing API level.\n */\ntype LooseOption = Record<string, unknown> & {\n series?: unknown\n}\n\ntype ModuleLoader = () => Promise<unknown>\n\n// ─── Chart type mapping ─────────────────────────────────────────────────────\n\nconst CHARTS: Record<string, ModuleLoader> = {\n bar: () => import('echarts/charts').then((m) => m.BarChart),\n line: () => import('echarts/charts').then((m) => m.LineChart),\n pie: () => import('echarts/charts').then((m) => m.PieChart),\n scatter: () => import('echarts/charts').then((m) => m.ScatterChart),\n radar: () => import('echarts/charts').then((m) => m.RadarChart),\n heatmap: () => import('echarts/charts').then((m) => m.HeatmapChart),\n treemap: () => import('echarts/charts').then((m) => m.TreemapChart),\n sunburst: () => import('echarts/charts').then((m) => m.SunburstChart),\n sankey: () => import('echarts/charts').then((m) => m.SankeyChart),\n funnel: () => import('echarts/charts').then((m) => m.FunnelChart),\n gauge: () => import('echarts/charts').then((m) => m.GaugeChart),\n graph: () => import('echarts/charts').then((m) => m.GraphChart),\n tree: () => import('echarts/charts').then((m) => m.TreeChart),\n boxplot: () => import('echarts/charts').then((m) => m.BoxplotChart),\n candlestick: () => import('echarts/charts').then((m) => m.CandlestickChart),\n parallel: () => import('echarts/charts').then((m) => m.ParallelChart),\n themeRiver: () => import('echarts/charts').then((m) => m.ThemeRiverChart),\n effectScatter: () =>\n import('echarts/charts').then((m) => m.EffectScatterChart),\n lines: () => import('echarts/charts').then((m) => m.LinesChart),\n pictorialBar: () => import('echarts/charts').then((m) => m.PictorialBarChart),\n custom: () => import('echarts/charts').then((m) => m.CustomChart),\n map: () => import('echarts/charts').then((m) => m.MapChart),\n}\n\n// ─── Component mapping ──────────────────────────────────────────────────────\n\n// Multiple config keys can map to the same component (xAxis/yAxis → Grid)\nconst COMPONENTS: Record<string, ModuleLoader> = {\n grid: () => import('echarts/components').then((m) => m.GridComponent),\n xAxis: () => import('echarts/components').then((m) => m.GridComponent),\n yAxis: () => import('echarts/components').then((m) => m.GridComponent),\n polar: () => import('echarts/components').then((m) => m.PolarComponent),\n radar: () => import('echarts/components').then((m) => m.RadarComponent),\n geo: () => import('echarts/components').then((m) => m.GeoComponent),\n tooltip: () => import('echarts/components').then((m) => m.TooltipComponent),\n legend: () => import('echarts/components').then((m) => m.LegendComponent),\n toolbox: () => import('echarts/components').then((m) => m.ToolboxComponent),\n title: () => import('echarts/components').then((m) => m.TitleComponent),\n dataZoom: () => import('echarts/components').then((m) => m.DataZoomComponent),\n visualMap: () =>\n import('echarts/components').then((m) => m.VisualMapComponent),\n timeline: () => import('echarts/components').then((m) => m.TimelineComponent),\n graphic: () => import('echarts/components').then((m) => m.GraphicComponent),\n brush: () => import('echarts/components').then((m) => m.BrushComponent),\n calendar: () => import('echarts/components').then((m) => m.CalendarComponent),\n dataset: () => import('echarts/components').then((m) => m.DatasetComponent),\n aria: () => import('echarts/components').then((m) => m.AriaComponent),\n}\n\n// Series-level features\nconst SERIES_FEATURES: Record<string, ModuleLoader> = {\n markPoint: () =>\n import('echarts/components').then((m) => m.MarkPointComponent),\n markLine: () => import('echarts/components').then((m) => m.MarkLineComponent),\n markArea: () => import('echarts/components').then((m) => m.MarkAreaComponent),\n}\n\n// ─── Renderers ──────────────────────────────────────────────────────────────\n\nconst RENDERERS: Record<string, ModuleLoader> = {\n canvas: () => import('echarts/renderers').then((m) => m.CanvasRenderer),\n svg: () => import('echarts/renderers').then((m) => m.SVGRenderer),\n}\n\n// ─── Core loading ───────────────────────────────────────────────────────────\n\nlet coreModule: typeof import('echarts/core') | null = null\nlet corePromise: Promise<typeof import('echarts/core')> | null = null\n\n/**\n * Lazily load echarts/core. Cached after first call.\n */\nexport async function getCore(): Promise<typeof import('echarts/core')> {\n if (coreModule) return coreModule\n if (!corePromise) {\n corePromise = import('echarts/core').then((m) => {\n coreModule = m\n return m\n })\n }\n return corePromise\n}\n\n/**\n * Get the cached core module (null if not yet loaded).\n */\nexport function getCoreSync(): typeof import('echarts/core') | null {\n return coreModule\n}\n\n// ─── Module registration ────────────────────────────────────────────────────\n\nconst registered = new Set<string>()\nconst inflight = new Map<string, Promise<void>>()\n\nasync function loadAndRegister(\n core: typeof import('echarts/core'),\n key: string,\n loader: ModuleLoader,\n): Promise<void> {\n if (registered.has(key)) return\n if (inflight.has(key)) return inflight.get(key)\n\n const promise = loader().then((mod) => {\n core.use(mod as any)\n registered.add(key)\n inflight.delete(key)\n })\n inflight.set(key, promise)\n return promise\n}\n\n/**\n * Analyze an ECharts option object and dynamically import only the\n * required chart types, components, and renderer. All imports are\n * cached — subsequent calls with the same types are instant.\n */\nexport async function ensureModules(\n option: LooseOption,\n renderer: 'canvas' | 'svg' = 'canvas',\n): Promise<typeof import('echarts/core')> {\n const core = await getCore()\n const loads: Promise<void>[] = []\n\n // Renderer (always needed)\n loads.push(\n loadAndRegister(core, `renderer:${renderer}`, RENDERERS[renderer]!),\n )\n\n // Normalize series to array for analysis\n const rawSeries = option.series\n const seriesList: Record<string, unknown>[] = rawSeries\n ? ((Array.isArray(rawSeries) ? rawSeries : [rawSeries]) as Record<\n string,\n unknown\n >[])\n : []\n\n // Chart types from series[].type\n for (const s of seriesList) {\n const type = s.type as string | undefined\n if (type && CHARTS[type]) {\n loads.push(loadAndRegister(core, `chart:${type}`, CHARTS[type]!))\n }\n }\n\n // Components from top-level config keys\n for (const key of Object.keys(option)) {\n if (COMPONENTS[key]) {\n loads.push(loadAndRegister(core, `component:${key}`, COMPONENTS[key]!))\n }\n }\n\n // Series-level features (markPoint, markLine, markArea)\n for (const s of seriesList) {\n for (const key of Object.keys(s)) {\n if (SERIES_FEATURES[key]) {\n loads.push(\n loadAndRegister(core, `feature:${key}`, SERIES_FEATURES[key]!),\n )\n }\n }\n }\n\n await Promise.all(loads)\n return core\n}\n\n/**\n * Manually register ECharts modules (for tree-shaking entry point).\n * Call this at app startup instead of relying on auto-detection.\n *\n * @example\n * ```ts\n * import { use } from '@pyreon/charts/manual'\n * import { BarChart } from 'echarts/charts'\n * import { GridComponent, TooltipComponent } from 'echarts/components'\n * import { CanvasRenderer } from 'echarts/renderers'\n *\n * use(BarChart, GridComponent, TooltipComponent, CanvasRenderer)\n * ```\n */\nexport function manualUse(...modules: unknown[]): void {\n const core = getCoreSync()\n if (core) {\n core.use(modules as any)\n } else {\n // Core not loaded yet — queue for when it loads\n getCore().then((c) => c.use(modules as any))\n }\n}\n\n// ─── Reset (for testing) ────────────────────────────────────────────────────\n\nexport function _resetLoader(): void {\n registered.clear()\n inflight.clear()\n coreModule = null\n corePromise = null\n}\n","import { onUnmount } from '@pyreon/core'\nimport { effect, signal } from '@pyreon/reactivity'\nimport type { EChartsOption } from 'echarts'\nimport { ensureModules } from './loader'\nimport type { UseChartConfig, UseChartResult } from './types'\n\n/**\n * Reactive ECharts hook. Creates a chart instance bound to a container\n * element, with automatic module lazy-loading, signal tracking, resize\n * handling, error capture, and cleanup.\n *\n * Generic parameter `TOption` narrows the option type for exact autocomplete.\n * Use `ComposeOption<SeriesUnion>` from ECharts to restrict to specific chart types.\n *\n * @example\n * ```tsx\n * // Default — accepts any ECharts option\n * const chart = useChart(() => ({\n * series: [{ type: 'bar', data: revenue() }],\n * }))\n *\n * // Strict — only bar + line allowed, full autocomplete\n * import type { ComposeOption, BarSeriesOption, LineSeriesOption } from '@pyreon/charts'\n * type MyChartOption = ComposeOption<BarSeriesOption | LineSeriesOption>\n *\n * const chart = useChart<MyChartOption>(() => ({\n * series: [{ type: 'bar', data: revenue() }], // ✓\n * }))\n * ```\n */\nexport function useChart<TOption extends EChartsOption = EChartsOption>(\n optionsFn: () => TOption,\n config?: UseChartConfig,\n): UseChartResult {\n const instance = signal<import('echarts/core').ECharts | null>(null)\n const loading = signal(true)\n const error = signal<Error | null>(null)\n const container = signal<HTMLElement | null>(null)\n const renderer = config?.renderer ?? 'canvas'\n\n let observer: ResizeObserver | null = null\n let initialized = false\n\n // Initialize chart when container is bound\n effect(() => {\n const el = container()\n if (!el || initialized) return\n\n initialized = true\n\n let opts: EChartsOption\n try {\n opts = optionsFn()\n } catch (err) {\n error.set(err instanceof Error ? err : new Error(String(err)))\n loading.set(false)\n return\n }\n\n // Load required ECharts modules, then create chart\n ensureModules(opts as Record<string, unknown>, renderer)\n .then((core) => {\n // Guard: component may have unmounted during async load\n if (!container.peek()) return\n\n try {\n const chart = core.init(el, config?.theme as any, {\n renderer,\n ...(config?.locale != null ? { locale: config.locale } : {}),\n ...(config?.devicePixelRatio != null\n ? { devicePixelRatio: config.devicePixelRatio }\n : {}),\n ...(config?.width != null ? { width: config.width } : {}),\n ...(config?.height != null ? { height: config.height } : {}),\n })\n\n chart.setOption(opts)\n instance.set(chart)\n loading.set(false)\n error.set(null)\n\n config?.onInit?.(chart)\n\n // ResizeObserver for auto-resize\n observer = new ResizeObserver(() => {\n chart.resize()\n })\n observer.observe(el)\n } catch (err) {\n error.set(err instanceof Error ? err : new Error(String(err)))\n loading.set(false)\n }\n })\n .catch((err) => {\n error.set(err instanceof Error ? err : new Error(String(err)))\n loading.set(false)\n })\n })\n\n // Reactive updates — re-run when signals in optionsFn change\n effect(() => {\n const chart = instance()\n if (!chart) return\n\n try {\n const opts = optionsFn()\n chart.setOption(opts, {\n notMerge: config?.notMerge ?? false,\n lazyUpdate: config?.lazyUpdate ?? true,\n })\n error.set(null)\n } catch (err) {\n error.set(err instanceof Error ? err : new Error(String(err)))\n }\n })\n\n // Cleanup on unmount\n onUnmount(() => {\n observer?.disconnect()\n observer = null\n\n const chart = instance.peek()\n if (chart) {\n chart.dispose()\n instance.set(null)\n }\n\n initialized = false\n })\n\n return {\n ref: (el: Element | null) => container.set(el as HTMLElement | null),\n instance,\n loading,\n error,\n resize: () => instance.peek()?.resize(),\n }\n}\n","//#region src/h.ts\n/** Marker for fragment nodes — renders children without a wrapper element */\nconst Fragment = Symbol(\"Pyreon.Fragment\");\n/**\n* Hyperscript function — the compiled output of JSX.\n* `<div class=\"x\">hello</div>` → `h(\"div\", { class: \"x\" }, \"hello\")`\n*\n* Generic on P so TypeScript validates props match the component's signature\n* at the call site, then stores the result in the loosely-typed VNode.\n*/\n/** Shared empty props sentinel — identity-checked in mountElement to skip applyProps. */\nconst EMPTY_PROPS = {};\nfunction h(type, props, ...children) {\n\treturn {\n\t\ttype,\n\t\tprops: props ?? EMPTY_PROPS,\n\t\tchildren: normalizeChildren(children),\n\t\tkey: props?.key ?? null\n\t};\n}\nfunction normalizeChildren(children) {\n\tfor (let i = 0; i < children.length; i++) if (Array.isArray(children[i])) return flattenChildren(children);\n\treturn children;\n}\nfunction flattenChildren(children) {\n\tconst result = [];\n\tfor (const child of children) if (Array.isArray(child)) result.push(...flattenChildren(child));\n\telse result.push(child);\n\treturn result;\n}\n\n//#endregion\n//#region src/jsx-runtime.ts\n/**\n* JSX automatic runtime.\n*\n* When tsconfig has `\"jsxImportSource\": \"@pyreon/core\"`, the TS/bundler compiler\n* rewrites JSX to imports from this file automatically:\n* <div class=\"x\" /> → jsx(\"div\", { class: \"x\" })\n*/\nfunction jsx(type, props, key) {\n\tconst { children, ...rest } = props;\n\tconst propsWithKey = key != null ? {\n\t\t...rest,\n\t\tkey\n\t} : rest;\n\tif (typeof type === \"function\") return h(type, children !== void 0 ? {\n\t\t...propsWithKey,\n\t\tchildren\n\t} : propsWithKey);\n\treturn h(type, propsWithKey, ...children === void 0 ? [] : Array.isArray(children) ? children : [children]);\n}\nconst jsxs = jsx;\n\n//#endregion\nexport { Fragment, jsx, jsxs };\n//# sourceMappingURL=jsx-runtime.js.map","import type { VNodeChild } from '@pyreon/core'\nimport { effect } from '@pyreon/reactivity'\nimport type { EChartsOption } from 'echarts'\nimport type { ChartProps } from './types'\nimport { useChart } from './use-chart'\n\n/**\n * Reactive chart component. Wraps useChart in a div with automatic\n * event binding.\n *\n * @example\n * ```tsx\n * // Default — any chart type\n * <Chart\n * options={() => ({\n * series: [{ type: 'bar', data: revenue() }],\n * tooltip: {},\n * })}\n * style=\"height: 400px\"\n * />\n *\n * // Strict — only specific chart types\n * import type { ComposeOption, BarSeriesOption } from '@pyreon/charts'\n * <Chart<ComposeOption<BarSeriesOption>>\n * options={() => ({\n * series: [{ type: 'bar', data: revenue() }],\n * })}\n * style=\"height: 400px\"\n * />\n * ```\n */\nexport function Chart<TOption extends EChartsOption = EChartsOption>(\n props: ChartProps<TOption>,\n): VNodeChild {\n const chart = useChart(props.options, {\n ...(props.theme != null ? { theme: props.theme } : {}),\n ...(props.renderer != null ? { renderer: props.renderer } : {}),\n })\n\n // Bind events when instance is ready\n effect(() => {\n const inst = chart.instance()\n if (!inst) return\n\n // Handlers are duck-typed ChartEventParams — cast needed because\n // echarts/core and echarts export incompatible private class types\n if (props.onClick) inst.on('click', props.onClick as any)\n if (props.onMouseover) inst.on('mouseover', props.onMouseover as any)\n if (props.onMouseout) inst.on('mouseout', props.onMouseout as any)\n })\n\n return () => <div ref={chart.ref} style={props.style} class={props.class} />\n}\n"],"x_google_ignoreList":[2],"mappings":";;;;AAoBA,MAAM,SAAuC;CAC3C,WAAW,OAAO,wBAAkB,MAAM,MAAM,EAAE,SAAS;CAC3D,YAAY,OAAO,wBAAkB,MAAM,MAAM,EAAE,UAAU;CAC7D,WAAW,OAAO,wBAAkB,MAAM,MAAM,EAAE,SAAS;CAC3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AAO,KAAK,GAAG,gBAAgB,MAAM,CAAC;KACzF,QAAO,KAAK,MAAM;AACvB,QAAO;;;;;;;;;AAYR,SAAS,IAAI,MAAM,OAAO,KAAK;CAC9B,MAAM,EAAE,UAAU,GAAG,SAAS;CAC9B,MAAM,eAAe,OAAO,OAAO;EAClC,GAAG;EACH;EACA,GAAG;AACJ,KAAI,OAAO,SAAS,WAAY,QAAO,EAAE,MAAM,aAAa,KAAK,IAAI;EACpE,GAAG;EACH;EACA,GAAG,aAAa;AACjB,QAAO,EAAE,MAAM,cAAc,GAAG,aAAa,KAAK,IAAI,EAAE,GAAG,MAAM,QAAQ,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACnB5G,SAAgB,MACd,OACY;CACZ,MAAM,QAAQ,SAAS,MAAM,SAAS;EACpC,GAAI,MAAM,SAAS,OAAO,EAAE,OAAO,MAAM,OAAO,GAAG,EAAE;EACrD,GAAI,MAAM,YAAY,OAAO,EAAE,UAAU,MAAM,UAAU,GAAG,EAAE;EAC/D,CAAC;AAGF,cAAa;EACX,MAAM,OAAO,MAAM,UAAU;AAC7B,MAAI,CAAC,KAAM;AAIX,MAAI,MAAM,QAAS,MAAK,GAAG,SAAS,MAAM,QAAe;AACzD,MAAI,MAAM,YAAa,MAAK,GAAG,aAAa,MAAM,YAAmB;AACrE,MAAI,MAAM,WAAY,MAAK,GAAG,YAAY,MAAM,WAAkB;GAClE;AAEF,cAAa,oBAAC,OAAD;EAAK,KAAK,MAAM;EAAK,OAAO,MAAM;EAAO,OAAO,MAAM;EAAS"}
1
+ {"version":3,"file":"manual.js","names":[],"sources":["../src/loader.ts","../src/use-chart.ts","../../../core/core/lib/jsx-runtime.js","../src/chart-component.tsx"],"sourcesContent":["/**\n * Lazy loading and auto-detection for ECharts modules.\n *\n * Maps config keys to ECharts modular imports. Only loads what's needed,\n * caches after first load. The echarts/core module itself is lazy-loaded\n * on first use — zero ECharts bytes until a chart actually renders.\n */\n\n/**\n * Loose option type for internal module analysis.\n * The strict EChartsOption type is used at the consumer-facing API level.\n */\ntype LooseOption = Record<string, unknown> & {\n series?: unknown\n}\n\ntype ModuleLoader = () => Promise<unknown>\n\n/** The argument type that `echarts/core.use()` accepts. */\ntype EChartsUseArg = Parameters<typeof import(\"echarts/core\").use>[0]\n\n// ─── Chart type mapping ─────────────────────────────────────────────────────\n\nconst CHARTS: Record<string, ModuleLoader> = {\n bar: () => import(\"echarts/charts\").then((m) => m.BarChart),\n line: () => import(\"echarts/charts\").then((m) => m.LineChart),\n pie: () => import(\"echarts/charts\").then((m) => m.PieChart),\n scatter: () => import(\"echarts/charts\").then((m) => m.ScatterChart),\n radar: () => import(\"echarts/charts\").then((m) => m.RadarChart),\n heatmap: () => import(\"echarts/charts\").then((m) => m.HeatmapChart),\n treemap: () => import(\"echarts/charts\").then((m) => m.TreemapChart),\n sunburst: () => import(\"echarts/charts\").then((m) => m.SunburstChart),\n sankey: () => import(\"echarts/charts\").then((m) => m.SankeyChart),\n funnel: () => import(\"echarts/charts\").then((m) => m.FunnelChart),\n gauge: () => import(\"echarts/charts\").then((m) => m.GaugeChart),\n graph: () => import(\"echarts/charts\").then((m) => m.GraphChart),\n tree: () => import(\"echarts/charts\").then((m) => m.TreeChart),\n boxplot: () => import(\"echarts/charts\").then((m) => m.BoxplotChart),\n candlestick: () => import(\"echarts/charts\").then((m) => m.CandlestickChart),\n parallel: () => import(\"echarts/charts\").then((m) => m.ParallelChart),\n themeRiver: () => import(\"echarts/charts\").then((m) => m.ThemeRiverChart),\n effectScatter: () => import(\"echarts/charts\").then((m) => m.EffectScatterChart),\n lines: () => import(\"echarts/charts\").then((m) => m.LinesChart),\n pictorialBar: () => import(\"echarts/charts\").then((m) => m.PictorialBarChart),\n custom: () => import(\"echarts/charts\").then((m) => m.CustomChart),\n map: () => import(\"echarts/charts\").then((m) => m.MapChart),\n}\n\n// ─── Component mapping ──────────────────────────────────────────────────────\n\n// Multiple config keys can map to the same component (xAxis/yAxis → Grid)\nconst COMPONENTS: Record<string, ModuleLoader> = {\n grid: () => import(\"echarts/components\").then((m) => m.GridComponent),\n xAxis: () => import(\"echarts/components\").then((m) => m.GridComponent),\n yAxis: () => import(\"echarts/components\").then((m) => m.GridComponent),\n polar: () => import(\"echarts/components\").then((m) => m.PolarComponent),\n radar: () => import(\"echarts/components\").then((m) => m.RadarComponent),\n geo: () => import(\"echarts/components\").then((m) => m.GeoComponent),\n tooltip: () => import(\"echarts/components\").then((m) => m.TooltipComponent),\n legend: () => import(\"echarts/components\").then((m) => m.LegendComponent),\n toolbox: () => import(\"echarts/components\").then((m) => m.ToolboxComponent),\n title: () => import(\"echarts/components\").then((m) => m.TitleComponent),\n dataZoom: () => import(\"echarts/components\").then((m) => m.DataZoomComponent),\n visualMap: () => import(\"echarts/components\").then((m) => m.VisualMapComponent),\n timeline: () => import(\"echarts/components\").then((m) => m.TimelineComponent),\n graphic: () => import(\"echarts/components\").then((m) => m.GraphicComponent),\n brush: () => import(\"echarts/components\").then((m) => m.BrushComponent),\n calendar: () => import(\"echarts/components\").then((m) => m.CalendarComponent),\n dataset: () => import(\"echarts/components\").then((m) => m.DatasetComponent),\n aria: () => import(\"echarts/components\").then((m) => m.AriaComponent),\n}\n\n// Series-level features\nconst SERIES_FEATURES: Record<string, ModuleLoader> = {\n markPoint: () => import(\"echarts/components\").then((m) => m.MarkPointComponent),\n markLine: () => import(\"echarts/components\").then((m) => m.MarkLineComponent),\n markArea: () => import(\"echarts/components\").then((m) => m.MarkAreaComponent),\n}\n\n// ─── Renderers ──────────────────────────────────────────────────────────────\n\nconst RENDERERS: Record<string, ModuleLoader> = {\n canvas: () => import(\"echarts/renderers\").then((m) => m.CanvasRenderer),\n svg: () => import(\"echarts/renderers\").then((m) => m.SVGRenderer),\n}\n\n// ─── Core loading ───────────────────────────────────────────────────────────\n\nlet coreModule: typeof import(\"echarts/core\") | null = null\nlet corePromise: Promise<typeof import(\"echarts/core\")> | null = null\n\n/**\n * Lazily load echarts/core. Cached after first call.\n */\nexport async function getCore(): Promise<typeof import(\"echarts/core\")> {\n if (coreModule) return coreModule\n if (!corePromise) {\n corePromise = import(\"echarts/core\").then((m) => {\n coreModule = m\n return m\n })\n }\n return corePromise\n}\n\n/**\n * Get the cached core module (null if not yet loaded).\n */\nexport function getCoreSync(): typeof import(\"echarts/core\") | null {\n return coreModule\n}\n\n// ─── Module registration ────────────────────────────────────────────────────\n\nconst registered = new Set<string>()\nconst inflight = new Map<string, Promise<void>>()\n\nasync function loadAndRegister(\n core: typeof import(\"echarts/core\"),\n key: string,\n loader: ModuleLoader,\n): Promise<void> {\n if (registered.has(key)) return\n if (inflight.has(key)) return inflight.get(key)\n\n const promise = loader().then((mod) => {\n core.use(mod as EChartsUseArg)\n registered.add(key)\n inflight.delete(key)\n })\n inflight.set(key, promise)\n return promise\n}\n\n/**\n * Analyze an ECharts option object and dynamically import only the\n * required chart types, components, and renderer. All imports are\n * cached — subsequent calls with the same types are instant.\n */\nexport async function ensureModules(\n option: LooseOption,\n renderer: \"canvas\" | \"svg\" = \"canvas\",\n): Promise<typeof import(\"echarts/core\")> {\n const core = await getCore()\n const loads: Promise<void>[] = []\n\n // Renderer (always needed)\n const rendererLoader = RENDERERS[renderer]\n if (rendererLoader) loads.push(loadAndRegister(core, `renderer:${renderer}`, rendererLoader))\n\n // Normalize series to array for analysis\n const rawSeries = option.series\n const seriesList: Record<string, unknown>[] = rawSeries\n ? ((Array.isArray(rawSeries) ? rawSeries : [rawSeries]) as Record<string, unknown>[])\n : []\n\n // Chart types from series[].type\n for (const s of seriesList) {\n const type = s.type as string | undefined\n const chartLoader = type ? CHARTS[type] : undefined\n if (chartLoader) {\n loads.push(loadAndRegister(core, `chart:${type}`, chartLoader))\n }\n }\n\n // Components from top-level config keys\n for (const key of Object.keys(option)) {\n const compLoader = COMPONENTS[key]\n if (compLoader) {\n loads.push(loadAndRegister(core, `component:${key}`, compLoader))\n }\n }\n\n // Series-level features (markPoint, markLine, markArea)\n for (const s of seriesList) {\n for (const key of Object.keys(s)) {\n const featureLoader = SERIES_FEATURES[key]\n if (featureLoader) {\n loads.push(loadAndRegister(core, `feature:${key}`, featureLoader))\n }\n }\n }\n\n await Promise.all(loads)\n return core\n}\n\n/**\n * Manually register ECharts modules (for tree-shaking entry point).\n * Call this at app startup instead of relying on auto-detection.\n *\n * @example\n * ```ts\n * import { use } from '@pyreon/charts/manual'\n * import { BarChart } from 'echarts/charts'\n * import { GridComponent, TooltipComponent } from 'echarts/components'\n * import { CanvasRenderer } from 'echarts/renderers'\n *\n * use(BarChart, GridComponent, TooltipComponent, CanvasRenderer)\n * ```\n */\nexport function manualUse(...modules: unknown[]): void {\n const core = getCoreSync()\n if (core) {\n core.use(modules as EChartsUseArg)\n } else {\n // Core not loaded yet — queue for when it loads\n getCore().then((c) => c.use(modules as any))\n }\n}\n\n// ─── Reset (for testing) ────────────────────────────────────────────────────\n\nexport function _resetLoader(): void {\n registered.clear()\n inflight.clear()\n coreModule = null\n corePromise = null\n}\n","import { onUnmount } from \"@pyreon/core\"\nimport { effect, signal } from \"@pyreon/reactivity\"\nimport type { EChartsOption } from \"echarts\"\nimport { ensureModules } from \"./loader\"\nimport type { UseChartConfig, UseChartResult } from \"./types\"\n\n/**\n * Reactive ECharts hook. Creates a chart instance bound to a container\n * element, with automatic module lazy-loading, signal tracking, resize\n * handling, error capture, and cleanup.\n *\n * Generic parameter `TOption` narrows the option type for exact autocomplete.\n * Use `ComposeOption<SeriesUnion>` from ECharts to restrict to specific chart types.\n *\n * @example\n * ```tsx\n * // Default — accepts any ECharts option\n * const chart = useChart(() => ({\n * series: [{ type: 'bar', data: revenue() }],\n * }))\n *\n * // Strict — only bar + line allowed, full autocomplete\n * import type { ComposeOption, BarSeriesOption, LineSeriesOption } from '@pyreon/charts'\n * type MyChartOption = ComposeOption<BarSeriesOption | LineSeriesOption>\n *\n * const chart = useChart<MyChartOption>(() => ({\n * series: [{ type: 'bar', data: revenue() }], // ✓\n * }))\n * ```\n */\nexport function useChart<TOption extends EChartsOption = EChartsOption>(\n optionsFn: () => TOption,\n config?: UseChartConfig,\n): UseChartResult {\n const instance = signal<import(\"echarts/core\").ECharts | null>(null)\n const loading = signal(true)\n const error = signal<Error | null>(null)\n const container = signal<HTMLElement | null>(null)\n const renderer = config?.renderer ?? \"canvas\"\n\n let observer: ResizeObserver | null = null\n let initialized = false\n\n // Initialize chart when container is bound\n effect(() => {\n const el = container()\n if (!el || initialized) return\n\n initialized = true\n\n let opts: EChartsOption\n try {\n opts = optionsFn()\n } catch (err) {\n error.set(err instanceof Error ? err : new Error(String(err)))\n loading.set(false)\n return\n }\n\n // Load required ECharts modules, then create chart\n ensureModules(opts as Record<string, unknown>, renderer)\n .then((core) => {\n // Guard: component may have unmounted during async load\n if (!container.peek()) return\n\n try {\n const chart = core.init(el, (config?.theme ?? null) as string | object | null, {\n renderer,\n ...(config?.locale != null ? { locale: config.locale } : {}),\n ...(config?.devicePixelRatio != null\n ? { devicePixelRatio: config.devicePixelRatio }\n : {}),\n ...(config?.width != null ? { width: config.width } : {}),\n ...(config?.height != null ? { height: config.height } : {}),\n })\n\n chart.setOption(opts)\n instance.set(chart)\n loading.set(false)\n error.set(null)\n\n config?.onInit?.(chart)\n\n // ResizeObserver for auto-resize\n observer = new ResizeObserver(() => {\n chart.resize()\n })\n observer.observe(el)\n } catch (err) {\n error.set(err instanceof Error ? err : new Error(String(err)))\n loading.set(false)\n }\n })\n .catch((err) => {\n error.set(err instanceof Error ? err : new Error(String(err)))\n loading.set(false)\n })\n })\n\n // Reactive updates — re-run when signals in optionsFn change\n effect(() => {\n const chart = instance()\n if (!chart) return\n\n try {\n const opts = optionsFn()\n chart.setOption(opts, {\n notMerge: config?.notMerge ?? false,\n lazyUpdate: config?.lazyUpdate ?? true,\n })\n error.set(null)\n } catch (err) {\n error.set(err instanceof Error ? err : new Error(String(err)))\n }\n })\n\n // Cleanup on unmount\n onUnmount(() => {\n observer?.disconnect()\n observer = null\n\n const chart = instance.peek()\n if (chart) {\n chart.dispose()\n instance.set(null)\n }\n\n initialized = false\n })\n\n return {\n ref: (el: Element | null) => container.set(el as HTMLElement | null),\n instance,\n loading,\n error,\n resize: () => instance.peek()?.resize(),\n }\n}\n","//#region src/h.ts\n/** Marker for fragment nodes — renders children without a wrapper element */\nconst Fragment = Symbol(\"Pyreon.Fragment\");\n/**\n* Hyperscript function — the compiled output of JSX.\n* `<div class=\"x\">hello</div>` → `h(\"div\", { class: \"x\" }, \"hello\")`\n*\n* Generic on P so TypeScript validates props match the component's signature\n* at the call site, then stores the result in the loosely-typed VNode.\n*/\n/** Shared empty props sentinel — identity-checked in mountElement to skip applyProps. */\nconst EMPTY_PROPS = {};\nfunction h(type, props, ...children) {\n\treturn {\n\t\ttype,\n\t\tprops: props ?? EMPTY_PROPS,\n\t\tchildren: normalizeChildren(children),\n\t\tkey: props?.key ?? null\n\t};\n}\nfunction normalizeChildren(children) {\n\tfor (let i = 0; i < children.length; i++) if (Array.isArray(children[i])) return flattenChildren(children);\n\treturn children;\n}\nfunction flattenChildren(children) {\n\tconst result = [];\n\tfor (const child of children) if (Array.isArray(child)) result.push(...flattenChildren(child));\n\telse result.push(child);\n\treturn result;\n}\n\n//#endregion\n//#region src/jsx-runtime.ts\n/**\n* JSX automatic runtime.\n*\n* When tsconfig has `\"jsxImportSource\": \"@pyreon/core\"`, the TS/bundler compiler\n* rewrites JSX to imports from this file automatically:\n* <div class=\"x\" /> → jsx(\"div\", { class: \"x\" })\n*/\nfunction jsx(type, props, key) {\n\tconst { children, ...rest } = props;\n\tconst propsWithKey = key != null ? {\n\t\t...rest,\n\t\tkey\n\t} : rest;\n\tif (typeof type === \"function\") return h(type, children !== void 0 ? {\n\t\t...propsWithKey,\n\t\tchildren\n\t} : propsWithKey);\n\treturn h(type, propsWithKey, ...children === void 0 ? [] : Array.isArray(children) ? children : [children]);\n}\nconst jsxs = jsx;\n\n//#endregion\nexport { Fragment, jsx, jsxs };\n//# sourceMappingURL=jsx-runtime.js.map","import type { VNodeChild } from \"@pyreon/core\"\nimport { effect } from \"@pyreon/reactivity\"\nimport type { EChartsOption } from \"echarts\"\nimport type { ECElementEvent } from \"echarts/core\"\nimport type { ChartProps } from \"./types\"\nimport { useChart } from \"./use-chart\"\n\n/**\n * Handler type that bridges our duck-typed ChartEventParams with\n * echarts' internal ECElementEvent. Used for event binding casts.\n */\ntype ECHandler = (params: ECElementEvent) => boolean | undefined\n\n/**\n * Reactive chart component. Wraps useChart in a div with automatic\n * event binding.\n *\n * @example\n * ```tsx\n * // Default — any chart type\n * <Chart\n * options={() => ({\n * series: [{ type: 'bar', data: revenue() }],\n * tooltip: {},\n * })}\n * style=\"height: 400px\"\n * />\n *\n * // Strict — only specific chart types\n * import type { ComposeOption, BarSeriesOption } from '@pyreon/charts'\n * <Chart<ComposeOption<BarSeriesOption>>\n * options={() => ({\n * series: [{ type: 'bar', data: revenue() }],\n * })}\n * style=\"height: 400px\"\n * />\n * ```\n */\nexport function Chart<TOption extends EChartsOption = EChartsOption>(\n props: ChartProps<TOption>,\n): VNodeChild {\n const chart = useChart(props.options, {\n ...(props.theme != null ? { theme: props.theme } : {}),\n ...(props.renderer != null ? { renderer: props.renderer } : {}),\n })\n\n // Bind events when instance is ready\n effect(() => {\n const inst = chart.instance()\n if (!inst) return\n\n // Handlers are duck-typed ChartEventParams — cast through unknown\n // to ECHandler because echarts/core and echarts export incompatible\n // private class types for ECElementEvent.\n if (props.onClick) inst.on(\"click\", props.onClick as unknown as ECHandler)\n if (props.onMouseover) inst.on(\"mouseover\", props.onMouseover as unknown as ECHandler)\n if (props.onMouseout) inst.on(\"mouseout\", props.onMouseout as unknown as ECHandler)\n })\n\n return () => <div ref={chart.ref} style={props.style} class={props.class} />\n}\n"],"mappings":";;;;AAuBA,MAAM,SAAuC;CAC3C,WAAW,OAAO,wBAAkB,MAAM,MAAM,EAAE,SAAS;CAC3D,YAAY,OAAO,wBAAkB,MAAM,MAAM,EAAE,UAAU;CAC7D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