git-tm 1.2.0 → 2.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/README.md +32 -4
- package/package.json +10 -2
- package/src/cli.js +118 -7
- package/src/edit.js +513 -0
- package/src/git.js +13 -3
- package/src/index.js +2 -1
- package/src/listen-again.js +30 -0
- package/src/paths.js +21 -0
- package/src/public/app.css +535 -0
- package/src/public/index.html +2 -0
- package/src/public/js/compare.js +24 -8
- package/src/public/js/detail.js +4 -0
- package/src/public/js/diff.js +82 -31
- package/src/public/js/edit.js +384 -0
- package/src/public/js/history.js +83 -1
- package/src/public/js/main.js +104 -2
- package/src/public/js/reflog.js +52 -6
- package/src/public/js/ui.js +166 -9
- package/src/server.js +133 -12
- package/src/types/edit.d.ts +69 -0
- package/src/types/git.d.ts +7 -0
- package/src/types/index.d.ts +4 -2
- package/src/types/server.d.ts +42 -0
package/src/public/app.css
CHANGED
|
@@ -202,6 +202,13 @@ button {
|
|
|
202
202
|
border-radius: 4px;
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
+
input[type="checkbox"]:focus-visible,
|
|
206
|
+
input[type="radio"]:focus-visible {
|
|
207
|
+
outline: none;
|
|
208
|
+
box-shadow: 0 0 0 3px var(--accent-soft);
|
|
209
|
+
border-radius: 3px;
|
|
210
|
+
}
|
|
211
|
+
|
|
205
212
|
svg.i,
|
|
206
213
|
.icon-btn svg,
|
|
207
214
|
.search svg {
|
|
@@ -263,6 +270,52 @@ kbd {
|
|
|
263
270
|
padding: 0 var(--gutter) var(--gutter);
|
|
264
271
|
}
|
|
265
272
|
|
|
273
|
+
.app:has(.mode-banner:not([hidden])) {
|
|
274
|
+
grid-template-rows: var(--top-h) auto minmax(0, 1fr);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.mode-banner {
|
|
278
|
+
grid-column: 1 / -1;
|
|
279
|
+
display: flex;
|
|
280
|
+
align-items: center;
|
|
281
|
+
justify-content: space-between;
|
|
282
|
+
gap: 10px;
|
|
283
|
+
padding: 6px 10px 6px 14px;
|
|
284
|
+
border: 1px solid var(--border);
|
|
285
|
+
border-radius: var(--radius);
|
|
286
|
+
background: var(--bg-panel);
|
|
287
|
+
font-size: 12.5px;
|
|
288
|
+
color: var(--text-2);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.mode-banner[hidden] {
|
|
292
|
+
display: none;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.mode-banner code {
|
|
296
|
+
padding: 1px 6px;
|
|
297
|
+
border-radius: 4px;
|
|
298
|
+
background: var(--bg-elev);
|
|
299
|
+
border: 1px solid var(--border);
|
|
300
|
+
color: var(--text);
|
|
301
|
+
font-size: 11.5px;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.mode-banner .icon-btn {
|
|
305
|
+
width: 24px;
|
|
306
|
+
height: 24px;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.mode-banner.edit {
|
|
310
|
+
border-color: color-mix(in srgb, var(--lane-4) 45%, transparent);
|
|
311
|
+
background: color-mix(in srgb, var(--lane-4) 14%, var(--bg-panel));
|
|
312
|
+
color: var(--text);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.mode-banner.edit strong {
|
|
316
|
+
color: var(--lane-4);
|
|
317
|
+
}
|
|
318
|
+
|
|
266
319
|
.topbar {
|
|
267
320
|
grid-column: 1 / -1;
|
|
268
321
|
display: flex;
|
|
@@ -1173,6 +1226,12 @@ select,
|
|
|
1173
1226
|
background: var(--accent-strong);
|
|
1174
1227
|
}
|
|
1175
1228
|
|
|
1229
|
+
.btn:disabled {
|
|
1230
|
+
opacity: 0.45;
|
|
1231
|
+
cursor: not-allowed;
|
|
1232
|
+
pointer-events: none;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1176
1235
|
.btn-ghost[aria-pressed="true"] {
|
|
1177
1236
|
background: var(--accent-soft);
|
|
1178
1237
|
border-color: transparent;
|
|
@@ -1880,6 +1939,10 @@ mark.del {
|
|
|
1880
1939
|
cursor: pointer;
|
|
1881
1940
|
}
|
|
1882
1941
|
|
|
1942
|
+
.travel-range:focus-visible {
|
|
1943
|
+
outline: none;
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1883
1946
|
.travel-range::-webkit-slider-thumb {
|
|
1884
1947
|
appearance: none;
|
|
1885
1948
|
width: 18px;
|
|
@@ -1890,6 +1953,10 @@ mark.del {
|
|
|
1890
1953
|
box-shadow: var(--shadow);
|
|
1891
1954
|
}
|
|
1892
1955
|
|
|
1956
|
+
.travel-range:focus-visible::-webkit-slider-thumb {
|
|
1957
|
+
box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow);
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1893
1960
|
.travel-range::-moz-range-thumb {
|
|
1894
1961
|
width: 14px;
|
|
1895
1962
|
height: 14px;
|
|
@@ -1898,6 +1965,10 @@ mark.del {
|
|
|
1898
1965
|
border: 3px solid var(--accent);
|
|
1899
1966
|
}
|
|
1900
1967
|
|
|
1968
|
+
.travel-range:focus-visible::-moz-range-thumb {
|
|
1969
|
+
box-shadow: 0 0 0 4px var(--accent-soft);
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1901
1972
|
.travel-ends {
|
|
1902
1973
|
display: flex;
|
|
1903
1974
|
justify-content: space-between;
|
|
@@ -2918,3 +2989,467 @@ dialog.help .btn {
|
|
|
2918
2989
|
transition: none !important;
|
|
2919
2990
|
}
|
|
2920
2991
|
}
|
|
2992
|
+
|
|
2993
|
+
/* ------------------------------------------------------------------ edit mode */
|
|
2994
|
+
|
|
2995
|
+
.edit-badge {
|
|
2996
|
+
display: inline-flex;
|
|
2997
|
+
align-items: center;
|
|
2998
|
+
height: 22px;
|
|
2999
|
+
padding: 0 8px;
|
|
3000
|
+
border: 1px solid color-mix(in srgb, var(--lane-4) 55%, transparent);
|
|
3001
|
+
border-radius: 999px;
|
|
3002
|
+
background: color-mix(in srgb, var(--lane-4) 14%, transparent);
|
|
3003
|
+
color: color-mix(in srgb, var(--lane-4) 70%, var(--text));
|
|
3004
|
+
font-size: 11.5px;
|
|
3005
|
+
font-weight: 600;
|
|
3006
|
+
white-space: nowrap;
|
|
3007
|
+
}
|
|
3008
|
+
|
|
3009
|
+
.btn-edit {
|
|
3010
|
+
color: var(--lane-4);
|
|
3011
|
+
background: color-mix(in srgb, var(--lane-4) 16%, var(--bg-panel));
|
|
3012
|
+
border-color: color-mix(in srgb, var(--lane-4) 55%, var(--border-strong));
|
|
3013
|
+
font-weight: 600;
|
|
3014
|
+
}
|
|
3015
|
+
|
|
3016
|
+
.btn-edit:hover {
|
|
3017
|
+
background: color-mix(in srgb, var(--lane-4) 26%, var(--bg-panel));
|
|
3018
|
+
border-color: var(--lane-4);
|
|
3019
|
+
}
|
|
3020
|
+
|
|
3021
|
+
/* ------------------------------------------------------------------ context menu */
|
|
3022
|
+
|
|
3023
|
+
.ctx-menu {
|
|
3024
|
+
position: fixed;
|
|
3025
|
+
z-index: 60;
|
|
3026
|
+
min-width: 190px;
|
|
3027
|
+
padding: 5px;
|
|
3028
|
+
border: 1px solid var(--border-strong);
|
|
3029
|
+
border-radius: var(--radius);
|
|
3030
|
+
background: var(--bg-panel);
|
|
3031
|
+
box-shadow: var(--shadow);
|
|
3032
|
+
display: flex;
|
|
3033
|
+
flex-direction: column;
|
|
3034
|
+
gap: 2px;
|
|
3035
|
+
}
|
|
3036
|
+
|
|
3037
|
+
.ctx-item {
|
|
3038
|
+
display: flex;
|
|
3039
|
+
align-items: center;
|
|
3040
|
+
gap: 8px;
|
|
3041
|
+
width: 100%;
|
|
3042
|
+
padding: 6px 10px;
|
|
3043
|
+
border: 0;
|
|
3044
|
+
border-radius: var(--radius-sm);
|
|
3045
|
+
background: transparent;
|
|
3046
|
+
color: var(--text);
|
|
3047
|
+
font-size: 12.5px;
|
|
3048
|
+
text-align: left;
|
|
3049
|
+
white-space: nowrap;
|
|
3050
|
+
}
|
|
3051
|
+
|
|
3052
|
+
.ctx-item:hover,
|
|
3053
|
+
.ctx-item:focus-visible {
|
|
3054
|
+
background: var(--bg-hover);
|
|
3055
|
+
outline: none;
|
|
3056
|
+
}
|
|
3057
|
+
|
|
3058
|
+
.ctx-item svg {
|
|
3059
|
+
width: 14px;
|
|
3060
|
+
height: 14px;
|
|
3061
|
+
color: var(--muted);
|
|
3062
|
+
}
|
|
3063
|
+
|
|
3064
|
+
.ctx-item.warn {
|
|
3065
|
+
color: var(--lane-4);
|
|
3066
|
+
font-weight: 600;
|
|
3067
|
+
}
|
|
3068
|
+
|
|
3069
|
+
.ctx-item.warn svg {
|
|
3070
|
+
color: var(--lane-4);
|
|
3071
|
+
}
|
|
3072
|
+
|
|
3073
|
+
.ctx-sep {
|
|
3074
|
+
height: 1px;
|
|
3075
|
+
margin: 4px 6px;
|
|
3076
|
+
background: var(--border);
|
|
3077
|
+
}
|
|
3078
|
+
|
|
3079
|
+
dialog.edit-dialog {
|
|
3080
|
+
width: min(600px, calc(100vw - 24px));
|
|
3081
|
+
max-height: min(86vh, 760px);
|
|
3082
|
+
overflow: auto;
|
|
3083
|
+
padding: 20px 22px;
|
|
3084
|
+
border: 1px solid var(--border);
|
|
3085
|
+
border-radius: 12px;
|
|
3086
|
+
background: var(--bg-panel);
|
|
3087
|
+
color: var(--text);
|
|
3088
|
+
box-shadow: var(--shadow);
|
|
3089
|
+
}
|
|
3090
|
+
|
|
3091
|
+
dialog.edit-dialog::backdrop {
|
|
3092
|
+
background: rgba(0, 0, 0, 0.45);
|
|
3093
|
+
}
|
|
3094
|
+
|
|
3095
|
+
.edit-head {
|
|
3096
|
+
display: flex;
|
|
3097
|
+
flex-wrap: wrap;
|
|
3098
|
+
align-items: center;
|
|
3099
|
+
gap: 8px;
|
|
3100
|
+
margin-bottom: 14px;
|
|
3101
|
+
}
|
|
3102
|
+
|
|
3103
|
+
.edit-head h2 {
|
|
3104
|
+
margin: 0 6px 0 0;
|
|
3105
|
+
font-size: 16px;
|
|
3106
|
+
}
|
|
3107
|
+
|
|
3108
|
+
.edit-subject {
|
|
3109
|
+
min-width: 0;
|
|
3110
|
+
overflow: hidden;
|
|
3111
|
+
color: var(--text-2);
|
|
3112
|
+
text-overflow: ellipsis;
|
|
3113
|
+
white-space: nowrap;
|
|
3114
|
+
flex: 1;
|
|
3115
|
+
}
|
|
3116
|
+
|
|
3117
|
+
.edit-ops {
|
|
3118
|
+
display: grid;
|
|
3119
|
+
grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
|
|
3120
|
+
gap: 8px;
|
|
3121
|
+
margin-bottom: 12px;
|
|
3122
|
+
}
|
|
3123
|
+
|
|
3124
|
+
.edit-op {
|
|
3125
|
+
display: flex;
|
|
3126
|
+
flex-direction: column;
|
|
3127
|
+
gap: 3px;
|
|
3128
|
+
padding: 10px 12px;
|
|
3129
|
+
border: 1px solid var(--border);
|
|
3130
|
+
border-radius: 9px;
|
|
3131
|
+
background: var(--bg-elev);
|
|
3132
|
+
color: var(--text);
|
|
3133
|
+
text-align: left;
|
|
3134
|
+
cursor: pointer;
|
|
3135
|
+
}
|
|
3136
|
+
|
|
3137
|
+
.edit-op span {
|
|
3138
|
+
color: var(--muted);
|
|
3139
|
+
font-size: 12.5px;
|
|
3140
|
+
}
|
|
3141
|
+
|
|
3142
|
+
.edit-op:hover:not(:disabled) {
|
|
3143
|
+
border-color: var(--accent);
|
|
3144
|
+
background: var(--accent-soft);
|
|
3145
|
+
}
|
|
3146
|
+
|
|
3147
|
+
.edit-op:disabled {
|
|
3148
|
+
opacity: 0.55;
|
|
3149
|
+
cursor: not-allowed;
|
|
3150
|
+
}
|
|
3151
|
+
|
|
3152
|
+
.edit-form p {
|
|
3153
|
+
margin: 0 0 10px;
|
|
3154
|
+
color: var(--text-2);
|
|
3155
|
+
}
|
|
3156
|
+
|
|
3157
|
+
.edit-field {
|
|
3158
|
+
display: flex;
|
|
3159
|
+
flex-direction: column;
|
|
3160
|
+
gap: 5px;
|
|
3161
|
+
margin-bottom: 12px;
|
|
3162
|
+
font-size: 12.5px;
|
|
3163
|
+
font-weight: 600;
|
|
3164
|
+
color: var(--text-2);
|
|
3165
|
+
}
|
|
3166
|
+
|
|
3167
|
+
.edit-field input,
|
|
3168
|
+
.edit-field textarea,
|
|
3169
|
+
.edit-field select {
|
|
3170
|
+
width: 100%;
|
|
3171
|
+
padding: 7px 9px;
|
|
3172
|
+
border: 1px solid var(--border-strong);
|
|
3173
|
+
border-radius: 7px;
|
|
3174
|
+
background: var(--bg-panel);
|
|
3175
|
+
color: var(--text);
|
|
3176
|
+
font: 13px var(--font);
|
|
3177
|
+
}
|
|
3178
|
+
|
|
3179
|
+
.edit-field textarea {
|
|
3180
|
+
font-family: var(--mono);
|
|
3181
|
+
resize: vertical;
|
|
3182
|
+
}
|
|
3183
|
+
|
|
3184
|
+
.edit-check {
|
|
3185
|
+
display: flex;
|
|
3186
|
+
align-items: center;
|
|
3187
|
+
gap: 8px;
|
|
3188
|
+
margin: 4px 0 12px;
|
|
3189
|
+
font-size: 13px;
|
|
3190
|
+
}
|
|
3191
|
+
|
|
3192
|
+
.edit-actions {
|
|
3193
|
+
display: flex;
|
|
3194
|
+
align-items: center;
|
|
3195
|
+
gap: 8px;
|
|
3196
|
+
margin-top: 16px;
|
|
3197
|
+
}
|
|
3198
|
+
|
|
3199
|
+
.edit-summary {
|
|
3200
|
+
margin: 0 0 10px;
|
|
3201
|
+
font-weight: 600;
|
|
3202
|
+
}
|
|
3203
|
+
|
|
3204
|
+
.edit-timeline {
|
|
3205
|
+
display: flex;
|
|
3206
|
+
flex-direction: column;
|
|
3207
|
+
gap: 2px;
|
|
3208
|
+
max-height: 210px;
|
|
3209
|
+
overflow: auto;
|
|
3210
|
+
margin: 0 0 14px;
|
|
3211
|
+
padding: 8px 10px;
|
|
3212
|
+
border: 1px solid var(--border);
|
|
3213
|
+
border-radius: 8px;
|
|
3214
|
+
background: var(--bg-elev);
|
|
3215
|
+
list-style: none;
|
|
3216
|
+
font-size: 12.5px;
|
|
3217
|
+
}
|
|
3218
|
+
|
|
3219
|
+
.edit-timeline li {
|
|
3220
|
+
display: flex;
|
|
3221
|
+
align-items: baseline;
|
|
3222
|
+
gap: 8px;
|
|
3223
|
+
min-width: 0;
|
|
3224
|
+
}
|
|
3225
|
+
|
|
3226
|
+
.edit-timeline .old {
|
|
3227
|
+
color: var(--muted);
|
|
3228
|
+
text-decoration: line-through;
|
|
3229
|
+
}
|
|
3230
|
+
|
|
3231
|
+
.edit-timeline .new {
|
|
3232
|
+
color: var(--add);
|
|
3233
|
+
}
|
|
3234
|
+
|
|
3235
|
+
.edit-timeline .dropped .new {
|
|
3236
|
+
color: var(--del);
|
|
3237
|
+
}
|
|
3238
|
+
|
|
3239
|
+
.edit-timeline .added .old {
|
|
3240
|
+
text-decoration: none;
|
|
3241
|
+
}
|
|
3242
|
+
|
|
3243
|
+
.edit-timeline .arrow {
|
|
3244
|
+
color: var(--muted);
|
|
3245
|
+
}
|
|
3246
|
+
|
|
3247
|
+
.edit-timeline .subj {
|
|
3248
|
+
min-width: 0;
|
|
3249
|
+
overflow: hidden;
|
|
3250
|
+
color: var(--text-2);
|
|
3251
|
+
text-overflow: ellipsis;
|
|
3252
|
+
white-space: nowrap;
|
|
3253
|
+
}
|
|
3254
|
+
|
|
3255
|
+
.edit-sub {
|
|
3256
|
+
margin: 0 0 6px;
|
|
3257
|
+
font-size: 12.5px;
|
|
3258
|
+
color: var(--text-2);
|
|
3259
|
+
}
|
|
3260
|
+
|
|
3261
|
+
.edit-files {
|
|
3262
|
+
display: flex;
|
|
3263
|
+
flex-direction: column;
|
|
3264
|
+
gap: 4px;
|
|
3265
|
+
margin-bottom: 12px;
|
|
3266
|
+
font-size: 12.5px;
|
|
3267
|
+
}
|
|
3268
|
+
|
|
3269
|
+
.edit-files div {
|
|
3270
|
+
display: flex;
|
|
3271
|
+
align-items: center;
|
|
3272
|
+
gap: 8px;
|
|
3273
|
+
min-width: 0;
|
|
3274
|
+
}
|
|
3275
|
+
|
|
3276
|
+
.edit-files code {
|
|
3277
|
+
min-width: 0;
|
|
3278
|
+
overflow: hidden;
|
|
3279
|
+
text-overflow: ellipsis;
|
|
3280
|
+
white-space: nowrap;
|
|
3281
|
+
}
|
|
3282
|
+
|
|
3283
|
+
.edit-files .add {
|
|
3284
|
+
color: var(--add);
|
|
3285
|
+
}
|
|
3286
|
+
|
|
3287
|
+
.edit-files .del {
|
|
3288
|
+
color: var(--del);
|
|
3289
|
+
}
|
|
3290
|
+
|
|
3291
|
+
.edit-warn {
|
|
3292
|
+
margin: 0 0 8px;
|
|
3293
|
+
padding: 8px 10px;
|
|
3294
|
+
border-left: 3px solid var(--lane-4);
|
|
3295
|
+
border-radius: 0 6px 6px 0;
|
|
3296
|
+
background: color-mix(in srgb, var(--lane-4) 10%, transparent);
|
|
3297
|
+
font-size: 13px;
|
|
3298
|
+
}
|
|
3299
|
+
|
|
3300
|
+
.edit-danger {
|
|
3301
|
+
margin: 10px 0 4px;
|
|
3302
|
+
padding: 10px 12px;
|
|
3303
|
+
border: 1px solid color-mix(in srgb, var(--del) 45%, transparent);
|
|
3304
|
+
border-radius: 8px;
|
|
3305
|
+
background: var(--del-bg);
|
|
3306
|
+
font-size: 13px;
|
|
3307
|
+
}
|
|
3308
|
+
|
|
3309
|
+
.edit-danger strong {
|
|
3310
|
+
color: var(--del);
|
|
3311
|
+
}
|
|
3312
|
+
|
|
3313
|
+
.edit-danger p {
|
|
3314
|
+
margin: 6px 0 8px;
|
|
3315
|
+
}
|
|
3316
|
+
|
|
3317
|
+
.edit-backups {
|
|
3318
|
+
margin: 0 0 16px;
|
|
3319
|
+
}
|
|
3320
|
+
|
|
3321
|
+
.edit-backups-title {
|
|
3322
|
+
margin: 0 0 8px;
|
|
3323
|
+
font-size: 14px;
|
|
3324
|
+
}
|
|
3325
|
+
|
|
3326
|
+
.edit-backups-empty {
|
|
3327
|
+
margin: 0 0 14px;
|
|
3328
|
+
padding: 10px 12px;
|
|
3329
|
+
border: 1px dashed var(--border-strong);
|
|
3330
|
+
border-radius: 8px;
|
|
3331
|
+
}
|
|
3332
|
+
|
|
3333
|
+
.edit-backups-list {
|
|
3334
|
+
display: flex;
|
|
3335
|
+
flex-direction: column;
|
|
3336
|
+
gap: 6px;
|
|
3337
|
+
margin: 0;
|
|
3338
|
+
padding: 0;
|
|
3339
|
+
list-style: none;
|
|
3340
|
+
}
|
|
3341
|
+
|
|
3342
|
+
.edit-backups-list li {
|
|
3343
|
+
display: flex;
|
|
3344
|
+
flex-wrap: wrap;
|
|
3345
|
+
align-items: center;
|
|
3346
|
+
justify-content: space-between;
|
|
3347
|
+
gap: 10px 14px;
|
|
3348
|
+
padding: 10px 14px;
|
|
3349
|
+
border: 1px solid var(--border);
|
|
3350
|
+
border-radius: var(--radius);
|
|
3351
|
+
background: var(--bg-panel);
|
|
3352
|
+
}
|
|
3353
|
+
|
|
3354
|
+
.edit-backup-main {
|
|
3355
|
+
display: flex;
|
|
3356
|
+
flex-direction: column;
|
|
3357
|
+
gap: 4px;
|
|
3358
|
+
min-width: 0;
|
|
3359
|
+
flex: 1 1 280px;
|
|
3360
|
+
}
|
|
3361
|
+
|
|
3362
|
+
.edit-backup-top {
|
|
3363
|
+
display: flex;
|
|
3364
|
+
align-items: center;
|
|
3365
|
+
gap: 8px;
|
|
3366
|
+
min-width: 0;
|
|
3367
|
+
}
|
|
3368
|
+
|
|
3369
|
+
.edit-backup-sum {
|
|
3370
|
+
font-weight: 500;
|
|
3371
|
+
overflow-wrap: anywhere;
|
|
3372
|
+
}
|
|
3373
|
+
|
|
3374
|
+
.edit-backup-meta {
|
|
3375
|
+
display: flex;
|
|
3376
|
+
flex-wrap: wrap;
|
|
3377
|
+
align-items: center;
|
|
3378
|
+
gap: 6px;
|
|
3379
|
+
}
|
|
3380
|
+
|
|
3381
|
+
.edit-backup-op {
|
|
3382
|
+
flex: none;
|
|
3383
|
+
display: inline-flex;
|
|
3384
|
+
align-items: center;
|
|
3385
|
+
padding: 1px 7px;
|
|
3386
|
+
border-radius: 999px;
|
|
3387
|
+
font: 600 11px/1.6 var(--font);
|
|
3388
|
+
letter-spacing: 0.01em;
|
|
3389
|
+
}
|
|
3390
|
+
|
|
3391
|
+
.edit-backup-op.op-edit {
|
|
3392
|
+
background: color-mix(in srgb, var(--lane-4) 18%, transparent);
|
|
3393
|
+
color: var(--lane-4);
|
|
3394
|
+
}
|
|
3395
|
+
|
|
3396
|
+
.edit-backup-op.op-undo {
|
|
3397
|
+
background: color-mix(in srgb, var(--lane-1) 16%, transparent);
|
|
3398
|
+
color: var(--lane-1);
|
|
3399
|
+
}
|
|
3400
|
+
|
|
3401
|
+
.edit-backup-op.op-drop {
|
|
3402
|
+
background: color-mix(in srgb, var(--del) 16%, transparent);
|
|
3403
|
+
color: var(--del);
|
|
3404
|
+
}
|
|
3405
|
+
|
|
3406
|
+
.edit-backup-op.op-revert {
|
|
3407
|
+
background: color-mix(in srgb, var(--add) 16%, transparent);
|
|
3408
|
+
color: var(--add);
|
|
3409
|
+
}
|
|
3410
|
+
|
|
3411
|
+
.edit-backup-actions {
|
|
3412
|
+
display: flex;
|
|
3413
|
+
align-items: center;
|
|
3414
|
+
gap: 8px;
|
|
3415
|
+
}
|
|
3416
|
+
|
|
3417
|
+
.edit-restore {
|
|
3418
|
+
display: flex;
|
|
3419
|
+
gap: 6px;
|
|
3420
|
+
}
|
|
3421
|
+
|
|
3422
|
+
.edit-restore input {
|
|
3423
|
+
width: 210px;
|
|
3424
|
+
max-width: 50vw;
|
|
3425
|
+
padding: 4px 8px;
|
|
3426
|
+
border: 1px solid var(--border-strong);
|
|
3427
|
+
border-radius: 7px;
|
|
3428
|
+
background: var(--bg-panel);
|
|
3429
|
+
color: var(--text);
|
|
3430
|
+
font: 12.5px var(--mono);
|
|
3431
|
+
}
|
|
3432
|
+
|
|
3433
|
+
.toast.has-action {
|
|
3434
|
+
display: flex;
|
|
3435
|
+
align-items: center;
|
|
3436
|
+
gap: 12px;
|
|
3437
|
+
pointer-events: auto;
|
|
3438
|
+
}
|
|
3439
|
+
|
|
3440
|
+
@media (max-width: 560px) {
|
|
3441
|
+
.edit-badge {
|
|
3442
|
+
height: 20px;
|
|
3443
|
+
padding: 0 6px;
|
|
3444
|
+
font-size: 10.5px;
|
|
3445
|
+
}
|
|
3446
|
+
|
|
3447
|
+
.mode-banner {
|
|
3448
|
+
padding: 5px 8px 5px 10px;
|
|
3449
|
+
font-size: 11.5px;
|
|
3450
|
+
}
|
|
3451
|
+
|
|
3452
|
+
dialog.edit-dialog {
|
|
3453
|
+
padding: 16px;
|
|
3454
|
+
}
|
|
3455
|
+
}
|
package/src/public/index.html
CHANGED
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
</button>
|
|
50
50
|
</div>
|
|
51
51
|
</header>
|
|
52
|
+
<div class="mode-banner" id="mode-banner" hidden></div>
|
|
52
53
|
<aside class="sidebar" id="sidebar" aria-label="References"></aside>
|
|
53
54
|
<main class="main" id="main"></main>
|
|
54
55
|
</div>
|
|
@@ -65,6 +66,7 @@
|
|
|
65
66
|
<dt><kbd>/</kbd></dt><dd>Search</dd>
|
|
66
67
|
<dt><kbd>Esc</kbd></dt><dd>Close panel / clear search</dd>
|
|
67
68
|
<dt><kbd>g</kbd> <kbd>h</kbd> / <kbd>c</kbd> / <kbd>r</kbd> / <kbd>i</kbd></dt><dd>History / Compare / Reflog / Insights</dd>
|
|
69
|
+
<dt><kbd>e</kbd></dt><dd>Edit selected commit (in edit mode)</dd>
|
|
68
70
|
</dl>
|
|
69
71
|
<h2>Search syntax</h2>
|
|
70
72
|
<dl>
|
package/src/public/js/compare.js
CHANGED
|
@@ -224,9 +224,9 @@ export function createCompare(app) {
|
|
|
224
224
|
const pct = travel.removedCount && travel.addedCount && backSteps > 0 ? (backSteps / path.length) * 100 : !travel.addedCount ? 100 : 0;
|
|
225
225
|
return html`<section class="travel" style="--back:${pct.toFixed(1)}%">
|
|
226
226
|
<div class="travel-row">
|
|
227
|
-
<button type="button" class="icon-btn" data-act="step" data-d="-1" title="Step back (←)" aria-label="Previous step">${raw('<svg viewBox="0 0 16 16" class="i"><path d="M10 4 6 8l4 4"/></svg>')}</button>
|
|
227
|
+
<button type="button" class="icon-btn" data-act="step" data-d="-1" title="Step back (←)" aria-label="Previous step" ${index === 0 ? "disabled" : ""}>${raw('<svg viewBox="0 0 16 16" class="i"><path d="M10 4 6 8l4 4"/></svg>')}</button>
|
|
228
228
|
<input type="range" class="travel-range" min="0" max="${path.length}" value="${index}" aria-label="Step through the journey from From to To">
|
|
229
|
-
<button type="button" class="icon-btn" data-act="step" data-d="1" title="Step forward (→)" aria-label="Next step">${raw('<svg viewBox="0 0 16 16" class="i"><path d="M6 4l4 4-4 4"/></svg>')}</button>
|
|
229
|
+
<button type="button" class="icon-btn" data-act="step" data-d="1" title="Step forward (→)" aria-label="Next step" ${index === path.length ? "disabled" : ""}>${raw('<svg viewBox="0 0 16 16" class="i"><path d="M6 4l4 4-4 4"/></svg>')}</button>
|
|
230
230
|
</div>
|
|
231
231
|
<div class="travel-ends muted small"><span>From</span><span>${plural(path.length, "step")} along the way</span><span>To</span></div>
|
|
232
232
|
<div class="travel-now">${stepLabel()}</div>
|
|
@@ -244,6 +244,10 @@ export function createCompare(app) {
|
|
|
244
244
|
if (box) {
|
|
245
245
|
$(".travel-now", box).innerHTML = String(stepLabel());
|
|
246
246
|
$(".travel-range", box).value = String(travel.index);
|
|
247
|
+
const prev = $('[data-act="step"][data-d="-1"]', box);
|
|
248
|
+
const next = $('[data-act="step"][data-d="1"]', box);
|
|
249
|
+
if (prev) prev.disabled = travel.index === 0;
|
|
250
|
+
if (next) next.disabled = travel.index === travel.path.length;
|
|
247
251
|
}
|
|
248
252
|
for (const row of $$(".mini-row", el)) row.classList.toggle("current", row.dataset.hash === currentTarget());
|
|
249
253
|
if (!files) return;
|
|
@@ -259,7 +263,9 @@ export function createCompare(app) {
|
|
|
259
263
|
|
|
260
264
|
function step(d) {
|
|
261
265
|
if (!travel) return;
|
|
262
|
-
|
|
266
|
+
const next = Math.max(0, Math.min(travel.path.length, travel.index + d));
|
|
267
|
+
if (next === travel.index) return;
|
|
268
|
+
travel.index = next;
|
|
263
269
|
showStep();
|
|
264
270
|
}
|
|
265
271
|
|
|
@@ -312,6 +318,11 @@ export function createCompare(app) {
|
|
|
312
318
|
travel = { ...r, diffFrom, index: atIndex > 0 ? atIndex : r.path.length };
|
|
313
319
|
}
|
|
314
320
|
|
|
321
|
+
const refLink = (c, name) => {
|
|
322
|
+
if (c.hash === WORKTREE) return "working tree";
|
|
323
|
+
const label = name === c.hash || c.hash.startsWith(name) ? c.hash.slice(0, 6) : name;
|
|
324
|
+
return html`<a class="sha-link" href="#/commit/${c.hash}" title="Open commit ${c.hash}">${label}</a>`;
|
|
325
|
+
};
|
|
315
326
|
out.innerHTML = String(html`
|
|
316
327
|
<div class="cmp-summary">
|
|
317
328
|
${side("From", from, spec.from)}
|
|
@@ -322,8 +333,8 @@ export function createCompare(app) {
|
|
|
322
333
|
${spec.mode === "merge-base" && r.removedCount ? html`<span class="muted">Showing only what To added since they diverged.</span>` : ""}</p>
|
|
323
334
|
${from.hash === to.hash ? empty("Same commit", "From and To point at the same snapshot.") : ""}
|
|
324
335
|
${travel && spec.mode === "direct" ? timeline() : ""}
|
|
325
|
-
${commitList(
|
|
326
|
-
${commitList(
|
|
336
|
+
${commitList(html`New in ${refLink(to, spec.to)} (${r.addedCount})`, r.added, r.addedCount, "added")}
|
|
337
|
+
${commitList(html`Only in ${refLink(from, spec.from)} (${r.removedCount})`, r.removed, r.removedCount, "removed")}
|
|
327
338
|
<div class="cmp-files"></div>`);
|
|
328
339
|
|
|
329
340
|
if (from.hash === to.hash) {
|
|
@@ -360,7 +371,9 @@ export function createCompare(app) {
|
|
|
360
371
|
|
|
361
372
|
el.addEventListener("input", (e) => {
|
|
362
373
|
if (e.target.classList.contains("travel-range")) {
|
|
363
|
-
|
|
374
|
+
const next = Number(e.target.value);
|
|
375
|
+
if (next === travel.index) return;
|
|
376
|
+
travel.index = next;
|
|
364
377
|
showStep();
|
|
365
378
|
} else if (e.target.name === "from" || e.target.name === "to") {
|
|
366
379
|
e.target.dataset.worktree = "";
|
|
@@ -382,8 +395,11 @@ export function createCompare(app) {
|
|
|
382
395
|
if (row && !e.target.closest("a")) {
|
|
383
396
|
const i = travel ? travel.path.findIndex((c) => c.hash === row.dataset.hash) : -1;
|
|
384
397
|
if (i >= 0 && $(".travel", el)) {
|
|
385
|
-
|
|
386
|
-
|
|
398
|
+
const next = i + 1;
|
|
399
|
+
if (next !== travel.index) {
|
|
400
|
+
travel.index = next;
|
|
401
|
+
showStep();
|
|
402
|
+
}
|
|
387
403
|
$(".travel", el).scrollIntoView({ block: "nearest", behavior: "smooth" });
|
|
388
404
|
} else {
|
|
389
405
|
app.navigate(`#/commit/${row.dataset.hash}`);
|
package/src/public/js/detail.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { api, html, raw, esc, $, avatar, refBadges, relTime, fullDate, short, bytes, plural, icons, copyText, loading, errorBox, empty, WORKTREE } from "./ui.js";
|
|
4
4
|
import { mountChanges } from "./diff.js";
|
|
5
5
|
import { detectLanguage, highlightLine } from "./highlight.js";
|
|
6
|
+
import { openEdit } from "./edit.js";
|
|
6
7
|
|
|
7
8
|
const enc = (p) => p.split("/").map(encodeURIComponent).join("/");
|
|
8
9
|
|
|
@@ -70,6 +71,7 @@ export function renderDetail(pane, app, hash, initial = {}) {
|
|
|
70
71
|
<button class="btn btn-sm" data-act="travel" data-which="to" title="Pick this as the destination of a time travel">Travel to here</button>`}
|
|
71
72
|
${!isWt && app.repo.head && c.hash !== app.repo.head ? html`<a class="btn btn-sm btn-ghost" href="#/compare/${c.hash}..HEAD" title="From this commit to where you are now">To HEAD</a>` : ""}
|
|
72
73
|
${!isWt && app.repo.changes ? html`<a class="btn btn-sm btn-ghost" href="#/compare/${c.hash}..${WORKTREE}" title="From this commit to your uncommitted working tree">To working tree</a>` : ""}
|
|
74
|
+
${!isWt && app.repo.edit ? html`<button class="btn btn-sm btn-edit" data-act="edit" title="Reword, change author or date, squash, drop or revert this commit">Edit</button>` : ""}
|
|
73
75
|
</div>
|
|
74
76
|
</div>
|
|
75
77
|
<div class="detail-tabs" role="tablist">
|
|
@@ -222,6 +224,8 @@ export function renderDetail(pane, app, hash, initial = {}) {
|
|
|
222
224
|
switch (t.dataset.act) {
|
|
223
225
|
case "travel":
|
|
224
226
|
return app.views.history.travelPick(t.dataset.which, commit);
|
|
227
|
+
case "edit":
|
|
228
|
+
return openEdit(app, commit);
|
|
225
229
|
case "copy":
|
|
226
230
|
return copyText(commit.hash, "Commit id copied");
|
|
227
231
|
case "blame":
|