@fieldnotes/core 0.8.7 → 0.8.9

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
@@ -72,6 +72,8 @@ interface ArrowElement extends BaseElement {
72
72
  width: number;
73
73
  fromBinding?: Binding;
74
74
  toBinding?: Binding;
75
+ /** Derived from from/to/bend. Redundant in serialized state — safe to omit. */
76
+ cachedControlPoint?: Point;
75
77
  }
76
78
  interface ImageElement extends BaseElement {
77
79
  type: 'image';
@@ -273,8 +275,16 @@ declare class Background {
273
275
  private readonly color;
274
276
  private readonly dotRadius;
275
277
  private readonly lineWidth;
278
+ private cachedCanvas;
279
+ private cachedCtx;
280
+ private lastZoom;
281
+ private lastOffsetX;
282
+ private lastOffsetY;
283
+ private lastWidth;
284
+ private lastHeight;
276
285
  constructor(options?: BackgroundOptions);
277
286
  render(ctx: CanvasRenderingContext2D, camera: Camera): void;
287
+ private ensureCachedCanvas;
278
288
  private adaptSpacing;
279
289
  private renderDots;
280
290
  private renderGrid;
@@ -430,6 +440,15 @@ interface ExportImageOptions {
430
440
  }
431
441
  declare function exportImage(store: ElementStore, options?: ExportImageOptions, layerManager?: LayerManager): Promise<Blob | null>;
432
442
 
443
+ interface RenderStatsSnapshot {
444
+ fps: number;
445
+ avgFrameMs: number;
446
+ p95FrameMs: number;
447
+ lastFrameMs: number;
448
+ lastGridMs: number;
449
+ frameCount: number;
450
+ }
451
+
433
452
  interface ViewportOptions {
434
453
  camera?: CameraOptions;
435
454
  background?: BackgroundOptions;
@@ -494,6 +513,8 @@ declare class Viewport {
494
513
  }): string;
495
514
  updateGrid(updates: Partial<Pick<GridElement, 'gridType' | 'hexOrientation' | 'cellSize' | 'strokeColor' | 'strokeWidth' | 'opacity'>>): void;
496
515
  removeGrid(): void;
516
+ getRenderStats(): RenderStatsSnapshot;
517
+ logPerformance(intervalMs?: number): () => void;
497
518
  destroy(): void;
498
519
  private startEditingElement;
499
520
  private onTextEditStop;
@@ -511,20 +532,14 @@ declare class Viewport {
511
532
  private observeResize;
512
533
  }
513
534
 
514
- interface RenderStatsSnapshot {
515
- fps: number;
516
- avgFrameMs: number;
517
- p95FrameMs: number;
518
- lastFrameMs: number;
519
- frameCount: number;
520
- }
521
-
522
535
  declare class ElementRenderer {
523
536
  private store;
524
537
  private imageCache;
525
538
  private onImageLoad;
526
539
  private camera;
527
540
  private canvasSize;
541
+ private hexTileCache;
542
+ private hexTileCacheKey;
528
543
  setStore(store: ElementStore): void;
529
544
  setOnImageLoad(callback: () => void): void;
530
545
  setCamera(camera: Camera): void;
@@ -540,6 +555,7 @@ declare class ElementRenderer {
540
555
  private strokeShapePath;
541
556
  private renderGrid;
542
557
  private renderImage;
558
+ private getHexTile;
543
559
  private getImage;
544
560
  }
545
561
 
@@ -914,6 +930,6 @@ declare class UpdateLayerCommand implements Command {
914
930
  undo(_store: ElementStore): void;
915
931
  }
916
932
 
917
- declare const VERSION = "0.8.7";
933
+ declare const VERSION = "0.8.8";
918
934
 
919
935
  export { 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, ElementRenderer, ElementStore, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, EventBus, type ExportImageOptions, type GridElement, HandTool, type HexOrientation, HistoryRecorder, HistoryStack, type HistoryStackOptions, type HtmlElement, type ImageElement, ImageTool, type ImageToolOptions, InputHandler, type Layer, LayerManager, NoteEditor, type NoteElement, NoteTool, type NoteToolOptions, PencilTool, type PencilToolOptions, type Point, type PointerState, Quadtree, RemoveElementCommand, RemoveLayerCommand, type RenderStatsSnapshot, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type Size, type StrokeElement, type StrokePoint, 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, createText, exportImage, exportState, findBindTarget, findBoundArrows, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getEdgeIntersection, getElementBounds, getElementCenter, isBindable, isNearBezier, parseState, snapPoint, unbindArrow, updateBoundArrow };
package/dist/index.d.ts CHANGED
@@ -72,6 +72,8 @@ interface ArrowElement extends BaseElement {
72
72
  width: number;
73
73
  fromBinding?: Binding;
74
74
  toBinding?: Binding;
75
+ /** Derived from from/to/bend. Redundant in serialized state — safe to omit. */
76
+ cachedControlPoint?: Point;
75
77
  }
76
78
  interface ImageElement extends BaseElement {
77
79
  type: 'image';
@@ -273,8 +275,16 @@ declare class Background {
273
275
  private readonly color;
274
276
  private readonly dotRadius;
275
277
  private readonly lineWidth;
278
+ private cachedCanvas;
279
+ private cachedCtx;
280
+ private lastZoom;
281
+ private lastOffsetX;
282
+ private lastOffsetY;
283
+ private lastWidth;
284
+ private lastHeight;
276
285
  constructor(options?: BackgroundOptions);
277
286
  render(ctx: CanvasRenderingContext2D, camera: Camera): void;
287
+ private ensureCachedCanvas;
278
288
  private adaptSpacing;
279
289
  private renderDots;
280
290
  private renderGrid;
@@ -430,6 +440,15 @@ interface ExportImageOptions {
430
440
  }
431
441
  declare function exportImage(store: ElementStore, options?: ExportImageOptions, layerManager?: LayerManager): Promise<Blob | null>;
432
442
 
443
+ interface RenderStatsSnapshot {
444
+ fps: number;
445
+ avgFrameMs: number;
446
+ p95FrameMs: number;
447
+ lastFrameMs: number;
448
+ lastGridMs: number;
449
+ frameCount: number;
450
+ }
451
+
433
452
  interface ViewportOptions {
434
453
  camera?: CameraOptions;
435
454
  background?: BackgroundOptions;
@@ -494,6 +513,8 @@ declare class Viewport {
494
513
  }): string;
495
514
  updateGrid(updates: Partial<Pick<GridElement, 'gridType' | 'hexOrientation' | 'cellSize' | 'strokeColor' | 'strokeWidth' | 'opacity'>>): void;
496
515
  removeGrid(): void;
516
+ getRenderStats(): RenderStatsSnapshot;
517
+ logPerformance(intervalMs?: number): () => void;
497
518
  destroy(): void;
498
519
  private startEditingElement;
499
520
  private onTextEditStop;
@@ -511,20 +532,14 @@ declare class Viewport {
511
532
  private observeResize;
512
533
  }
513
534
 
514
- interface RenderStatsSnapshot {
515
- fps: number;
516
- avgFrameMs: number;
517
- p95FrameMs: number;
518
- lastFrameMs: number;
519
- frameCount: number;
520
- }
521
-
522
535
  declare class ElementRenderer {
523
536
  private store;
524
537
  private imageCache;
525
538
  private onImageLoad;
526
539
  private camera;
527
540
  private canvasSize;
541
+ private hexTileCache;
542
+ private hexTileCacheKey;
528
543
  setStore(store: ElementStore): void;
529
544
  setOnImageLoad(callback: () => void): void;
530
545
  setCamera(camera: Camera): void;
@@ -540,6 +555,7 @@ declare class ElementRenderer {
540
555
  private strokeShapePath;
541
556
  private renderGrid;
542
557
  private renderImage;
558
+ private getHexTile;
543
559
  private getImage;
544
560
  }
545
561
 
@@ -914,6 +930,6 @@ declare class UpdateLayerCommand implements Command {
914
930
  undo(_store: ElementStore): void;
915
931
  }
916
932
 
917
- declare const VERSION = "0.8.7";
933
+ declare const VERSION = "0.8.8";
918
934
 
919
935
  export { 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, ElementRenderer, ElementStore, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, EventBus, type ExportImageOptions, type GridElement, HandTool, type HexOrientation, HistoryRecorder, HistoryStack, type HistoryStackOptions, type HtmlElement, type ImageElement, ImageTool, type ImageToolOptions, InputHandler, type Layer, LayerManager, NoteEditor, type NoteElement, NoteTool, type NoteToolOptions, PencilTool, type PencilToolOptions, type Point, type PointerState, Quadtree, RemoveElementCommand, RemoveLayerCommand, type RenderStatsSnapshot, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type Size, type StrokeElement, type StrokePoint, 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, createText, exportImage, exportState, findBindTarget, findBoundArrows, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getEdgeIntersection, getElementBounds, getElementCenter, isBindable, isNearBezier, parseState, snapPoint, unbindArrow, updateBoundArrow };