diff options
| author | Maze Winther <mazewinther@gmail.com> | 2026-04-14 18:17:14 +0200 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2026-04-14 18:17:14 +0200 |
| commit | 6de6c7fd95de1de9d8d3107eaf7ce1dd150ed094 (patch) | |
| tree | 75d5eb387b867449fc2218f5fe9b3acc70731561 /apps/web/src/services | |
| parent | 34c67ef8e85eafd6dfe6808280c807aceb00a345 (diff) | |
| download | opencut-6de6c7fd95de1de9d8d3107eaf7ce1dd150ed094.tar.gz | |
refactor: move constants to domain modules
Diffstat (limited to 'apps/web/src/services')
9 files changed, 19 insertions, 15 deletions
diff --git a/apps/web/src/services/renderer/nodes/text-node.ts b/apps/web/src/services/renderer/nodes/text-node.ts index fc503991..c9e13261 100644 --- a/apps/web/src/services/renderer/nodes/text-node.ts +++ b/apps/web/src/services/renderer/nodes/text-node.ts @@ -5,7 +5,7 @@ import type { Transform } from "@/lib/rendering"; import { CORNER_RADIUS_MAX, CORNER_RADIUS_MIN, -} from "@/constants/text-constants"; +} from "@/lib/text/background"; import { drawTextDecoration, getTextBackgroundRect, diff --git a/apps/web/src/services/renderer/scene-builder.ts b/apps/web/src/services/renderer/scene-builder.ts index 68ba956b..47e6139c 100644 --- a/apps/web/src/services/renderer/scene-builder.ts +++ b/apps/web/src/services/renderer/scene-builder.ts @@ -11,7 +11,7 @@ import { BlurBackgroundNode } from "./nodes/blur-background-node"; import { EffectLayerNode } from "./nodes/effect-layer-node"; import type { AnyBaseNode } from "./nodes/base-node"; import type { TBackground, TCanvasSize } from "@/lib/project/types"; -import { DEFAULT_BACKGROUND_BLUR_INTENSITY } from "@/lib/background/constants"; +import { DEFAULT_BACKGROUND_BLUR_INTENSITY } from "@/lib/background/blur"; const PREVIEW_MAX_IMAGE_SIZE = 2048; diff --git a/apps/web/src/services/storage/migrations/__tests__/v1-to-v2.test.ts b/apps/web/src/services/storage/migrations/__tests__/v1-to-v2.test.ts index 7a0617a7..56c83403 100644 --- a/apps/web/src/services/storage/migrations/__tests__/v1-to-v2.test.ts +++ b/apps/web/src/services/storage/migrations/__tests__/v1-to-v2.test.ts @@ -1,9 +1,9 @@ import { describe, expect, test } from "bun:test"; import { DEFAULT_BACKGROUND_BLUR_INTENSITY, - DEFAULT_BACKGROUND_COLOR, -} from "@/lib/background/constants"; -import { DEFAULT_CANVAS_SIZE } from "@/lib/canvas/constants"; +} from "@/lib/background/blur"; +import { DEFAULT_BACKGROUND_COLOR } from "@/lib/background/color"; +import { DEFAULT_CANVAS_SIZE } from "@/lib/canvas/sizes"; const DEFAULT_FPS = 30; import type { MediaAssetData } from "@/services/storage/types"; import { getProjectId, transformProjectV1ToV2 } from "../transformers/v1-to-v2"; diff --git a/apps/web/src/services/storage/migrations/__tests__/v20-to-v21.test.ts b/apps/web/src/services/storage/migrations/__tests__/v20-to-v21.test.ts index af2124c8..3d77a775 100644 --- a/apps/web/src/services/storage/migrations/__tests__/v20-to-v21.test.ts +++ b/apps/web/src/services/storage/migrations/__tests__/v20-to-v21.test.ts @@ -1,7 +1,8 @@ import { describe, expect, test } from "bun:test"; -import { DEFAULT_BLUR_INTENSITY } from "@/constants/project-constants"; import { transformProjectV20ToV21 } from "../transformers/v20-to-v21"; +const LEGACY_DEFAULT_BACKGROUND_BLUR_INTENSITY = 50; + describe("V20 to V21 Migration", () => { test("multiplies blur background intensity by 5", () => { const result = transformProjectV20ToV21({ @@ -46,7 +47,9 @@ describe("V20 to V21 Migration", () => { expect(result.skipped).toBe(false); const settings = result.project.settings as Record<string, unknown>; const background = settings.background as Record<string, unknown>; - expect(background.blurIntensity).toBe(DEFAULT_BLUR_INTENSITY); + expect(background.blurIntensity).toBe( + LEGACY_DEFAULT_BACKGROUND_BLUR_INTENSITY, + ); }); test("leaves color background unchanged", () => { diff --git a/apps/web/src/services/storage/migrations/transformers/v1-to-v2.ts b/apps/web/src/services/storage/migrations/transformers/v1-to-v2.ts index 6313c311..b6b38f3c 100644 --- a/apps/web/src/services/storage/migrations/transformers/v1-to-v2.ts +++ b/apps/web/src/services/storage/migrations/transformers/v1-to-v2.ts @@ -1,8 +1,8 @@ import { DEFAULT_BACKGROUND_BLUR_INTENSITY, - DEFAULT_BACKGROUND_COLOR, -} from "@/lib/background/constants"; -import { DEFAULT_CANVAS_SIZE } from "@/lib/canvas/constants"; +} from "@/lib/background/blur"; +import { DEFAULT_BACKGROUND_COLOR } from "@/lib/background/color"; +import { DEFAULT_CANVAS_SIZE } from "@/lib/canvas/sizes"; const DEFAULT_FPS = 30; import { IndexedDBAdapter } from "@/services/storage/indexeddb-adapter"; import type { MediaAssetData } from "@/services/storage/types"; diff --git a/apps/web/src/services/storage/migrations/transformers/v14-to-v15.ts b/apps/web/src/services/storage/migrations/transformers/v14-to-v15.ts index e75c541b..36e3d9a8 100644 --- a/apps/web/src/services/storage/migrations/transformers/v14-to-v15.ts +++ b/apps/web/src/services/storage/migrations/transformers/v14-to-v15.ts @@ -1,4 +1,4 @@ -import { STICKER_INTRINSIC_SIZE_FALLBACK } from "@/constants/sticker-constants";
+import { STICKER_INTRINSIC_SIZE_FALLBACK } from "@/lib/stickers/intrinsic-size";
import type { MigrationResult, ProjectRecord } from "./types";
import { getProjectId, isRecord } from "./utils";
diff --git a/apps/web/src/services/storage/migrations/transformers/v20-to-v21.ts b/apps/web/src/services/storage/migrations/transformers/v20-to-v21.ts index 63ad24de..f5194bda 100644 --- a/apps/web/src/services/storage/migrations/transformers/v20-to-v21.ts +++ b/apps/web/src/services/storage/migrations/transformers/v20-to-v21.ts @@ -1,8 +1,9 @@ -import { DEFAULT_BLUR_INTENSITY } from "@/constants/project-constants"; import { INTENSITY_TO_SIGMA_DIVISOR } from "@/lib/effects/definitions/blur"; import type { MigrationResult, ProjectRecord } from "./types"; import { getProjectId, isRecord } from "./utils"; +const LEGACY_DEFAULT_BACKGROUND_BLUR_INTENSITY = 50; + export function transformProjectV20ToV21({ project, }: { @@ -51,7 +52,7 @@ function migrateBackgroundBlurScale({ const blurIntensity = typeof raw === "number" && Number.isFinite(raw) ? raw * INTENSITY_TO_SIGMA_DIVISOR - : DEFAULT_BLUR_INTENSITY; + : LEGACY_DEFAULT_BACKGROUND_BLUR_INTENSITY; return { ...project, diff --git a/apps/web/src/services/transcription/service.ts b/apps/web/src/services/transcription/service.ts index fa657032..443a4230 100644 --- a/apps/web/src/services/transcription/service.ts +++ b/apps/web/src/services/transcription/service.ts @@ -7,7 +7,7 @@ import type { import {
DEFAULT_TRANSCRIPTION_MODEL,
TRANSCRIPTION_MODELS,
-} from "@/constants/transcription-constants";
+} from "@/lib/transcription/models";
import type { WorkerMessage, WorkerResponse } from "./worker";
type ProgressCallback = (progress: TranscriptionProgress) => void;
diff --git a/apps/web/src/services/transcription/worker.ts b/apps/web/src/services/transcription/worker.ts index e22fe796..928b580e 100644 --- a/apps/web/src/services/transcription/worker.ts +++ b/apps/web/src/services/transcription/worker.ts @@ -7,7 +7,7 @@ import type { TranscriptionSegment } from "@/lib/transcription/types"; import {
DEFAULT_CHUNK_LENGTH_SECONDS,
DEFAULT_STRIDE_SECONDS,
-} from "@/constants/transcription-constants";
+} from "@/lib/transcription/audio";
export type WorkerMessage =
| { type: "init"; modelId: string }
|
