acttrader-charts 1.3.0-beta.24 → 1.3.0-beta.26

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.
package/README.md CHANGED
@@ -1013,6 +1013,12 @@ it on the next load with `crosshairEnabled: false`. `enableCrosshairToggle` is t
1013
1013
  name of the same flag and still works. Native wrappers get the same switch via their
1014
1014
  `enableCrossHairHeader` init option, the `onCrosshairToggle` callback and `setCrosshairEnabled()`.
1015
1015
 
1016
+ ### Native UI catalog (webview bridge only)
1017
+
1018
+ The webview bridge used by the Android and iOS wrappers posts a **`catalog`** event right after every `init` command, and again on the **`getCatalog`** command (which also works before `init`). It lists everything a native app needs to build its own header, drawing-tools sheet, indicators list and chart-settings screen: timeframes, chart types, cursors, drawing tool groups (with point counts and style fields), drawing-toolbar options, indicators (with pane and editable settings fields), the Chart Settings dialog (tabs → sections → items with types, options and defaults), canvas colour keys, price sources and limits. Every entry carries `available` (`true` = works in this version, `false` = planned). `catalogVersion` is the library version, stamped at build time.
1019
+
1020
+ Source: `src/core/mobileCatalog.ts`. `src/__tests__/mobileCatalog.test.ts` fails the build if an `available: true` id does not exist in the engine, or an engine tool / indicator is missing from the catalog — update the catalog together with any new chart type, tool or indicator. The web `ChartEngine` API is unchanged.
1021
+
1016
1022
  ### Viewport
1017
1023
 
1018
1024
  ```ts
package/dist/index.cjs CHANGED
@@ -25314,6 +25314,10 @@ var _ChartEngine = class _ChartEngine {
25314
25314
  this.logoImage = null;
25315
25315
  // ── State persistence ─────────────────────────────────────────────────────
25316
25316
  this.isRestoringState = false;
25317
+ this.onPointerEnter = () => {
25318
+ this._cachedWrapRect = null;
25319
+ this._cachedDrawRect = null;
25320
+ };
25317
25321
  this.onMouseMove = (e) => {
25318
25322
  if (this._mobileCrosshairActive) return;
25319
25323
  if (Date.now() - this._lastTouchTime < 500) return;
@@ -26462,19 +26466,29 @@ var _ChartEngine = class _ChartEngine {
26462
26466
  throw new Error("acttrader-charts requires a browser environment");
26463
26467
  }
26464
26468
  enableKeyboardOverlayMode();
26465
- if (window.visualViewport) {
26466
- const vv = window.visualViewport;
26467
- const invalidate = () => {
26468
- this._cachedWrapRect = null;
26469
- this._cachedDrawRect = null;
26470
- };
26469
+ const invalidate = () => {
26470
+ this._cachedWrapRect = null;
26471
+ this._cachedDrawRect = null;
26472
+ };
26473
+ const vv = window.visualViewport;
26474
+ if (vv) {
26471
26475
  vv.addEventListener("resize", invalidate);
26472
26476
  vv.addEventListener("scroll", invalidate);
26473
- this.disposeVvListener = () => {
26477
+ }
26478
+ document.addEventListener("scroll", invalidate, { capture: true, passive: true });
26479
+ window.addEventListener("resize", invalidate);
26480
+ const layoutObserver = typeof ResizeObserver !== "undefined" ? new ResizeObserver(invalidate) : null;
26481
+ layoutObserver?.observe(document.documentElement);
26482
+ if (document.body) layoutObserver?.observe(document.body);
26483
+ this.disposeVvListener = () => {
26484
+ if (vv) {
26474
26485
  vv.removeEventListener("resize", invalidate);
26475
26486
  vv.removeEventListener("scroll", invalidate);
26476
- };
26477
- }
26487
+ }
26488
+ document.removeEventListener("scroll", invalidate, { capture: true });
26489
+ window.removeEventListener("resize", invalidate);
26490
+ layoutObserver?.disconnect();
26491
+ };
26478
26492
  const {
26479
26493
  container,
26480
26494
  theme = "dark",
@@ -27392,6 +27406,7 @@ var _ChartEngine = class _ChartEngine {
27392
27406
  this.scheduleViewportPersist();
27393
27407
  }
27394
27408
  );
27409
+ this.drawCanvas.addEventListener("mouseenter", this.onPointerEnter);
27395
27410
  this.drawCanvas.addEventListener("mousemove", this.onMouseMove);
27396
27411
  this.drawCanvas.addEventListener("mouseleave", this.onMouseLeave);
27397
27412
  this.drawCanvas.addEventListener("mousedown", this.onCanvasClick);
@@ -29844,6 +29859,7 @@ var _ChartEngine = class _ChartEngine {
29844
29859
  this.advancedToolbar?.destroy();
29845
29860
  this.mobileHeader?.destroy();
29846
29861
  this.leftBar?.destroy();
29862
+ this.drawCanvas.removeEventListener("mouseenter", this.onPointerEnter);
29847
29863
  this.drawCanvas.removeEventListener("mousemove", this.onMouseMove);
29848
29864
  this.drawCanvas.removeEventListener("mouseleave", this.onMouseLeave);
29849
29865
  this.drawCanvas.removeEventListener("mousedown", this.onCanvasClick);