@nkzw/codiff-core 1.10.0 → 1.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.
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);
@@ -5493,8 +5518,24 @@ a.review-top-bar-repository:focus-visible, a.review-top-bar-source:focus-visible
5493
5518
  position: relative;
5494
5519
  }
5495
5520
 
5496
- .app-shell > .sidebar, .app-shell > .sidebar-resizer, .app-shell > .review {
5497
- grid-row: 2;
5521
+ .app-shell > .sidebar {
5522
+ grid-area: 2 / 1;
5523
+ }
5524
+
5525
+ .app-shell > .sidebar-resizer {
5526
+ grid-area: 2 / 2;
5527
+ }
5528
+
5529
+ .app-shell > .review {
5530
+ grid-area: 2 / 3;
5531
+ }
5532
+
5533
+ .app-shell[data-sidebar-position="right"] > .review {
5534
+ grid-column: 1;
5535
+ }
5536
+
5537
+ .app-shell[data-sidebar-position="right"] > .sidebar {
5538
+ grid-column: 3;
5498
5539
  }
5499
5540
 
5500
5541
  .sidebar-resizer:before {
@@ -6159,6 +6200,118 @@ html[data-codiff-platform="darwin"] .sidebar {
6159
6200
  overflow: auto;
6160
6201
  }
6161
6202
 
6203
+ .definition-popover {
6204
+ background: var(--code-bg);
6205
+ border: 1px solid var(--file-border);
6206
+ color: var(--text);
6207
+ z-index: 100;
6208
+ border-radius: 14px;
6209
+ width: min(420px, 100vw - 24px);
6210
+ max-height: 300px;
6211
+ animation: .12s review-submit-popover-in;
6212
+ position: fixed;
6213
+ overflow: hidden;
6214
+ box-shadow: 0 12px 36px #0003;
6215
+ }
6216
+
6217
+ .definition-popover-header, .definition-popover-location {
6218
+ justify-content: space-between;
6219
+ align-items: center;
6220
+ display: flex;
6221
+ }
6222
+
6223
+ .definition-popover-header {
6224
+ border-bottom: 1px solid var(--file-border);
6225
+ padding: 9px 10px 9px 12px;
6226
+ font-size: 12px;
6227
+ font-weight: 600;
6228
+ }
6229
+
6230
+ .definition-popover-header code {
6231
+ font-family: var(--codiff-font-mono);
6232
+ }
6233
+
6234
+ .definition-popover-header button {
6235
+ color: var(--muted);
6236
+ background: none;
6237
+ border: 0;
6238
+ border-radius: 6px;
6239
+ align-items: center;
6240
+ padding: 3px;
6241
+ display: flex;
6242
+ }
6243
+
6244
+ .definition-popover-header button:hover, .definition-popover-result:hover {
6245
+ background: var(--hover-wash);
6246
+ }
6247
+
6248
+ .definition-popover-message {
6249
+ color: var(--muted);
6250
+ padding: 18px 12px;
6251
+ font-size: 12px;
6252
+ }
6253
+
6254
+ .definition-popover-results {
6255
+ max-height: 252px;
6256
+ padding: 5px;
6257
+ overflow: auto;
6258
+ }
6259
+
6260
+ .definition-popover-result {
6261
+ color: inherit;
6262
+ text-align: left;
6263
+ background: none;
6264
+ border: 0;
6265
+ border-radius: 8px;
6266
+ width: 100%;
6267
+ padding: 7px 8px;
6268
+ display: block;
6269
+ }
6270
+
6271
+ .definition-popover-result:disabled {
6272
+ cursor: not-allowed;
6273
+ opacity: .56;
6274
+ }
6275
+
6276
+ .definition-popover-result:disabled:hover {
6277
+ background: none;
6278
+ }
6279
+
6280
+ .definition-popover-location {
6281
+ gap: 12px;
6282
+ margin-bottom: 4px;
6283
+ font-size: 11px;
6284
+ }
6285
+
6286
+ .definition-popover-meta, .definition-popover-destination {
6287
+ align-items: center;
6288
+ display: inline-flex;
6289
+ }
6290
+
6291
+ .definition-popover-meta {
6292
+ color: var(--muted);
6293
+ gap: 7px;
6294
+ }
6295
+
6296
+ .definition-popover-destination {
6297
+ opacity: .72;
6298
+ }
6299
+
6300
+ .definition-popover-result:hover .definition-popover-destination {
6301
+ color: var(--text);
6302
+ opacity: 1;
6303
+ }
6304
+
6305
+ .definition-popover-result code {
6306
+ color: var(--muted);
6307
+ font-family: var(--codiff-font-mono);
6308
+ text-overflow: ellipsis;
6309
+ white-space: nowrap;
6310
+ font-size: 11px;
6311
+ display: block;
6312
+ overflow: hidden;
6313
+ }
6314
+
6162
6315
  .codiff-header-toggle.codiff-header-toggle-static {
6163
6316
  cursor: default;
6164
6317
  grid-template-columns: minmax(0, 1fr);
@@ -6610,8 +6763,23 @@ html[data-codiff-platform="darwin"] .sidebar {
6610
6763
  color: var(--text);
6611
6764
  cursor: pointer;
6612
6765
  font: 600 13px/1.4 var(--font-sans);
6766
+ align-items: center;
6767
+ gap: 8px;
6613
6768
  padding: 8px 10px;
6614
6769
  list-style: none;
6770
+ display: flex;
6771
+ }
6772
+
6773
+ .codiff-markdown-details-summary-label {
6774
+ flex: 1;
6775
+ min-width: 0;
6776
+ }
6777
+
6778
+ .codiff-markdown-details > summary .codiff-copy-code-button {
6779
+ opacity: 1;
6780
+ width: 24px;
6781
+ height: 24px;
6782
+ margin: -4px 0;
6615
6783
  }
6616
6784
 
6617
6785
  .codiff-markdown-details > summary::-webkit-details-marker {
@@ -6620,7 +6788,7 @@ html[data-codiff-platform="darwin"] .sidebar {
6620
6788
 
6621
6789
  .codiff-markdown-details > summary:before {
6622
6790
  content: "▸";
6623
- margin-right: 8px;
6791
+ flex: none;
6624
6792
  font-size: 20px;
6625
6793
  line-height: .5;
6626
6794
  display: inline-block;
@@ -7318,6 +7486,10 @@ html[data-codiff-platform="darwin"] .sidebar {
7318
7486
  color: #b8312f;
7319
7487
  }
7320
7488
 
7489
+ .codiff-status-badge.conflicted {
7490
+ color: var(--danger);
7491
+ }
7492
+
7321
7493
  .codiff-status-badge.renamed, .codiff-section-badge.staged {
7322
7494
  color: #8f5d18;
7323
7495
  }
@@ -7475,6 +7647,75 @@ diffs-container .review-comment-thread {
7475
7647
  display: flex;
7476
7648
  }
7477
7649
 
7650
+ .resolved-thread-disclosure {
7651
+ border: 1px solid var(--file-border);
7652
+ border-radius: 6px;
7653
+ inline-size: 100%;
7654
+ min-inline-size: 0;
7655
+ overflow: clip;
7656
+ }
7657
+
7658
+ .resolved-thread-toggle {
7659
+ color: var(--muted);
7660
+ cursor: pointer;
7661
+ font: 600 12px/1.3 var(--font-sans);
7662
+ text-align: start;
7663
+ background: #7f7f7f12;
7664
+ border: 0;
7665
+ align-items: center;
7666
+ gap: 7px;
7667
+ min-block-size: 34px;
7668
+ inline-size: 100%;
7669
+ min-inline-size: 0;
7670
+ padding: 7px 9px;
7671
+ display: flex;
7672
+ }
7673
+
7674
+ .resolved-thread-toggle:hover {
7675
+ color: var(--text);
7676
+ background: #7f7f7f1f;
7677
+ }
7678
+
7679
+ .resolved-thread-toggle:focus-visible {
7680
+ box-shadow: 0 0 0 2px var(--tree-selection-focus) inset;
7681
+ outline: 0;
7682
+ }
7683
+
7684
+ .resolved-thread-caret {
7685
+ flex: none;
7686
+ display: block;
7687
+ }
7688
+
7689
+ .resolved-thread-label {
7690
+ color: currentColor;
7691
+ text-overflow: ellipsis;
7692
+ white-space: nowrap;
7693
+ min-inline-size: 0;
7694
+ overflow: hidden;
7695
+ }
7696
+
7697
+ .resolved-thread-count {
7698
+ white-space: nowrap;
7699
+ margin-inline-start: auto;
7700
+ font-weight: 500;
7701
+ }
7702
+
7703
+ .resolved-thread-caret {
7704
+ transition: transform .14s;
7705
+ }
7706
+
7707
+ .resolved-thread-disclosure.expanded .resolved-thread-caret {
7708
+ transform: rotate(180deg);
7709
+ }
7710
+
7711
+ .resolved-thread-content {
7712
+ border-block-start: 1px solid var(--file-border);
7713
+ flex-direction: column;
7714
+ gap: 8px;
7715
+ padding: 10px;
7716
+ display: flex;
7717
+ }
7718
+
7478
7719
  .review-comment-thread-footer {
7479
7720
  justify-content: flex-end;
7480
7721
  align-items: center;
@@ -7920,37 +8161,23 @@ diffs-container .review-comment-thread {
7920
8161
  word-break: break-word;
7921
8162
  }
7922
8163
 
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
8164
  .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;
8165
+ -webkit-app-region: no-drag;
8166
+ color: var(--muted);
8167
+ corner-shape: squircle;
7943
8168
  cursor: pointer;
7944
- width: 46px;
7945
- height: 46px;
7946
- color: var(--copy-icon);
7947
- border-radius: 50%;
8169
+ font: 700 11px/1 var(--font-sans);
8170
+ background: none;
8171
+ border: 0;
8172
+ border-radius: 8px;
8173
+ flex: none;
7948
8174
  justify-content: center;
7949
8175
  align-items: center;
7950
- padding: 0;
7951
- transition: all .25s cubic-bezier(.34, 1.56, .64, 1);
8176
+ gap: 5px;
8177
+ height: 28px;
8178
+ padding: 0 8px;
8179
+ transition: background .12s, color .12s;
7952
8180
  display: inline-flex;
7953
- transform: scale(1);
7954
8181
  }
7955
8182
 
7956
8183
  .review-submit-button {
@@ -8091,16 +8318,20 @@ diffs-container .review-comment-thread {
8091
8318
  color: var(--text);
8092
8319
  }
8093
8320
 
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);
8321
+ .copy-comments-button:hover:not(:disabled) {
8322
+ color: var(--sidebar-text);
8323
+ background: #7f7f7f24;
8100
8324
  }
8101
8325
 
8102
- .copy-comments-button:active {
8103
- transform: scale(.95);
8326
+ .copy-comments-button:active:not(:disabled) {
8327
+ color: var(--sidebar-text);
8328
+ background: #7f7f7f33;
8329
+ }
8330
+
8331
+ .copy-comments-button:disabled {
8332
+ color: var(--muted);
8333
+ cursor: default;
8334
+ opacity: .5;
8104
8335
  }
8105
8336
 
8106
8337
  .review-submit-button:disabled {
@@ -8108,9 +8339,8 @@ diffs-container .review-comment-thread {
8108
8339
  opacity: .58;
8109
8340
  }
8110
8341
 
8111
- .copy-comments-button.copied {
8112
- background: color-mix(in srgb, var(--code-bg) 80%, var(--viewed) 14%);
8113
- color: var(--viewed);
8342
+ .copy-comments-count {
8343
+ font: 700 11px/1 var(--font-mono);
8114
8344
  }
8115
8345
 
8116
8346
  .copy-comments-icon {
@@ -8120,7 +8350,7 @@ diffs-container .review-comment-thread {
8120
8350
  }
8121
8351
 
8122
8352
  .copy-comments-icon.check {
8123
- transform: translateY(-1px);
8353
+ transform: none;
8124
8354
  }
8125
8355
 
8126
8356
  .review-submit-icon {
@@ -8566,7 +8796,19 @@ diffs-container .review-comment-thread {
8566
8796
  }
8567
8797
 
8568
8798
  @media (width <= 720px) {
8569
- .review-top-bar-repository-slot, .review-top-bar-context {
8799
+ .share-shell.sidebar-auto {
8800
+ grid-template-columns: minmax(0, 1fr);
8801
+ }
8802
+
8803
+ .share-shell.sidebar-auto .sidebar, .share-shell.sidebar-auto .sidebar-resizer {
8804
+ display: none;
8805
+ }
8806
+
8807
+ .share-shell.sidebar-auto > .review {
8808
+ grid-column: 1;
8809
+ }
8810
+
8811
+ .review-top-bar-repository-slot, .review-top-bar-center, .review-top-bar-context {
8570
8812
  display: none;
8571
8813
  }
8572
8814
  }
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;
@@ -610,6 +610,30 @@ export type DiffSectionContentRequest = {
610
610
  showWhitespace?: boolean;
611
611
  source?: ReviewSource;
612
612
  };
613
+ export type DefinitionSearchRequest = {
614
+ identifier: string;
615
+ kind: DiffSection['kind'];
616
+ lineNumber: number;
617
+ path: string;
618
+ side: 'additions' | 'deletions';
619
+ source: ReviewSource;
620
+ };
621
+ export type DefinitionCandidate = {
622
+ canOpenInEditor: boolean;
623
+ kind: string;
624
+ line: string;
625
+ lineNumber: number;
626
+ path: string;
627
+ side: 'additions' | 'deletions';
628
+ };
629
+ export type DefinitionSearchResult = {
630
+ candidates: ReadonlyArray<DefinitionCandidate>;
631
+ identifier: string;
632
+ status: 'ready';
633
+ } | {
634
+ reason: string;
635
+ status: 'unavailable';
636
+ };
613
637
  export type DiffImageContentRequest = {
614
638
  kind: DiffSection['kind'];
615
639
  path: string;
@@ -645,6 +669,7 @@ export type CodiffPreferences = {
645
669
  reviewCommentsPrefix: string;
646
670
  showOutdated: boolean;
647
671
  showWhitespace: boolean;
672
+ sidebarPosition: 'left' | 'right';
648
673
  theme: CodiffTheme;
649
674
  walkthroughPrompt: string;
650
675
  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.0",
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": {