openalgo-charts 1.0.23 → 1.0.25

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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /** Library version string. Matches package.json (published npm release). */
2
- declare const VERSION = "1.0.23";
2
+ declare const VERSION = "1.0.24";
3
3
  /** Returns the current library version. */
4
4
  declare function version(): string;
5
5
 
@@ -2482,6 +2482,58 @@ interface LogoWatermarkOptions {
2482
2482
  tint?: string;
2483
2483
  /** Layer order vs the series. Default `top`. */
2484
2484
  zOrder?: ZOrder;
2485
+ /**
2486
+ * Text revealed to the right of the mark on hover — "Chart by OpenAlgo".
2487
+ * The mark alone is what sits on the chart at rest; the wording is only
2488
+ * needed when someone looks at it, so it unrolls rather than occupying the
2489
+ * corner permanently. Omit for a plain, non-interactive mark.
2490
+ */
2491
+ label?: string;
2492
+ /** Hit-test id, so the chart can report hover. Default `watermark`. */
2493
+ id?: string;
2494
+ /** Reveal duration in seconds. Default 0.18. */
2495
+ revealSeconds?: number;
2496
+ /** Label colour. Defaults to `tint`, then the theme's text. */
2497
+ labelColor?: string;
2498
+ /** Label size in media px. Default 12. */
2499
+ fontSize?: number;
2500
+ /**
2501
+ * Rounded plate behind the mark and label. Without one the wording sits
2502
+ * straight on the candles and is unreadable wherever the chart is busy.
2503
+ * Defaults to a translucent form of the theme background; `'none'` omits it.
2504
+ */
2505
+ background?: string;
2506
+ /** Plate border. Defaults to the theme's axis line. `'none'` omits it. */
2507
+ borderColor?: string;
2508
+ /** Plate corner radius in media px. Default 6. */
2509
+ radius?: number;
2510
+ /**
2511
+ * Plate padding around the lockup, in media px. A number pads both axes;
2512
+ * `{ x, y }` pads them separately. Default `{ x: 7, y: 4 }`, which keeps the
2513
+ * revealed label clear of the plate edge.
2514
+ *
2515
+ * Use it to size the resting plate exactly: a 40px mark with `padding: 2.5`
2516
+ * sits in a 45x45 square. The plate widens as the label unrolls; the padding
2517
+ * is what stays constant.
2518
+ */
2519
+ padding?: number | {
2520
+ x: number;
2521
+ y: number;
2522
+ };
2523
+ /**
2524
+ * Where the mark points. A canvas cannot hold an anchor, so this only marks
2525
+ * it as clickable — the hit reports a pointer cursor, and the host opens
2526
+ * {@link href} from its own click handler.
2527
+ *
2528
+ * Given a bare URL, `href()` appends UTM parameters naming the page the chart
2529
+ * is embedded in, so the referral is attributable. Pass a URL that already
2530
+ * has a query string to compose your own and skip that entirely.
2531
+ */
2532
+ href?: string;
2533
+ /** `utm_medium` for the composed link. Default `oac-link`. */
2534
+ utmMedium?: string;
2535
+ /** `utm_campaign` for the composed link. Default `oac-chart`. */
2536
+ utmCampaign?: string;
2485
2537
  }
2486
2538
  /** Top-left placement (in media px) of a `w x h` logo within a `plotW x plotH` plot. */
2487
2539
  declare function watermarkRect(position: WatermarkPosition, margin: number, w: number, h: number, plotW: number, plotH: number): {
@@ -2492,6 +2544,12 @@ declare function watermarkRect(position: WatermarkPosition, margin: number, w: n
2492
2544
  };
2493
2545
  declare class LogoWatermark implements IPrimitive {
2494
2546
  private _opts;
2547
+ /** 0..1 reveal progress, eased toward hover state each frame. */
2548
+ private _reveal;
2549
+ private _lastFrameMs;
2550
+ /** Label width in media px, measured once the font is known. */
2551
+ private _labelW;
2552
+ private readonly _now;
2495
2553
  private _host;
2496
2554
  private _img;
2497
2555
  private _ready;
@@ -2504,7 +2562,26 @@ declare class LogoWatermark implements IPrimitive {
2504
2562
  autoscaleInfo(): null;
2505
2563
  /** Live restyle. Pass a new `src`/`image` to swap the logo. */
2506
2564
  setOptions(patch: Partial<LogoWatermarkOptions>): void;
2565
+ /**
2566
+ * The mark's box, in media px. The label unrolls to its right, so the hit
2567
+ * area is the mark alone — hovering the revealed text keeps it open because
2568
+ * the pointer is still within the widened box below.
2569
+ */
2570
+ private _rect;
2571
+ /**
2572
+ * The link to open, with attribution appended. A caller who supplied their
2573
+ * own query string gets it back untouched.
2574
+ */
2575
+ href(): string | undefined;
2576
+ hitTest(x: number, y: number, rc: PrimitiveRenderContext): PrimitiveHit | null;
2507
2577
  draw(ctx: CanvasRenderingContext2D, rc: PrimitiveRenderContext): void;
2578
+ /**
2579
+ * The single colour the mark and its label share. Either option can set it;
2580
+ * they follow each other so the pair never renders in two shades.
2581
+ */
2582
+ private _ink;
2583
+ /** Ease the reveal toward the hover state, asking for frames while moving. */
2584
+ private _advanceReveal;
2508
2585
  /** Recolor the opaque logo pixels to `color` at (dw x dh) device px, cached. */
2509
2586
  private _tinted;
2510
2587
  }