@fieldnotes/core 0.25.0 → 0.27.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
@@ -185,6 +185,7 @@ interface ToolContext {
185
185
  requestRender: () => void;
186
186
  switchTool?: (name: string) => void;
187
187
  editElement?: (id: string) => void;
188
+ fitNoteHeight?: (id: string) => void;
188
189
  setCursor?: (cursor: string) => void;
189
190
  snapToGrid?: boolean;
190
191
  gridSize?: number;
@@ -393,6 +394,16 @@ interface RenderStatsSnapshot {
393
394
  frameCount: number;
394
395
  }
395
396
 
397
+ interface ElementStyle {
398
+ color?: string;
399
+ fillColor?: string;
400
+ strokeWidth?: number;
401
+ opacity?: number;
402
+ fontSize?: number;
403
+ }
404
+ declare function styleToPatch(element: CanvasElement, style: ElementStyle): Partial<CanvasElement>;
405
+ declare function getElementStyle(element: CanvasElement): ElementStyle;
406
+
396
407
  interface GridInfo {
397
408
  gridType: 'square' | 'hex';
398
409
  hexOrientation: 'pointy' | 'flat';
@@ -493,10 +504,16 @@ declare class Viewport {
493
504
  removeGrid(): void;
494
505
  getGridInfo(): GridInfo | null;
495
506
  onGridChange(listener: (info: GridInfo | null) => void): () => void;
507
+ private getSelectTool;
508
+ getSelectedIds(): string[];
509
+ onSelectionChange(listener: () => void): () => void;
510
+ getSelectionStyle(): ElementStyle | null;
511
+ applyStyleToSelection(style: ElementStyle): void;
496
512
  getRenderStats(): RenderStatsSnapshot;
497
513
  logPerformance(intervalMs?: number): () => void;
498
514
  destroy(): void;
499
515
  private startEditingElement;
516
+ private fitNoteHeight;
500
517
  private onTextEditStop;
501
518
  private onTapDown;
502
519
  private onDoubleTap;
@@ -698,6 +715,7 @@ declare class EraserTool implements Tool {
698
715
  declare class SelectTool implements Tool {
699
716
  readonly name = "select";
700
717
  private _selectedIds;
718
+ private selectionListeners;
701
719
  private mode;
702
720
  private lastWorld;
703
721
  private currentWorld;
@@ -707,6 +725,8 @@ declare class SelectTool implements Tool {
707
725
  private resizeAspectRatio;
708
726
  private hoveredId;
709
727
  get selectedIds(): string[];
728
+ onSelectionChange(listener: () => void): () => void;
729
+ private setSelectedIds;
710
730
  setSelection(ids: string[]): void;
711
731
  get isMarqueeActive(): boolean;
712
732
  onActivate(ctx: ToolContext): void;
@@ -931,6 +951,6 @@ declare class TemplateTool implements Tool {
931
951
  private notifyOptionsChange;
932
952
  }
933
953
 
934
- declare const VERSION = "0.25.0";
954
+ declare const VERSION = "0.27.0";
935
955
 
936
- export { type ActiveFormats, 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, ElementStore, 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, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInSquare, getHexDistance, isNearBezier, setFontSize, smartSnap, snapPoint, snapToHexCenter, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
956
+ export { type ActiveFormats, 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, 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
@@ -185,6 +185,7 @@ interface ToolContext {
185
185
  requestRender: () => void;
186
186
  switchTool?: (name: string) => void;
187
187
  editElement?: (id: string) => void;
188
+ fitNoteHeight?: (id: string) => void;
188
189
  setCursor?: (cursor: string) => void;
189
190
  snapToGrid?: boolean;
190
191
  gridSize?: number;
@@ -393,6 +394,16 @@ interface RenderStatsSnapshot {
393
394
  frameCount: number;
394
395
  }
395
396
 
397
+ interface ElementStyle {
398
+ color?: string;
399
+ fillColor?: string;
400
+ strokeWidth?: number;
401
+ opacity?: number;
402
+ fontSize?: number;
403
+ }
404
+ declare function styleToPatch(element: CanvasElement, style: ElementStyle): Partial<CanvasElement>;
405
+ declare function getElementStyle(element: CanvasElement): ElementStyle;
406
+
396
407
  interface GridInfo {
397
408
  gridType: 'square' | 'hex';
398
409
  hexOrientation: 'pointy' | 'flat';
@@ -493,10 +504,16 @@ declare class Viewport {
493
504
  removeGrid(): void;
494
505
  getGridInfo(): GridInfo | null;
495
506
  onGridChange(listener: (info: GridInfo | null) => void): () => void;
507
+ private getSelectTool;
508
+ getSelectedIds(): string[];
509
+ onSelectionChange(listener: () => void): () => void;
510
+ getSelectionStyle(): ElementStyle | null;
511
+ applyStyleToSelection(style: ElementStyle): void;
496
512
  getRenderStats(): RenderStatsSnapshot;
497
513
  logPerformance(intervalMs?: number): () => void;
498
514
  destroy(): void;
499
515
  private startEditingElement;
516
+ private fitNoteHeight;
500
517
  private onTextEditStop;
501
518
  private onTapDown;
502
519
  private onDoubleTap;
@@ -698,6 +715,7 @@ declare class EraserTool implements Tool {
698
715
  declare class SelectTool implements Tool {
699
716
  readonly name = "select";
700
717
  private _selectedIds;
718
+ private selectionListeners;
701
719
  private mode;
702
720
  private lastWorld;
703
721
  private currentWorld;
@@ -707,6 +725,8 @@ declare class SelectTool implements Tool {
707
725
  private resizeAspectRatio;
708
726
  private hoveredId;
709
727
  get selectedIds(): string[];
728
+ onSelectionChange(listener: () => void): () => void;
729
+ private setSelectedIds;
710
730
  setSelection(ids: string[]): void;
711
731
  get isMarqueeActive(): boolean;
712
732
  onActivate(ctx: ToolContext): void;
@@ -931,6 +951,6 @@ declare class TemplateTool implements Tool {
931
951
  private notifyOptionsChange;
932
952
  }
933
953
 
934
- declare const VERSION = "0.25.0";
954
+ declare const VERSION = "0.27.0";
935
955
 
936
- export { type ActiveFormats, 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, ElementStore, 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, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInSquare, getHexDistance, isNearBezier, setFontSize, smartSnap, snapPoint, snapToHexCenter, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
956
+ export { type ActiveFormats, 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, 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 };