@fieldnotes/core 0.22.0 → 0.24.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
@@ -602,7 +602,10 @@ interface ViewportOptions {
602
602
  onImageError?: (info: {
603
603
  src: string;
604
604
  elementIds: string[];
605
+ cause?: unknown;
605
606
  }) => void;
607
+ /** CSS-pixel margin cached beyond the viewport. Default `256`. Set `0` to disable. */
608
+ panBufferMargin?: number;
606
609
  }
607
610
  declare class Viewport {
608
611
  private readonly container;
@@ -622,6 +625,7 @@ declare class Viewport {
622
625
  private readonly noteEditor;
623
626
  private readonly historyRecorder;
624
627
  readonly toolContext: ToolContext;
628
+ private readonly marginViewport;
625
629
  private resizeObserver;
626
630
  private _snapToGrid;
627
631
  private readonly _gridSize;
@@ -708,11 +712,18 @@ declare class ElementRenderer {
708
712
  private canvasSize;
709
713
  private hexTileCache;
710
714
  private hexTileCacheKey;
715
+ private gridBoundsOverride;
711
716
  setStore(store: ElementStore): void;
712
717
  setOnImageLoad(callback: () => void): void;
713
- setOnImageError(callback: (src: string) => void): void;
718
+ setOnImageError(callback: (src: string, cause?: unknown) => void): void;
714
719
  setCamera(camera: Camera): void;
715
720
  setCanvasSize(w: number, h: number): void;
721
+ setGridBoundsOverride(bounds: {
722
+ minX: number;
723
+ minY: number;
724
+ maxX: number;
725
+ maxY: number;
726
+ } | null): void;
716
727
  isDomElement(element: CanvasElement): boolean;
717
728
  renderCanvasElement(ctx: CanvasRenderingContext2D, element: CanvasElement): void;
718
729
  private renderStroke;
@@ -1251,6 +1262,6 @@ declare class UpdateLayerCommand implements Command {
1251
1262
  undo(_store: ElementStore): void;
1252
1263
  }
1253
1264
 
1254
- declare const VERSION = "0.22.0";
1265
+ declare const VERSION = "0.24.0";
1255
1266
 
1256
1267
  export { type ActiveFormats, AddElementCommand, type ArrowElement, ArrowTool, type ArrowToolOptions, AutoSave, type AutoSaveOptions, Background, type BackgroundOptions, type BackgroundPattern, BatchCommand, type Binding, type Bounds, Camera, type CameraChangeInfo, type CameraOptions, type CanvasElement, type CanvasState, type Command, CreateLayerCommand, DEFAULT_FONT_SIZE_PRESETS, DEFAULT_NOTE_FONT_SIZE, DoubleTapDetector, type DoubleTapDetectorOptions, ElementRenderer, ElementStore, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, EventBus, type ExportImageOptions, type FilterAction, type FilteredEvent, type FilteredUpEvent, type FontSizePreset, type GridElement, type GridInfo, HandTool, type HexOrientation, HistoryRecorder, HistoryStack, type HistoryStackOptions, type HtmlElement, type ImageElement, ImageTool, type ImageToolOptions, InputFilter, InputHandler, type InputHandlerOptions, type Layer, LayerManager, MeasureTool, type MeasureToolOptions, type Measurement, NoteEditor, type NoteEditorOptions, type NoteElement, NoteTool, type NoteToolOptions, NoteToolbar, PencilTool, type PencilToolOptions, type Point, type PointerState, Quadtree, RemoveElementCommand, RemoveLayerCommand, type RenderStatsSnapshot, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StrokeElement, type StrokePoint, type StyledRun, type TemplateElement, type TemplateShape, TemplateTool, type TemplateToolOptions, type TextElement, TextTool, type TextToolOptions, type Tool, type ToolContext, ToolManager, type ToolName, UpdateElementCommand, UpdateLayerCommand, VERSION, Viewport, type ViewportOptions, boundsIntersect, clearStaleBindings, createArrow, createGrid, createHtmlElement, createId, createImage, createNote, createShape, createStroke, createTemplate, createText, drawHexPath, exportImage, exportState, findBindTarget, findBoundArrows, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getEdgeIntersection, getElementBounds, getElementCenter, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInSquare, getHexDistance, isBindable, isNearBezier, isNoteContentEmpty, parseState, sanitizeNoteHtml, setFontSize, smartSnap, snapPoint, snapToHexCenter, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline, unbindArrow, updateBoundArrow };
package/dist/index.d.ts CHANGED
@@ -602,7 +602,10 @@ interface ViewportOptions {
602
602
  onImageError?: (info: {
603
603
  src: string;
604
604
  elementIds: string[];
605
+ cause?: unknown;
605
606
  }) => void;
607
+ /** CSS-pixel margin cached beyond the viewport. Default `256`. Set `0` to disable. */
608
+ panBufferMargin?: number;
606
609
  }
607
610
  declare class Viewport {
608
611
  private readonly container;
@@ -622,6 +625,7 @@ declare class Viewport {
622
625
  private readonly noteEditor;
623
626
  private readonly historyRecorder;
624
627
  readonly toolContext: ToolContext;
628
+ private readonly marginViewport;
625
629
  private resizeObserver;
626
630
  private _snapToGrid;
627
631
  private readonly _gridSize;
@@ -708,11 +712,18 @@ declare class ElementRenderer {
708
712
  private canvasSize;
709
713
  private hexTileCache;
710
714
  private hexTileCacheKey;
715
+ private gridBoundsOverride;
711
716
  setStore(store: ElementStore): void;
712
717
  setOnImageLoad(callback: () => void): void;
713
- setOnImageError(callback: (src: string) => void): void;
718
+ setOnImageError(callback: (src: string, cause?: unknown) => void): void;
714
719
  setCamera(camera: Camera): void;
715
720
  setCanvasSize(w: number, h: number): void;
721
+ setGridBoundsOverride(bounds: {
722
+ minX: number;
723
+ minY: number;
724
+ maxX: number;
725
+ maxY: number;
726
+ } | null): void;
716
727
  isDomElement(element: CanvasElement): boolean;
717
728
  renderCanvasElement(ctx: CanvasRenderingContext2D, element: CanvasElement): void;
718
729
  private renderStroke;
@@ -1251,6 +1262,6 @@ declare class UpdateLayerCommand implements Command {
1251
1262
  undo(_store: ElementStore): void;
1252
1263
  }
1253
1264
 
1254
- declare const VERSION = "0.22.0";
1265
+ declare const VERSION = "0.24.0";
1255
1266
 
1256
1267
  export { type ActiveFormats, AddElementCommand, type ArrowElement, ArrowTool, type ArrowToolOptions, AutoSave, type AutoSaveOptions, Background, type BackgroundOptions, type BackgroundPattern, BatchCommand, type Binding, type Bounds, Camera, type CameraChangeInfo, type CameraOptions, type CanvasElement, type CanvasState, type Command, CreateLayerCommand, DEFAULT_FONT_SIZE_PRESETS, DEFAULT_NOTE_FONT_SIZE, DoubleTapDetector, type DoubleTapDetectorOptions, ElementRenderer, ElementStore, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, EventBus, type ExportImageOptions, type FilterAction, type FilteredEvent, type FilteredUpEvent, type FontSizePreset, type GridElement, type GridInfo, HandTool, type HexOrientation, HistoryRecorder, HistoryStack, type HistoryStackOptions, type HtmlElement, type ImageElement, ImageTool, type ImageToolOptions, InputFilter, InputHandler, type InputHandlerOptions, type Layer, LayerManager, MeasureTool, type MeasureToolOptions, type Measurement, NoteEditor, type NoteEditorOptions, type NoteElement, NoteTool, type NoteToolOptions, NoteToolbar, PencilTool, type PencilToolOptions, type Point, type PointerState, Quadtree, RemoveElementCommand, RemoveLayerCommand, type RenderStatsSnapshot, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StrokeElement, type StrokePoint, type StyledRun, type TemplateElement, type TemplateShape, TemplateTool, type TemplateToolOptions, type TextElement, TextTool, type TextToolOptions, type Tool, type ToolContext, ToolManager, type ToolName, UpdateElementCommand, UpdateLayerCommand, VERSION, Viewport, type ViewportOptions, boundsIntersect, clearStaleBindings, createArrow, createGrid, createHtmlElement, createId, createImage, createNote, createShape, createStroke, createTemplate, createText, drawHexPath, exportImage, exportState, findBindTarget, findBoundArrows, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getEdgeIntersection, getElementBounds, getElementCenter, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInSquare, getHexDistance, isBindable, isNearBezier, isNoteContentEmpty, parseState, sanitizeNoteHtml, setFontSize, smartSnap, snapPoint, snapToHexCenter, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline, unbindArrow, updateBoundArrow };