@fieldnotes/core 0.60.0 → 0.62.0

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
@@ -450,7 +450,7 @@ declare class HistoryStack {
450
450
  }
451
451
 
452
452
  type HtmlExportRenderer = (element: HtmlElement) => CanvasImageSource | null | Promise<CanvasImageSource | null>;
453
- type HtmlExportErrorReason = 'unsupported' | 'timeout' | 'render' | 'encode';
453
+ type HtmlExportErrorReason = 'unsupported' | 'timeout' | 'render' | 'encode' | 'missing-painter' | 'painter-threw' | 'degenerate-size';
454
454
  interface HtmlExportError {
455
455
  elementId: string;
456
456
  htmlType?: string;
@@ -466,6 +466,51 @@ interface HtmlExportOptions {
466
466
  onHtmlError?: (error: HtmlExportError) => void;
467
467
  }
468
468
 
469
+ interface HtmlPaintContext {
470
+ /** Translated to the element origin, rotated about its centre, clipped, save()d.
471
+ * Layer opacity is NOT applied here — each surface owns that boundary. */
472
+ ctx: CanvasRenderingContext2D;
473
+ element: Readonly<HtmlElement>;
474
+ size: Readonly<Size>;
475
+ /** CSS pixels per world unit for THIS surface (screen | minimap | export). */
476
+ zoom: number;
477
+ }
478
+ type HtmlPainter = (paint: HtmlPaintContext) => void;
479
+ type HtmlRouting = 'dom' | 'canvas' | 'missing';
480
+ declare class HtmlPainterMissingError extends Error {
481
+ readonly elementId: string;
482
+ readonly htmlType: string | undefined;
483
+ constructor(elementId: string, htmlType: string | undefined);
484
+ }
485
+ declare class HtmlPainterRegistry {
486
+ private readonly painters;
487
+ private readonly declared;
488
+ private readonly listeners;
489
+ private _version;
490
+ private canvasTypesCache;
491
+ get version(): number;
492
+ /**
493
+ * Memoized: this is the hottest read in the feature — `isDomElement` consults it several
494
+ * times per element per frame, and every html-element store update re-reconciles every
495
+ * html element. The cache is dropped in `bump()`, which is called on exactly the
496
+ * transitions that can change the membership of this set (first `expect` of a type, last
497
+ * release of a type, any `register`, and any unregister that empties a type's stack).
498
+ *
499
+ * The returned `Set` is the LIVE memoized instance, not a copy: callers must not mutate
500
+ * it, and a caller that holds it across a `bump()` holds a stale snapshot. Nothing in the
501
+ * codebase does either — `withHtmlDefaults` passes it straight through to the exporters
502
+ * unless the caller supplied `expectedCanvasTypes`, in which case it builds a fresh union
503
+ * — and holding it across a change was already a stale snapshot before memoization.
504
+ */
505
+ get canvasTypes(): ReadonlySet<string>;
506
+ expect(htmlTypes: Iterable<string>): () => void;
507
+ register(htmlType: string, painter: HtmlPainter): () => void;
508
+ getActivePainter(htmlType: string): HtmlPainter | undefined;
509
+ onChange(listener: () => void): () => void;
510
+ private bump;
511
+ }
512
+ declare function resolveHtmlRouting(el: Readonly<HtmlElement>, registry: HtmlPainterRegistry | null, expectedCanvasTypes?: ReadonlySet<string>): HtmlRouting;
513
+
469
514
  interface ExportImageOptions extends ExportResourceOptions, HtmlExportOptions {
470
515
  scale?: number;
471
516
  padding?: number;
@@ -497,6 +542,20 @@ interface ExportImageOptions extends ExportResourceOptions, HtmlExportOptions {
497
542
  * caps (never above the requested scale).
498
543
  */
499
544
  scaleMode?: 'exact' | 'fit';
545
+ /** Registry of canvas-backed html painters, keyed by `htmlType`. When absent (or when
546
+ * an element's `htmlType` isn't claimed), html elements fall back to the legacy
547
+ * DOM-raster path (`renderHtml`). */
548
+ htmlPainters?: HtmlPainterRegistry;
549
+ /** `htmlType`s that must route to canvas even before a painter for them is
550
+ * registered — lets a host declare intent up front (mirrors `HtmlPainterRegistry.expect`). */
551
+ expectedCanvasTypes?: ReadonlySet<string>;
552
+ /**
553
+ * When true, a canvas-routed html element with no active painter throws
554
+ * `HtmlPainterMissingError` instead of reporting `onHtmlError` and continuing.
555
+ * DOM-routed html elements are never affected — a missing `renderHtml` stays
556
+ * a non-fatal `'unsupported'` diagnostic regardless of this flag.
557
+ */
558
+ strictMissingCanvasHtml?: boolean;
500
559
  }
501
560
  type ExportAssetErrorReason = 'load' | 'timeout' | 'encode';
502
561
  interface ExportAssetError {
@@ -522,9 +581,32 @@ interface ExportSvgOptions extends ExportResourceOptions, HtmlExportOptions {
522
581
  background?: string;
523
582
  filter?: (el: CanvasElement) => boolean;
524
583
  rasterScale?: number;
584
+ /** Registry of canvas-backed html painters, keyed by `htmlType`. When absent (or when
585
+ * an element's `htmlType` isn't claimed), html elements fall back to the legacy
586
+ * DOM-raster path (`renderHtml`). */
587
+ htmlPainters?: HtmlPainterRegistry;
588
+ /** `htmlType`s that must route to canvas even before a painter for them is
589
+ * registered — lets a host declare intent up front (mirrors `HtmlPainterRegistry.expect`). */
590
+ expectedCanvasTypes?: ReadonlySet<string>;
591
+ /**
592
+ * When true, a canvas-routed html element with no active painter throws
593
+ * `HtmlPainterMissingError` instead of reporting `onHtmlError` and continuing.
594
+ * DOM-routed html elements are never affected — a missing `renderHtml` stays
595
+ * a non-fatal `'unsupported'` diagnostic regardless of this flag.
596
+ */
597
+ strictMissingCanvasHtml?: boolean;
525
598
  }
526
599
  declare function exportSvg(store: ElementStore, options?: ExportSvgOptions, layerManager?: LayerManager): Promise<string>;
527
600
 
601
+ type HtmlRenderTarget = 'screen' | 'minimap' | 'export';
602
+ interface HtmlPaintDiagnostic {
603
+ kind: 'missing-painter' | 'painter-threw' | 'degenerate-size';
604
+ elementId: string;
605
+ htmlType?: string;
606
+ target: HtmlRenderTarget;
607
+ error?: unknown;
608
+ }
609
+
528
610
  interface RenderStatsSnapshot {
529
611
  fps: number;
530
612
  avgFrameMs: number;
@@ -575,6 +657,30 @@ interface GridInfo {
575
657
  cellRadius: number;
576
658
  }
577
659
 
660
+ interface ElementActivationEvent {
661
+ element: Readonly<CanvasElement>;
662
+ /** Pointerup location converted through the pointerup camera snapshot. */
663
+ world: Point;
664
+ /**
665
+ * Raw `PointerEvent.pointerType`. Usually `'mouse' | 'touch' | 'pen'`, but the
666
+ * spec permits vendor-defined and empty strings, so this is NOT narrowed and
667
+ * NOT normalised.
668
+ */
669
+ pointerType: string;
670
+ gesture: 'single' | 'double';
671
+ }
672
+ interface ActivationOptions {
673
+ gesture: 'single' | 'double';
674
+ /** Additional host filter, applied on top of the core canvas-routing gate. */
675
+ isActivatable?: (el: Readonly<CanvasElement>) => boolean;
676
+ /** Host-owned camera animators the viewport cannot see. */
677
+ isCameraBusy?: () => boolean;
678
+ /** Maximum pointer travel between down and up. Default `8` (PingInput parity). */
679
+ slopPx?: number;
680
+ /** Maximum gap between the halves of a double tap. Default `300`. */
681
+ doubleDelayMs?: number;
682
+ }
683
+
578
684
  interface ViewportOptions {
579
685
  camera?: CameraOptions;
580
686
  background?: BackgroundOptions;
@@ -643,6 +749,14 @@ declare class Viewport {
643
749
  private contextMenu;
644
750
  private minimap;
645
751
  private readonly htmlRenderers;
752
+ private readonly htmlPainters;
753
+ private readonly htmlDiagnosticListeners;
754
+ private readonly htmlDiagnostics;
755
+ private readonly resolveRouting;
756
+ private readonly unsubHtmlPainters;
757
+ private activation;
758
+ private activationGeneration;
759
+ private readonly activationListeners;
646
760
  private readonly resizeListeners;
647
761
  private readonly selectionListeners;
648
762
  private detachSelectionSource;
@@ -658,6 +772,18 @@ declare class Viewport {
658
772
  fitToContent(padding?: number): void;
659
773
  /** World-space rectangle currently visible through the canvas. */
660
774
  getVisibleRect(): Bounds;
775
+ /**
776
+ * Size in CSS pixels of the canvas that `getVisibleRect()` measures.
777
+ * Exposed because `canvasEl` is private: consumers can only reach the
778
+ * wrapper (via `domLayer.parentElement`), so without this accessor the
779
+ * canonical size behind `getVisibleRect()` is unreachable and callers
780
+ * resort to `getVisibleRect().w * camera.zoom`. Capture and restore must
781
+ * measure the same element or saved views do not round-trip.
782
+ */
783
+ getCanvasSize(): {
784
+ w: number;
785
+ h: number;
786
+ };
661
787
  /** Centers the camera on a world point without changing zoom. */
662
788
  centerCameraAt(world: Point): void;
663
789
  /**
@@ -678,6 +804,15 @@ declare class Viewport {
678
804
  registerOverlay(draw: OverlayRenderer): () => void;
679
805
  exportState(): CanvasState;
680
806
  exportJSON(): string;
807
+ /**
808
+ * Injects this viewport's own html painter registry into export options so a host
809
+ * that registered painters via `registerHtmlPainter`/`expectCanvasHtmlTypes` gets
810
+ * markers in exports without passing anything. An explicitly passed `htmlPainters`
811
+ * REPLACES the viewport's registry rather than merging with it. `expectedCanvasTypes`
812
+ * is always UNIONED with the resolved registry's own declarations — a caller's set
813
+ * can only add expectations, never shrink the registry's own.
814
+ */
815
+ private withHtmlDefaults;
681
816
  exportImage(options?: ExportImageOptions): Promise<Blob | null>;
682
817
  exportSVG(options?: ExportSvgOptions): Promise<string>;
683
818
  loadState(state: CanvasState): void;
@@ -729,6 +864,74 @@ declare class Viewport {
729
864
  removeLayer(id: string): void;
730
865
  registerHtmlRenderer(htmlType: string, factory: (el: HtmlElement) => HTMLElement): void;
731
866
  updateHtmlElement(id: string, newContent: HTMLElement): void;
867
+ /**
868
+ * Declares htmlTypes that route to canvas painters even before a painter for
869
+ * them registers, so the element renderer never treats them as DOM-backed
870
+ * (avoiding a DOM-mount flash while a host is still loading its painter).
871
+ * Returns an idempotent release; each `expect` call is independently reference
872
+ * counted by the registry.
873
+ */
874
+ expectCanvasHtmlTypes(htmlTypes: Iterable<string>): () => void;
875
+ /**
876
+ * Direct access to the viewport's live html-painter registry — the same
877
+ * instance the viewport itself uses to route canvas-backed html elements.
878
+ * Beyond `register`/`expectCanvasHtmlTypes` (already exposed above), this
879
+ * hands out `getActivePainter`, `canvasTypes`, `onChange`, and `version`,
880
+ * so a surface such as the minimap that needs to read routing state or
881
+ * react to registry changes can do so without the viewport re-deriving or
882
+ * proxying each capability individually.
883
+ */
884
+ getHtmlPainters(): HtmlPainterRegistry;
885
+ /**
886
+ * Registers the canvas painter for `htmlType`. Later registrations for the
887
+ * same type shadow earlier ones (LIFO); unregistering restores the previous
888
+ * entry. Existing elements of this type reconcile synchronously — DOM nodes
889
+ * detach and the render loop repaints on the next frame.
890
+ */
891
+ registerHtmlPainter(htmlType: string, painter: HtmlPainter): () => void;
892
+ /**
893
+ * Subscribes to diagnostics emitted while painting canvas-routed html
894
+ * elements (missing painter, painter threw, degenerate size). Deduped per
895
+ * element/target/kind against the current registry and element versions, so
896
+ * a fail -> repair -> fail-again sequence reports twice rather than being
897
+ * suppressed forever. Returns an idempotent unsubscribe.
898
+ */
899
+ onHtmlPaintDiagnostic(listener: (d: HtmlPaintDiagnostic) => void): () => void;
900
+ /**
901
+ * Enables (or replaces, or with `null` disables) pointer activation of
902
+ * canvas-painted elements — the bridge for elements that are drawn rather than
903
+ * mounted and so cannot receive DOM events. **Default off**, so every existing
904
+ * consumer behaves identically.
905
+ *
906
+ * The controller is a passive observer: listeners are `{ passive: true }` and
907
+ * it never calls `preventDefault`, `stopPropagation`, or takes pointer capture.
908
+ * Changing or disabling activation resets all active and pending gestures.
909
+ * Throws `RangeError` for a non-finite/negative `slopPx` or a non-positive
910
+ * `doubleDelayMs`, leaving any existing activation untouched.
911
+ *
912
+ * The returned disposer clears **only its own generation**, so a stale
913
+ * Strict-Mode cleanup cannot tear down a newer registration.
914
+ */
915
+ setActivation(options: ActivationOptions | null): () => void;
916
+ /**
917
+ * Subscribes to element activations. Persistent and independent of
918
+ * `setActivation`: subscribing before activation is enabled, or across a
919
+ * replacement, keeps working. Emission iterates a snapshot with per-listener
920
+ * try/catch. Returns an idempotent unsubscribe.
921
+ */
922
+ onElementActivate(listener: (e: ElementActivationEvent) => void): () => void;
923
+ private emitActivation;
924
+ /**
925
+ * Fires whenever the html painter registry's active-painter set changes
926
+ * (declare, register, or their release). Reconciliation is synchronous —
927
+ * routing flips (and any DOM detach/remount) happen before this returns —
928
+ * while the actual repaint of newly canvas-routed elements is deferred to
929
+ * the next render frame via markAllLayersDirty + requestRender. Does NOT
930
+ * touch a minimap: Viewport does not own a MinimapController, and the
931
+ * built-in wrapper / React <Minimap /> each subscribe to the registry
932
+ * directly.
933
+ */
934
+ private onHtmlRegistryChanged;
732
935
  addGrid(input: {
733
936
  gridType?: 'square' | 'hex';
734
937
  hexOrientation?: 'pointy' | 'flat';
@@ -1356,6 +1559,7 @@ declare class MinimapController {
1356
1559
  private readonly requestFrame;
1357
1560
  private readonly cancelFrame;
1358
1561
  private readonly renderer;
1562
+ private readonly htmlPainters;
1359
1563
  private scene;
1360
1564
  private frameId;
1361
1565
  private debounceTimer;
@@ -1365,6 +1569,19 @@ declare class MinimapController {
1365
1569
  constructor(viewport: Viewport, canvas: HTMLCanvasElement, options?: MinimapControllerOptions);
1366
1570
  setSize(width: number, height: number): void;
1367
1571
  requestDraw(): void;
1572
+ /**
1573
+ * Invalidates the cached scene bitmap in response to html-painter registry
1574
+ * changes (a painter registering/unregistering, or an `expect` declaration
1575
+ * changing) and schedules the same debounced rebuild `markSceneDirty` uses
1576
+ * for every other invalidation source. Unlike those other sources — which
1577
+ * deliberately keep compositing the OLD bitmap until the rebuild lands, so
1578
+ * camera motion and content edits never stall on a render — painter
1579
+ * availability has no "old bitmap is still valid" reading: an element that
1580
+ * was falling back to a neutral fillRect (no painter yet) or a stale
1581
+ * painter's output is not a safe thing to keep showing, so the cached
1582
+ * bitmap is dropped immediately instead of composited a further time.
1583
+ */
1584
+ invalidateScene(): void;
1368
1585
  dispose(): void;
1369
1586
  private clearDebounce;
1370
1587
  private dpr;
@@ -1384,6 +1601,201 @@ declare class MinimapController {
1384
1601
  private onPointerEnd;
1385
1602
  }
1386
1603
 
1604
+ /**
1605
+ * A viewport-size-independent camera view: the world rectangle to frame.
1606
+ * Restored by contain-fit, so the same view frames the same world content on
1607
+ * any screen size or aspect — a DM's saved zone looks right on a phone and a
1608
+ * TV. Center+zoom would NOT have this property.
1609
+ */
1610
+ interface CameraView {
1611
+ x: number;
1612
+ y: number;
1613
+ w: number;
1614
+ h: number;
1615
+ }
1616
+ /** Captures the currently visible world rect. */
1617
+ declare function captureCameraView(viewport: {
1618
+ getVisibleRect(): {
1619
+ x: number;
1620
+ y: number;
1621
+ w: number;
1622
+ h: number;
1623
+ };
1624
+ }): CameraView;
1625
+ /**
1626
+ * Unclamped contain-fit zoom: the largest zoom at which the whole rect fits.
1627
+ * Contain, never crop — a view whose aspect differs from the canvas shows
1628
+ * extra world content on the short axis.
1629
+ */
1630
+ declare function fitZoomForView(view: CameraView, canvasW: number, canvasH: number): number;
1631
+ /** Camera origin that centers `view` on the canvas at an already-decided zoom. */
1632
+ declare function cameraOriginForView(view: CameraView, zoom: number, canvasW: number, canvasH: number): Point;
1633
+ /**
1634
+ * Writes `view` to `camera`. No-ops on a zero canvas dimension (mount and
1635
+ * visibility races are legitimate); throws on an invalid view or on negative
1636
+ * or non-finite dimensions.
1637
+ */
1638
+ declare function applyCameraView(camera: Camera, view: CameraView, canvasW: number, canvasH: number): void;
1639
+
1640
+ /** A scheduler and its matching canceller. Inseparable by construction. */
1641
+ interface FrameScheduler {
1642
+ requestFrame: (cb: () => void) => number;
1643
+ cancelFrame: (id: number) => void;
1644
+ }
1645
+ interface CameraAnimatorOptions {
1646
+ /** REQUIRED. `element` is used for input listeners only, never measurement. */
1647
+ getCanvasSize: () => {
1648
+ w: number;
1649
+ h: number;
1650
+ };
1651
+ durationMs?: number;
1652
+ easing?: (t: number) => number;
1653
+ interactive?: boolean;
1654
+ frames?: FrameScheduler;
1655
+ now?: () => number;
1656
+ }
1657
+ type CameraAnimationEndReason = 'complete' | 'cancelled' | 'superseded';
1658
+ /**
1659
+ * Animates a camera to a `CameraView`. Standalone controller in the
1660
+ * `PingInput`/`MinimapController` shape: the host owns construction and
1661
+ * disposal, and every timing dependency is injectable for deterministic tests.
1662
+ */
1663
+ declare class CameraAnimator {
1664
+ private readonly camera;
1665
+ private readonly getCanvasSize;
1666
+ private readonly frames;
1667
+ private readonly now;
1668
+ private readonly durationMs;
1669
+ private readonly easing;
1670
+ private rafId;
1671
+ private from;
1672
+ private to;
1673
+ private startedAt;
1674
+ private endListeners;
1675
+ /**
1676
+ * Monotonic operation counter. `animateTo`/`jumpTo` claim a generation
1677
+ * before emitting 'superseded'; if an onEnd listener starts a newer
1678
+ * operation during that emit, the outer call sees a bumped counter and
1679
+ * bails instead of overwriting the nested animation's state. Without this,
1680
+ * the nested animation would run to completion having never reported an end
1681
+ * reason, breaking the exactly-one guarantee the spec makes.
1682
+ */
1683
+ private generation;
1684
+ private lastWrite;
1685
+ private disposed;
1686
+ private detachListeners;
1687
+ constructor(element: HTMLElement, camera: Camera, options: CameraAnimatorOptions);
1688
+ get animating(): boolean;
1689
+ onEnd(listener: (reason: CameraAnimationEndReason) => void): () => void;
1690
+ animateTo(view: CameraView): void;
1691
+ jumpTo(view: CameraView): void;
1692
+ cancel(): void;
1693
+ /**
1694
+ * Terminal. Order is load-bearing: the flag is set BEFORE any listener runs,
1695
+ * because an onEnd listener can call animateTo during the disposal callback.
1696
+ * With the flag set last, that call would start a real animation which the
1697
+ * listener clear then silently discards — a second animation with no end
1698
+ * reason, breaking the exactly-one guarantee.
1699
+ */
1700
+ dispose(): void;
1701
+ /**
1702
+ * Steps 1-3 of the public-call contract. Returns null when the caller must
1703
+ * stop, having already handled termination.
1704
+ *
1705
+ * The disposed check precedes validation deliberately: ordering it after
1706
+ * would make `disposed.animateTo(invalidView)` both required to throw and
1707
+ * required to stay silent. Disposal wins — a terminal animator is inert for
1708
+ * every input, and post-disposal calls are exactly the racy teardown paths
1709
+ * where a throw is least useful.
1710
+ */
1711
+ private validateAndMeasure;
1712
+ private step;
1713
+ private recordWrite;
1714
+ private foreignWrite;
1715
+ /** Terminates an in-flight animation with `reason`. No-op when idle. */
1716
+ private end;
1717
+ private clearFrame;
1718
+ private emit;
1719
+ }
1720
+
1721
+ /**
1722
+ * The wire shape of a focus-request presence payload. Focus is ephemeral by
1723
+ * contract: presence frames only — never elements, undo history, persisted
1724
+ * canvas state, or durable operations. A frame that arrives while a client is
1725
+ * offline is dropped, never queued, and late joiners are never retro-focused.
1726
+ *
1727
+ * `audience` is a delivery hint, NOT a security boundary: the relay broadcasts
1728
+ * presence room-wide and receivers filter by their own role. The payload is a
1729
+ * map rectangle, not secret data; hidden elements stay behind relay `canRead`.
1730
+ */
1731
+ interface FocusPresence {
1732
+ readonly kind: 'focus';
1733
+ readonly x: number;
1734
+ readonly y: number;
1735
+ readonly w: number;
1736
+ readonly h: number;
1737
+ readonly audience: FocusAudience;
1738
+ readonly color?: string;
1739
+ }
1740
+ type FocusAudience = 'all' | 'players' | 'display';
1741
+ declare const FOCUS_PRESENCE_KIND = "focus";
1742
+ /**
1743
+ * The only trust boundary between untyped wire data and the canvas. Mirrors
1744
+ * `isPingPresence`: every field is validated, and `color` is rejected when
1745
+ * defined but not a string, because it flows into canvas styling.
1746
+ *
1747
+ * These rules deliberately match `CameraView` validation, so a payload that
1748
+ * passes here can never make the animator's synchronous target validation
1749
+ * throw on the receive path.
1750
+ */
1751
+ declare function isFocusPresence(data: unknown): data is FocusPresence;
1752
+ /** Builds the presence payload for one local focus request. */
1753
+ declare function toFocusPresence(view: CameraView, audience: FocusAudience, color?: string): FocusPresence;
1754
+
1755
+ type FocusRole = 'dm' | 'player' | 'display';
1756
+ /** The two viewport capabilities the receiver needs; `Viewport` satisfies it. */
1757
+ type RemoteFocusReceiverHost = RemotePingOverlayHost;
1758
+ interface RemoteFocusReceiverOptions {
1759
+ role: FocusRole;
1760
+ animator: CameraAnimator;
1761
+ /** Draw an arrival pulse at the focus target. Default `true`. */
1762
+ pulse?: boolean;
1763
+ pulseColor?: string;
1764
+ pulseDurationMs?: number;
1765
+ pulseRadius?: number;
1766
+ /** Animate the camera (default) or jump instantly. */
1767
+ animate?: boolean;
1768
+ }
1769
+ /**
1770
+ * Applies remote focus requests addressed to this client's role: moves the
1771
+ * camera and marks the target with one pulse.
1772
+ *
1773
+ * The pulse is DELEGATED to a private `RemotePingOverlay` rather than
1774
+ * reimplemented. `renderPingPulse` draws a single frame from an elapsed time,
1775
+ * so an animated pulse needs a rAF loop that re-requests renders, expires the
1776
+ * pulse, and cancels on disposal — machinery that already exists and is tested
1777
+ * there. `maxPingsPerSender: 1` makes a rapid second focus REPLACE the older
1778
+ * pulse instead of leaving two competing markers; different senders keep
1779
+ * separate keys and coexist, which is correct when two DMs share a table.
1780
+ */
1781
+ declare class RemoteFocusReceiver {
1782
+ private readonly role;
1783
+ private readonly animator;
1784
+ private readonly animate;
1785
+ private readonly pulseColor;
1786
+ private readonly overlay;
1787
+ private disposed;
1788
+ constructor(host: RemoteFocusReceiverHost, options: RemoteFocusReceiverOptions);
1789
+ /**
1790
+ * Applies a presence payload from `sender`. Returns `false` for payloads
1791
+ * that are not focus frames, or are addressed to a different role, so hosts
1792
+ * can feed every presence frame through without disturbing other handlers.
1793
+ */
1794
+ apply(from: string, data: unknown): boolean;
1795
+ /** Idempotent. Does NOT dispose the animator — the host owns that. */
1796
+ dispose(): void;
1797
+ }
1798
+
1387
1799
  interface ActiveFormats {
1388
1800
  bold: boolean;
1389
1801
  italic: boolean;
@@ -1442,6 +1854,7 @@ interface HtmlInput extends BaseDefaults {
1442
1854
  interactive?: boolean;
1443
1855
  htmlType?: string;
1444
1856
  data?: Record<string, unknown>;
1857
+ rotation?: number;
1445
1858
  }
1446
1859
  interface TextInput extends BaseDefaults {
1447
1860
  position: Point;
@@ -1789,6 +2202,6 @@ declare class TemplateTool implements Tool {
1789
2202
  private notifyOptionsChange;
1790
2203
  }
1791
2204
 
1792
- declare const VERSION = "0.60.0";
2205
+ declare const VERSION = "0.62.0";
1793
2206
 
1794
- export { type ActiveFormats, type AlignEdge, type ArrowElement, type ArrowStrokeStyle, ArrowTool, type ArrowToolOptions, AutoSave, type AutoSaveOptions, type BackgroundOptions, type BackgroundPattern, type Binding, type Bounds, Camera, type CameraChangeInfo, type CameraOptions, type CanvasElement, type CanvasState, type Command, DEFAULT_NOTE_FONT_SIZE, type DistributeAxis, type ElementChangeMeta, ElementStore, type ElementStyle, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, type ExportAssetError, type ExportAssetErrorReason, type ExportImageOptions, type ExportResourceOptions, type ExportSvgOptions, type FontSizePreset, type GridElement, type GridInfo, HandTool, type HexOrientation, HistoryStack, type HistoryStackOptions, type HtmlElement, type HtmlExportError, type HtmlExportErrorReason, type HtmlExportOptions, type HtmlExportRenderer, type ImageElement, ImageTool, type ImageToolOptions, IndexedDBAdapter, type IndexedDBAdapterOptions, LASER_TRAIL_PRESENCE_KIND, LaserTool, type LaserToolOptions, type LaserTrailEmission, type LaserTrailPresence, type Layer, LayerManager, LocalStorageAdapter, MEASURE_PRESENCE_KIND, type MeasureEmission, type MeasurePresence, MeasureTool, type MeasureToolOptions, type Measurement, MemoryAdapter, MinimapController, type MinimapControllerOptions, type NoteElement, NoteTool, type NoteToolOptions, type OverlayRenderer, PING_PRESENCE_KIND, PencilTool, type PencilToolOptions, type PingEmission, PingInput, type PingInputHost, type PingInputOptions, type PingPresence, PingTool, type PingToolOptions, type Point, type PointerState, RemoteLaserOverlay, type RemoteLaserOverlayHost, type RemoteLaserOverlayOptions, RemoteMeasureOverlay, type RemoteMeasureOverlayHost, type RemoteMeasureOverlayOptions, RemotePingOverlay, type RemotePingOverlayHost, type RemotePingOverlayOptions, type RenderStatsSnapshot, type RotateDirection, SelectTool, type SelectionStyleDetails, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StorageAdapter, type StrokeElement, type StrokePoint, type TemplateElement, type TemplateRenderStyle, type TemplateShape, TemplateTool, type TemplateToolOptions, type TextElement, TextTool, type TextToolOptions, type Tool, type ToolContext, ToolManager, type ToolName, VERSION, Viewport, type ViewportOptions, boundsIntersect, createArrow, createGrid, createHtmlElement, createImage, createNote, createShape, createStroke, createTemplate, createText, drawHexPath, exportImage, exportSvg, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInRectangle, getHexCellsInSquare, getHexDistance, isLaserTrailPresence, isMeasurePresence, isNearBezier, isPingPresence, setFontSize, smartSnap, snapPoint, snapToHexCenter, styleToPatch, toLaserTrailPresence, toMeasurePresence, toPingPresence, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
2207
+ export { type ActivationOptions, type ActiveFormats, type AlignEdge, type ArrowElement, type ArrowStrokeStyle, ArrowTool, type ArrowToolOptions, AutoSave, type AutoSaveOptions, type BackgroundOptions, type BackgroundPattern, type Binding, type Bounds, Camera, type CameraAnimationEndReason, CameraAnimator, type CameraAnimatorOptions, type CameraChangeInfo, type CameraOptions, type CameraView, type CanvasElement, type CanvasState, type Command, DEFAULT_NOTE_FONT_SIZE, type DistributeAxis, type ElementActivationEvent, type ElementChangeMeta, ElementStore, type ElementStyle, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, type ExportAssetError, type ExportAssetErrorReason, type ExportImageOptions, type ExportResourceOptions, type ExportSvgOptions, FOCUS_PRESENCE_KIND, type FocusAudience, type FocusPresence, type FocusRole, type FontSizePreset, type FrameScheduler, type GridElement, type GridInfo, HandTool, type HexOrientation, HistoryStack, type HistoryStackOptions, type HtmlElement, type HtmlExportError, type HtmlExportErrorReason, type HtmlExportOptions, type HtmlExportRenderer, type HtmlPaintContext, type HtmlPaintDiagnostic, type HtmlPainter, HtmlPainterMissingError, HtmlPainterRegistry, type HtmlRenderTarget, type HtmlRouting, type ImageElement, ImageTool, type ImageToolOptions, IndexedDBAdapter, type IndexedDBAdapterOptions, LASER_TRAIL_PRESENCE_KIND, LaserTool, type LaserToolOptions, type LaserTrailEmission, type LaserTrailPresence, type Layer, LayerManager, LocalStorageAdapter, MEASURE_PRESENCE_KIND, type MeasureEmission, type MeasurePresence, MeasureTool, type MeasureToolOptions, type Measurement, MemoryAdapter, MinimapController, type MinimapControllerOptions, type NoteElement, NoteTool, type NoteToolOptions, type OverlayRenderer, PING_PRESENCE_KIND, PencilTool, type PencilToolOptions, type PingEmission, PingInput, type PingInputHost, type PingInputOptions, type PingPresence, PingTool, type PingToolOptions, type Point, type PointerState, RemoteFocusReceiver, type RemoteFocusReceiverHost, type RemoteFocusReceiverOptions, RemoteLaserOverlay, type RemoteLaserOverlayHost, type RemoteLaserOverlayOptions, RemoteMeasureOverlay, type RemoteMeasureOverlayHost, type RemoteMeasureOverlayOptions, RemotePingOverlay, type RemotePingOverlayHost, type RemotePingOverlayOptions, type RenderStatsSnapshot, type RotateDirection, SelectTool, type SelectionStyleDetails, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StorageAdapter, type StrokeElement, type StrokePoint, type TemplateElement, type TemplateRenderStyle, type TemplateShape, TemplateTool, type TemplateToolOptions, type TextElement, TextTool, type TextToolOptions, type Tool, type ToolContext, ToolManager, type ToolName, VERSION, Viewport, type ViewportOptions, applyCameraView, boundsIntersect, cameraOriginForView, captureCameraView, createArrow, createGrid, createHtmlElement, createImage, createNote, createShape, createStroke, createTemplate, createText, drawHexPath, exportImage, exportSvg, fitZoomForView, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInRectangle, getHexCellsInSquare, getHexDistance, isFocusPresence, isLaserTrailPresence, isMeasurePresence, isNearBezier, isPingPresence, resolveHtmlRouting, setFontSize, smartSnap, snapPoint, snapToHexCenter, styleToPatch, toFocusPresence, toLaserTrailPresence, toMeasurePresence, toPingPresence, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };