@young1lin/dsh-ui-gitworkbench 0.1.6 → 0.1.7

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.
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Which way the History tab arranges its panes.
3
+ *
4
+ * Two arrangements, kept because they are good at different things and the
5
+ * drawer's width is fixed, so neither wins outright.
6
+ *
7
+ * `columns` puts the commit list beside the tree and the diff. The list is then
8
+ * as tall as the drawer, which is what makes a log scannable — but it is a 26%
9
+ * column, and measured on a 1700px drawer that left about 420px, enough for a
10
+ * subject of roughly forty characters before the ellipsis.
11
+ *
12
+ * `stacked` spans the list across the top instead, the way IDEA's git log does.
13
+ * No subject is cut and thirty rows fit where the column fitted thirteen, at
14
+ * the cost of the height the diff below it would otherwise have had.
15
+ */
16
+ export type HistoryLayout = 'columns' | 'stacked'
17
+
18
+ /** Every layout, in the order the switch offers them. */
19
+ export const HISTORY_LAYOUTS: readonly HistoryLayout[] = ['columns', 'stacked']
20
+
21
+ /** The arrangement the tab had first, and what a reader who never touches the
22
+ * switch gets. */
23
+ export const DEFAULT_HISTORY_LAYOUT: HistoryLayout = 'columns'
24
+
25
+ /**
26
+ * Narrow a stored value to a layout this build has.
27
+ *
28
+ * Storage is a durable boundary: the value on disk was written by whatever
29
+ * build the reader ran last, and a layout this one has since dropped must fall
30
+ * back rather than reach the stylesheet.
31
+ * @param value - value read back from storage.
32
+ * @returns whether it names a layout.
33
+ */
34
+ export function isHistoryLayout(value: unknown): value is HistoryLayout {
35
+ return HISTORY_LAYOUTS.some(known => known === value)
36
+ }
37
+
38
+ /**
39
+ * How tall one commit row is, per layout.
40
+ *
41
+ * The two differ because the row itself differs: a column has no width to
42
+ * spend, so the hash, the author and the date take a line of their own above
43
+ * the subject; spanning the drawer they all fit on one line and a 48px row
44
+ * would spend the stacked layout's scarcest axis on padding.
45
+ *
46
+ * This is the ONE home for the number. The panel publishes the active entry as
47
+ * `--gs-commit-row` and the stylesheet sizes the row from it, while the lane
48
+ * graph draws each row's segment exactly that tall — the lanes only meet across
49
+ * the seam between rows if both come from here. Guarded by
50
+ * `tests/commit-row-height.test.ts`.
51
+ */
52
+ export const COMMIT_ROW_H: Record<HistoryLayout, number> = { columns: 48, stacked: 28 }
@@ -47,6 +47,8 @@ export type WorkbenchKey =
47
47
  | 'bgNone' | 'bgChoose' | 'bgClear' | 'bgBlur' | 'bgVeil' | 'bgWorking' | 'bgFailed' | 'bgTooBig'
48
48
  | 'cssPlaceholder' | 'cssImport' | 'cssApply' | 'cssUnapplied' | 'styleFailed'
49
49
  | 'resizeLabel' | 'resizeCommits' | 'resizeTree' | 'resizeSides'
50
+ // History arrangement switch: the commit list beside the diff, or above it
51
+ | 'historyLayout' | 'layoutColumns' | 'layoutStacked'
50
52
  | 'expandAll' | 'collapseAll' | 'noBranch'
51
53
  | 'copyCommit' | 'copiedCommit'
52
54
  // write operations
@@ -149,6 +151,9 @@ export const zh: Record<WorkbenchKey, string> = {
149
151
  styleFailed: '保存失败',
150
152
  resizeLabel: '拖动调整抽屉宽度',
151
153
  resizeCommits: '拖动调整提交列表宽度',
154
+ historyLayout: '提交列表布局',
155
+ layoutColumns: '并排:列表与差异分列',
156
+ layoutStacked: '上下:列表横跨顶部',
152
157
  resizeTree: '拖动调整文件树宽度',
153
158
  resizeSides: '拖动调整左右两栏宽度',
154
159
  sourceLabel: '统计来源切换',
@@ -384,6 +389,9 @@ export const en: Record<WorkbenchKey, string> = {
384
389
  styleFailed: 'Could not save',
385
390
  resizeLabel: 'Drag to resize the drawer',
386
391
  resizeCommits: 'Drag to resize the commit list',
392
+ historyLayout: 'Commit list layout',
393
+ layoutColumns: 'Side by side: list beside the diff',
394
+ layoutStacked: 'Stacked: list across the top',
387
395
  resizeTree: 'Drag to resize the file tree',
388
396
  resizeSides: 'Drag to resize the two columns',
389
397
  sourceLabel: 'Switch stats source',