refactor(mobile): remove unused native style constants (#10001)
This commit is contained in:
1 parent
1c59d3b72c
commit
3382b26c4f
3 files changed
-33
No files matched your search
@@ -3,30 +3,10 @@ import { describe, expect, it } from "vite-plus/test";
|
||||
import {
|
||||
buildNativeSourceRows,
|
||||
buildNativeSourceTokens,
|
||||
NATIVE_SOURCE_ROW_HEIGHT,
|
||||
NATIVE_SOURCE_STYLE,
|
||||
nativeSourceRowId,
|
||||
} from "./nativeSourceFileAdapter";
|
||||
import {
|
||||
NATIVE_REVIEW_DIFF_ROW_HEIGHT,
|
||||
NATIVE_REVIEW_DIFF_STYLE,
|
||||
} from "../review/nativeReviewDiffAdapter";
|
||||
|
||||
describe("nativeSourceFileAdapter", () => {
|
||||
it("uses the same compact code typography as the diff viewer", () => {
|
||||
expect(NATIVE_SOURCE_ROW_HEIGHT).toBe(NATIVE_REVIEW_DIFF_ROW_HEIGHT);
|
||||
expect(NATIVE_SOURCE_STYLE).toMatchObject({
|
||||
rowHeight: NATIVE_REVIEW_DIFF_STYLE.rowHeight,
|
||||
gutterWidth: NATIVE_REVIEW_DIFF_STYLE.gutterWidth,
|
||||
codePadding: NATIVE_REVIEW_DIFF_STYLE.codePadding,
|
||||
textVerticalInset: NATIVE_REVIEW_DIFF_STYLE.textVerticalInset,
|
||||
codeFontSize: NATIVE_REVIEW_DIFF_STYLE.codeFontSize,
|
||||
codeFontWeight: NATIVE_REVIEW_DIFF_STYLE.codeFontWeight,
|
||||
lineNumberFontSize: NATIVE_REVIEW_DIFF_STYLE.lineNumberFontSize,
|
||||
lineNumberFontWeight: NATIVE_REVIEW_DIFF_STYLE.lineNumberFontWeight,
|
||||
});
|
||||
});
|
||||
|
||||
it("maps plain source lines onto context rows with stable line numbers", () => {
|
||||
expect(buildNativeSourceRows(["const value = 1;", "\treturn value;"])).toEqual([
|
||||
{
|
||||
|
||||
@@ -4,17 +4,11 @@ import type {
|
||||
NativeReviewDiffToken,
|
||||
} from "../diffs/nativeReviewDiffSurface";
|
||||
import type { ResolvedMobileCodeSurface } from "../../lib/appearancePreferences";
|
||||
import { resolveMobileCodeSurface } from "../../lib/appearancePreferences";
|
||||
import { MOBILE_CODE_SURFACE, MOBILE_TYPOGRAPHY } from "../../lib/typography";
|
||||
import type { SourceHighlightTokens } from "./sourceHighlightingState";
|
||||
|
||||
export const NATIVE_SOURCE_ROW_HEIGHT = MOBILE_CODE_SURFACE.rowHeight;
|
||||
export const NATIVE_SOURCE_CONTENT_WIDTH = 32_000;
|
||||
|
||||
export const NATIVE_SOURCE_STYLE: NativeReviewDiffStyle = createNativeSourceStyle(
|
||||
resolveMobileCodeSurface(MOBILE_CODE_SURFACE.fontSize),
|
||||
);
|
||||
|
||||
export function createNativeSourceStyle(
|
||||
codeSurface: ResolvedMobileCodeSurface,
|
||||
): NativeReviewDiffStyle {
|
||||
|
||||
@@ -6,8 +6,6 @@ import type {
|
||||
import * as Arr from "effect/Array";
|
||||
import { pipe } from "effect/Function";
|
||||
import type { ResolvedMobileCodeSurface } from "../../lib/appearancePreferences";
|
||||
import { resolveMobileCodeSurface } from "../../lib/appearancePreferences";
|
||||
import { MOBILE_CODE_SURFACE } from "../../lib/typography";
|
||||
import { type MobileThemeId, type MobileThemeVariables } from "../../lib/mobileTheme";
|
||||
import { getMobileTerminalTheme, type TerminalAppearanceScheme } from "../terminal/terminalTheme";
|
||||
import { computeWordAltDiffRanges } from "./reviewWordDiffs";
|
||||
@@ -25,13 +23,8 @@ const NATIVE_HEX_COLOR = /^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i;
|
||||
const NATIVE_RGBA_COLOR =
|
||||
/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)(?:\s*,\s*([\d.]+))?\s*\)$/;
|
||||
|
||||
export const NATIVE_REVIEW_DIFF_ROW_HEIGHT = MOBILE_CODE_SURFACE.rowHeight;
|
||||
export const NATIVE_REVIEW_DIFF_CONTENT_WIDTH = 2_800;
|
||||
|
||||
export const NATIVE_REVIEW_DIFF_STYLE = createNativeReviewDiffStyle(
|
||||
resolveMobileCodeSurface(MOBILE_CODE_SURFACE.fontSize),
|
||||
);
|
||||
|
||||
function opaqueNativeHexColor(color: string, background: string): string {
|
||||
const hex = NATIVE_HEX_COLOR.exec(color);
|
||||
if (hex) return color;
|
||||
|
||||
Reference in new issue
Block a user