@reviewflow/ui 6.24.0 → 6.25.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/package.json +17 -2
- package/src/components/branch-diff/diff-font.ts +26 -0
- package/src/components/branch-diff/diff-themes.ts +53 -1
- package/src/components/branch-diff/reviewflow-diff-selection.ts +11 -0
- package/src/components/branch-diff/reviewflow-diff-themes.ts +2218 -0
- package/src/components/branch-diff/use-diff-settings.tsx +15 -3
- package/src/components/branch-diff/whitespace-button.tsx +2 -2
- package/src/components/diff-settings-section.tsx +189 -0
- package/src/components/diff-theme-preview.tsx +63 -0
- package/src/components/file-kind.ts +91 -0
- package/src/components/file-type-icon.tsx +70 -0
- package/src/components/pull-request-diff-annotations.tsx +5 -2
- package/src/components/pull-request-diff-jump.ts +59 -1
- package/src/components/pull-request-diff-overview-tree.ts +57 -0
- package/src/components/pull-request-diff-overview.tsx +488 -88
- package/src/components/pull-request-diff-tree-files.ts +64 -0
- package/src/components/pull-request-diff-tree.tsx +232 -0
- package/src/components/pull-request-diff-view.tsx +111 -27
- package/src/components/pull-request-diff-viewer.tsx +23 -2
- package/src/components/pull-request-files.tsx +4 -4
- package/src/components/pull-request-panel.tsx +4 -2
- package/src/components/pull-request-screen.tsx +16 -4
- package/src/components/scroll-parent.ts +20 -0
- package/src/components/tooltip-icon-button.tsx +27 -0
- package/src/editor/code-editor.tsx +1 -0
- package/src/editor/code-token-colors.css +39 -0
- package/src/editor/codeHighlight.ts +2 -1
- package/src/editor/markdown-editor.css +1 -34
- package/src/editor/markdown-editor.tsx +1 -0
- package/src/index.ts +6 -6
- package/src/palette.ts +22 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reviewflow/ui",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.25.0",
|
|
4
4
|
"description": "react-native pull request screen components. Consumed as SOURCES (no build): exports resolve `default` to ./src/index.ts, which metro transforms like the app's own files; the consuming app's css must @source this package's src so tailwind keeps its classes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"alouette",
|
|
@@ -46,6 +46,10 @@
|
|
|
46
46
|
"types": "./src/components/branch-diff/diff-worker-pool.tsx",
|
|
47
47
|
"browser": "./src/components/branch-diff/diff-worker-pool.web.tsx",
|
|
48
48
|
"default": "./src/components/branch-diff/diff-worker-pool.tsx"
|
|
49
|
+
},
|
|
50
|
+
"./palette": {
|
|
51
|
+
"types": "./src/palette.ts",
|
|
52
|
+
"default": "./src/palette.ts"
|
|
49
53
|
}
|
|
50
54
|
},
|
|
51
55
|
"publishConfig": {
|
|
@@ -68,18 +72,22 @@
|
|
|
68
72
|
"@lezer/highlight": "1.2.3",
|
|
69
73
|
"@lezer/markdown": "1.7.2",
|
|
70
74
|
"@pierre/diffs": "1.5.2",
|
|
71
|
-
"@
|
|
75
|
+
"@pierre/trees": "1.0.0-beta.6",
|
|
76
|
+
"@reviewflow/sdk": "6.25.0",
|
|
72
77
|
"@tanstack/markdown": "0.0.13",
|
|
73
78
|
"alouette-icons": "12.0.0",
|
|
74
79
|
"gemoji": "8.1.0",
|
|
75
80
|
"htmlparser2": "12.0.0"
|
|
76
81
|
},
|
|
77
82
|
"devDependencies": {
|
|
83
|
+
"@pierre/theme": "2.0.0",
|
|
78
84
|
"@storybook/react-native": "10.6.0",
|
|
79
85
|
"@types/react": "19.2.18",
|
|
80
86
|
"@typescript/native": "npm:typescript@7.0.2",
|
|
81
87
|
"alouette": "25.0.1",
|
|
88
|
+
"colorjs.io": "0.6.0-alpha.1",
|
|
82
89
|
"react": "19.2.8",
|
|
90
|
+
"react-dom": "19.2.8",
|
|
83
91
|
"react-native": "0.86.2",
|
|
84
92
|
"react-native-safe-area-context": "5.8.0",
|
|
85
93
|
"react-native-svg": "15.15.5",
|
|
@@ -89,13 +97,20 @@
|
|
|
89
97
|
"peerDependencies": {
|
|
90
98
|
"alouette": "^25.0.0",
|
|
91
99
|
"react": "^19.2.3",
|
|
100
|
+
"react-dom": "^19.2.3",
|
|
92
101
|
"react-native": "*",
|
|
93
102
|
"react-native-svg": "*"
|
|
94
103
|
},
|
|
104
|
+
"peerDependenciesMeta": {
|
|
105
|
+
"react-dom": {
|
|
106
|
+
"optional": true
|
|
107
|
+
}
|
|
108
|
+
},
|
|
95
109
|
"engines": {
|
|
96
110
|
"node": ">=22.18.0"
|
|
97
111
|
},
|
|
98
112
|
"scripts": {
|
|
113
|
+
"build:code-theme": "node build-code-theme.ts",
|
|
99
114
|
"lint": "pnpm run lint:oxlint && pnpm run lint:eslint",
|
|
100
115
|
"lint:eslint": "pnpm --dir '../..' exec eslint --quiet 'packages/ui'",
|
|
101
116
|
"lint:oxlint": "pnpm --dir '../..' exec oxlint --quiet 'packages/ui'",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { DiffFont } from "@reviewflow/sdk";
|
|
2
|
+
|
|
3
|
+
const alouetteMono = "var(--font-mono)";
|
|
4
|
+
|
|
5
|
+
/** What would end the declaration, the rule or the style, or open a comment. */
|
|
6
|
+
const outsideAFontFamily = /[\n\r*/;<>\\{}]/g;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The CSS `font-family` of the diff's code; null keeps pierre's own. A custom
|
|
10
|
+
* one falls back to alouette's mono, for a font this machine does not have.
|
|
11
|
+
* alouette's `--font-mono` is declared on the document root, which pierre's
|
|
12
|
+
* shadow root inherits.
|
|
13
|
+
*/
|
|
14
|
+
export const diffFontFamily = (
|
|
15
|
+
font: DiffFont,
|
|
16
|
+
customFont: string,
|
|
17
|
+
): string | null => {
|
|
18
|
+
if (font === "pierre") return null;
|
|
19
|
+
const custom = customFont.replaceAll(outsideAFontFamily, "").trim();
|
|
20
|
+
if (font === "custom" && custom !== "") return `${custom}, ${alouetteMono}`;
|
|
21
|
+
return alouetteMono;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** For a pierre file's `unsafeCSS`: its code in `fontFamily`. */
|
|
25
|
+
export const diffFontCSS = (fontFamily: string | null): string =>
|
|
26
|
+
fontFamily === null ? "" : `:host { --diffs-font-family: ${fontFamily}; }`;
|
|
@@ -1,6 +1,58 @@
|
|
|
1
|
+
import { registerCustomTheme } from "@pierre/diffs";
|
|
2
|
+
import type { DiffTheme } from "@reviewflow/sdk";
|
|
3
|
+
import { diffThemeNames as sdkDiffThemeNames } from "@reviewflow/sdk";
|
|
4
|
+
|
|
1
5
|
/**
|
|
2
6
|
* The theme list lives in `@reviewflow/sdk`, which a server can import to
|
|
3
7
|
* validate a stored setting; re-exported here so the ui's imports stay put.
|
|
4
8
|
*/
|
|
5
9
|
export type { DiffTheme } from "@reviewflow/sdk";
|
|
6
|
-
export {
|
|
10
|
+
export { diffThemeOptions, diffThemes } from "@reviewflow/sdk";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* How much of its git color an added or deleted line of the reviewflow theme
|
|
14
|
+
* mixes into the code's background: less than pierre's 12% and 20%, which its
|
|
15
|
+
* saturated palette greens and reds read too dark at.
|
|
16
|
+
*/
|
|
17
|
+
const reviewflowChangeMix = { light: 6, dark: 15 };
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* For a pierre file's `unsafeCSS`: its added and deleted lines' background.
|
|
21
|
+
* Through the percentages pierre mixes a line with (`--mix-light`,
|
|
22
|
+
* `--mix-dark`), not `--diffs-bg-addition-override`: pierre mixes that one
|
|
23
|
+
* with the background again, as the color it mixes towards.
|
|
24
|
+
*/
|
|
25
|
+
export const changeBackgroundCSS = (theme: DiffTheme): string =>
|
|
26
|
+
theme === "reviewflow"
|
|
27
|
+
? `:host [data-line], :host [data-no-newline] { --mix-light: ${String(100 - reviewflowChangeMix.light)}%; --mix-dark: ${String(100 - reviewflowChangeMix.dark)}%; }`
|
|
28
|
+
: "";
|
|
29
|
+
|
|
30
|
+
let reviewflowThemesRegistered = false;
|
|
31
|
+
|
|
32
|
+
const registerReviewflowThemes = (): void => {
|
|
33
|
+
if (reviewflowThemesRegistered) return;
|
|
34
|
+
reviewflowThemesRegistered = true;
|
|
35
|
+
registerCustomTheme("reviewflow-light", () =>
|
|
36
|
+
import("./reviewflow-diff-themes.ts").then(
|
|
37
|
+
({ reviewflowLightTheme }) => reviewflowLightTheme,
|
|
38
|
+
),
|
|
39
|
+
);
|
|
40
|
+
registerCustomTheme("reviewflow-dark", () =>
|
|
41
|
+
import("./reviewflow-diff-themes.ts").then(
|
|
42
|
+
({ reviewflowDarkTheme }) => reviewflowDarkTheme,
|
|
43
|
+
),
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The shiki theme names of `theme`, for `@pierre/diffs`. Registers the
|
|
49
|
+
* reviewflow themes first, which pierre resolves from its own registry: a
|
|
50
|
+
* module import with that side effect could be dropped by a bundler, since
|
|
51
|
+
* this package declares itself free of side effects.
|
|
52
|
+
*/
|
|
53
|
+
export const diffThemeNames = (
|
|
54
|
+
theme: DiffTheme,
|
|
55
|
+
): { light: string; dark: string } => {
|
|
56
|
+
registerReviewflowThemes();
|
|
57
|
+
return sdkDiffThemeNames(theme);
|
|
58
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* Generated by build-code-theme.ts from the palette in src/palette.ts. DO NOT EDIT. */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The background the reviewflow diff theme's selected lines mix with, apart
|
|
5
|
+
* from its modified color, which is darker (`build-code-theme.ts`). Its own
|
|
6
|
+
* module: the themes it comes with are loaded lazily.
|
|
7
|
+
*/
|
|
8
|
+
export const reviewflowSelectionColors: Record<"dark" | "light", string> = {
|
|
9
|
+
light: "#228adf",
|
|
10
|
+
dark: "#47a5f4",
|
|
11
|
+
};
|