@ai-matrx/context-menu 0.1.7 → 0.1.8

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/engine.js CHANGED
@@ -2402,6 +2402,7 @@ var STRIP_FOR = {
2402
2402
  var PAGE_TEXT_FILE_IDS = /* @__PURE__ */ new Set(["save-as-pdf"]);
2403
2403
  var OPEN_ROW = /^open( record)?$/i;
2404
2404
  var LINK_A_RECORD = /^link a record/i;
2405
+ var RECORD_VERBS = [/^merge with/i, /^split(…|\.\.\.)?$/i, /^extract parent/i];
2405
2406
  var FOLDS_INTO_SHARE = [/^copy link\b/i, /^share link\b/i];
2406
2407
  var SAVE_SHARE_GROUPS = ["copy", "download", "convert", "publish", "share"];
2407
2408
  var ORGANIZE_GROUPS = /* @__PURE__ */ new Set(["organize", "history", "compare"]);
@@ -2499,14 +2500,19 @@ function proposedArrangement(target, resolved, { noun }) {
2499
2500
  };
2500
2501
  const openRow = lead(OPEN_ROW);
2501
2502
  const linkRow = lead(LINK_A_RECORD);
2502
- ownCandidates.unshift(...[openRow, linkRow].filter((r) => r !== null));
2503
+ const verbRows = RECORD_VERBS.map(lead).filter((r) => r !== null);
2504
+ const leading = [openRow, linkRow, ...verbRows].filter((r) => r !== null);
2505
+ const verbIds = new Set(verbRows.map((r) => r.action.id));
2506
+ let counted = 0;
2507
+ ownCandidates.unshift(...leading);
2503
2508
  const own = [];
2504
2509
  const more = [];
2505
2510
  for (const r of ownCandidates) {
2506
2511
  used.add(r.action.id);
2507
2512
  const folds = hasShare && FOLDS_INTO_SHARE.some((re) => re.test(label(r)));
2508
- if (!folds && own.length < OWN_ROWS_MAX && !r.action.expand) {
2513
+ if (!folds && (verbIds.has(r.action.id) || counted < OWN_ROWS_MAX) && !r.action.expand) {
2509
2514
  const destructive = SLOT2.archive.ownLabels.some((re) => re.test(label(r)));
2515
+ if (!verbIds.has(r.action.id)) counted += 1;
2510
2516
  own.push({ ...r, action: plain(r.action, { category: "edit", order: own.length, ...destructive ? { destructive: true } : {} }) });
2511
2517
  } else {
2512
2518
  more.push(plain(r.action));