@linkurious/ogma-annotations 2.1.0 → 2.1.1

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.
@@ -556,6 +556,51 @@ export declare class Control extends default_2<FeatureEvents> {
556
556
  commentStyle?: Partial<CommentProps>;
557
557
  arrowStyle?: Partial<ArrowProperties>;
558
558
  }): this;
559
+ /**
560
+ * Enable sticky note drawing mode - drops a plain, resizable text box
561
+ * (empty content, "Quick note…" ghost placeholder, no connector arrow)
562
+ * like a Miro sticky note, unlike `enableCommentDrawing`. It's a regular
563
+ * `text` annotation, so it's placed the same interactive way as
564
+ * `enableBoxDrawing`/`enableTextDrawing`: click for a default-size square,
565
+ * or drag to size it - either way it keeps the usual corner/edge drag
566
+ * handles to resize it afterward.
567
+ *
568
+ * Call this method when the user clicks an "Add sticky note" button. The
569
+ * control will:
570
+ * 1. Wait for the next mousedown event
571
+ * 2. Create the note at that position and start the interactive
572
+ * corner-drag, already selected
573
+ * 3. On release: a plain click (no drag) gets a default square size, a
574
+ * drag gets sized to match instead - either way it drops straight
575
+ * into editing (the placeholder is just ghost text, so typing
576
+ * immediately replaces it)
577
+ * 4. Clean up automatically when done
578
+ *
579
+ * @example
580
+ * ```ts
581
+ * addStickyNoteButton.addEventListener('click', () => {
582
+ * control.enableStickyNoteDrawing({ background: '#FFEB99' });
583
+ * });
584
+ * ```
585
+ *
586
+ * @param style Sticky note style options (merged over the sticky note defaults)
587
+ * @returns this for chaining
588
+ * @see startStickyNote for low-level programmatic control
589
+ */
590
+ enableStickyNoteDrawing(style?: Partial<Text_2["properties"]["style"]>): this;
591
+ /**
592
+ * Enable erase mode: every click on an annotation deletes it immediately.
593
+ * Stays armed across multiple clicks until `disableEraseMode()` is called,
594
+ * or another drawing tool is enabled / `cancelDrawing()` is called.
595
+ *
596
+ * @returns this for chaining
597
+ * @see disableEraseMode to turn erase mode off
598
+ */
599
+ enableEraseMode(): this;
600
+ /** Turn erase mode off. No-op if it isn't active. */
601
+ disableEraseMode(): this;
602
+ /** Whether erase mode is currently active. */
603
+ isEraseModeActive(): boolean;
559
604
  /**
560
605
  * Place a pre-created annotation by moving it with the cursor.
561
606
  * The annotation follows the mouse until the user clicks to place it.
@@ -603,6 +648,21 @@ export declare class Control extends default_2<FeatureEvents> {
603
648
  commentStyle?: Partial<CommentProps>;
604
649
  arrowStyle?: Partial<ArrowProperties>;
605
650
  }): this;
651
+ /**
652
+ * **Advanced API:** Programmatically start drawing a sticky note at
653
+ * specific coordinates - same interactive corner-drag as `startBox`.
654
+ * You must handle mouse events yourself (or immediately release/complete
655
+ * it via the same events `enableStickyNoteDrawing` would).
656
+ *
657
+ * **For most use cases, use `enableStickyNoteDrawing()` instead.**
658
+ *
659
+ * @param x X coordinate for the note's top-left corner
660
+ * @param y Y coordinate for the note's top-left corner
661
+ * @param style Sticky note style options
662
+ * @returns this for chaining
663
+ * @see enableStickyNoteDrawing for the recommended high-level API
664
+ */
665
+ startStickyNote(x: number, y: number, style?: Partial<Text_2["properties"]["style"]>): this;
606
666
  /**
607
667
  * **Advanced API:** Programmatically start drawing a box at specific coordinates.
608
668
  *
@@ -1751,6 +1811,13 @@ export declare interface TextStyle extends BoxStyle {
1751
1811
  borderRadius?: number;
1752
1812
  /** When true, text maintains constant size regardless of zoom level */
1753
1813
  fixedSize?: boolean;
1814
+ /**
1815
+ * Ghost text shown (via the textarea's native `placeholder` attribute)
1816
+ * while `content` is empty - disappears the instant the user types, no
1817
+ * selection/focus tricks needed. Overrides the global
1818
+ * `ControllerOptions.textPlaceholder` for this annotation.
1819
+ */
1820
+ placeholder?: string;
1754
1821
  }
1755
1822
 
1756
1823
  /** @private */