@fieldnotes/core 0.38.5 → 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.cjs CHANGED
@@ -924,6 +924,11 @@ var KeyboardActions = class {
924
924
  this.nudgeTxId = recorder?.currentTransactionId ?? null;
925
925
  } else {
926
926
  clearTimeout(this.nudgeTimer);
927
+ const recorder = this.deps.getHistoryRecorder();
928
+ if (recorder?.currentTransactionId !== this.nudgeTxId) {
929
+ recorder?.begin();
930
+ this.nudgeTxId = recorder?.currentTransactionId ?? null;
931
+ }
927
932
  }
928
933
  const moved = sel.tool.nudgeSelection(dx * step, dy * step, sel.ctx);
929
934
  this.nudgeTimer = setTimeout(() => this.flushPendingNudge(), 400);
@@ -934,7 +939,7 @@ var KeyboardActions = class {
934
939
  clearTimeout(this.nudgeTimer);
935
940
  this.nudgeTimer = null;
936
941
  const recorder = this.deps.getHistoryRecorder();
937
- if (this.nudgeTxId === null || recorder?.currentTransactionId === this.nudgeTxId) {
942
+ if (recorder?.currentTransactionId === this.nudgeTxId) {
938
943
  recorder?.commit();
939
944
  }
940
945
  this.nudgeTxId = null;
@@ -1245,6 +1250,9 @@ function bindingMatches(p, e, allowShift) {
1245
1250
  if (e.altKey !== p.alt) return false;
1246
1251
  return p.digit ? e.code === `Digit${p.key}` : e.key.toLowerCase() === p.key;
1247
1252
  }
1253
+ function sameBinding(a, b) {
1254
+ 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;
1255
+ }
1248
1256
  function toArray(bindings) {
1249
1257
  if (bindings === null) return [];
1250
1258
  return Array.isArray(bindings) ? [...bindings] : [bindings];
@@ -1273,6 +1281,16 @@ var ShortcutMap = class {
1273
1281
  rebind(action, bindings) {
1274
1282
  const list = toArray(bindings);
1275
1283
  const parsedList = list.map(parseBinding);
1284
+ for (const p of parsedList) {
1285
+ for (const [otherAction, otherList] of this.parsed) {
1286
+ if (otherAction === action) continue;
1287
+ if (otherList.some((q) => sameBinding(p, q))) {
1288
+ console.warn(
1289
+ `[fieldnotes] shortcut binding for "${action}" conflicts with "${otherAction}"; first registered wins`
1290
+ );
1291
+ }
1292
+ }
1293
+ }
1276
1294
  this.raw.set(action, list);
1277
1295
  this.parsed.set(action, parsedList);
1278
1296
  }
@@ -9124,7 +9142,7 @@ var TemplateTool = class {
9124
9142
  };
9125
9143
 
9126
9144
  // src/index.ts
9127
- var VERSION = "0.38.5";
9145
+ var VERSION = "0.38.7";
9128
9146
  // Annotate the CommonJS export names for ESM import in node:
9129
9147
  0 && (module.exports = {
9130
9148
  ArrowTool,