@erdemtuna/doc-review 0.9.0 → 0.11.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.
Files changed (103) hide show
  1. package/README.md +58 -222
  2. package/{src → lib}/SKILL.md +5 -2
  3. package/lib/anchor-text.js +155 -0
  4. package/lib/atomic-write.js +54 -0
  5. package/lib/changes-controller.js +184 -0
  6. package/lib/chrome-api.js +78 -0
  7. package/lib/chrome-client.js +1700 -0
  8. package/lib/chrome-session.js +73 -0
  9. package/lib/chrome.html +53 -0
  10. package/lib/cli.js +255 -0
  11. package/lib/click-target.js +28 -0
  12. package/lib/comment-anchor.js +23 -0
  13. package/lib/comment-target.js +164 -0
  14. package/lib/comments-controller.js +109 -0
  15. package/lib/contextual-controller.js +33 -0
  16. package/lib/contracts/feedback.js +1 -0
  17. package/lib/contracts/frame.js +7 -0
  18. package/lib/contracts/history.js +1 -0
  19. package/lib/contracts/index.js +2 -0
  20. package/lib/contracts/page.js +23 -0
  21. package/lib/controller-store.js +96 -0
  22. package/lib/document-execution.js +115 -0
  23. package/lib/edit-limits.js +24 -0
  24. package/lib/editing.js +107 -0
  25. package/lib/execution-client.js +19 -0
  26. package/lib/feedback-controller.js +113 -0
  27. package/lib/feedback-panel-controller.js +161 -0
  28. package/lib/frame-channel.js +42 -0
  29. package/lib/frame-controller.js +313 -0
  30. package/lib/frame-host.js +136 -0
  31. package/lib/frame-policy.js +50 -0
  32. package/lib/history-client.js +112 -0
  33. package/lib/history-coordinator.js +217 -0
  34. package/lib/history-policy.js +43 -0
  35. package/lib/history-server.js +464 -0
  36. package/lib/html-transform.js +52 -0
  37. package/lib/icons.js +325 -0
  38. package/{src → lib}/markdown.js +25 -26
  39. package/lib/paths.js +83 -0
  40. package/lib/poll-transport.js +220 -0
  41. package/lib/positioning.js +97 -0
  42. package/lib/recovery-controller.js +123 -0
  43. package/lib/review-controller.js +93 -0
  44. package/lib/review-mode.js +66 -0
  45. package/lib/revision-diff.js +482 -0
  46. package/lib/revision-schema.js +235 -0
  47. package/lib/revision-store.js +190 -0
  48. package/lib/save-controller.js +303 -0
  49. package/lib/sdk.js +2629 -0
  50. package/lib/semantic-snapshot.js +268 -0
  51. package/lib/serialize.js +32 -0
  52. package/lib/server-entry.js +26 -0
  53. package/lib/server-lock.js +109 -0
  54. package/lib/server.js +1501 -0
  55. package/lib/setup-guidance.js +119 -0
  56. package/{src → lib}/setup.js +44 -55
  57. package/lib/state.js +733 -0
  58. package/lib/toolbar-controller.js +32 -0
  59. package/lib/ui/THIRD_PARTY_NOTICES.md +1254 -0
  60. package/lib/ui/chrome.css +4881 -0
  61. package/lib/ui/chrome.js +52 -0
  62. package/lib/view-identity.js +112 -0
  63. package/package.json +50 -14
  64. package/src/anchor-text.js +0 -160
  65. package/src/atomic-write.js +0 -53
  66. package/src/chrome-client.js +0 -2747
  67. package/src/chrome-session.js +0 -85
  68. package/src/chrome.css +0 -652
  69. package/src/chrome.html +0 -196
  70. package/src/cli.js +0 -271
  71. package/src/click-target.js +0 -26
  72. package/src/comment-anchor.js +0 -22
  73. package/src/comment-target.js +0 -164
  74. package/src/comparison-view.js +0 -337
  75. package/src/document-execution.js +0 -103
  76. package/src/edit-limits.js +0 -23
  77. package/src/editing.js +0 -99
  78. package/src/execution-client.js +0 -63
  79. package/src/frame-channel.js +0 -44
  80. package/src/frame-policy.js +0 -54
  81. package/src/history-client.js +0 -104
  82. package/src/history-coordinator.js +0 -186
  83. package/src/history-policy.js +0 -43
  84. package/src/history-server.js +0 -463
  85. package/src/html-transform.js +0 -62
  86. package/src/icons.js +0 -251
  87. package/src/paths.js +0 -91
  88. package/src/poll-transport.js +0 -222
  89. package/src/positioning.js +0 -107
  90. package/src/review-mode.js +0 -59
  91. package/src/revision-diff.js +0 -440
  92. package/src/revision-schema.js +0 -219
  93. package/src/revision-store.js +0 -177
  94. package/src/sdk.js +0 -2607
  95. package/src/semantic-snapshot.js +0 -230
  96. package/src/serialize.js +0 -32
  97. package/src/server-entry.js +0 -26
  98. package/src/server-lock.js +0 -101
  99. package/src/server.js +0 -1466
  100. package/src/setup-guidance.js +0 -128
  101. package/src/state.js +0 -732
  102. package/src/view-identity.js +0 -99
  103. /package/{src → lib}/document-trust.js +0 -0
@@ -1,85 +0,0 @@
1
- export function pageUrl(key, sessionId) {
2
- return `/api/page/${key}?session=${encodeURIComponent(sessionId)}`;
3
- }
4
-
5
- export function replacePage(state, page) {
6
- state.page = page;
7
- state.others = page.others || [];
8
- }
9
-
10
- /** New and newly revised feedback belongs where the reviewer can see it. */
11
- export function newestComments(comments) {
12
- return [...(comments || [])].sort(
13
- (a, b) => (b.updatedAt || b.createdAt || 0) - (a.updatedAt || a.createdAt || 0)
14
- );
15
- }
16
-
17
- export function modePresentation(mode) {
18
- return mode === "edit"
19
- ? { label: "Edit", icon: "pencil", description: "Direct editing on" }
20
- : { label: "View", icon: "eye", description: "Editing off, comments enabled" };
21
- }
22
-
23
- export function createCommentUi() {
24
- return { menu: null, confirmation: null, edit: null };
25
- }
26
-
27
- export function ownMenu(ui, commentId, surface, triggerId) {
28
- if (ui.edit) return false;
29
- ui.menu = { commentId, surface, triggerId };
30
- ui.confirmation = null;
31
- return true;
32
- }
33
-
34
- export function ownConfirmation(ui, commentId, surface) {
35
- if (ui.edit) return false;
36
- ui.menu = null;
37
- ui.confirmation = { commentId, surface, status: "idle" };
38
- return true;
39
- }
40
-
41
- export function ownEdit(ui, comment, surface) {
42
- if (ui.edit) return ui.edit.commentId === comment.id;
43
- ui.menu = null;
44
- ui.confirmation = null;
45
- ui.edit = {
46
- commentId: comment.id,
47
- draft: comment.feedback,
48
- original: comment.feedback,
49
- originSurface: surface,
50
- status: "idle",
51
- selectionStart: comment.feedback.length,
52
- selectionEnd: comment.feedback.length,
53
- composing: false,
54
- validation: "",
55
- };
56
- return true;
57
- }
58
-
59
- export function clearOwned(ui, kind) {
60
- ui[kind] = null;
61
- return ui;
62
- }
63
-
64
- export function migrateCommentUi(ui, fromId, toId) {
65
- for (const key of ["menu", "confirmation", "edit"]) {
66
- if (ui[key]?.commentId === fromId) ui[key].commentId = toId;
67
- }
68
- return ui;
69
- }
70
-
71
- export function reconcileCommentUi(ui, comments) {
72
- const ids = new Set((comments || []).map((comment) => comment.id));
73
- const removed = new Set();
74
- for (const key of ["menu", "confirmation", "edit"]) {
75
- if (ui[key] && !ids.has(ui[key].commentId)) {
76
- removed.add(ui[key].commentId);
77
- ui[key] = null;
78
- }
79
- }
80
- return removed;
81
- }
82
-
83
- export function mutationIsCurrent(startEpoch, currentEpoch, comments, commentId) {
84
- return startEpoch === currentEpoch && (comments || []).some((comment) => comment.id === commentId);
85
- }