@nkzw/codiff-core 1.10.0 → 1.11.1

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/share.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { array, check, integer, literal, looseObject, maxLength, maxValue, minLength, minValue, number, optional, parse, picklist, pipe, safeParse, string, union } from "valibot";
2
2
  //#region share.ts
3
- const maxDocumentLength = 2 * 1024 * 1024;
4
- const maxCommentLength = 128 * 1024;
5
- const maxAnchorTextLength = 64 * 1024;
3
+ const maxDocumentLength = 2097152;
4
+ const maxCommentLength = 131072;
5
+ const maxAnchorTextLength = 65536;
6
6
  const boundedString = (maximum) => pipe(string(), maxLength(maximum));
7
7
  const nonEmptyString = (maximum) => pipe(string(), minLength(1), maxLength(maximum));
8
8
  const timestamp = pipe(nonEmptyString(64), check((value) => Number.isFinite(Date.parse(value)), "Invalid timestamp."));
@@ -83,12 +83,13 @@ const planShareManifestV1Schema = looseObject({
83
83
  })),
84
84
  version: literal(1)
85
85
  });
86
+ const uploaderSchema = looseObject({
87
+ email: optional(boundedString(320)),
88
+ name: optional(boundedString(200))
89
+ });
86
90
  const planShareUploadEnvelopeSchema = looseObject({
87
91
  snapshot: planShareManifestV1Schema,
88
- uploader: optional(looseObject({
89
- email: optional(boundedString(320)),
90
- name: optional(boundedString(200))
91
- }))
92
+ uploader: optional(uploaderSchema)
92
93
  });
93
94
  const parsePlanShareManifest = (value) => parse(planShareManifestV1Schema, value);
94
95
  const parsePlanShareUpload = (value) => {
package/dist/style.css CHANGED
@@ -3766,7 +3766,7 @@ form._multiFieldForm_sre1d_1628 {
3766
3766
  box-shadow: inset 3px 0 #3d87f500;
3767
3767
  }
3768
3768
 
3769
- .wt-stop-block-header.current {
3769
+ .codiff-selected-item .wt-stop-block-header {
3770
3770
  box-shadow: inset 3px 0 0 var(--tree-selection-focus);
3771
3771
  }
3772
3772
 
@@ -5249,6 +5249,10 @@ html[data-codiff-platform="darwin"] .workspace-top-bar {
5249
5249
  display: none;
5250
5250
  }
5251
5251
 
5252
+ .app-shell.sidebar-collapsed > .review {
5253
+ grid-column: 1;
5254
+ }
5255
+
5252
5256
  .review-top-bar {
5253
5257
  grid-area: 1 / 1 / auto / -1;
5254
5258
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
@@ -5256,6 +5260,7 @@ html[data-codiff-platform="darwin"] .workspace-top-bar {
5256
5260
  min-width: 0;
5257
5261
  padding: 0 14px 0 78px;
5258
5262
  display: grid;
5263
+ position: relative;
5259
5264
  }
5260
5265
 
5261
5266
  .share-shell .review-top-bar, .app-shell.window-fullscreen .review-top-bar {
@@ -5270,13 +5275,33 @@ html[data-codiff-platform="darwin"] .workspace-top-bar {
5270
5275
  }
5271
5276
 
5272
5277
  .review-top-bar-left {
5278
+ grid-column: 1;
5273
5279
  justify-content: flex-start;
5274
5280
  }
5275
5281
 
5276
5282
  .review-top-bar-right {
5283
+ grid-column: 3;
5277
5284
  justify-content: flex-end;
5278
5285
  }
5279
5286
 
5287
+ .review-top-bar-center {
5288
+ pointer-events: none;
5289
+ justify-content: center;
5290
+ align-items: center;
5291
+ min-width: 0;
5292
+ max-width: min(38%, 320px);
5293
+ display: flex;
5294
+ position: absolute;
5295
+ top: 50%;
5296
+ left: 50%;
5297
+ transform: translate(-50%, -50%);
5298
+ }
5299
+
5300
+ .review-top-bar-center .review-top-bar-branch {
5301
+ pointer-events: auto;
5302
+ max-width: 100%;
5303
+ }
5304
+
5280
5305
  .review-top-bar-repository-slot {
5281
5306
  color: var(--sidebar-text);
5282
5307
  font-family: var(--font-mono);
@@ -5428,7 +5453,6 @@ a.review-top-bar-repository:focus-visible, a.review-top-bar-source:focus-visible
5428
5453
  .review-mode-control button[aria-selected="true"] {
5429
5454
  background: var(--hover-wash);
5430
5455
  color: var(--sidebar-text);
5431
- box-shadow: 0 1px 2px #00000014;
5432
5456
  }
5433
5457
 
5434
5458
  .review-mode-label {
@@ -5493,8 +5517,24 @@ a.review-top-bar-repository:focus-visible, a.review-top-bar-source:focus-visible
5493
5517
  position: relative;
5494
5518
  }
5495
5519
 
5496
- .app-shell > .sidebar, .app-shell > .sidebar-resizer, .app-shell > .review {
5497
- grid-row: 2;
5520
+ .app-shell > .sidebar {
5521
+ grid-area: 2 / 1;
5522
+ }
5523
+
5524
+ .app-shell > .sidebar-resizer {
5525
+ grid-area: 2 / 2;
5526
+ }
5527
+
5528
+ .app-shell > .review {
5529
+ grid-area: 2 / 3;
5530
+ }
5531
+
5532
+ .app-shell[data-sidebar-position="right"] > .review {
5533
+ grid-column: 1;
5534
+ }
5535
+
5536
+ .app-shell[data-sidebar-position="right"] > .sidebar {
5537
+ grid-column: 3;
5498
5538
  }
5499
5539
 
5500
5540
  .sidebar-resizer:before {
@@ -6159,6 +6199,118 @@ html[data-codiff-platform="darwin"] .sidebar {
6159
6199
  overflow: auto;
6160
6200
  }
6161
6201
 
6202
+ .definition-popover {
6203
+ background: var(--code-bg);
6204
+ border: 1px solid var(--file-border);
6205
+ color: var(--text);
6206
+ z-index: 100;
6207
+ border-radius: 14px;
6208
+ width: min(420px, 100vw - 24px);
6209
+ max-height: 300px;
6210
+ animation: .12s review-submit-popover-in;
6211
+ position: fixed;
6212
+ overflow: hidden;
6213
+ box-shadow: 0 12px 36px #0003;
6214
+ }
6215
+
6216
+ .definition-popover-header, .definition-popover-location {
6217
+ justify-content: space-between;
6218
+ align-items: center;
6219
+ display: flex;
6220
+ }
6221
+
6222
+ .definition-popover-header {
6223
+ border-bottom: 1px solid var(--file-border);
6224
+ padding: 9px 10px 9px 12px;
6225
+ font-size: 12px;
6226
+ font-weight: 600;
6227
+ }
6228
+
6229
+ .definition-popover-header code {
6230
+ font-family: var(--codiff-font-mono);
6231
+ }
6232
+
6233
+ .definition-popover-header button {
6234
+ color: var(--muted);
6235
+ background: none;
6236
+ border: 0;
6237
+ border-radius: 6px;
6238
+ align-items: center;
6239
+ padding: 3px;
6240
+ display: flex;
6241
+ }
6242
+
6243
+ .definition-popover-header button:hover, .definition-popover-result:hover {
6244
+ background: var(--hover-wash);
6245
+ }
6246
+
6247
+ .definition-popover-message {
6248
+ color: var(--muted);
6249
+ padding: 18px 12px;
6250
+ font-size: 12px;
6251
+ }
6252
+
6253
+ .definition-popover-results {
6254
+ max-height: 252px;
6255
+ padding: 5px;
6256
+ overflow: auto;
6257
+ }
6258
+
6259
+ .definition-popover-result {
6260
+ color: inherit;
6261
+ text-align: left;
6262
+ background: none;
6263
+ border: 0;
6264
+ border-radius: 8px;
6265
+ width: 100%;
6266
+ padding: 7px 8px;
6267
+ display: block;
6268
+ }
6269
+
6270
+ .definition-popover-result:disabled {
6271
+ cursor: not-allowed;
6272
+ opacity: .56;
6273
+ }
6274
+
6275
+ .definition-popover-result:disabled:hover {
6276
+ background: none;
6277
+ }
6278
+
6279
+ .definition-popover-location {
6280
+ gap: 12px;
6281
+ margin-bottom: 4px;
6282
+ font-size: 11px;
6283
+ }
6284
+
6285
+ .definition-popover-meta, .definition-popover-destination {
6286
+ align-items: center;
6287
+ display: inline-flex;
6288
+ }
6289
+
6290
+ .definition-popover-meta {
6291
+ color: var(--muted);
6292
+ gap: 7px;
6293
+ }
6294
+
6295
+ .definition-popover-destination {
6296
+ opacity: .72;
6297
+ }
6298
+
6299
+ .definition-popover-result:hover .definition-popover-destination {
6300
+ color: var(--text);
6301
+ opacity: 1;
6302
+ }
6303
+
6304
+ .definition-popover-result code {
6305
+ color: var(--muted);
6306
+ font-family: var(--codiff-font-mono);
6307
+ text-overflow: ellipsis;
6308
+ white-space: nowrap;
6309
+ font-size: 11px;
6310
+ display: block;
6311
+ overflow: hidden;
6312
+ }
6313
+
6162
6314
  .codiff-header-toggle.codiff-header-toggle-static {
6163
6315
  cursor: default;
6164
6316
  grid-template-columns: minmax(0, 1fr);
@@ -6610,8 +6762,23 @@ html[data-codiff-platform="darwin"] .sidebar {
6610
6762
  color: var(--text);
6611
6763
  cursor: pointer;
6612
6764
  font: 600 13px/1.4 var(--font-sans);
6765
+ align-items: center;
6766
+ gap: 8px;
6613
6767
  padding: 8px 10px;
6614
6768
  list-style: none;
6769
+ display: flex;
6770
+ }
6771
+
6772
+ .codiff-markdown-details-summary-label {
6773
+ flex: 1;
6774
+ min-width: 0;
6775
+ }
6776
+
6777
+ .codiff-markdown-details > summary .codiff-copy-code-button {
6778
+ opacity: 1;
6779
+ width: 24px;
6780
+ height: 24px;
6781
+ margin: -4px 0;
6615
6782
  }
6616
6783
 
6617
6784
  .codiff-markdown-details > summary::-webkit-details-marker {
@@ -6620,7 +6787,7 @@ html[data-codiff-platform="darwin"] .sidebar {
6620
6787
 
6621
6788
  .codiff-markdown-details > summary:before {
6622
6789
  content: "▸";
6623
- margin-right: 8px;
6790
+ flex: none;
6624
6791
  font-size: 20px;
6625
6792
  line-height: .5;
6626
6793
  display: inline-block;
@@ -7318,6 +7485,10 @@ html[data-codiff-platform="darwin"] .sidebar {
7318
7485
  color: #b8312f;
7319
7486
  }
7320
7487
 
7488
+ .codiff-status-badge.conflicted {
7489
+ color: var(--danger);
7490
+ }
7491
+
7321
7492
  .codiff-status-badge.renamed, .codiff-section-badge.staged {
7322
7493
  color: #8f5d18;
7323
7494
  }
@@ -7475,6 +7646,75 @@ diffs-container .review-comment-thread {
7475
7646
  display: flex;
7476
7647
  }
7477
7648
 
7649
+ .resolved-thread-disclosure {
7650
+ border: 1px solid var(--file-border);
7651
+ border-radius: 6px;
7652
+ inline-size: 100%;
7653
+ min-inline-size: 0;
7654
+ overflow: clip;
7655
+ }
7656
+
7657
+ .resolved-thread-toggle {
7658
+ color: var(--muted);
7659
+ cursor: pointer;
7660
+ font: 600 12px/1.3 var(--font-sans);
7661
+ text-align: start;
7662
+ background: #7f7f7f12;
7663
+ border: 0;
7664
+ align-items: center;
7665
+ gap: 7px;
7666
+ min-block-size: 34px;
7667
+ inline-size: 100%;
7668
+ min-inline-size: 0;
7669
+ padding: 7px 9px;
7670
+ display: flex;
7671
+ }
7672
+
7673
+ .resolved-thread-toggle:hover {
7674
+ color: var(--text);
7675
+ background: #7f7f7f1f;
7676
+ }
7677
+
7678
+ .resolved-thread-toggle:focus-visible {
7679
+ box-shadow: 0 0 0 2px var(--tree-selection-focus) inset;
7680
+ outline: 0;
7681
+ }
7682
+
7683
+ .resolved-thread-caret {
7684
+ flex: none;
7685
+ display: block;
7686
+ }
7687
+
7688
+ .resolved-thread-label {
7689
+ color: currentColor;
7690
+ text-overflow: ellipsis;
7691
+ white-space: nowrap;
7692
+ min-inline-size: 0;
7693
+ overflow: hidden;
7694
+ }
7695
+
7696
+ .resolved-thread-count {
7697
+ white-space: nowrap;
7698
+ margin-inline-start: auto;
7699
+ font-weight: 500;
7700
+ }
7701
+
7702
+ .resolved-thread-caret {
7703
+ transition: transform .14s;
7704
+ }
7705
+
7706
+ .resolved-thread-disclosure.expanded .resolved-thread-caret {
7707
+ transform: rotate(180deg);
7708
+ }
7709
+
7710
+ .resolved-thread-content {
7711
+ border-block-start: 1px solid var(--file-border);
7712
+ flex-direction: column;
7713
+ gap: 8px;
7714
+ padding: 10px;
7715
+ display: flex;
7716
+ }
7717
+
7478
7718
  .review-comment-thread-footer {
7479
7719
  justify-content: flex-end;
7480
7720
  align-items: center;
@@ -7920,37 +8160,23 @@ diffs-container .review-comment-thread {
7920
8160
  word-break: break-word;
7921
8161
  }
7922
8162
 
7923
- .review-action-bar {
7924
- -webkit-app-region: no-drag;
7925
- z-index: 12;
7926
- align-items: center;
7927
- gap: 12px;
7928
- display: inline-flex;
7929
- position: fixed;
7930
- bottom: 16px;
7931
- right: 16px;
7932
- }
7933
-
7934
8163
  .copy-comments-button {
7935
- backdrop-filter: blur(22px) saturate(1.35);
7936
- background: color-mix(in srgb, var(--code-bg) 78%, transparent);
7937
- border: 1px solid var(--file-border);
7938
- box-shadow: 0 0 0 1px #ffffff29 inset,
7939
- 0 0 0 1px var(--file-border),
7940
- 0 18px 80px -54px #000c,
7941
- 0 16px 46px -30px #000000b8,
7942
- 0 12px 24px -18px #000000e6;
8164
+ -webkit-app-region: no-drag;
8165
+ color: var(--muted);
8166
+ corner-shape: squircle;
7943
8167
  cursor: pointer;
7944
- width: 46px;
7945
- height: 46px;
7946
- color: var(--copy-icon);
7947
- border-radius: 50%;
8168
+ font: 700 11px/1 var(--font-sans);
8169
+ background: none;
8170
+ border: 0;
8171
+ border-radius: 8px;
8172
+ flex: none;
7948
8173
  justify-content: center;
7949
8174
  align-items: center;
7950
- padding: 0;
7951
- transition: all .25s cubic-bezier(.34, 1.56, .64, 1);
8175
+ gap: 5px;
8176
+ height: 28px;
8177
+ padding: 0 8px;
8178
+ transition: background .12s, color .12s;
7952
8179
  display: inline-flex;
7953
- transform: scale(1);
7954
8180
  }
7955
8181
 
7956
8182
  .review-submit-button {
@@ -7967,7 +8193,7 @@ diffs-container .review-comment-thread {
7967
8193
  position: relative;
7968
8194
  }
7969
8195
 
7970
- .review-submit-button:not(.close) {
8196
+ .review-submit-button:is(.approve, .comment, .request-changes) {
7971
8197
  cursor: default;
7972
8198
  gap: 0;
7973
8199
  padding: 0;
@@ -8091,16 +8317,20 @@ diffs-container .review-comment-thread {
8091
8317
  color: var(--text);
8092
8318
  }
8093
8319
 
8094
- .copy-comments-button:hover {
8095
- box-shadow: 0 0 0 1px var(--file-border),
8096
- 0 26px 96px -48px #000000eb,
8097
- 0 22px 62px -30px #000000d1,
8098
- 0 16px 32px -18px #000000f5;
8099
- transform: scale(1.05);
8320
+ .copy-comments-button:hover:not(:disabled) {
8321
+ color: var(--sidebar-text);
8322
+ background: #7f7f7f24;
8100
8323
  }
8101
8324
 
8102
- .copy-comments-button:active {
8103
- transform: scale(.95);
8325
+ .copy-comments-button:active:not(:disabled) {
8326
+ color: var(--sidebar-text);
8327
+ background: #7f7f7f33;
8328
+ }
8329
+
8330
+ .copy-comments-button:disabled {
8331
+ color: var(--muted);
8332
+ cursor: default;
8333
+ opacity: .5;
8104
8334
  }
8105
8335
 
8106
8336
  .review-submit-button:disabled {
@@ -8108,9 +8338,8 @@ diffs-container .review-comment-thread {
8108
8338
  opacity: .58;
8109
8339
  }
8110
8340
 
8111
- .copy-comments-button.copied {
8112
- background: color-mix(in srgb, var(--code-bg) 80%, var(--viewed) 14%);
8113
- color: var(--viewed);
8341
+ .copy-comments-count {
8342
+ font: 700 11px/1 var(--font-mono);
8114
8343
  }
8115
8344
 
8116
8345
  .copy-comments-icon {
@@ -8120,7 +8349,7 @@ diffs-container .review-comment-thread {
8120
8349
  }
8121
8350
 
8122
8351
  .copy-comments-icon.check {
8123
- transform: translateY(-1px);
8352
+ transform: none;
8124
8353
  }
8125
8354
 
8126
8355
  .review-submit-icon {
@@ -8566,7 +8795,19 @@ diffs-container .review-comment-thread {
8566
8795
  }
8567
8796
 
8568
8797
  @media (width <= 720px) {
8569
- .review-top-bar-repository-slot, .review-top-bar-context {
8798
+ .share-shell.sidebar-auto {
8799
+ grid-template-columns: minmax(0, 1fr);
8800
+ }
8801
+
8802
+ .share-shell.sidebar-auto .sidebar, .share-shell.sidebar-auto .sidebar-resizer {
8803
+ display: none;
8804
+ }
8805
+
8806
+ .share-shell.sidebar-auto > .review {
8807
+ grid-column: 1;
8808
+ }
8809
+
8810
+ .review-top-bar-repository-slot, .review-top-bar-center, .review-top-bar-context {
8570
8811
  display: none;
8571
8812
  }
8572
8813
  }
package/dist/types.d.ts CHANGED
@@ -25,7 +25,7 @@ export type DiffSection = {
25
25
  size?: number;
26
26
  };
27
27
  };
28
- export type GitFileStatus = 'added' | 'deleted' | 'modified' | 'renamed' | 'untracked';
28
+ export type GitFileStatus = 'added' | 'conflicted' | 'deleted' | 'modified' | 'renamed' | 'untracked';
29
29
  export type ChangedFile = {
30
30
  fingerprint: string;
31
31
  generated?: boolean;
@@ -52,6 +52,7 @@ export type PullRequestReviewStatus = {
52
52
  approve?: PullRequestReviewActionStatus;
53
53
  close?: PullRequestReviewActionStatus;
54
54
  comment?: PullRequestReviewActionStatus;
55
+ markReady?: PullRequestReviewActionStatus;
55
56
  requestChanges?: PullRequestReviewActionStatus;
56
57
  };
57
58
  export type PullRequestMergeCheckStatus = 'failed' | 'neutral' | 'pending' | 'success';
@@ -133,6 +134,7 @@ export type ReviewSource = {
133
134
  canEditReviewers?: boolean;
134
135
  canEditTitle?: boolean;
135
136
  description?: string;
137
+ draft?: boolean;
136
138
  headSha?: string;
137
139
  host?: string;
138
140
  mergeState?: PullRequestMergeState;
@@ -610,6 +612,30 @@ export type DiffSectionContentRequest = {
610
612
  showWhitespace?: boolean;
611
613
  source?: ReviewSource;
612
614
  };
615
+ export type DefinitionSearchRequest = {
616
+ identifier: string;
617
+ kind: DiffSection['kind'];
618
+ lineNumber: number;
619
+ path: string;
620
+ side: 'additions' | 'deletions';
621
+ source: ReviewSource;
622
+ };
623
+ export type DefinitionCandidate = {
624
+ canOpenInEditor: boolean;
625
+ kind: string;
626
+ line: string;
627
+ lineNumber: number;
628
+ path: string;
629
+ side: 'additions' | 'deletions';
630
+ };
631
+ export type DefinitionSearchResult = {
632
+ candidates: ReadonlyArray<DefinitionCandidate>;
633
+ identifier: string;
634
+ status: 'ready';
635
+ } | {
636
+ reason: string;
637
+ status: 'unavailable';
638
+ };
613
639
  export type DiffImageContentRequest = {
614
640
  kind: DiffSection['kind'];
615
641
  path: string;
@@ -645,6 +671,7 @@ export type CodiffPreferences = {
645
671
  reviewCommentsPrefix: string;
646
672
  showOutdated: boolean;
647
673
  showWhitespace: boolean;
674
+ sidebarPosition: 'left' | 'right';
648
675
  theme: CodiffTheme;
649
676
  walkthroughPrompt: string;
650
677
  wordWrap: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nkzw/codiff-core",
3
- "version": "1.10.0",
3
+ "version": "1.11.1",
4
4
  "description": "A fast diff viewer.",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -54,12 +54,12 @@
54
54
  "@nkzw/mdx-editor": "^0.2.2",
55
55
  "@nkzw/use-relative-time": "^1.2.3",
56
56
  "@phosphor-icons/react": "^2.1.10",
57
- "@pierre/diffs": "1.3.0-beta.9",
58
- "@pierre/trees": "1.0.0-beta.5",
57
+ "@pierre/diffs": "1.3.6",
58
+ "@pierre/trees": "1.0.0-beta.6",
59
59
  "@radix-ui/react-slot": "^1.3.3",
60
60
  "class-variance-authority": "^0.7.1",
61
61
  "ghostty-web": "^0.4.0",
62
- "lucide-react": "^1.26.0",
62
+ "lucide-react": "^1.34.0",
63
63
  "valibot": "^1.4.2"
64
64
  },
65
65
  "peerDependencies": {