@fieldnotes/core 0.38.6 → 0.38.7

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
@@ -993,6 +993,6 @@ declare class TemplateTool implements Tool {
993
993
  private notifyOptionsChange;
994
994
  }
995
995
 
996
- declare const VERSION = "0.38.6";
996
+ declare const VERSION = "0.38.7";
997
997
 
998
998
  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
@@ -993,6 +993,6 @@ declare class TemplateTool implements Tool {
993
993
  private notifyOptionsChange;
994
994
  }
995
995
 
996
- declare const VERSION = "0.38.6";
996
+ declare const VERSION = "0.38.7";
997
997
 
998
998
  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.js CHANGED
@@ -843,6 +843,11 @@ var KeyboardActions = class {
843
843
  this.nudgeTxId = recorder?.currentTransactionId ?? null;
844
844
  } else {
845
845
  clearTimeout(this.nudgeTimer);
846
+ const recorder = this.deps.getHistoryRecorder();
847
+ if (recorder?.currentTransactionId !== this.nudgeTxId) {
848
+ recorder?.begin();
849
+ this.nudgeTxId = recorder?.currentTransactionId ?? null;
850
+ }
846
851
  }
847
852
  const moved = sel.tool.nudgeSelection(dx * step, dy * step, sel.ctx);
848
853
  this.nudgeTimer = setTimeout(() => this.flushPendingNudge(), 400);
@@ -853,7 +858,7 @@ var KeyboardActions = class {
853
858
  clearTimeout(this.nudgeTimer);
854
859
  this.nudgeTimer = null;
855
860
  const recorder = this.deps.getHistoryRecorder();
856
- if (this.nudgeTxId === null || recorder?.currentTransactionId === this.nudgeTxId) {
861
+ if (recorder?.currentTransactionId === this.nudgeTxId) {
857
862
  recorder?.commit();
858
863
  }
859
864
  this.nudgeTxId = null;
@@ -1164,6 +1169,9 @@ function bindingMatches(p, e, allowShift) {
1164
1169
  if (e.altKey !== p.alt) return false;
1165
1170
  return p.digit ? e.code === `Digit${p.key}` : e.key.toLowerCase() === p.key;
1166
1171
  }
1172
+ function sameBinding(a, b) {
1173
+ return a.key === b.key && a.mod === b.mod && a.ctrl === b.ctrl && a.meta === b.meta && a.shift === b.shift && a.alt === b.alt;
1174
+ }
1167
1175
  function toArray(bindings) {
1168
1176
  if (bindings === null) return [];
1169
1177
  return Array.isArray(bindings) ? [...bindings] : [bindings];
@@ -1192,6 +1200,16 @@ var ShortcutMap = class {
1192
1200
  rebind(action, bindings) {
1193
1201
  const list = toArray(bindings);
1194
1202
  const parsedList = list.map(parseBinding);
1203
+ for (const p of parsedList) {
1204
+ for (const [otherAction, otherList] of this.parsed) {
1205
+ if (otherAction === action) continue;
1206
+ if (otherList.some((q) => sameBinding(p, q))) {
1207
+ console.warn(
1208
+ `[fieldnotes] shortcut binding for "${action}" conflicts with "${otherAction}"; first registered wins`
1209
+ );
1210
+ }
1211
+ }
1212
+ }
1195
1213
  this.raw.set(action, list);
1196
1214
  this.parsed.set(action, parsedList);
1197
1215
  }
@@ -9043,7 +9061,7 @@ var TemplateTool = class {
9043
9061
  };
9044
9062
 
9045
9063
  // src/index.ts
9046
- var VERSION = "0.38.6";
9064
+ var VERSION = "0.38.7";
9047
9065
  export {
9048
9066
  ArrowTool,
9049
9067
  AutoSave,