Merge remote-tracking branch 'origin/V2' into

codex/add-pdf-to-json-and-json-to-pdf-features
This commit is contained in:
Anthony Stirling
2025-11-01 11:20:36 +00:00
822 changed files with 17377 additions and 2816 deletions

View File

@@ -1,13 +0,0 @@
export interface AlphabetOption {
value: string;
label: string;
}
export const alphabetOptions: AlphabetOption[] = [
{ value: "roman", label: "Roman" },
{ value: "arabic", label: "العربية" },
{ value: "japanese", label: "日本語" },
{ value: "korean", label: "한국어" },
{ value: "chinese", label: "简体中文" },
{ value: "thai", label: "ไทย" },
];

View File

@@ -1,16 +0,0 @@
// Base path from Vite config - build-time constant, normalized (no trailing slash)
// When no subpath, use empty string instead of '.' to avoid relative path issues
export const BASE_PATH = (import.meta.env.BASE_URL || '/').replace(/\/$/, '').replace(/^\.$/, '');
/** For in-app navigations when you must touch window.location (rare). */
export const withBasePath = (path: string): string => {
const clean = path.startsWith('/') ? path : `/${path}`;
return `${BASE_PATH}${clean}`;
};
/** For OAuth (needs absolute URL with scheme+host) */
export const absoluteWithBasePath = (path: string): string => {
const clean = path.startsWith('/') ? path : `/${path}`;
return `${window.location.origin}${BASE_PATH}${clean}`;
};

View File

@@ -1,42 +0,0 @@
/**
* Constants for automation functionality
*/
export const AUTOMATION_CONSTANTS = {
// Timeouts
OPERATION_TIMEOUT: 300000, // 5 minutes in milliseconds
// Default values
DEFAULT_TOOL_COUNT: 2,
MIN_TOOL_COUNT: 2,
// File prefixes
FILE_PREFIX: 'automated_',
RESPONSE_ZIP_PREFIX: 'response_',
RESULT_FILE_PREFIX: 'result_',
PROCESSED_FILE_PREFIX: 'processed_',
// Operation types
CONVERT_OPERATION_TYPE: 'convert',
// Storage keys
DB_NAME: 'StirlingPDF_Automations',
DB_VERSION: 1,
STORE_NAME: 'automations',
// UI delays
SPINNER_ANIMATION_DURATION: '1s'
} as const;
export const AUTOMATION_STEPS = {
SELECTION: 'selection',
CREATION: 'creation',
RUN: 'run'
} as const;
export const EXECUTION_STATUS = {
PENDING: 'pending',
RUNNING: 'running',
COMPLETED: 'completed',
ERROR: 'error'
} as const;

View File

@@ -1,12 +0,0 @@
import { PAGE_SIZES } from "./pageSizeConstants";
// Default crop area (covers entire page)
export const DEFAULT_CROP_AREA = {
x: 0,
y: 0,
width: PAGE_SIZES.A4.width,
height: PAGE_SIZES.A4.height,
} as const;
export type ResizeHandle = 'nw' | 'ne' | 'sw' | 'se' | 'n' | 'e' | 's' | 'w' | null;

View File

@@ -1,8 +0,0 @@
// Default PDF page sizes in points (1 point = 1/72 inch)
export const PAGE_SIZES = {
A4: { width: 595, height: 842 },
LETTER: { width: 612, height: 792 },
A3: { width: 842, height: 1191 },
A5: { width: 420, height: 595 },
LEGAL: { width: 612, height: 1008 },
} as const;

View File

@@ -1,78 +0,0 @@
export const SPLIT_METHODS = {
BY_PAGES: 'byPages',
BY_SECTIONS: 'bySections',
BY_SIZE: 'bySize',
BY_PAGE_COUNT: 'byPageCount',
BY_DOC_COUNT: 'byDocCount',
BY_CHAPTERS: 'byChapters',
BY_PAGE_DIVIDER: 'byPageDivider'
} as const;
export const ENDPOINTS = {
[SPLIT_METHODS.BY_PAGES]: 'split-pages',
[SPLIT_METHODS.BY_SECTIONS]: 'split-pdf-by-sections',
[SPLIT_METHODS.BY_SIZE]: 'split-by-size-or-count',
[SPLIT_METHODS.BY_PAGE_COUNT]: 'split-by-size-or-count',
[SPLIT_METHODS.BY_DOC_COUNT]: 'split-by-size-or-count',
[SPLIT_METHODS.BY_CHAPTERS]: 'split-pdf-by-chapters',
[SPLIT_METHODS.BY_PAGE_DIVIDER]: 'auto-split-pdf'
} as const;
export type SplitMethod = typeof SPLIT_METHODS[keyof typeof SPLIT_METHODS];
export const isSplitMethod = (value: string | null): value is SplitMethod => {
return Object.values(SPLIT_METHODS).includes(value as SplitMethod);
};
import { CardOption } from '../components/shared/CardSelector';
export interface MethodOption extends CardOption<SplitMethod> {
tooltipKey: string;
}
export const METHOD_OPTIONS: MethodOption[] = [
{
value: SPLIT_METHODS.BY_PAGES,
prefixKey: "split.methods.prefix.splitAt",
nameKey: "split.methods.byPages.name",
tooltipKey: "split.methods.byPages.tooltip"
},
{
value: SPLIT_METHODS.BY_CHAPTERS,
prefixKey: "split.methods.prefix.splitBy",
nameKey: "split.methods.byChapters.name",
tooltipKey: "split.methods.byChapters.tooltip"
},
{
value: SPLIT_METHODS.BY_SECTIONS,
prefixKey: "split.methods.prefix.splitBy",
nameKey: "split.methods.bySections.name",
tooltipKey: "split.methods.bySections.tooltip"
},
{
value: SPLIT_METHODS.BY_SIZE,
prefixKey: "split.methods.prefix.splitBy",
nameKey: "split.methods.bySize.name",
tooltipKey: "split.methods.bySize.tooltip"
},
{
value: SPLIT_METHODS.BY_PAGE_COUNT,
prefixKey: "split.methods.prefix.splitBy",
nameKey: "split.methods.byPageCount.name",
tooltipKey: "split.methods.byPageCount.tooltip"
},
{
value: SPLIT_METHODS.BY_DOC_COUNT,
prefixKey: "split.methods.prefix.splitBy",
nameKey: "split.methods.byDocCount.name",
tooltipKey: "split.methods.byDocCount.tooltip"
},
{
value: SPLIT_METHODS.BY_PAGE_DIVIDER,
prefixKey: "split.methods.prefix.splitBy",
nameKey: "split.methods.byPageDivider.name",
tooltipKey: "split.methods.byPageDivider.tooltip"
}
];

View File

@@ -1,8 +0,0 @@
// Theme constants and utilities
export type ThemeMode = 'light' | 'dark' | 'rainbow';
// Detect OS theme preference
export function getSystemTheme(): 'light' | 'dark' {
return window?.matchMedia?.('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
}

View File

@@ -1,5 +0,0 @@
// Tool panel constants
export type ToolPanelMode = 'sidebar' | 'fullscreen';
export const DEFAULT_TOOL_PANEL_MODE: ToolPanelMode = 'sidebar';