@nandoblanco/opencode-local-backup 1.0.2 → 1.1.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/tui.ts CHANGED
@@ -462,7 +462,7 @@ function createTuiRenderer() {
462
462
  if (sel) executeOpenDiff(sel);
463
463
  return;
464
464
  }
465
- if (name === "return" || name === "enter") {
465
+ if (name === "return" || name === "enter" || name === "kpenter") {
466
466
  evt.preventDefault?.();
467
467
  evt.stopPropagation?.();
468
468
  const sel = selectedEntry();
@@ -562,7 +562,7 @@ function createTuiRenderer() {
562
562
  return;
563
563
  }
564
564
 
565
- if (name === "return" || name === "enter") {
565
+ if (name === "return" || name === "enter" || name === "kpenter") {
566
566
  evt.preventDefault?.();
567
567
  evt.stopPropagation?.();
568
568
  if (selectedEntry()) {
@@ -664,105 +664,144 @@ function createTuiRenderer() {
664
664
  queueMicrotask(applyDialogWidth);
665
665
  },
666
666
  width: "100%",
667
- height: 28,
667
+ height: 34,
668
668
  flexDirection: "column",
669
- backgroundColor: () => theme().background.base
669
+ backgroundColor: () => theme().background.base,
670
+ paddingLeft: 2,
671
+ paddingRight: 2,
672
+ paddingTop: 1,
673
+ paddingBottom: 1,
674
+ gap: 1
670
675
  },
671
- // 1. Header Bar
676
+ // 1. Header Bar (single-line, no wrapping)
672
677
  el(
673
678
  "box",
674
679
  {
675
680
  flexDirection: "row",
676
681
  justifyContent: "space-between",
677
682
  alignItems: "center",
678
- paddingX: 2,
679
- paddingTop: 1,
680
- flexShrink: 0
683
+ border: ["bottom"],
684
+ borderColor: () => theme().border.base,
685
+ paddingBottom: 0,
686
+ flexShrink: 0,
687
+ width: "100%"
681
688
  },
682
689
  el(
683
690
  "box",
684
- { flexDirection: "row", gap: 2, alignItems: "center" },
691
+ { flexDirection: "row", gap: 2, alignItems: "center", flexShrink: 0 },
685
692
  el(
686
693
  "text",
687
694
  {
688
- fg: () => theme().text.base,
695
+ wrapMode: "none",
696
+ flexShrink: 0,
697
+ fg: () => theme().text.action.primary.base,
689
698
  attributes: TextAttributes.BOLD
690
699
  },
691
- "Auto-Backup Snapshots"
700
+ "opencode / backups"
692
701
  ),
693
702
  el(
694
703
  "text",
695
- { fg: () => theme().text.muted },
696
- () =>
697
- statusMsg() ||
698
- `${filtered().length} of ${allEntries().length} snapshots`
704
+ {
705
+ wrapMode: "none",
706
+ flexShrink: 0,
707
+ fg: () => theme().text.muted
708
+ },
709
+ () => props.context.ui.format.path(props.workspaceDir)
699
710
  )
700
711
  ),
701
712
  el(
702
- "box",
703
- { flexDirection: "row", gap: 2, alignItems: "center" },
704
- el(
705
- "text",
706
- { fg: () => theme().text.muted },
707
- () => props.context.ui.format.path(props.workspaceDir)
708
- ),
709
- el(
710
- "box",
711
- { paddingX: 1, onMouseUp: () => props.close() },
712
- el("text", { fg: () => theme().text.muted }, "esc")
713
- )
713
+ "text",
714
+ {
715
+ wrapMode: "none",
716
+ flexShrink: 0,
717
+ fg: () => theme().text.muted
718
+ },
719
+ "[↑↓] select [Enter] actions [Tab] pane [Esc] close"
714
720
  )
715
721
  ),
716
722
 
717
- // 2. Search Input + Colored Filter Pills Bar (matching session-search & local-memory)
723
+ // 2. Boxed Filter + Pills Card
718
724
  el(
719
725
  "box",
720
726
  {
721
727
  flexDirection: "column",
722
- paddingX: 2,
723
- paddingY: 1,
724
- gap: 1,
728
+ backgroundColor: () =>
729
+ theme().background.raised?.base ?? theme().background.base,
730
+ border: true,
731
+ borderColor: () =>
732
+ focusPane() === "search" && !actionPopupOpen()
733
+ ? theme().text.action.primary.base
734
+ : theme().border.base,
735
+ paddingLeft: 2,
736
+ paddingRight: 2,
737
+ paddingTop: 0,
738
+ paddingBottom: 0,
739
+ gap: 0,
725
740
  flexShrink: 0,
726
- border: ["bottom"],
727
- borderColor: () => theme().border.base
741
+ width: "100%"
728
742
  },
729
743
  el(
730
744
  "box",
731
745
  {
732
746
  flexDirection: "row",
747
+ justifyContent: "space-between",
733
748
  alignItems: "center",
734
- gap: 1
749
+ gap: 1,
750
+ width: "100%"
735
751
  },
736
752
  el(
737
753
  "text",
738
754
  {
739
- fg: () =>
740
- focusPane() === "search" && !actionPopupOpen()
741
- ? theme().text.action.primary.base
742
- : theme().text.muted,
755
+ width: 7,
756
+ wrapMode: "none",
757
+ flexShrink: 0,
758
+ fg: () => theme().text.action.primary.base,
743
759
  attributes: TextAttributes.BOLD
744
760
  },
745
- "›"
761
+ "Filter:"
746
762
  ),
747
- el("input", {
748
- id: "auto-backup-search-input",
749
- flexGrow: 1,
750
- value: () => query(),
751
- focused: () => focusPane() === "search" && !actionPopupOpen(),
752
- maxLength: Number.POSITIVE_INFINITY,
753
- placeholder:
754
- "Filter backups by file path, parent folder, or snapshot slug... (0 tokens)",
755
- placeholderColor: () => theme().text.muted,
756
- textColor: () => theme().text.base,
757
- focusedTextColor: () => theme().text.formfield.focused,
758
- cursorColor: () => theme().text.formfield.focused,
759
- backgroundColor: () => theme().background.base,
760
- focusedBackgroundColor: () => theme().background.formfield.focused,
761
- onMouseDown: () => setFocusPane("search"),
762
- onInput: (val: string) => {
763
- setQuery(typeof val === "string" ? val : "");
764
- }
765
- })
763
+ el(
764
+ "box",
765
+ {
766
+ flexGrow: 1,
767
+ flexShrink: 1,
768
+ minWidth: 0
769
+ },
770
+ el("input", {
771
+ id: "auto-backup-search-input",
772
+ width: "100%",
773
+ value: () => query(),
774
+ focused: () => focusPane() === "search" && !actionPopupOpen(),
775
+ maxLength: Number.POSITIVE_INFINITY,
776
+ placeholder:
777
+ "Filter backups by file path, parent folder, or snapshot slug...",
778
+ placeholderColor: () => theme().text.muted,
779
+ textColor: () => theme().text.base,
780
+ focusedTextColor: () => theme().text.formfield.focused,
781
+ cursorColor: () => theme().text.formfield.focused,
782
+ backgroundColor: () =>
783
+ theme().background.raised?.base ?? theme().background.base,
784
+ focusedBackgroundColor: () =>
785
+ theme().background.raised?.base ?? theme().background.base,
786
+ onMouseDown: () => setFocusPane("search"),
787
+ onInput: (val: string) => {
788
+ setQuery(typeof val === "string" ? val : "");
789
+ }
790
+ })
791
+ ),
792
+ el(
793
+ "text",
794
+ {
795
+ wrapMode: "none",
796
+ flexShrink: 0,
797
+ fg: () =>
798
+ theme().text.feedback?.success?.base ??
799
+ theme().text.action.primary.base
800
+ },
801
+ () =>
802
+ statusMsg() ||
803
+ `${filtered().length} of ${allEntries().length} snapshots · 0 tokens`
804
+ )
766
805
  ),
767
806
  // Colored Filter Pills Row
768
807
  el(
@@ -800,13 +839,8 @@ function createTuiRenderer() {
800
839
  active: () => false,
801
840
  onClick: handlePrune
802
841
  })
803
- )
804
- ),
805
-
806
- // 3. Action Confirmation Sub-Popup (wrapped in its own container so @opentui/solid Show cleanup never clears rootRef siblings)
807
- el(
808
- "box",
809
- { flexDirection: "column", flexShrink: 0 },
842
+ ),
843
+ // Action Confirmation Sub-Popup inside Filter Card (avoids extra gap row when closed)
810
844
  createComponent(Show, {
811
845
  get when() {
812
846
  return actionPopupOpen() && Boolean(selectedEntry());
@@ -816,14 +850,10 @@ function createTuiRenderer() {
816
850
  "box",
817
851
  {
818
852
  flexDirection: "column",
819
- marginX: 2,
820
- marginTop: 1,
821
- paddingX: 2,
822
- paddingY: 1,
853
+ paddingTop: 1,
823
854
  gap: 1,
824
- border: ["top", "bottom", "left", "right"],
855
+ border: ["top"],
825
856
  borderColor: () => theme().text.action.primary.base,
826
- backgroundColor: () => theme().background.raised.base,
827
857
  flexShrink: 0
828
858
  },
829
859
  el(
@@ -832,15 +862,16 @@ function createTuiRenderer() {
832
862
  el(
833
863
  "text",
834
864
  {
865
+ wrapMode: "none",
835
866
  fg: () => theme().text.action.primary.base,
836
867
  attributes: TextAttributes.BOLD
837
868
  },
838
- () => `Action for: ${selectedEntry()?.relativePath ?? ""}`
869
+ () => `◈ ACTION FOR: ${selectedEntry()?.relativePath ?? ""}`
839
870
  ),
840
871
  el(
841
872
  "text",
842
- { fg: () => theme().text.muted },
843
- "↑/↓ or 1/2/3 choose · Enter confirm · Esc cancel"
873
+ { wrapMode: "none", fg: () => theme().text.muted },
874
+ "[↑↓ / 1-3] choose [Enter] confirm [Esc] cancel"
844
875
  )
845
876
  ),
846
877
  el(
@@ -850,7 +881,7 @@ function createTuiRenderer() {
850
881
  ),
851
882
  el(
852
883
  "box",
853
- { flexDirection: "row", flexWrap: "wrap", gap: 2, marginTop: 0 },
884
+ { flexDirection: "row", flexWrap: "wrap", gap: 2 },
854
885
  // Option 1: Restore
855
886
  el(
856
887
  "box",
@@ -869,6 +900,7 @@ function createTuiRenderer() {
869
900
  el(
870
901
  "text",
871
902
  {
903
+ wrapMode: "none",
872
904
  fg: () =>
873
905
  actionChoice() === 0
874
906
  ? theme().text.action.primary.focused
@@ -877,7 +909,7 @@ function createTuiRenderer() {
877
909
  actionChoice() === 0 ? TextAttributes.BOLD : undefined
878
910
  },
879
911
  () =>
880
- `${actionChoice() === 0 ? "› " : " "}[1] Restore file`
912
+ `${actionChoice() === 0 ? "▸ " : " "}[1] Restore file`
881
913
  )
882
914
  ),
883
915
  // Option 2: Open File
@@ -898,6 +930,7 @@ function createTuiRenderer() {
898
930
  el(
899
931
  "text",
900
932
  {
933
+ wrapMode: "none",
901
934
  fg: () =>
902
935
  actionChoice() === 1
903
936
  ? theme().text.action.primary.focused
@@ -906,7 +939,7 @@ function createTuiRenderer() {
906
939
  actionChoice() === 1 ? TextAttributes.BOLD : undefined
907
940
  },
908
941
  () =>
909
- `${actionChoice() === 1 ? "› " : " "}[2] Open backup file`
942
+ `${actionChoice() === 1 ? "▸ " : " "}[2] Open backup file`
910
943
  )
911
944
  ),
912
945
  // Option 3: Open Side-by-Side Diff in Editor
@@ -927,6 +960,7 @@ function createTuiRenderer() {
927
960
  el(
928
961
  "text",
929
962
  {
963
+ wrapMode: "none",
930
964
  fg: () =>
931
965
  actionChoice() === 2
932
966
  ? theme().text.action.primary.focused
@@ -935,7 +969,7 @@ function createTuiRenderer() {
935
969
  actionChoice() === 2 ? TextAttributes.BOLD : undefined
936
970
  },
937
971
  () =>
938
- `${actionChoice() === 2 ? "› " : " "}[3] Open diff in editor (backup vs current)`
972
+ `${actionChoice() === 2 ? "▸ " : " "}[3] Open diff in editor (backup vs current)`
939
973
  )
940
974
  )
941
975
  )
@@ -944,315 +978,373 @@ function createTuiRenderer() {
944
978
  })
945
979
  ),
946
980
 
947
- // 4. Main Split View (Left: Two-line Snapshot List with Parent Folder, Right: Full Paths + Colored Diff)
981
+ // 3. Main Split View: Two Side-by-Side Bordered Cards
948
982
  el(
949
983
  "box",
950
984
  {
951
985
  flexDirection: "row",
986
+ gap: 2,
952
987
  flexGrow: 1,
953
- minHeight: 0
988
+ minHeight: 0,
989
+ width: "100%"
954
990
  },
955
- // Left Pane: Snapshot List (44% width, matching session-search & local-memory)
991
+ // Left Card: Snapshot List (44% width)
956
992
  el(
957
- "scrollbox",
993
+ "box",
958
994
  {
959
- id: "auto-backup-list",
960
- ref: (r: unknown) => {
961
- listScrollRef = r;
962
- },
963
995
  width: "44%",
964
996
  height: "100%",
997
+ flexDirection: "column",
965
998
  flexShrink: 0,
966
- border: ["right"],
999
+ backgroundColor: () =>
1000
+ theme().background.raised?.base ?? theme().background.base,
1001
+ border: true,
967
1002
  borderColor: () =>
968
- focusPane() === "list" ? theme().text.base : theme().border.base,
969
- scrollbarOptions: { visible: false },
1003
+ focusPane() === "list"
1004
+ ? theme().text.action.primary.base
1005
+ : theme().border.base,
1006
+ paddingLeft: 1,
1007
+ paddingRight: 1,
1008
+ paddingTop: 0,
1009
+ paddingBottom: 0,
970
1010
  onMouseDown: () => setFocusPane("list")
971
1011
  },
972
- createComponent(Show, {
973
- get when() {
974
- return filtered().length > 0;
1012
+ el(
1013
+ "box",
1014
+ {
1015
+ flexDirection: "row",
1016
+ justifyContent: "space-between",
1017
+ border: ["bottom"],
1018
+ borderColor: () => theme().border.base,
1019
+ paddingX: 1,
1020
+ flexShrink: 0
975
1021
  },
976
- get fallback() {
977
- return el(
978
- "box",
979
- { paddingX: 2, paddingY: 1 },
980
- el(
981
- "text",
982
- { fg: () => theme().text.muted },
983
- "No matching backup snapshots found."
984
- )
985
- );
1022
+ el(
1023
+ "text",
1024
+ {
1025
+ fg: () => theme().text.action.primary.base,
1026
+ attributes: TextAttributes.BOLD
1027
+ },
1028
+ "◈ BACKUP SNAPSHOTS"
1029
+ ),
1030
+ el(
1031
+ "text",
1032
+ { fg: () => theme().text.muted },
1033
+ () => `tool:${toolFilter()} · date:${dateFilter()}`
1034
+ )
1035
+ ),
1036
+ el(
1037
+ "scrollbox",
1038
+ {
1039
+ id: "auto-backup-list",
1040
+ ref: (r: unknown) => {
1041
+ listScrollRef = r;
1042
+ },
1043
+ width: "100%",
1044
+ flexGrow: 1,
1045
+ minHeight: 0,
1046
+ scrollbarOptions: { visible: false }
986
1047
  },
987
- get children() {
988
- return createComponent(For, {
989
- get each() {
990
- return filtered();
991
- },
992
- children: (item: BackupEntry, idx: () => number) => {
993
- const isSel = () => idx() === selectedIndex();
994
- return el(
995
- "box",
996
- {
997
- id: () => `backup-row-${idx()}`,
998
- flexDirection: "column",
999
- paddingX: 1,
1000
- paddingY: 0,
1001
- marginBottom: 1,
1002
- flexShrink: 0,
1003
- backgroundColor: () =>
1004
- isSel()
1005
- ? theme().background.action.primary.focused
1006
- : undefined,
1007
- onMouseUp: () => {
1008
- setSelectedIndex(idx());
1009
- setActionChoice(0);
1010
- setActionPopupOpen(true);
1011
- },
1012
- onMouseOver: () => {
1013
- setSelectedIndex(idx());
1014
- }
1015
- },
1016
- // Line 1: Backed-up file relative path + [tool] badge + age
1017
- el(
1048
+ createComponent(Show, {
1049
+ get when() {
1050
+ return filtered().length > 0;
1051
+ },
1052
+ get fallback() {
1053
+ return el(
1054
+ "box",
1055
+ { paddingX: 1, paddingY: 1 },
1056
+ el(
1057
+ "text",
1058
+ { fg: () => theme().text.muted },
1059
+ "No matching backup snapshots found."
1060
+ )
1061
+ );
1062
+ },
1063
+ get children() {
1064
+ return createComponent(For, {
1065
+ get each() {
1066
+ return filtered();
1067
+ },
1068
+ children: (item: BackupEntry, idx: () => number) => {
1069
+ const isSel = () => idx() === selectedIndex();
1070
+ return el(
1018
1071
  "box",
1019
1072
  {
1020
- flexDirection: "row",
1021
- justifyContent: "space-between",
1022
- width: "100%"
1073
+ id: () => `backup-row-${idx()}`,
1074
+ flexDirection: "column",
1075
+ paddingX: 1,
1076
+ paddingY: 0,
1077
+ marginBottom: 1,
1078
+ flexShrink: 0,
1079
+ backgroundColor: () =>
1080
+ isSel()
1081
+ ? theme().background.action.primary.focused
1082
+ : undefined,
1083
+ onMouseUp: () => {
1084
+ setSelectedIndex(idx());
1085
+ setActionChoice(0);
1086
+ setActionPopupOpen(true);
1087
+ },
1088
+ onMouseOver: () => {
1089
+ setSelectedIndex(idx());
1090
+ }
1023
1091
  },
1092
+ // Line 1: Backed-up file relative path + [tool] badge + age
1024
1093
  el(
1025
- "text",
1094
+ "box",
1026
1095
  {
1027
- wrapMode: "none",
1028
- truncate: true,
1029
- flexShrink: 1,
1030
- minWidth: 0,
1031
- fg: () =>
1032
- isSel()
1033
- ? theme().text.action.primary.focused
1034
- : theme().text.base,
1035
- attributes: () =>
1036
- isSel() ? TextAttributes.BOLD : undefined
1096
+ flexDirection: "row",
1097
+ justifyContent: "space-between",
1098
+ width: "100%"
1037
1099
  },
1038
- () => `${isSel() ? "› " : " "}${item.relativePath}`
1100
+ el(
1101
+ "text",
1102
+ {
1103
+ wrapMode: "none",
1104
+ truncate: true,
1105
+ flexShrink: 1,
1106
+ minWidth: 0,
1107
+ fg: () =>
1108
+ isSel()
1109
+ ? theme().text.action.primary.focused
1110
+ : theme().text.base,
1111
+ attributes: () =>
1112
+ isSel() ? TextAttributes.BOLD : undefined
1113
+ },
1114
+ () => `${isSel() ? "▸ " : " "}${item.relativePath}`
1115
+ ),
1116
+ el(
1117
+ "text",
1118
+ {
1119
+ wrapMode: "none",
1120
+ flexShrink: 0,
1121
+ fg: () =>
1122
+ isSel()
1123
+ ? theme().text.action.primary.focused
1124
+ : theme().text.action.primary.base
1125
+ },
1126
+ () =>
1127
+ ` [${item.tool || "auto"}] ${formatAge(item.timeMs)}`
1128
+ )
1039
1129
  ),
1130
+ // Line 2: Parent backup folder directly underneath
1040
1131
  el(
1041
1132
  "text",
1042
1133
  {
1043
1134
  wrapMode: "none",
1044
- flexShrink: 0,
1135
+ truncate: true,
1045
1136
  fg: () =>
1046
1137
  isSel()
1047
1138
  ? theme().text.action.primary.focused
1048
- : theme().text.action.primary.base
1139
+ : theme().text.muted
1049
1140
  },
1050
- () =>
1051
- ` [${item.tool || "auto"}] ${formatAge(item.timeMs)}`
1141
+ () => ` ↳ ${formatParentBackupPath(item)}`
1052
1142
  )
1053
- ),
1054
- // Line 2: Parent backup folder directly underneath
1055
- el(
1056
- "text",
1057
- {
1058
- wrapMode: "none",
1059
- truncate: true,
1060
- fg: () =>
1061
- isSel()
1062
- ? theme().text.action.primary.focused
1063
- : theme().text.muted
1064
- },
1065
- () => ` ↳ ${formatParentBackupPath(item)}`
1066
- )
1067
- );
1068
- }
1069
- });
1070
- }
1071
- })
1143
+ );
1144
+ }
1145
+ });
1146
+ }
1147
+ })
1148
+ )
1072
1149
  ),
1073
1150
 
1074
- // Right Pane: Full Paths + Unified Diff Preview (56% width)
1151
+ // Right Card: Full Paths + Unified Diff Preview (56% width)
1075
1152
  el(
1076
- "scrollbox",
1153
+ "box",
1077
1154
  {
1078
- id: "auto-backup-preview",
1079
- ref: (r: unknown) => {
1080
- previewScrollRef = r;
1081
- },
1082
1155
  flexGrow: 1,
1156
+ height: "100%",
1083
1157
  minWidth: 0,
1084
1158
  minHeight: 0,
1085
- paddingX: 2,
1086
- paddingY: 1,
1087
- focused: () => focusPane() === "preview",
1159
+ flexDirection: "column",
1160
+ backgroundColor: () =>
1161
+ theme().background.raised?.base ?? theme().background.base,
1162
+ border: true,
1163
+ borderColor: () =>
1164
+ focusPane() === "preview"
1165
+ ? theme().text.action.primary.base
1166
+ : theme().border.base,
1167
+ paddingLeft: 2,
1168
+ paddingRight: 2,
1169
+ paddingTop: 0,
1170
+ paddingBottom: 1,
1088
1171
  onMouseDown: () => setFocusPane("preview")
1089
1172
  },
1090
- createComponent(Show, {
1091
- get when() {
1092
- return Boolean(selectedEntry() && diffPreview());
1173
+ el(
1174
+ "box",
1175
+ {
1176
+ flexDirection: "row",
1177
+ justifyContent: "space-between",
1178
+ border: ["bottom"],
1179
+ borderColor: () => theme().border.base,
1180
+ marginBottom: 1,
1181
+ flexShrink: 0
1093
1182
  },
1094
- get fallback() {
1095
- return el(
1096
- "text",
1097
- { fg: () => theme().text.muted },
1098
- "Select a snapshot on the left to inspect its full path and diff."
1099
- );
1183
+ el(
1184
+ "text",
1185
+ {
1186
+ fg: () => theme().text.action.primary.base,
1187
+ attributes: TextAttributes.BOLD
1188
+ },
1189
+ "◈ SNAPSHOT & DIFF PREVIEW"
1190
+ ),
1191
+ el(
1192
+ "text",
1193
+ { fg: () => theme().text.muted },
1194
+ () =>
1195
+ selectedEntry()
1196
+ ? `${formatBytes(selectedEntry()?.size ?? 0)} · ${formatAge(selectedEntry()?.timeMs ?? 0)}`
1197
+ : "no selection"
1198
+ )
1199
+ ),
1200
+ el(
1201
+ "scrollbox",
1202
+ {
1203
+ id: "auto-backup-preview",
1204
+ ref: (r: unknown) => {
1205
+ previewScrollRef = r;
1206
+ },
1207
+ flexGrow: 1,
1208
+ minWidth: 0,
1209
+ minHeight: 0,
1210
+ focused: () => focusPane() === "preview"
1100
1211
  },
1101
- get children() {
1102
- return el(
1103
- "box",
1104
- { flexDirection: "column", gap: 1 },
1105
- // Colored left-border header card
1106
- el(
1212
+ createComponent(Show, {
1213
+ get when() {
1214
+ return Boolean(selectedEntry() && diffPreview());
1215
+ },
1216
+ get fallback() {
1217
+ return el(
1218
+ "text",
1219
+ { fg: () => theme().text.muted },
1220
+ "Select a snapshot on the left to inspect its full path and diff."
1221
+ );
1222
+ },
1223
+ get children() {
1224
+ return el(
1107
1225
  "box",
1108
- {
1109
- flexDirection: "column",
1110
- paddingLeft: 1,
1111
- border: ["left"],
1112
- borderColor: () => theme().text.action.primary.base
1113
- },
1226
+ { flexDirection: "column", gap: 1 },
1227
+ // Colored left-border header card
1114
1228
  el(
1115
1229
  "box",
1116
1230
  {
1117
- flexDirection: "row",
1118
- justifyContent: "space-between",
1119
- width: "100%"
1231
+ flexDirection: "column",
1232
+ paddingLeft: 1,
1233
+ border: ["left"],
1234
+ borderColor: () => theme().text.action.primary.base
1120
1235
  },
1121
1236
  el(
1122
- "text",
1237
+ "box",
1123
1238
  {
1124
- fg: () => theme().text.base,
1125
- attributes: TextAttributes.BOLD
1239
+ flexDirection: "row",
1240
+ justifyContent: "space-between",
1241
+ width: "100%"
1126
1242
  },
1127
- () => selectedEntry()?.relativePath ?? ""
1243
+ el(
1244
+ "text",
1245
+ {
1246
+ fg: () => theme().text.base,
1247
+ attributes: TextAttributes.BOLD
1248
+ },
1249
+ () => selectedEntry()?.relativePath ?? ""
1250
+ ),
1251
+ el(
1252
+ "text",
1253
+ {
1254
+ fg: () => theme().text.action.primary.base,
1255
+ attributes: TextAttributes.BOLD
1256
+ },
1257
+ () =>
1258
+ `[${(selectedEntry()?.tool || "auto").toUpperCase()} · ${formatBytes(selectedEntry()?.size ?? 0)} · ${formatAge(selectedEntry()?.timeMs ?? 0)}]`
1259
+ )
1128
1260
  ),
1129
1261
  el(
1130
1262
  "text",
1131
- {
1132
- fg: () => theme().text.action.primary.base,
1133
- attributes: TextAttributes.BOLD
1134
- },
1135
- () =>
1136
- `[${(selectedEntry()?.tool || "auto").toUpperCase()} · ${formatBytes(selectedEntry()?.size ?? 0)} · ${formatAge(selectedEntry()?.timeMs ?? 0)}]`
1263
+ { fg: () => theme().text.muted },
1264
+ () => `Snapshot: ${selectedEntry()?.snapshotId ?? ""}`
1265
+ ),
1266
+ el(
1267
+ "text",
1268
+ { fg: () => theme().text.base, wrapMode: "word" },
1269
+ () => `Original: ${selectedEntry()?.originalPath ?? ""}`
1270
+ ),
1271
+ el(
1272
+ "text",
1273
+ { fg: () => theme().text.muted, wrapMode: "word" },
1274
+ () => `Backup: ${selectedEntry()?.backupPath ?? ""}`
1137
1275
  )
1138
1276
  ),
1277
+
1278
+ // Diff section header
1139
1279
  el(
1140
1280
  "text",
1141
- { fg: () => theme().text.muted },
1142
- () => `Snapshot: ${selectedEntry()?.snapshotId ?? ""}`
1143
- ),
1144
- el(
1145
- "text",
1146
- { fg: () => theme().text.base, wrapMode: "word" },
1147
- () => `Original: ${selectedEntry()?.originalPath ?? ""}`
1281
+ {
1282
+ fg: () => theme().text.action.primary.base,
1283
+ attributes: TextAttributes.BOLD,
1284
+ marginTop: 1
1285
+ },
1286
+ () => diffPreview()?.summary ?? ""
1148
1287
  ),
1149
- el(
1150
- "text",
1151
- { fg: () => theme().text.muted, wrapMode: "word" },
1152
- () => `Backup: ${selectedEntry()?.backupPath ?? ""}`
1153
- )
1154
- ),
1155
1288
 
1156
- // Diff section header
1157
- el(
1158
- "text",
1159
- {
1160
- fg: () => theme().text.action.primary.base,
1161
- attributes: TextAttributes.BOLD,
1162
- marginTop: 1
1163
- },
1164
- () => diffPreview()?.summary ?? ""
1165
- ),
1166
-
1167
- // Colored diff lines inside a subtle left-bordered block
1168
- el(
1169
- "box",
1170
- {
1171
- flexDirection: "column",
1172
- paddingLeft: 1,
1173
- border: ["left"],
1174
- borderColor: () => theme().border.base
1175
- },
1176
- createComponent(For, {
1177
- get each() {
1178
- return diffPreview()?.lines ?? [];
1289
+ // Colored diff lines inside a subtle left-bordered block
1290
+ el(
1291
+ "box",
1292
+ {
1293
+ flexDirection: "column",
1294
+ paddingLeft: 1,
1295
+ border: ["left"],
1296
+ borderColor: () => theme().border.base
1179
1297
  },
1180
- children: (line: { type: string; text: string }) =>
1181
- el(
1182
- "text",
1183
- {
1184
- fg: () =>
1185
- line.type === "add"
1186
- ? theme().text.feedback?.success?.base ??
1187
- theme().text.action.primary.base
1188
- : line.type === "del"
1189
- ? theme().text.feedback?.error?.base ??
1190
- "#f87171"
1191
- : line.text.startsWith("@@")
1192
- ? theme().text.action.primary.base
1193
- : theme().text.muted,
1194
- attributes: () =>
1195
- line.type === "add" || line.type === "del"
1196
- ? TextAttributes.BOLD
1197
- : undefined,
1198
- wrapMode: "none",
1199
- truncate: true
1200
- },
1201
- createComponent(For, {
1202
- get each() {
1203
- return splitHighlightedText(line.text, query());
1204
- },
1205
- children: (seg: { text: string; match: boolean }) =>
1206
- el(
1207
- "span",
1208
- {
1209
- fg: () =>
1210
- seg.match
1298
+ createComponent(For, {
1299
+ get each() {
1300
+ return diffPreview()?.lines ?? [];
1301
+ },
1302
+ children: (line: { type: string; text: string }) =>
1303
+ el(
1304
+ "text",
1305
+ {
1306
+ fg: () =>
1307
+ line.type === "add"
1308
+ ? theme().text.feedback?.success?.base ??
1309
+ theme().text.action.primary.base
1310
+ : line.type === "del"
1311
+ ? theme().text.feedback?.error?.base ??
1312
+ "#f87171"
1313
+ : line.text.startsWith("@@")
1211
1314
  ? theme().text.action.primary.base
1212
- : undefined,
1213
- attributes: () =>
1214
- seg.match ? TextAttributes.BOLD : undefined
1215
- },
1216
- seg.text
1217
- )
1218
- })
1219
- )
1220
- })
1221
- )
1222
- );
1223
- }
1224
- })
1225
- )
1226
- ),
1227
-
1228
- // 5. Footer Shortcut Bar
1229
- el(
1230
- "box",
1231
- {
1232
- flexDirection: "row",
1233
- justifyContent: "space-between",
1234
- gap: 2,
1235
- paddingX: 2,
1236
- paddingY: 1,
1237
- flexShrink: 0,
1238
- border: ["top"],
1239
- borderColor: () => theme().border.base
1240
- },
1241
- el(
1242
- "text",
1243
- {
1244
- fg: () => theme().text.muted,
1245
- flexShrink: 1,
1246
- minWidth: 0,
1247
- wrapMode: "none",
1248
- truncate: true
1249
- },
1250
- "enter actions (restore / open) · ↑/↓ or ^j/^k move · ^t tool · ^g date · ^r retention · ^d prune · tab pane"
1251
- ),
1252
- el(
1253
- "text",
1254
- { fg: () => theme().text.muted, flexShrink: 0, wrapMode: "none" },
1255
- "0 tokens"
1315
+ : theme().text.muted,
1316
+ attributes: () =>
1317
+ line.type === "add" || line.type === "del"
1318
+ ? TextAttributes.BOLD
1319
+ : undefined,
1320
+ wrapMode: "none",
1321
+ truncate: true
1322
+ },
1323
+ createComponent(For, {
1324
+ get each() {
1325
+ return splitHighlightedText(line.text, query());
1326
+ },
1327
+ children: (seg: { text: string; match: boolean }) =>
1328
+ el(
1329
+ "span",
1330
+ {
1331
+ fg: () =>
1332
+ seg.match
1333
+ ? theme().text.action.primary.base
1334
+ : undefined,
1335
+ attributes: () =>
1336
+ seg.match ? TextAttributes.BOLD : undefined
1337
+ },
1338
+ seg.text
1339
+ )
1340
+ })
1341
+ )
1342
+ })
1343
+ )
1344
+ );
1345
+ }
1346
+ })
1347
+ )
1256
1348
  )
1257
1349
  )
1258
1350
  );
@@ -1393,45 +1485,6 @@ export default {
1393
1485
  run: (input) => {
1394
1486
  void openBackupsPopup(input);
1395
1487
  }
1396
- },
1397
- {
1398
- id: "auto.backup.browse.alias.backup",
1399
- title: "Browse & restore file backups (/backup)",
1400
- category: "Backup",
1401
- palette: false,
1402
- slash: {
1403
- name: "backup",
1404
- arguments: true
1405
- },
1406
- run: (input) => {
1407
- void openBackupsPopup(input);
1408
- }
1409
- },
1410
- {
1411
- id: "auto.backup.browse.alias.restore",
1412
- title: "Browse & restore file backups (/restore)",
1413
- category: "Backup",
1414
- palette: false,
1415
- slash: {
1416
- name: "restore",
1417
- arguments: true
1418
- },
1419
- run: (input) => {
1420
- void openBackupsPopup(input);
1421
- }
1422
- },
1423
- {
1424
- id: "auto.backup.browse.alias.snapshots",
1425
- title: "Browse & restore file backups (/snapshots)",
1426
- category: "Backup",
1427
- palette: false,
1428
- slash: {
1429
- name: "snapshots",
1430
- arguments: true
1431
- },
1432
- run: (input) => {
1433
- void openBackupsPopup(input);
1434
- }
1435
1488
  }
1436
1489
  ]
1437
1490
  }));