@fieldnotes/core 0.35.0 → 0.37.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
@@ -445,6 +445,8 @@ interface ViewportOptions {
445
445
  }) => void;
446
446
  /** CSS-pixel margin cached beyond the viewport. Default `256`. Set `0` to disable. */
447
447
  panBufferMargin?: number;
448
+ /** Enable the built-in context menu. Default `true`. */
449
+ contextMenu?: boolean;
448
450
  }
449
451
  declare class Viewport {
450
452
  private readonly container;
@@ -457,6 +459,7 @@ declare class Viewport {
457
459
  private readonly canvasEl;
458
460
  private readonly wrapper;
459
461
  private readonly unsubCamera;
462
+ private readonly unsubToolChange;
460
463
  private readonly unsubStore;
461
464
  private readonly inputHandler;
462
465
  private readonly background;
@@ -479,6 +482,7 @@ declare class Viewport {
479
482
  private readonly doubleTapDetector;
480
483
  private tapDownX;
481
484
  private tapDownY;
485
+ private contextMenu;
482
486
  constructor(container: HTMLElement, options?: ViewportOptions);
483
487
  get ctx(): CanvasRenderingContext2D | null;
484
488
  get snapToGrid(): boolean;
@@ -526,11 +530,15 @@ declare class Viewport {
526
530
  onGridChange(listener: (info: GridInfo | null) => void): () => void;
527
531
  private getSelectTool;
528
532
  getSelectedIds(): string[];
533
+ runAction(action: string): void;
534
+ canPaste(): boolean;
535
+ openContextMenu(screenPos: Point): void;
529
536
  onSelectionChange(listener: () => void): () => void;
530
537
  getSelectionStyle(): ElementStyle | null;
531
538
  applyStyleToSelection(style: ElementStyle): void;
532
539
  groupSelection(): void;
533
540
  ungroupSelection(): void;
541
+ toggleLockSelection(): void;
534
542
  alignSelection(edge: AlignEdge): void;
535
543
  distributeSelection(axis: DistributeAxis): void;
536
544
  private boundedSelection;
@@ -771,6 +779,7 @@ declare class SelectTool implements Tool {
771
779
  onSelectionChange(listener: () => void): () => void;
772
780
  private setSelectedIds;
773
781
  setSelection(ids: string[]): void;
782
+ selectAtPoint(world: Point, ctx: ToolContext): void;
774
783
  get isMarqueeActive(): boolean;
775
784
  onActivate(ctx: ToolContext): void;
776
785
  onDeactivate(ctx: ToolContext): void;
@@ -796,6 +805,7 @@ declare class SelectTool implements Tool {
796
805
  private topMidpoint;
797
806
  private renderMarquee;
798
807
  private renderSelectionBoxes;
808
+ private drawLockBadge;
799
809
  private renderBindingHighlights;
800
810
  private hitTestTemplateResizeHandle;
801
811
  private handleTemplateResize;
@@ -1001,6 +1011,6 @@ declare class TemplateTool implements Tool {
1001
1011
  private notifyOptionsChange;
1002
1012
  }
1003
1013
 
1004
- declare const VERSION = "0.35.0";
1014
+ declare const VERSION = "0.37.0";
1005
1015
 
1006
1016
  export { type ActiveFormats, type AlignEdge, type ArrowElement, 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, ElementStore, type ElementStyle, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, type ExportImageOptions, type FontSizePreset, type GridElement, type GridInfo, HandTool, type HexOrientation, HistoryStack, type HistoryStackOptions, type HtmlElement, type ImageElement, ImageTool, type ImageToolOptions, type Layer, LayerManager, MeasureTool, type MeasureToolOptions, type Measurement, type NoteElement, NoteTool, type NoteToolOptions, PencilTool, type PencilToolOptions, type Point, type PointerState, type RenderStatsSnapshot, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StrokeElement, type StrokePoint, type TemplateElement, 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, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInSquare, getHexDistance, isNearBezier, setFontSize, smartSnap, snapPoint, snapToHexCenter, styleToPatch, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
package/dist/index.d.ts CHANGED
@@ -445,6 +445,8 @@ interface ViewportOptions {
445
445
  }) => void;
446
446
  /** CSS-pixel margin cached beyond the viewport. Default `256`. Set `0` to disable. */
447
447
  panBufferMargin?: number;
448
+ /** Enable the built-in context menu. Default `true`. */
449
+ contextMenu?: boolean;
448
450
  }
449
451
  declare class Viewport {
450
452
  private readonly container;
@@ -457,6 +459,7 @@ declare class Viewport {
457
459
  private readonly canvasEl;
458
460
  private readonly wrapper;
459
461
  private readonly unsubCamera;
462
+ private readonly unsubToolChange;
460
463
  private readonly unsubStore;
461
464
  private readonly inputHandler;
462
465
  private readonly background;
@@ -479,6 +482,7 @@ declare class Viewport {
479
482
  private readonly doubleTapDetector;
480
483
  private tapDownX;
481
484
  private tapDownY;
485
+ private contextMenu;
482
486
  constructor(container: HTMLElement, options?: ViewportOptions);
483
487
  get ctx(): CanvasRenderingContext2D | null;
484
488
  get snapToGrid(): boolean;
@@ -526,11 +530,15 @@ declare class Viewport {
526
530
  onGridChange(listener: (info: GridInfo | null) => void): () => void;
527
531
  private getSelectTool;
528
532
  getSelectedIds(): string[];
533
+ runAction(action: string): void;
534
+ canPaste(): boolean;
535
+ openContextMenu(screenPos: Point): void;
529
536
  onSelectionChange(listener: () => void): () => void;
530
537
  getSelectionStyle(): ElementStyle | null;
531
538
  applyStyleToSelection(style: ElementStyle): void;
532
539
  groupSelection(): void;
533
540
  ungroupSelection(): void;
541
+ toggleLockSelection(): void;
534
542
  alignSelection(edge: AlignEdge): void;
535
543
  distributeSelection(axis: DistributeAxis): void;
536
544
  private boundedSelection;
@@ -771,6 +779,7 @@ declare class SelectTool implements Tool {
771
779
  onSelectionChange(listener: () => void): () => void;
772
780
  private setSelectedIds;
773
781
  setSelection(ids: string[]): void;
782
+ selectAtPoint(world: Point, ctx: ToolContext): void;
774
783
  get isMarqueeActive(): boolean;
775
784
  onActivate(ctx: ToolContext): void;
776
785
  onDeactivate(ctx: ToolContext): void;
@@ -796,6 +805,7 @@ declare class SelectTool implements Tool {
796
805
  private topMidpoint;
797
806
  private renderMarquee;
798
807
  private renderSelectionBoxes;
808
+ private drawLockBadge;
799
809
  private renderBindingHighlights;
800
810
  private hitTestTemplateResizeHandle;
801
811
  private handleTemplateResize;
@@ -1001,6 +1011,6 @@ declare class TemplateTool implements Tool {
1001
1011
  private notifyOptionsChange;
1002
1012
  }
1003
1013
 
1004
- declare const VERSION = "0.35.0";
1014
+ declare const VERSION = "0.37.0";
1005
1015
 
1006
1016
  export { type ActiveFormats, type AlignEdge, type ArrowElement, 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, ElementStore, type ElementStyle, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, type ExportImageOptions, type FontSizePreset, type GridElement, type GridInfo, HandTool, type HexOrientation, HistoryStack, type HistoryStackOptions, type HtmlElement, type ImageElement, ImageTool, type ImageToolOptions, type Layer, LayerManager, MeasureTool, type MeasureToolOptions, type Measurement, type NoteElement, NoteTool, type NoteToolOptions, PencilTool, type PencilToolOptions, type Point, type PointerState, type RenderStatsSnapshot, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StrokeElement, type StrokePoint, type TemplateElement, 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, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInSquare, getHexDistance, isNearBezier, setFontSize, smartSnap, snapPoint, snapToHexCenter, styleToPatch, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };