@loidolt/theme-charts 0.7.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 (77) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +124 -0
  3. package/dist/components/BarChart.svelte +64 -0
  4. package/dist/components/BarChart.svelte.d.ts +14 -0
  5. package/dist/components/CandlestickChart.svelte +58 -0
  6. package/dist/components/CandlestickChart.svelte.d.ts +21 -0
  7. package/dist/components/Chart.svelte +282 -0
  8. package/dist/components/Chart.svelte.d.ts +73 -0
  9. package/dist/components/ChartDataTable.svelte +79 -0
  10. package/dist/components/ChartDataTable.svelte.d.ts +23 -0
  11. package/dist/components/FunnelChart.svelte +50 -0
  12. package/dist/components/FunnelChart.svelte.d.ts +18 -0
  13. package/dist/components/GaugeChart.svelte +54 -0
  14. package/dist/components/GaugeChart.svelte.d.ts +18 -0
  15. package/dist/components/HeatmapChart.svelte +51 -0
  16. package/dist/components/HeatmapChart.svelte.d.ts +14 -0
  17. package/dist/components/LineChart.svelte +66 -0
  18. package/dist/components/LineChart.svelte.d.ts +14 -0
  19. package/dist/components/PieChart.svelte +62 -0
  20. package/dist/components/PieChart.svelte.d.ts +18 -0
  21. package/dist/components/RadarChart.svelte +48 -0
  22. package/dist/components/RadarChart.svelte.d.ts +14 -0
  23. package/dist/components/SankeyChart.svelte +48 -0
  24. package/dist/components/SankeyChart.svelte.d.ts +18 -0
  25. package/dist/components/ScatterChart.svelte +61 -0
  26. package/dist/components/ScatterChart.svelte.d.ts +18 -0
  27. package/dist/components/TreemapChart.svelte +48 -0
  28. package/dist/components/TreemapChart.svelte.d.ts +17 -0
  29. package/dist/core/builders/category.d.ts +37 -0
  30. package/dist/core/builders/category.js +109 -0
  31. package/dist/core/builders/more.d.ts +119 -0
  32. package/dist/core/builders/more.js +530 -0
  33. package/dist/core/builders/slices.d.ts +36 -0
  34. package/dist/core/builders/slices.js +117 -0
  35. package/dist/core/describe.d.ts +27 -0
  36. package/dist/core/describe.js +69 -0
  37. package/dist/core/format.d.ts +15 -0
  38. package/dist/core/format.js +39 -0
  39. package/dist/core/index.d.ts +11 -0
  40. package/dist/core/index.js +12 -0
  41. package/dist/core/theme.d.ts +30 -0
  42. package/dist/core/theme.js +137 -0
  43. package/dist/core/types.d.ts +98 -0
  44. package/dist/core/types.js +1 -0
  45. package/dist/core/validate.d.ts +4 -0
  46. package/dist/core/validate.js +10 -0
  47. package/dist/echarts/all.d.ts +3 -0
  48. package/dist/echarts/all.js +23 -0
  49. package/dist/echarts/bar.d.ts +3 -0
  50. package/dist/echarts/bar.js +2 -0
  51. package/dist/echarts/base.d.ts +3 -0
  52. package/dist/echarts/base.js +13 -0
  53. package/dist/echarts/candlestick.d.ts +3 -0
  54. package/dist/echarts/candlestick.js +3 -0
  55. package/dist/echarts/funnel.d.ts +3 -0
  56. package/dist/echarts/funnel.js +2 -0
  57. package/dist/echarts/gauge.d.ts +3 -0
  58. package/dist/echarts/gauge.js +2 -0
  59. package/dist/echarts/heatmap.d.ts +3 -0
  60. package/dist/echarts/heatmap.js +3 -0
  61. package/dist/echarts/line.d.ts +3 -0
  62. package/dist/echarts/line.js +2 -0
  63. package/dist/echarts/pie.d.ts +3 -0
  64. package/dist/echarts/pie.js +2 -0
  65. package/dist/echarts/radar.d.ts +3 -0
  66. package/dist/echarts/radar.js +3 -0
  67. package/dist/echarts/sankey.d.ts +3 -0
  68. package/dist/echarts/sankey.js +2 -0
  69. package/dist/echarts/scatter.d.ts +3 -0
  70. package/dist/echarts/scatter.js +2 -0
  71. package/dist/echarts/treemap.d.ts +3 -0
  72. package/dist/echarts/treemap.js +2 -0
  73. package/dist/echarts.d.ts +22 -0
  74. package/dist/echarts.js +24 -0
  75. package/dist/index.d.ts +16 -0
  76. package/dist/index.js +15 -0
  77. package/package.json +67 -0
@@ -0,0 +1,24 @@
1
+ /*
2
+ * ECharts is a peer dependency, but it is never imported at module scope: a chart loads it from
3
+ * an effect, so server rendering never evaluates it and pages that show no chart never download
4
+ * it. Each chart type pulls in only the ECharts pieces it draws with (see `./echarts/`).
5
+ *
6
+ * `setEChartsLoader` replaces how the core is loaded — to use a global build from a script tag,
7
+ * or a stand-in under test.
8
+ */
9
+ const defaultLoader = () => import('echarts/core');
10
+ let registered = null;
11
+ let cached = null;
12
+ /** Replaces how `echarts/core` is loaded. `null` restores the default dynamic import. */
13
+ export function setEChartsLoader(loader) {
14
+ registered = loader;
15
+ cached = null;
16
+ }
17
+ /** Loads the ECharts core once. Resolves `null` rather than rejecting when it cannot. */
18
+ export function loadECharts() {
19
+ cached ??= Promise.resolve()
20
+ .then(registered ?? defaultLoader)
21
+ .then((core) => core ?? null)
22
+ .catch(() => null);
23
+ return cached;
24
+ }
@@ -0,0 +1,16 @@
1
+ export { default as BarChart } from './components/BarChart.svelte';
2
+ export { default as CandlestickChart } from './components/CandlestickChart.svelte';
3
+ export { default as Chart } from './components/Chart.svelte';
4
+ export { default as ChartDataTable } from './components/ChartDataTable.svelte';
5
+ export { default as FunnelChart } from './components/FunnelChart.svelte';
6
+ export { default as GaugeChart } from './components/GaugeChart.svelte';
7
+ export { default as HeatmapChart } from './components/HeatmapChart.svelte';
8
+ export { default as LineChart } from './components/LineChart.svelte';
9
+ export { default as PieChart } from './components/PieChart.svelte';
10
+ export { default as RadarChart } from './components/RadarChart.svelte';
11
+ export { default as SankeyChart } from './components/SankeyChart.svelte';
12
+ export { default as ScatterChart } from './components/ScatterChart.svelte';
13
+ export { default as TreemapChart } from './components/TreemapChart.svelte';
14
+ export { loadECharts, setEChartsLoader } from './echarts.js';
15
+ export type { ChartExtensions, EChartsCore, EChartsInstance, EChartsLoader } from './echarts.js';
16
+ export * from './core/index.js';
package/dist/index.js ADDED
@@ -0,0 +1,15 @@
1
+ export { default as BarChart } from './components/BarChart.svelte';
2
+ export { default as CandlestickChart } from './components/CandlestickChart.svelte';
3
+ export { default as Chart } from './components/Chart.svelte';
4
+ export { default as ChartDataTable } from './components/ChartDataTable.svelte';
5
+ export { default as FunnelChart } from './components/FunnelChart.svelte';
6
+ export { default as GaugeChart } from './components/GaugeChart.svelte';
7
+ export { default as HeatmapChart } from './components/HeatmapChart.svelte';
8
+ export { default as LineChart } from './components/LineChart.svelte';
9
+ export { default as PieChart } from './components/PieChart.svelte';
10
+ export { default as RadarChart } from './components/RadarChart.svelte';
11
+ export { default as SankeyChart } from './components/SankeyChart.svelte';
12
+ export { default as ScatterChart } from './components/ScatterChart.svelte';
13
+ export { default as TreemapChart } from './components/TreemapChart.svelte';
14
+ export { loadECharts, setEChartsLoader } from './echarts.js';
15
+ export * from './core/index.js';
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@loidolt/theme-charts",
3
+ "version": "0.7.0",
4
+ "description": "Accessible, themed ECharts components for Loidolt applications",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "svelte": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "svelte": "./dist/index.js",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "./core": {
16
+ "types": "./dist/core/index.d.ts",
17
+ "default": "./dist/core/index.js"
18
+ },
19
+ "./package.json": "./package.json"
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "sideEffects": false,
25
+ "scripts": {
26
+ "build": "svelte-package -i src/lib -o dist",
27
+ "prepack": "npm run build",
28
+ "typecheck": "svelte-check --tsconfig ./tsconfig.json",
29
+ "test": "vitest run && vitest run --config vitest.config.ssr.ts",
30
+ "test:coverage": "vitest run --coverage",
31
+ "clean": "rimraf dist"
32
+ },
33
+ "dependencies": {
34
+ "@loidolt/theme-svelte": "^0.7.0",
35
+ "@loidolt/theme-tokens": "^0.7.0"
36
+ },
37
+ "peerDependencies": {
38
+ "echarts": "^5.5.0 || ^6.0.0",
39
+ "svelte": "^5.33.0"
40
+ },
41
+ "devDependencies": {
42
+ "@sveltejs/package": "^2.5.8",
43
+ "@sveltejs/vite-plugin-svelte": "^7.0.0",
44
+ "@testing-library/jest-dom": "^6.8.0",
45
+ "@testing-library/svelte": "^5.2.8",
46
+ "@testing-library/user-event": "^14.6.1",
47
+ "@types/node": "^24.3.0",
48
+ "@vitest/coverage-v8": "^4.1.11",
49
+ "echarts": "^6.0.0",
50
+ "jsdom": "^27.0.0",
51
+ "rimraf": "^6.0.1",
52
+ "svelte": "^5.56.10",
53
+ "svelte-check": "^4.3.2",
54
+ "typescript": "^6.0.3",
55
+ "vitest": "^4.0.0",
56
+ "vitest-axe": "^0.1.0"
57
+ },
58
+ "publishConfig": {
59
+ "access": "public",
60
+ "provenance": true
61
+ },
62
+ "repository": {
63
+ "type": "git",
64
+ "url": "git+https://github.com/loidolt/loidolt-theme.git",
65
+ "directory": "packages/charts"
66
+ }
67
+ }