hyperprop-charting-library 0.1.122 → 0.1.123

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.
@@ -222,6 +222,7 @@ var DEFAULT_OPTIONS = {
222
222
  autoScaleIgnoreLatestCandle: true,
223
223
  kineticScroll: { touch: true, mouse: false },
224
224
  timeStepMs: 0,
225
+ clockOffsetMs: 0,
225
226
  pinOutOfRangeLines: false,
226
227
  doubleClickEnabled: true,
227
228
  doubleClickAction: "reset",
@@ -3639,7 +3640,8 @@ function createChart(element, options = {}) {
3639
3640
  return null;
3640
3641
  }
3641
3642
  const stepMs = getTimeStepMs();
3642
- const elapsedMs = Date.now() - last.time.getTime();
3643
+ const nowMs = Date.now() + (Number(mergedOptions.clockOffsetMs) || 0);
3644
+ const elapsedMs = nowMs - last.time.getTime();
3643
3645
  const countdownMs = elapsedMs >= 0 ? stepMs - elapsedMs % stepMs : Math.min(stepMs, stepMs - elapsedMs);
3644
3646
  return formatDuration(countdownMs);
3645
3647
  };
@@ -3893,7 +3895,8 @@ function createChart(element, options = {}) {
3893
3895
  }
3894
3896
  if (labels.visible && labels.showCountdownToBarClose && lastPoint) {
3895
3897
  const stepMs = getTimeStepMs();
3896
- const elapsedMs = Date.now() - lastPoint.time.getTime();
3898
+ const nowMs = Date.now() + (Number(mergedOptions.clockOffsetMs) || 0);
3899
+ const elapsedMs = nowMs - lastPoint.time.getTime();
3897
3900
  const countdownMs = elapsedMs >= 0 ? stepMs - elapsedMs % stepMs : Math.min(stepMs, stepMs - elapsedMs);
3898
3901
  const countdownText = formatDuration(countdownMs);
3899
3902
  const prevFont = ctx.font;
@@ -45,6 +45,14 @@ interface ChartOptions {
45
45
  * futures data with sparse back-month eras). 0/undefined = infer.
46
46
  */
47
47
  timeStepMs?: number;
48
+ /**
49
+ * Correction added to the machine's clock for time-sensitive rendering
50
+ * (bar-close countdowns): exchangeNow ≈ Date.now() + clockOffsetMs. Hosts
51
+ * should derive it from exchange-stamped ticks; without it a skewed local
52
+ * clock freezes the countdown at one full interval (bars arrive stamped
53
+ * "in the future") or makes it run visibly early/late.
54
+ */
55
+ clockOffsetMs?: number;
48
56
  pinOutOfRangeLines?: boolean;
49
57
  doubleClickEnabled?: boolean;
50
58
  doubleClickAction?: "reset" | "placeLimitOrder";
@@ -196,6 +196,7 @@ var DEFAULT_OPTIONS = {
196
196
  autoScaleIgnoreLatestCandle: true,
197
197
  kineticScroll: { touch: true, mouse: false },
198
198
  timeStepMs: 0,
199
+ clockOffsetMs: 0,
199
200
  pinOutOfRangeLines: false,
200
201
  doubleClickEnabled: true,
201
202
  doubleClickAction: "reset",
@@ -3613,7 +3614,8 @@ function createChart(element, options = {}) {
3613
3614
  return null;
3614
3615
  }
3615
3616
  const stepMs = getTimeStepMs();
3616
- const elapsedMs = Date.now() - last.time.getTime();
3617
+ const nowMs = Date.now() + (Number(mergedOptions.clockOffsetMs) || 0);
3618
+ const elapsedMs = nowMs - last.time.getTime();
3617
3619
  const countdownMs = elapsedMs >= 0 ? stepMs - elapsedMs % stepMs : Math.min(stepMs, stepMs - elapsedMs);
3618
3620
  return formatDuration(countdownMs);
3619
3621
  };
@@ -3867,7 +3869,8 @@ function createChart(element, options = {}) {
3867
3869
  }
3868
3870
  if (labels.visible && labels.showCountdownToBarClose && lastPoint) {
3869
3871
  const stepMs = getTimeStepMs();
3870
- const elapsedMs = Date.now() - lastPoint.time.getTime();
3872
+ const nowMs = Date.now() + (Number(mergedOptions.clockOffsetMs) || 0);
3873
+ const elapsedMs = nowMs - lastPoint.time.getTime();
3871
3874
  const countdownMs = elapsedMs >= 0 ? stepMs - elapsedMs % stepMs : Math.min(stepMs, stepMs - elapsedMs);
3872
3875
  const countdownText = formatDuration(countdownMs);
3873
3876
  const prevFont = ctx.font;
package/dist/index.cjs CHANGED
@@ -222,6 +222,7 @@ var DEFAULT_OPTIONS = {
222
222
  autoScaleIgnoreLatestCandle: true,
223
223
  kineticScroll: { touch: true, mouse: false },
224
224
  timeStepMs: 0,
225
+ clockOffsetMs: 0,
225
226
  pinOutOfRangeLines: false,
226
227
  doubleClickEnabled: true,
227
228
  doubleClickAction: "reset",
@@ -3639,7 +3640,8 @@ function createChart(element, options = {}) {
3639
3640
  return null;
3640
3641
  }
3641
3642
  const stepMs = getTimeStepMs();
3642
- const elapsedMs = Date.now() - last.time.getTime();
3643
+ const nowMs = Date.now() + (Number(mergedOptions.clockOffsetMs) || 0);
3644
+ const elapsedMs = nowMs - last.time.getTime();
3643
3645
  const countdownMs = elapsedMs >= 0 ? stepMs - elapsedMs % stepMs : Math.min(stepMs, stepMs - elapsedMs);
3644
3646
  return formatDuration(countdownMs);
3645
3647
  };
@@ -3893,7 +3895,8 @@ function createChart(element, options = {}) {
3893
3895
  }
3894
3896
  if (labels.visible && labels.showCountdownToBarClose && lastPoint) {
3895
3897
  const stepMs = getTimeStepMs();
3896
- const elapsedMs = Date.now() - lastPoint.time.getTime();
3898
+ const nowMs = Date.now() + (Number(mergedOptions.clockOffsetMs) || 0);
3899
+ const elapsedMs = nowMs - lastPoint.time.getTime();
3897
3900
  const countdownMs = elapsedMs >= 0 ? stepMs - elapsedMs % stepMs : Math.min(stepMs, stepMs - elapsedMs);
3898
3901
  const countdownText = formatDuration(countdownMs);
3899
3902
  const prevFont = ctx.font;
package/dist/index.d.cts CHANGED
@@ -45,6 +45,14 @@ interface ChartOptions {
45
45
  * futures data with sparse back-month eras). 0/undefined = infer.
46
46
  */
47
47
  timeStepMs?: number;
48
+ /**
49
+ * Correction added to the machine's clock for time-sensitive rendering
50
+ * (bar-close countdowns): exchangeNow ≈ Date.now() + clockOffsetMs. Hosts
51
+ * should derive it from exchange-stamped ticks; without it a skewed local
52
+ * clock freezes the countdown at one full interval (bars arrive stamped
53
+ * "in the future") or makes it run visibly early/late.
54
+ */
55
+ clockOffsetMs?: number;
48
56
  pinOutOfRangeLines?: boolean;
49
57
  doubleClickEnabled?: boolean;
50
58
  doubleClickAction?: "reset" | "placeLimitOrder";
package/dist/index.d.ts CHANGED
@@ -45,6 +45,14 @@ interface ChartOptions {
45
45
  * futures data with sparse back-month eras). 0/undefined = infer.
46
46
  */
47
47
  timeStepMs?: number;
48
+ /**
49
+ * Correction added to the machine's clock for time-sensitive rendering
50
+ * (bar-close countdowns): exchangeNow ≈ Date.now() + clockOffsetMs. Hosts
51
+ * should derive it from exchange-stamped ticks; without it a skewed local
52
+ * clock freezes the countdown at one full interval (bars arrive stamped
53
+ * "in the future") or makes it run visibly early/late.
54
+ */
55
+ clockOffsetMs?: number;
48
56
  pinOutOfRangeLines?: boolean;
49
57
  doubleClickEnabled?: boolean;
50
58
  doubleClickAction?: "reset" | "placeLimitOrder";
package/dist/index.js CHANGED
@@ -196,6 +196,7 @@ var DEFAULT_OPTIONS = {
196
196
  autoScaleIgnoreLatestCandle: true,
197
197
  kineticScroll: { touch: true, mouse: false },
198
198
  timeStepMs: 0,
199
+ clockOffsetMs: 0,
199
200
  pinOutOfRangeLines: false,
200
201
  doubleClickEnabled: true,
201
202
  doubleClickAction: "reset",
@@ -3613,7 +3614,8 @@ function createChart(element, options = {}) {
3613
3614
  return null;
3614
3615
  }
3615
3616
  const stepMs = getTimeStepMs();
3616
- const elapsedMs = Date.now() - last.time.getTime();
3617
+ const nowMs = Date.now() + (Number(mergedOptions.clockOffsetMs) || 0);
3618
+ const elapsedMs = nowMs - last.time.getTime();
3617
3619
  const countdownMs = elapsedMs >= 0 ? stepMs - elapsedMs % stepMs : Math.min(stepMs, stepMs - elapsedMs);
3618
3620
  return formatDuration(countdownMs);
3619
3621
  };
@@ -3867,7 +3869,8 @@ function createChart(element, options = {}) {
3867
3869
  }
3868
3870
  if (labels.visible && labels.showCountdownToBarClose && lastPoint) {
3869
3871
  const stepMs = getTimeStepMs();
3870
- const elapsedMs = Date.now() - lastPoint.time.getTime();
3872
+ const nowMs = Date.now() + (Number(mergedOptions.clockOffsetMs) || 0);
3873
+ const elapsedMs = nowMs - lastPoint.time.getTime();
3871
3874
  const countdownMs = elapsedMs >= 0 ? stepMs - elapsedMs % stepMs : Math.min(stepMs, stepMs - elapsedMs);
3872
3875
  const countdownText = formatDuration(countdownMs);
3873
3876
  const prevFont = ctx.font;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperprop-charting-library",
3
- "version": "0.1.122",
3
+ "version": "0.1.123",
4
4
  "description": "Lightweight TypeScript charting core",
5
5
  "type": "module",
6
6
  "main": "./dist/hyperprop-charting-library.cjs",