@tradecanvas/svelte 1.3.33 → 1.3.35

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.
@@ -7,6 +7,7 @@
7
7
  LIGHT_THEME,
8
8
  syncIndicators,
9
9
  feedBars,
10
+ CORRECTABLE_BARS,
10
11
  } from '@tradecanvas/chart';
11
12
  import type {
12
13
  ChartType,
@@ -37,9 +38,11 @@
37
38
  * them at mount. Bars that go on from those given before, the last one
38
39
  * changed or bars added after it, go in as live ticks (the view isn't
39
40
  * reset): pushed onto the same array, changed in place, or in a new array.
41
+ * A change to one of the last three bars before the forming one, its time
42
+ * the same, goes in as a correction (`updateBar`), the view kept too.
40
43
  * Any other bars are a new series, as are yours after a stream gave the
41
- * chart bars of its own. An older bar changed needs a new array with a new
42
- * bar in its place.
44
+ * chart bars of its own. A bar further back changed in place isn't seen;
45
+ * in a new array it makes a new series.
43
46
  */
44
47
  data?: OHLCBar[];
45
48
  adapter?: DataAdapter;
@@ -199,8 +202,9 @@
199
202
  fed = feedBars(target, bars, fed);
200
203
  }
201
204
 
202
- // Follows the array, its length and the last bar's fields: a bar pushed onto
203
- // $state data or the forming bar changed, without walking every bar.
205
+ // Follows the array, its length and the fields of its last bars: a bar
206
+ // pushed onto $state data, the forming bar changed or one just before it
207
+ // corrected (`CORRECTABLE_BARS`), without walking every bar.
204
208
  $effect(() => {
205
209
  const bars = data;
206
210
  // Without data, the next bars are a new series: a stream may have come in between.
@@ -208,7 +212,7 @@
208
212
  fed = null;
209
213
  return;
210
214
  }
211
- void barKey(bars[bars.length - 1]);
215
+ for (const bar of bars.slice(-1 - CORRECTABLE_BARS)) void barKey(bar);
212
216
  untrack(() => { if (instance) feed(instance, bars); });
213
217
  });
214
218
 
@@ -12,9 +12,11 @@ interface Props {
12
12
  * them at mount. Bars that go on from those given before, the last one
13
13
  * changed or bars added after it, go in as live ticks (the view isn't
14
14
  * reset): pushed onto the same array, changed in place, or in a new array.
15
+ * A change to one of the last three bars before the forming one, its time
16
+ * the same, goes in as a correction (`updateBar`), the view kept too.
15
17
  * Any other bars are a new series, as are yours after a stream gave the
16
- * chart bars of its own. An older bar changed needs a new array with a new
17
- * bar in its place.
18
+ * chart bars of its own. A bar further back changed in place isn't seen;
19
+ * in a new array it makes a new series.
18
20
  */
19
21
  data?: OHLCBar[];
20
22
  adapter?: DataAdapter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tradecanvas/svelte",
3
- "version": "1.3.33",
3
+ "version": "1.3.35",
4
4
  "type": "module",
5
5
  "description": "Svelte 5 component for @tradecanvas/chart — reactive props, runes, zero boilerplate.",
6
6
  "license": "MIT",
@@ -39,7 +39,7 @@
39
39
  "README.md"
40
40
  ],
41
41
  "dependencies": {
42
- "@tradecanvas/chart": "1.50.0"
42
+ "@tradecanvas/chart": "1.52.0"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "svelte": ">=5.0.0"