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/constants | |
| parent | 34c67ef8e85eafd6dfe6808280c807aceb00a345 (diff) | |
| download | opencut-6de6c7fd95de1de9d8d3107eaf7ce1dd150ed094.tar.gz | |
refactor: move constants to domain modules
Diffstat (limited to 'apps/web/src/constants')
| -rw-r--r-- | apps/web/src/constants/animation-constants.ts | 1 | ||||
| -rw-r--r-- | apps/web/src/constants/editor-constants.ts | 23 | ||||
| -rw-r--r-- | apps/web/src/constants/export-constants.ts | 12 | ||||
| -rw-r--r-- | apps/web/src/constants/font-constants.ts | 11 | ||||
| -rw-r--r-- | apps/web/src/constants/guide-constants.ts | 4 | ||||
| -rw-r--r-- | apps/web/src/constants/language-constants.ts | 14 | ||||
| -rw-r--r-- | apps/web/src/constants/mask-constants.ts | 4 | ||||
| -rw-r--r-- | apps/web/src/constants/project-constants.ts | 27 | ||||
| -rw-r--r-- | apps/web/src/constants/site-constants.ts | 69 | ||||
| -rw-r--r-- | apps/web/src/constants/sticker-constants.ts | 9 | ||||
| -rw-r--r-- | apps/web/src/constants/text-constants.ts | 11 | ||||
| -rw-r--r-- | apps/web/src/constants/timeline-constants.ts | 75 | ||||
| -rw-r--r-- | apps/web/src/constants/transcription-constants.ts | 60 |
13 files changed, 0 insertions, 320 deletions
diff --git a/apps/web/src/constants/animation-constants.ts b/apps/web/src/constants/animation-constants.ts deleted file mode 100644 index ab932ea2..00000000 --- a/apps/web/src/constants/animation-constants.ts +++ /dev/null @@ -1 +0,0 @@ -export const MIN_TRANSFORM_SCALE = 0.01; diff --git a/apps/web/src/constants/editor-constants.ts b/apps/web/src/constants/editor-constants.ts deleted file mode 100644 index 6428af32..00000000 --- a/apps/web/src/constants/editor-constants.ts +++ /dev/null @@ -1,23 +0,0 @@ -export type TPlatformLayout = - | "tiktok" - | "instagram" - | "youtube" - | "snapchat"; - -export const PREVIEW_ZOOM_PRESETS = [25, 50, 75, 100, 150, 200]; - -export const PREVIEW_ZOOM = { - min: 0.25, - max: 16, - step: 1.25, -}; - -export const PANEL_CONFIG = { - panels: { - tools: 25, - preview: 50, - properties: 25, - mainContent: 50, - timeline: 50, - }, -}; diff --git a/apps/web/src/constants/export-constants.ts b/apps/web/src/constants/export-constants.ts deleted file mode 100644 index 5579e7f0..00000000 --- a/apps/web/src/constants/export-constants.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { ExportOptions } from "@/lib/export";
-
-export const DEFAULT_EXPORT_OPTIONS = {
- format: "mp4",
- quality: "high",
- includeAudio: true,
-} satisfies ExportOptions;
-
-export const EXPORT_MIME_TYPES = {
- webm: "video/webm",
- mp4: "video/mp4",
-} as const;
diff --git a/apps/web/src/constants/font-constants.ts b/apps/web/src/constants/font-constants.ts deleted file mode 100644 index 44f8220f..00000000 --- a/apps/web/src/constants/font-constants.ts +++ /dev/null @@ -1,11 +0,0 @@ -export const SYSTEM_FONTS = new Set([
- "Arial",
- "Helvetica",
- "Times New Roman",
- "Courier New",
- "Verdana",
- "Georgia",
- "monospace",
- "sans-serif",
- "serif",
-]);
diff --git a/apps/web/src/constants/guide-constants.ts b/apps/web/src/constants/guide-constants.ts deleted file mode 100644 index 4d5c6c41..00000000 --- a/apps/web/src/constants/guide-constants.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const GRID_MIN = 1;
-export const GRID_MAX = 24;
-
-export const DEFAULT_GRID_CONFIG = { rows: 3, cols: 3 } as const;
diff --git a/apps/web/src/constants/language-constants.ts b/apps/web/src/constants/language-constants.ts deleted file mode 100644 index e5678145..00000000 --- a/apps/web/src/constants/language-constants.ts +++ /dev/null @@ -1,14 +0,0 @@ -export const LANGUAGES = [ - { code: "en", name: "English" }, - { code: "es", name: "Spanish" }, - { code: "it", name: "Italian" }, - { code: "fr", name: "French" }, - { code: "de", name: "German" }, - { code: "pt", name: "Portuguese" }, - { code: "ru", name: "Russian" }, - { code: "ja", name: "Japanese" }, - { code: "zh", name: "Chinese" }, -] as const; - -export type Language = (typeof LANGUAGES)[number]; -export type LanguageCode = Language["code"]; diff --git a/apps/web/src/constants/mask-constants.ts b/apps/web/src/constants/mask-constants.ts deleted file mode 100644 index 2b453e0e..00000000 --- a/apps/web/src/constants/mask-constants.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const MAX_FEATHER = 1000;
-export const FEATHER_HANDLE_SCALE = 0.11;
-export const DEFAULT_SHAPE_MASK_SHORT_SIDE_RATIO = 0.6;
-export const MIN_MASK_DIMENSION = 0.01;
diff --git a/apps/web/src/constants/project-constants.ts b/apps/web/src/constants/project-constants.ts deleted file mode 100644 index 96e178dc..00000000 --- a/apps/web/src/constants/project-constants.ts +++ /dev/null @@ -1,27 +0,0 @@ -import type { TCanvasSize } from "@/lib/project/types"; - -export const DEFAULT_CANVAS_PRESETS: TCanvasSize[] = [ - { width: 1920, height: 1080 }, - { width: 1080, height: 1920 }, - { width: 1080, height: 1080 }, - { width: 1440, height: 1080 }, -]; - -export const FPS_PRESETS = [ - { value: "24", label: "24 fps" }, - { value: "25", label: "25 fps" }, - { value: "30", label: "30 fps" }, - { value: "60", label: "60 fps" }, - { value: "120", label: "120 fps" }, -] as const; - -export const BLUR_INTENSITY_PRESETS: { label: string; value: number }[] = [ - { label: "Light", value: 50 }, - { label: "Medium", value: 250 }, - { label: "Heavy", value: 500 }, -] as const; - -export const DEFAULT_CANVAS_SIZE: TCanvasSize = { width: 1920, height: 1080 }; -export const DEFAULT_FPS = 30; -export const DEFAULT_BLUR_INTENSITY = 50; -export const DEFAULT_COLOR = "#000000"; diff --git a/apps/web/src/constants/site-constants.ts b/apps/web/src/constants/site-constants.ts deleted file mode 100644 index ea2d2fe2..00000000 --- a/apps/web/src/constants/site-constants.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { OcDataBuddyIcon, OcMarbleIcon } from "@/components/icons"; - -export const SITE_URL = "https://opencut.app"; - -export const SITE_INFO = { - title: "OpenCut", - description: - "A simple but powerful video editor that gets the job done. In your browser.", - url: SITE_URL, - openGraphImage: "/open-graph/default.jpg", - twitterImage: "/open-graph/default.jpg", - favicon: "/favicon.ico", -}; - -export type ExternalTool = { - name: string; - description: string; - url: string; - icon: React.ElementType; -}; - -export const EXTERNAL_TOOLS: ExternalTool[] = [ - { - name: "Marble", - description: - "Modern headless CMS for content management and the blog for OpenCut", - url: "https://marblecms.com?utm_source=opencut", - icon: OcMarbleIcon, - }, - { - name: "Databuddy", - description: "GDPR compliant analytics and user insights for OpenCut", - url: "https://databuddy.cc?utm_source=opencut", - icon: OcDataBuddyIcon, - }, -]; - -export const DEFAULT_LOGO_URL = "/logos/opencut/svg/logo.svg"; - -export const SOCIAL_LINKS = { - x: "https://x.com/opencutapp", - github: "https://github.com/OpenCut-app/OpenCut", - discord: "https://discord.com/invite/Mu3acKZvCp", -}; - -export type Sponsor = { - name: string; - url: string; - logo: string; - description: string; - invertOnDark?: boolean; -}; - -export const SPONSORS: Sponsor[] = [ - { - name: "Fal.ai", - url: "https://fal.ai?utm_source=opencut", - logo: "/logos/others/fal.svg", - description: "Generative image, video, and audio models all in one place.", - invertOnDark: true, - }, - { - name: "Vercel", - url: "https://vercel.com?utm_source=opencut", - logo: "/logos/others/vercel.svg", - description: "Platform where we deploy and host OpenCut.", - invertOnDark: true, - }, -]; diff --git a/apps/web/src/constants/sticker-constants.ts b/apps/web/src/constants/sticker-constants.ts deleted file mode 100644 index 29e48c25..00000000 --- a/apps/web/src/constants/sticker-constants.ts +++ /dev/null @@ -1,9 +0,0 @@ -export const STICKER_INTRINSIC_SIZE_FALLBACK = 200; - -export const STICKER_CATEGORIES = { - all: "All", - // v0.4.0 - // logos: "Logos", - flags: "Flags", - shapes: "Shapes", -}; diff --git a/apps/web/src/constants/text-constants.ts b/apps/web/src/constants/text-constants.ts deleted file mode 100644 index 67833949..00000000 --- a/apps/web/src/constants/text-constants.ts +++ /dev/null @@ -1,11 +0,0 @@ -export const MIN_FONT_SIZE = 5;
-export const MAX_FONT_SIZE = 300;
-
-/**
- * higher value: smaller font size
- * lower value: larger font size
- */
-export const FONT_SIZE_SCALE_REFERENCE = 90;
-
-export const CORNER_RADIUS_MIN = 0;
-export const CORNER_RADIUS_MAX = 100;
diff --git a/apps/web/src/constants/timeline-constants.ts b/apps/web/src/constants/timeline-constants.ts deleted file mode 100644 index 99fa2d2d..00000000 --- a/apps/web/src/constants/timeline-constants.ts +++ /dev/null @@ -1,75 +0,0 @@ -import type { TrackType } from "@/lib/timeline";
-
-export const TRACK_CONFIG: Record<
- TrackType,
- {
- height: number;
- defaultName: string;
- }
-> = {
- video: {
- height: 65,
- defaultName: "Video track",
- },
- text: {
- height: 25,
- defaultName: "Text track",
- },
- audio: {
- height: 50,
- defaultName: "Audio track",
- },
- graphic: {
- height: 25,
- defaultName: "Graphic track",
- },
- effect: {
- height: 25,
- defaultName: "Effect track",
- },
-} as const;
-
-export const ELEMENT_TYPE_CONFIG: Record<
- TrackType,
- {
- background: string;
- waveformColor?: string;
- }
-> = {
- video: { background: "transparent" },
- text: { background: "bg-[#5DBAA0]" },
- audio: {
- background: "bg-[#8F5DBA]",
- waveformColor: "rgba(255, 255, 255, 0.5)",
- },
- graphic: { background: "bg-[#BA5D7A]" },
- effect: { background: "bg-[#5d93ba]" },
-} as const;
-
-export const TRACK_GAP = 6;
-export const TRACK_LABELS_WIDTH_PX = 112;
-
-export const TIMELINE_RULER_HEIGHT = 22;
-export const TIMELINE_BOOKMARK_ROW_HEIGHT = 16;
-
-export const DEFAULT_BOOKMARK_COLOR = "#009dff";
-export const DRAG_THRESHOLD_PX = 5;
-export const TIMELINE_SCROLLBAR_SIZE_PX = 12;
-export const TIMELINE_LAYERS = {
- trackContent: 10,
- dragLine: 20,
- playhead: 30,
- snapIndicator: 40,
-} as const;
-
-export const TIMELINE_CONSTANTS = {
- PIXELS_PER_SECOND: 50,
- DEFAULT_ELEMENT_DURATION: 5,
- PADDING_TOP_PX: 2,
- HORIZONTAL_WHEEL_STEP_PX: 40,
- ZOOM_MIN: 0.1,
- ZOOM_MAX: 100,
- ZOOM_BUTTON_FACTOR: 1.7,
- ZOOM_ANCHOR_PLAYHEAD_THRESHOLD: 0.15,
- TRACK_SELECTED_BG: "bg-accent/50",
-} as const;
diff --git a/apps/web/src/constants/transcription-constants.ts b/apps/web/src/constants/transcription-constants.ts deleted file mode 100644 index bb9ce0d7..00000000 --- a/apps/web/src/constants/transcription-constants.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { LANGUAGES } from "@/constants/language-constants";
-import type {
- TranscriptionModel,
- TranscriptionModelId,
-} from "@/lib/transcription/types";
-import type { LanguageCode } from "@/constants/language-constants";
-
-const SUPPORTED_TRANSCRIPTION_LANGS: ReadonlyArray<LanguageCode> = [
- "en",
- "es",
- "it",
- "fr",
- "de",
- "pt",
- "ru",
- "ja",
- "zh",
-];
-
-export const TRANSCRIPTION_LANGUAGES = LANGUAGES.filter((language) =>
- SUPPORTED_TRANSCRIPTION_LANGS.includes(language.code),
-);
-
-export const TRANSCRIPTION_MODELS: TranscriptionModel[] = [
- {
- id: "whisper-tiny",
- name: "Tiny",
- huggingFaceId: "onnx-community/whisper-tiny",
- description: "Fastest, lower accuracy",
- },
- {
- id: "whisper-small",
- name: "Small",
- huggingFaceId: "onnx-community/whisper-small",
- description: "Good balance of speed and accuracy",
- },
- {
- id: "whisper-medium",
- name: "Medium",
- huggingFaceId: "onnx-community/whisper-medium",
- description: "Higher accuracy, slower",
- },
- {
- id: "whisper-large-v3-turbo",
- name: "Large v3 Turbo",
- huggingFaceId: "onnx-community/whisper-large-v3-turbo",
- description: "Best accuracy, requires WebGPU for good performance",
- },
-];
-
-export const DEFAULT_TRANSCRIPTION_MODEL: TranscriptionModelId =
- "whisper-small";
-
-export const DEFAULT_TRANSCRIPTION_SAMPLE_RATE = 16000;
-
-export const DEFAULT_CHUNK_LENGTH_SECONDS = 30;
-export const DEFAULT_STRIDE_SECONDS = 5;
-
-export const DEFAULT_WORDS_PER_CAPTION = 3;
-export const MIN_CAPTION_DURATION_SECONDS = 0.8;
|
