@parhelia/core 0.1.12937 → 0.1.12938

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.
Files changed (51) hide show
  1. package/dist/agents-view/AgentCard.d.ts +2 -1
  2. package/dist/agents-view/AgentCard.js +14 -5
  3. package/dist/agents-view/AgentCard.js.map +1 -1
  4. package/dist/agents-view/AgentsView.js +6 -5
  5. package/dist/agents-view/AgentsView.js.map +1 -1
  6. package/dist/agents-view/DateAgentsGroup.d.ts +2 -1
  7. package/dist/agents-view/DateAgentsGroup.js +3 -2
  8. package/dist/agents-view/DateAgentsGroup.js.map +1 -1
  9. package/dist/agents-view/ProfileAgentsGroup.d.ts +2 -1
  10. package/dist/agents-view/ProfileAgentsGroup.js +11 -2
  11. package/dist/agents-view/ProfileAgentsGroup.js.map +1 -1
  12. package/dist/editor/ConfirmationDialog.js +3 -3
  13. package/dist/editor/ConfirmationDialog.js.map +1 -1
  14. package/dist/editor/ai/AgentProfileSelector.js +1 -1
  15. package/dist/editor/ai/AgentProfileSelector.js.map +1 -1
  16. package/dist/editor/client/EditorShell.js +40 -9
  17. package/dist/editor/client/EditorShell.js.map +1 -1
  18. package/dist/editor/client/editContext.d.ts +8 -0
  19. package/dist/editor/client/editContext.js.map +1 -1
  20. package/dist/editor/client/hooks/useWorkbox.d.ts +2 -2
  21. package/dist/editor/client/hooks/useWorkbox.js +3 -3
  22. package/dist/editor/client/hooks/useWorkbox.js.map +1 -1
  23. package/dist/editor/client/hooks/workboxDescriptors.d.ts +6 -1
  24. package/dist/editor/client/hooks/workboxDescriptors.js +37 -9
  25. package/dist/editor/client/hooks/workboxDescriptors.js.map +1 -1
  26. package/dist/editor/notifications/NotificationCenter.js +2 -2
  27. package/dist/editor/notifications/NotificationCenter.js.map +1 -1
  28. package/dist/editor/reviews/MultiReviewManager.js +1 -0
  29. package/dist/editor/reviews/MultiReviewManager.js.map +1 -1
  30. package/dist/editor/reviews/useMultiReview.d.ts +10 -2
  31. package/dist/editor/reviews/useMultiReview.js +54 -12
  32. package/dist/editor/reviews/useMultiReview.js.map +1 -1
  33. package/dist/editor/sidebar/Validation.js +29 -16
  34. package/dist/editor/sidebar/Validation.js.map +1 -1
  35. package/dist/editor/sidebar/Workbox.js +107 -21
  36. package/dist/editor/sidebar/Workbox.js.map +1 -1
  37. package/dist/editor/ui/SimpleTable.d.ts +1 -0
  38. package/dist/editor/ui/SimpleTable.js +12 -2
  39. package/dist/editor/ui/SimpleTable.js.map +1 -1
  40. package/dist/editor/ui/Splitter.js +1 -1
  41. package/dist/editor/ui/Splitter.js.map +1 -1
  42. package/dist/editor/ui/WorkboxItemsTable.js +22 -5
  43. package/dist/editor/ui/WorkboxItemsTable.js.map +1 -1
  44. package/dist/editor/utils/textInsertionWhitespace.d.ts +21 -0
  45. package/dist/editor/utils/textInsertionWhitespace.js +71 -0
  46. package/dist/editor/utils/textInsertionWhitespace.js.map +1 -0
  47. package/dist/editor/views/editorSlotContext.js +14 -2
  48. package/dist/editor/views/editorSlotContext.js.map +1 -1
  49. package/dist/revision.d.ts +2 -2
  50. package/dist/revision.js +2 -2
  51. package/package.json +1 -1
@@ -43,6 +43,7 @@ import { logFieldValueDiagnostic, summarizeFieldDescriptor, } from "../fieldValu
43
43
  import { Spinner } from "../ui/Spinner";
44
44
  import { createSettleRegistry } from "../ui/animationSettle";
45
45
  import { cleanId } from "../utils/id-helper";
46
+ import { preserveSelectionBoundaryWhitespace, padInsertedTextWhitespace, } from "../utils/textInsertionWhitespace";
46
47
  import { useDebouncedCallback } from "use-debounce";
47
48
  import { useKeyboardNavigation } from "../utils/keyboardNavigation";
48
49
  import { Toaster } from "../../components/ui/sonner";
@@ -2876,6 +2877,7 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
2876
2877
  slotId: next[idx].slotId,
2877
2878
  itemDescriptor: itemToLoad,
2878
2879
  refreshToken: Date.now(),
2880
+ tag: next[idx].tag,
2879
2881
  };
2880
2882
  return next;
2881
2883
  });
@@ -2921,19 +2923,28 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
2921
2923
  next[existingIdx] = {
2922
2924
  slotId: next[existingIdx].slotId,
2923
2925
  itemDescriptor: itemToLoad,
2926
+ tag: next[existingIdx].tag ?? options?.newSlotTag,
2924
2927
  };
2925
2928
  return next;
2926
2929
  }
2927
2930
  return [
2928
2931
  ...prev,
2929
- { slotId: targetSlotId, itemDescriptor: itemToLoad },
2932
+ {
2933
+ slotId: targetSlotId,
2934
+ itemDescriptor: itemToLoad,
2935
+ tag: options?.newSlotTag,
2936
+ },
2930
2937
  ];
2931
2938
  }
2932
2939
  const idx = prev.findIndex((s) => s.slotId === targetSlotId);
2933
2940
  if (idx === -1)
2934
2941
  return prev;
2935
2942
  const next = [...prev];
2936
- next[idx] = { slotId: next[idx].slotId, itemDescriptor: itemToLoad };
2943
+ next[idx] = {
2944
+ slotId: next[idx].slotId,
2945
+ itemDescriptor: itemToLoad,
2946
+ tag: next[idx].tag,
2947
+ };
2937
2948
  return next;
2938
2949
  });
2939
2950
  // Decide whether this load should update the global "current item" state.
@@ -3273,9 +3284,27 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
3273
3284
  onOperationExecuted,
3274
3285
  };
3275
3286
  // moved to useMediaSelector
3287
+ // Workbox/validation scope spans every open slot (each slot's page tree plus
3288
+ // its item), so opening a validation result in a second slot keeps the page's
3289
+ // list intact regardless of which slot is active. The slot contexts are
3290
+ // mutable refs; re-reads happen because notifyPageModelReady bumps the
3291
+ // pageModelReadyToken state whenever a slot's page model finishes building.
3292
+ const registeredSlotScopes = editorSlots.flatMap((slot) => {
3293
+ const slotContext = slotContexts.get(slot.slotId);
3294
+ if (!slotContext)
3295
+ return [];
3296
+ return [
3297
+ {
3298
+ page: slotContext.primaryPageViewContext.page,
3299
+ itemDescriptor: slotContext.itemDescriptor,
3300
+ },
3301
+ ];
3302
+ });
3303
+ const workboxScopeSlots = registeredSlotScopes.length
3304
+ ? registeredSlotScopes
3305
+ : [{ page, itemDescriptor: currentItemDescriptor }];
3276
3306
  const { workboxItems, isWorkboxLoading, refreshWorkbox } = useWorkbox({
3277
- page,
3278
- currentItemDescriptor,
3307
+ scopeSlots: workboxScopeSlots,
3279
3308
  validate,
3280
3309
  });
3281
3310
  // Refs for operations-context callbacks (needed because operationsContext is created later)
@@ -3906,7 +3935,7 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
3906
3935
  try {
3907
3936
  // If we have selected text and a replaceText callback, use it
3908
3937
  if (rangeToReplace?.text && rangeToReplace.replaceText) {
3909
- rangeToReplace.replaceText(newText);
3938
+ rangeToReplace.replaceText(preserveSelectionBoundaryWhitespace(rangeToReplace.text, newText));
3910
3939
  setSelectedRange(undefined);
3911
3940
  lastTextSelectionRangeRef.current = undefined;
3912
3941
  return;
@@ -3914,7 +3943,7 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
3914
3943
  // If no selection but we have a replaceText callback, try to use it for insertion
3915
3944
  // (some editors might support insertion via the same callback)
3916
3945
  if (!rangeToReplace?.text && rangeToReplace?.replaceText) {
3917
- rangeToReplace.replaceText(newText);
3946
+ rangeToReplace.replaceText(padInsertedTextWhitespace(newText, rangeToReplace.contextBefore?.slice(-1) ?? "", rangeToReplace.contextAfter?.charAt(0) ?? ""));
3918
3947
  setSelectedRange(undefined);
3919
3948
  lastTextSelectionRangeRef.current = undefined;
3920
3949
  return;
@@ -3953,7 +3982,7 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
3953
3982
  }
3954
3983
  newValue =
3955
3984
  currentValue.slice(0, actualPosition) +
3956
- newText +
3985
+ preserveSelectionBoundaryWhitespace(originalSelectedText, newText) +
3957
3986
  currentValue.slice(actualPosition + originalSelectedText.length);
3958
3987
  }
3959
3988
  else {
@@ -3961,7 +3990,7 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
3961
3990
  const insertPosition = rangeToReplace?.startOffset ?? currentValue.length;
3962
3991
  newValue =
3963
3992
  currentValue.slice(0, insertPosition) +
3964
- newText +
3993
+ padInsertedTextWhitespace(newText, insertPosition > 0 ? currentValue[insertPosition - 1] : "", currentValue[insertPosition] ?? "") +
3965
3994
  currentValue.slice(insertPosition);
3966
3995
  }
3967
3996
  // Update the field
@@ -4031,7 +4060,7 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
4031
4060
  "";
4032
4061
  insertPosition = insertPosition ?? currentValue.length;
4033
4062
  const newValue = currentValue.slice(0, insertPosition) +
4034
- newText +
4063
+ padInsertedTextWhitespace(newText, insertPosition > 0 ? currentValue[insertPosition - 1] : "", currentValue[insertPosition] ?? "") +
4035
4064
  currentValue.slice(insertPosition);
4036
4065
  // Update the field
4037
4066
  await operations.editField({
@@ -5093,6 +5122,7 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
5093
5122
  commentsLoaded,
5094
5123
  availableCommentTags,
5095
5124
  loadComments,
5125
+ loadSuggestedEdits,
5096
5126
  setComments,
5097
5127
  showComments,
5098
5128
  setShowComments,
@@ -5374,6 +5404,7 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
5374
5404
  commentsLoaded,
5375
5405
  availableCommentTags,
5376
5406
  loadComments,
5407
+ loadSuggestedEdits,
5377
5408
  showComments,
5378
5409
  showResolvedComments,
5379
5410
  reviews,