@tradecanvas/svelte 1.2.5 → 1.3.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.
@@ -19,6 +19,7 @@
19
19
  TradeZoneStyle,
20
20
  DataAdapter,
21
21
  ChartStyleOverrides,
22
+ ChartOptions,
22
23
  IndicatorSpec,
23
24
  } from '@tradecanvas/chart';
24
25
 
@@ -45,6 +46,13 @@
45
46
  /** Style overrides, by key: all of your app's (`chart.setOverrides`). */
46
47
  overrides?: ChartStyleOverrides;
47
48
  watermarkText?: string;
49
+ /**
50
+ * Chart options the props don't cover (`maxBarSpacing`, `rightMargin`,
51
+ * `renderer`…), merged over the component's defaults at mount; later
52
+ * changes are not applied. `chartType`, `theme` and `autoScale` always come
53
+ * from their props.
54
+ */
55
+ options?: Partial<ChartOptions>;
48
56
  onReady?: (chart: Chart) => void;
49
57
  chart?: Chart | null;
50
58
  }
@@ -67,6 +75,7 @@
67
75
  tradeZoneStyle = undefined as TradeZoneStyle | undefined,
68
76
  overrides = undefined as ChartStyleOverrides | undefined,
69
77
  watermarkText = undefined as string | undefined,
78
+ options = undefined as Partial<ChartOptions> | undefined,
70
79
  onReady = undefined as ((chart: Chart) => void) | undefined,
71
80
  chart = $bindable(null) as Chart | null,
72
81
  }: Props = $props();
@@ -87,14 +96,13 @@
87
96
 
88
97
  onMount(() => {
89
98
  instance = new Chart(container, {
99
+ rightMargin: 5,
100
+ crosshair: { mode: 'magnet' },
101
+ ...options,
90
102
  chartType,
91
103
  theme: resolveTheme(theme),
92
104
  autoScale,
93
- rightMargin: 5,
94
- crosshair: { mode: 'magnet' },
95
- watermark: watermarkText
96
- ? { text: watermarkText, fontSize: 48, color: 'rgba(255,255,255,0.03)' }
97
- : undefined,
105
+ ...(watermarkText ? { watermark: { text: watermarkText, fontSize: 48, color: 'rgba(255,255,255,0.03)' } } : {}),
98
106
  features: {
99
107
  drawings: true,
100
108
  drawingMagnet: true,
@@ -110,6 +118,7 @@
110
118
  barCountdown: true,
111
119
  logScale: true,
112
120
  watermark: true,
121
+ ...options?.features,
113
122
  ...features,
114
123
  },
115
124
  });
@@ -1,5 +1,5 @@
1
1
  import { Chart } from '@tradecanvas/chart';
2
- import type { ChartType, TimeFrame, FeaturesConfig, Theme, OHLCBar, SignalMarker, TradeZone, SignalMarkerStyle, TradeZoneStyle, DataAdapter, ChartStyleOverrides, IndicatorSpec } from '@tradecanvas/chart';
2
+ import type { ChartType, TimeFrame, FeaturesConfig, Theme, OHLCBar, SignalMarker, TradeZone, SignalMarkerStyle, TradeZoneStyle, DataAdapter, ChartStyleOverrides, ChartOptions, IndicatorSpec } from '@tradecanvas/chart';
3
3
  interface Props {
4
4
  symbol?: string;
5
5
  timeframe?: TimeFrame;
@@ -23,6 +23,13 @@ interface Props {
23
23
  /** Style overrides, by key: all of your app's (`chart.setOverrides`). */
24
24
  overrides?: ChartStyleOverrides;
25
25
  watermarkText?: string;
26
+ /**
27
+ * Chart options the props don't cover (`maxBarSpacing`, `rightMargin`,
28
+ * `renderer`…), merged over the component's defaults at mount; later
29
+ * changes are not applied. `chartType`, `theme` and `autoScale` always come
30
+ * from their props.
31
+ */
32
+ options?: Partial<ChartOptions>;
26
33
  onReady?: (chart: Chart) => void;
27
34
  chart?: Chart | null;
28
35
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tradecanvas/svelte",
3
- "version": "1.2.5",
3
+ "version": "1.3.0",
4
4
  "type": "module",
5
5
  "description": "Svelte 5 component for @tradecanvas/chart — reactive props, runes, zero boilerplate.",
6
6
  "license": "MIT",
@@ -35,7 +35,7 @@
35
35
  "README.md"
36
36
  ],
37
37
  "dependencies": {
38
- "@tradecanvas/chart": "1.18.0"
38
+ "@tradecanvas/chart": "1.19.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "svelte": ">=5.0.0"