@fieldnotes/core 0.57.0 → 0.58.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.cts CHANGED
@@ -610,6 +610,7 @@ declare class Viewport {
610
610
  private contextMenu;
611
611
  private minimap;
612
612
  private readonly htmlRenderers;
613
+ private readonly resizeListeners;
613
614
  constructor(container: HTMLElement, options?: ViewportOptions);
614
615
  get ctx(): CanvasRenderingContext2D | null;
615
616
  get snapToGrid(): boolean;
@@ -617,6 +618,16 @@ declare class Viewport {
617
618
  get smartGuides(): boolean;
618
619
  setSmartGuides(enabled: boolean): void;
619
620
  fitToContent(padding?: number): void;
621
+ /** World-space rectangle currently visible through the canvas. */
622
+ getVisibleRect(): Bounds;
623
+ /** Centers the camera on a world point without changing zoom. */
624
+ centerCameraAt(world: Point): void;
625
+ /**
626
+ * Notifies after the host container resizes (ResizeObserver-driven). A resize
627
+ * changes the visible world rect without a camera event; overlays such as the
628
+ * minimap subscribe to stay current. Returns an idempotent unsubscribe.
629
+ */
630
+ onResize(listener: () => void): () => void;
620
631
  requestRender(): void;
621
632
  /**
622
633
  * Registers a world-space overlay drawn above elements on every frame,
@@ -1245,6 +1256,74 @@ declare class PingInput {
1245
1256
  private emit;
1246
1257
  }
1247
1258
 
1259
+ interface MinimapControllerOptions {
1260
+ /** Minimap width in CSS pixels. Default `200`. */
1261
+ width?: number;
1262
+ /** Minimap height in CSS pixels. Default `140`. */
1263
+ height?: number;
1264
+ /** Content inset inside the minimap, in minimap pixels. Default `8`. */
1265
+ padding?: number;
1266
+ /** Backdrop fill behind the thumbnail. Default: none (transparent). */
1267
+ background?: string;
1268
+ /** Stroke color of the viewport rectangle. Default `'#3b82f6'`. */
1269
+ viewportStroke?: string;
1270
+ /** Trailing debounce for scene bitmap re-renders. Default `200`. */
1271
+ debounceMs?: number;
1272
+ /** Tap/drag-to-center navigation on the canvas. Default `true`. */
1273
+ interactive?: boolean;
1274
+ /** Frame scheduler; default `requestAnimationFrame`. Injected by tests. */
1275
+ requestFrame?: (cb: () => void) => number;
1276
+ /** Frame canceller; default `cancelAnimationFrame`. Injected by tests. */
1277
+ cancelFrame?: (id: number) => void;
1278
+ }
1279
+ /**
1280
+ * Thumbnail overview navigator: renders the scene (real element shapes,
1281
+ * downscaled images, per-layer opacity compositing) into a cached offscreen
1282
+ * bitmap, composites it with the live viewport rectangle each frame, and
1283
+ * centers the camera on tap/drag. The cached bitmap and its transform swap
1284
+ * atomically: camera motion never renders the scene, only re-composites.
1285
+ */
1286
+ declare class MinimapController {
1287
+ private readonly viewport;
1288
+ private readonly canvas;
1289
+ private width;
1290
+ private height;
1291
+ private readonly padding;
1292
+ private readonly background;
1293
+ private readonly viewportStroke;
1294
+ private readonly debounceMs;
1295
+ private readonly interactive;
1296
+ private readonly requestFrame;
1297
+ private readonly cancelFrame;
1298
+ private readonly renderer;
1299
+ private scene;
1300
+ private frameId;
1301
+ private debounceTimer;
1302
+ private dragging;
1303
+ private disposed;
1304
+ private readonly unsubs;
1305
+ constructor(viewport: Viewport, canvas: HTMLCanvasElement, options?: MinimapControllerOptions);
1306
+ setSize(width: number, height: number): void;
1307
+ requestDraw(): void;
1308
+ dispose(): void;
1309
+ private clearDebounce;
1310
+ private dpr;
1311
+ private applyCanvasSize;
1312
+ private sceneElements;
1313
+ private currentMapping;
1314
+ private onViewChanged;
1315
+ private markSceneDirty;
1316
+ private renderScene;
1317
+ private renderLayerElements;
1318
+ private draw;
1319
+ private navTransform;
1320
+ private navigateFromEvent;
1321
+ private onPointerDown;
1322
+ private onPointerMove;
1323
+ private onPointerUp;
1324
+ private onPointerEnd;
1325
+ }
1326
+
1248
1327
  interface ActiveFormats {
1249
1328
  bold: boolean;
1250
1329
  italic: boolean;
@@ -1650,6 +1729,6 @@ declare class TemplateTool implements Tool {
1650
1729
  private notifyOptionsChange;
1651
1730
  }
1652
1731
 
1653
- declare const VERSION = "0.57.0";
1732
+ declare const VERSION = "0.58.0";
1654
1733
 
1655
- 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, 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 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 };
1734
+ 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 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 };
package/dist/index.d.ts CHANGED
@@ -610,6 +610,7 @@ declare class Viewport {
610
610
  private contextMenu;
611
611
  private minimap;
612
612
  private readonly htmlRenderers;
613
+ private readonly resizeListeners;
613
614
  constructor(container: HTMLElement, options?: ViewportOptions);
614
615
  get ctx(): CanvasRenderingContext2D | null;
615
616
  get snapToGrid(): boolean;
@@ -617,6 +618,16 @@ declare class Viewport {
617
618
  get smartGuides(): boolean;
618
619
  setSmartGuides(enabled: boolean): void;
619
620
  fitToContent(padding?: number): void;
621
+ /** World-space rectangle currently visible through the canvas. */
622
+ getVisibleRect(): Bounds;
623
+ /** Centers the camera on a world point without changing zoom. */
624
+ centerCameraAt(world: Point): void;
625
+ /**
626
+ * Notifies after the host container resizes (ResizeObserver-driven). A resize
627
+ * changes the visible world rect without a camera event; overlays such as the
628
+ * minimap subscribe to stay current. Returns an idempotent unsubscribe.
629
+ */
630
+ onResize(listener: () => void): () => void;
620
631
  requestRender(): void;
621
632
  /**
622
633
  * Registers a world-space overlay drawn above elements on every frame,
@@ -1245,6 +1256,74 @@ declare class PingInput {
1245
1256
  private emit;
1246
1257
  }
1247
1258
 
1259
+ interface MinimapControllerOptions {
1260
+ /** Minimap width in CSS pixels. Default `200`. */
1261
+ width?: number;
1262
+ /** Minimap height in CSS pixels. Default `140`. */
1263
+ height?: number;
1264
+ /** Content inset inside the minimap, in minimap pixels. Default `8`. */
1265
+ padding?: number;
1266
+ /** Backdrop fill behind the thumbnail. Default: none (transparent). */
1267
+ background?: string;
1268
+ /** Stroke color of the viewport rectangle. Default `'#3b82f6'`. */
1269
+ viewportStroke?: string;
1270
+ /** Trailing debounce for scene bitmap re-renders. Default `200`. */
1271
+ debounceMs?: number;
1272
+ /** Tap/drag-to-center navigation on the canvas. Default `true`. */
1273
+ interactive?: boolean;
1274
+ /** Frame scheduler; default `requestAnimationFrame`. Injected by tests. */
1275
+ requestFrame?: (cb: () => void) => number;
1276
+ /** Frame canceller; default `cancelAnimationFrame`. Injected by tests. */
1277
+ cancelFrame?: (id: number) => void;
1278
+ }
1279
+ /**
1280
+ * Thumbnail overview navigator: renders the scene (real element shapes,
1281
+ * downscaled images, per-layer opacity compositing) into a cached offscreen
1282
+ * bitmap, composites it with the live viewport rectangle each frame, and
1283
+ * centers the camera on tap/drag. The cached bitmap and its transform swap
1284
+ * atomically: camera motion never renders the scene, only re-composites.
1285
+ */
1286
+ declare class MinimapController {
1287
+ private readonly viewport;
1288
+ private readonly canvas;
1289
+ private width;
1290
+ private height;
1291
+ private readonly padding;
1292
+ private readonly background;
1293
+ private readonly viewportStroke;
1294
+ private readonly debounceMs;
1295
+ private readonly interactive;
1296
+ private readonly requestFrame;
1297
+ private readonly cancelFrame;
1298
+ private readonly renderer;
1299
+ private scene;
1300
+ private frameId;
1301
+ private debounceTimer;
1302
+ private dragging;
1303
+ private disposed;
1304
+ private readonly unsubs;
1305
+ constructor(viewport: Viewport, canvas: HTMLCanvasElement, options?: MinimapControllerOptions);
1306
+ setSize(width: number, height: number): void;
1307
+ requestDraw(): void;
1308
+ dispose(): void;
1309
+ private clearDebounce;
1310
+ private dpr;
1311
+ private applyCanvasSize;
1312
+ private sceneElements;
1313
+ private currentMapping;
1314
+ private onViewChanged;
1315
+ private markSceneDirty;
1316
+ private renderScene;
1317
+ private renderLayerElements;
1318
+ private draw;
1319
+ private navTransform;
1320
+ private navigateFromEvent;
1321
+ private onPointerDown;
1322
+ private onPointerMove;
1323
+ private onPointerUp;
1324
+ private onPointerEnd;
1325
+ }
1326
+
1248
1327
  interface ActiveFormats {
1249
1328
  bold: boolean;
1250
1329
  italic: boolean;
@@ -1650,6 +1729,6 @@ declare class TemplateTool implements Tool {
1650
1729
  private notifyOptionsChange;
1651
1730
  }
1652
1731
 
1653
- declare const VERSION = "0.57.0";
1732
+ declare const VERSION = "0.58.0";
1654
1733
 
1655
- 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, 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 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 };
1734
+ 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 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 };