@fieldnotes/core 0.19.0 → 0.20.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
@@ -588,6 +588,7 @@ interface ViewportOptions {
588
588
  background?: BackgroundOptions;
589
589
  fontSizePresets?: FontSizePreset[];
590
590
  toolbar?: boolean;
591
+ placeholder?: string;
591
592
  shortcuts?: ShortcutOptions;
592
593
  onHtmlElementMount?: (elementId: string, domId: string | undefined, container: HTMLDivElement) => void;
593
594
  onDrop?: (event: DragEvent, worldPosition: {
@@ -724,6 +725,7 @@ declare class ElementRenderer {
724
725
  interface NoteEditorOptions {
725
726
  fontSizePresets?: FontSizePreset[];
726
727
  toolbar?: boolean;
728
+ placeholder?: string;
727
729
  }
728
730
  declare class NoteEditor {
729
731
  private editingId;
@@ -731,9 +733,11 @@ declare class NoteEditor {
731
733
  private blurHandler;
732
734
  private keyHandler;
733
735
  private pointerHandler;
736
+ private inputHandler;
734
737
  private pendingEditId;
735
738
  private onStopCallback;
736
739
  private toolbar;
740
+ private readonly placeholder;
737
741
  constructor(options?: NoteEditorOptions);
738
742
  get isEditing(): boolean;
739
743
  get editingElementId(): string | null;
@@ -756,6 +760,7 @@ interface StyledRun extends RunStyle {
756
760
  text: string;
757
761
  }
758
762
  declare function sanitizeNoteHtml(html: string): string;
763
+ declare function isNoteContentEmpty(html: string): boolean;
759
764
 
760
765
  interface ActiveFormats {
761
766
  bold: boolean;
@@ -985,6 +990,7 @@ declare class SelectTool implements Tool {
985
990
  private pendingSingleSelectId;
986
991
  private hasDragged;
987
992
  private resizeAspectRatio;
993
+ private hoveredId;
988
994
  get selectedIds(): string[];
989
995
  setSelection(ids: string[]): void;
990
996
  get isMarqueeActive(): boolean;
@@ -999,6 +1005,7 @@ declare class SelectTool implements Tool {
999
1005
  private updateArrowsBoundTo;
1000
1006
  nudgeSelection(dx: number, dy: number, ctx: ToolContext): boolean;
1001
1007
  private updateHoverCursor;
1008
+ private setHovered;
1002
1009
  private handleResize;
1003
1010
  private hitTestResizeHandle;
1004
1011
  private getHandlePositions;
@@ -1233,6 +1240,6 @@ declare class UpdateLayerCommand implements Command {
1233
1240
  undo(_store: ElementStore): void;
1234
1241
  }
1235
1242
 
1236
- declare const VERSION = "0.19.0";
1243
+ declare const VERSION = "0.20.0";
1237
1244
 
1238
- 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, parseState, sanitizeNoteHtml, setFontSize, smartSnap, snapPoint, snapToHexCenter, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline, unbindArrow, updateBoundArrow };
1245
+ 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
@@ -588,6 +588,7 @@ interface ViewportOptions {
588
588
  background?: BackgroundOptions;
589
589
  fontSizePresets?: FontSizePreset[];
590
590
  toolbar?: boolean;
591
+ placeholder?: string;
591
592
  shortcuts?: ShortcutOptions;
592
593
  onHtmlElementMount?: (elementId: string, domId: string | undefined, container: HTMLDivElement) => void;
593
594
  onDrop?: (event: DragEvent, worldPosition: {
@@ -724,6 +725,7 @@ declare class ElementRenderer {
724
725
  interface NoteEditorOptions {
725
726
  fontSizePresets?: FontSizePreset[];
726
727
  toolbar?: boolean;
728
+ placeholder?: string;
727
729
  }
728
730
  declare class NoteEditor {
729
731
  private editingId;
@@ -731,9 +733,11 @@ declare class NoteEditor {
731
733
  private blurHandler;
732
734
  private keyHandler;
733
735
  private pointerHandler;
736
+ private inputHandler;
734
737
  private pendingEditId;
735
738
  private onStopCallback;
736
739
  private toolbar;
740
+ private readonly placeholder;
737
741
  constructor(options?: NoteEditorOptions);
738
742
  get isEditing(): boolean;
739
743
  get editingElementId(): string | null;
@@ -756,6 +760,7 @@ interface StyledRun extends RunStyle {
756
760
  text: string;
757
761
  }
758
762
  declare function sanitizeNoteHtml(html: string): string;
763
+ declare function isNoteContentEmpty(html: string): boolean;
759
764
 
760
765
  interface ActiveFormats {
761
766
  bold: boolean;
@@ -985,6 +990,7 @@ declare class SelectTool implements Tool {
985
990
  private pendingSingleSelectId;
986
991
  private hasDragged;
987
992
  private resizeAspectRatio;
993
+ private hoveredId;
988
994
  get selectedIds(): string[];
989
995
  setSelection(ids: string[]): void;
990
996
  get isMarqueeActive(): boolean;
@@ -999,6 +1005,7 @@ declare class SelectTool implements Tool {
999
1005
  private updateArrowsBoundTo;
1000
1006
  nudgeSelection(dx: number, dy: number, ctx: ToolContext): boolean;
1001
1007
  private updateHoverCursor;
1008
+ private setHovered;
1002
1009
  private handleResize;
1003
1010
  private hitTestResizeHandle;
1004
1011
  private getHandlePositions;
@@ -1233,6 +1240,6 @@ declare class UpdateLayerCommand implements Command {
1233
1240
  undo(_store: ElementStore): void;
1234
1241
  }
1235
1242
 
1236
- declare const VERSION = "0.19.0";
1243
+ declare const VERSION = "0.20.0";
1237
1244
 
1238
- 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, parseState, sanitizeNoteHtml, setFontSize, smartSnap, snapPoint, snapToHexCenter, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline, unbindArrow, updateBoundArrow };
1245
+ 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.js CHANGED
@@ -273,6 +273,12 @@ function sanitizeNode(node) {
273
273
  sanitizeNode(el);
274
274
  }
275
275
  }
276
+ function isNoteContentEmpty(html) {
277
+ if (!html) return true;
278
+ const doc = new DOMParser().parseFromString(html, "text/html");
279
+ const text = doc.body.textContent ?? "";
280
+ return text.replace(/\u00a0/g, " ").trim().length === 0;
281
+ }
276
282
  function sanitizeAttributes(el, tag) {
277
283
  const attrs = Array.from(el.attributes);
278
284
  for (const attr of attrs) {
@@ -3364,17 +3370,36 @@ var FORMAT_SHORTCUTS = {
3364
3370
  i: toggleItalic,
3365
3371
  u: toggleUnderline
3366
3372
  };
3373
+ function ensureEditorStyles() {
3374
+ if (document.querySelector("style[data-fieldnotes-editor]")) return;
3375
+ const style = document.createElement("style");
3376
+ style.setAttribute("data-fieldnotes-editor", "");
3377
+ style.textContent = `[data-fn-placeholder][data-fn-empty='true']::before {
3378
+ content: attr(data-fn-placeholder);
3379
+ color: #9e9e9e;
3380
+ position: absolute;
3381
+ pointer-events: none;
3382
+ }`;
3383
+ document.head.appendChild(style);
3384
+ }
3385
+ function isNodeEmpty(node) {
3386
+ const text = node.textContent ?? "";
3387
+ return text.replace(/\u00a0/g, " ").trim().length === 0;
3388
+ }
3367
3389
  var NoteEditor = class {
3368
3390
  editingId = null;
3369
3391
  editingNode = null;
3370
3392
  blurHandler = null;
3371
3393
  keyHandler = null;
3372
3394
  pointerHandler = null;
3395
+ inputHandler = null;
3373
3396
  pendingEditId = null;
3374
3397
  onStopCallback = null;
3375
3398
  toolbar;
3399
+ placeholder;
3376
3400
  constructor(options) {
3377
3401
  this.toolbar = options?.toolbar === false ? null : new NoteToolbar(options?.fontSizePresets);
3402
+ this.placeholder = options?.placeholder ?? "Type\u2026";
3378
3403
  }
3379
3404
  get isEditing() {
3380
3405
  return this.editingId !== null;
@@ -3409,6 +3434,11 @@ var NoteEditor = class {
3409
3434
  if (this.pointerHandler) {
3410
3435
  this.editingNode.removeEventListener("pointerdown", this.pointerHandler);
3411
3436
  }
3437
+ if (this.inputHandler) {
3438
+ this.editingNode.removeEventListener("input", this.inputHandler);
3439
+ }
3440
+ this.editingNode.removeAttribute("data-fn-placeholder");
3441
+ this.editingNode.removeAttribute("data-fn-empty");
3412
3442
  const text = sanitizeNoteHtml(this.editingNode.innerHTML);
3413
3443
  store.update(this.editingId, { text });
3414
3444
  this.editingNode.contentEditable = "false";
@@ -3425,6 +3455,7 @@ var NoteEditor = class {
3425
3455
  this.blurHandler = null;
3426
3456
  this.keyHandler = null;
3427
3457
  this.pointerHandler = null;
3458
+ this.inputHandler = null;
3428
3459
  }
3429
3460
  destroy(store) {
3430
3461
  this.pendingEditId = null;
@@ -3455,6 +3486,13 @@ var NoteEditor = class {
3455
3486
  selection.removeAllRanges();
3456
3487
  selection.addRange(range);
3457
3488
  }
3489
+ ensureEditorStyles();
3490
+ node.setAttribute("data-fn-placeholder", this.placeholder);
3491
+ node.setAttribute("data-fn-empty", String(isNodeEmpty(node)));
3492
+ this.inputHandler = () => {
3493
+ node.setAttribute("data-fn-empty", String(isNodeEmpty(node)));
3494
+ };
3495
+ node.addEventListener("input", this.inputHandler);
3458
3496
  this.toolbar?.show(node);
3459
3497
  this.blurHandler = (e) => {
3460
3498
  const related = e.relatedTarget;
@@ -4893,7 +4931,8 @@ var Viewport = class {
4893
4931
  });
4894
4932
  this.noteEditor = new NoteEditor({
4895
4933
  fontSizePresets: options.fontSizePresets,
4896
- toolbar: options.toolbar
4934
+ toolbar: options.toolbar,
4935
+ placeholder: options.placeholder
4897
4936
  });
4898
4937
  this.noteEditor.setOnStop((id) => this.onTextEditStop(id));
4899
4938
  this.onHtmlElementMount = options.onHtmlElementMount;
@@ -5239,7 +5278,16 @@ var Viewport = class {
5239
5278
  }
5240
5279
  onTextEditStop(elementId) {
5241
5280
  const element = this.store.getById(elementId);
5242
- if (!element || element.type !== "text") return;
5281
+ if (!element) return;
5282
+ if (element.type === "note") {
5283
+ if (isNoteContentEmpty(element.text)) {
5284
+ this.historyRecorder.begin();
5285
+ this.store.remove(elementId);
5286
+ this.historyRecorder.commit();
5287
+ }
5288
+ return;
5289
+ }
5290
+ if (element.type !== "text") return;
5243
5291
  if (!element.text || element.text.trim() === "") {
5244
5292
  this.historyRecorder.begin();
5245
5293
  this.store.remove(elementId);
@@ -5788,6 +5836,7 @@ var SelectTool = class {
5788
5836
  pendingSingleSelectId = null;
5789
5837
  hasDragged = false;
5790
5838
  resizeAspectRatio = 0;
5839
+ hoveredId = null;
5791
5840
  get selectedIds() {
5792
5841
  return [...this._selectedIds];
5793
5842
  }
@@ -5804,6 +5853,7 @@ var SelectTool = class {
5804
5853
  onDeactivate(ctx) {
5805
5854
  this._selectedIds = [];
5806
5855
  this.mode = { type: "idle" };
5856
+ this.hoveredId = null;
5807
5857
  ctx.setCursor?.("default");
5808
5858
  }
5809
5859
  snap(point, ctx) {
@@ -5811,6 +5861,7 @@ var SelectTool = class {
5811
5861
  }
5812
5862
  onPointerDown(state, ctx) {
5813
5863
  this.ctx = ctx;
5864
+ this.setHovered(null, ctx);
5814
5865
  const world = ctx.camera.screenToWorld({ x: state.x, y: state.y });
5815
5866
  this.lastWorld = this.snap(world, ctx);
5816
5867
  this.currentWorld = world;
@@ -5953,7 +6004,8 @@ var SelectTool = class {
5953
6004
  }
5954
6005
  onHover(state, ctx) {
5955
6006
  const world = ctx.camera.screenToWorld({ x: state.x, y: state.y });
5956
- this.updateHoverCursor(world, ctx);
6007
+ const hoverId = this.updateHoverCursor(world, ctx);
6008
+ this.setHovered(hoverId, ctx);
5957
6009
  }
5958
6010
  renderOverlay(canvasCtx) {
5959
6011
  this.renderMarquee(canvasCtx);
@@ -5974,6 +6026,23 @@ var SelectTool = class {
5974
6026
  canvasCtx.restore();
5975
6027
  }
5976
6028
  }
6029
+ if (this.hoveredId && this.ctx && this.mode.type === "idle") {
6030
+ if (!this._selectedIds.includes(this.hoveredId)) {
6031
+ const el = this.ctx.store.getById(this.hoveredId);
6032
+ if (el) {
6033
+ const b = getElementBounds(el);
6034
+ if (b) {
6035
+ canvasCtx.save();
6036
+ canvasCtx.strokeStyle = "#2196F3";
6037
+ canvasCtx.globalAlpha = 0.35;
6038
+ canvasCtx.lineWidth = 1.5 / this.ctx.camera.zoom;
6039
+ canvasCtx.setLineDash([]);
6040
+ canvasCtx.strokeRect(b.x, b.y, b.w, b.h);
6041
+ canvasCtx.restore();
6042
+ }
6043
+ }
6044
+ }
6045
+ }
5977
6046
  }
5978
6047
  updateArrowsBoundTo(ids, ctx) {
5979
6048
  const movedNonArrowIds = /* @__PURE__ */ new Set();
@@ -6022,20 +6091,26 @@ var SelectTool = class {
6022
6091
  const arrowHit = hitTestArrowHandles(world, this._selectedIds, ctx);
6023
6092
  if (arrowHit) {
6024
6093
  ctx.setCursor?.(getArrowHandleCursor(arrowHit.handle, false));
6025
- return;
6094
+ return null;
6026
6095
  }
6027
6096
  const templateResizeHit = this.hitTestTemplateResizeHandle(world, ctx);
6028
6097
  if (templateResizeHit) {
6029
6098
  ctx.setCursor?.("nwse-resize");
6030
- return;
6099
+ return null;
6031
6100
  }
6032
6101
  const resizeHit = this.hitTestResizeHandle(world, ctx);
6033
6102
  if (resizeHit) {
6034
6103
  ctx.setCursor?.(HANDLE_CURSORS[resizeHit.handle]);
6035
- return;
6104
+ return null;
6036
6105
  }
6037
6106
  const hit = this.hitTest(world, ctx);
6038
6107
  ctx.setCursor?.(hit ? "move" : "default");
6108
+ return hit ? hit.id : null;
6109
+ }
6110
+ setHovered(id, ctx) {
6111
+ if (this.hoveredId === id) return;
6112
+ this.hoveredId = id;
6113
+ ctx.requestRender();
6039
6114
  }
6040
6115
  handleResize(world, ctx, shiftKey = false) {
6041
6116
  if (this.mode.type !== "resizing") return;
@@ -7142,7 +7217,7 @@ var TemplateTool = class {
7142
7217
  };
7143
7218
 
7144
7219
  // src/index.ts
7145
- var VERSION = "0.19.0";
7220
+ var VERSION = "0.20.0";
7146
7221
  export {
7147
7222
  AddElementCommand,
7148
7223
  ArrowTool,
@@ -7216,6 +7291,7 @@ export {
7216
7291
  getHexDistance,
7217
7292
  isBindable,
7218
7293
  isNearBezier,
7294
+ isNoteContentEmpty,
7219
7295
  parseState,
7220
7296
  sanitizeNoteHtml,
7221
7297
  setFontSize,