setup i18n and ported all tools to standalone pages

This commit is contained in:
abdullahalam123
2025-12-11 19:34:14 +05:30
parent fe3e54f979
commit 78dc6333f9
221 changed files with 30351 additions and 11131 deletions

View File

@@ -14,10 +14,10 @@ export function applyFullWidthMode(enabled: boolean) {
const pageUploaders = document.querySelectorAll('#tool-uploader');
pageUploaders.forEach((uploader) => {
if (enabled) {
uploader.classList.remove('max-w-2xl', 'max-w-5xl');
uploader.classList.remove('max-w-2xl', 'max-w-4xl', 'max-w-5xl');
} else {
// Restore original max-width if not already present
if (!uploader.classList.contains('max-w-2xl') && !uploader.classList.contains('max-w-5xl')) {
if (!uploader.classList.contains('max-w-2xl') && !uploader.classList.contains('max-w-4xl') && !uploader.classList.contains('max-w-5xl')) {
uploader.classList.add('max-w-2xl');
}
}

View File

@@ -69,7 +69,7 @@ export const formatBytes = (bytes: any, decimals = 1) => {
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
};
export const downloadFile = (blob: any, filename: any) => {
export const downloadFile = (blob: Blob, filename: string): void => {
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
@@ -89,12 +89,12 @@ export const readFileAsArrayBuffer = (file: any) => {
});
};
export function parsePageRanges(rangeString: any, totalPages: any) {
export function parsePageRanges(rangeString: string, totalPages: number): number[] {
if (!rangeString || rangeString.trim() === '') {
return Array.from({ length: totalPages }, (_, i) => i);
}
const indices = new Set();
const indices = new Set<number>();
const parts = rangeString.split(',');
for (const part of parts) {
@@ -128,10 +128,11 @@ export function parsePageRanges(rangeString: any, totalPages: any) {
}
}
// @ts-expect-error TS(2362) FIXME: The left-hand side of an arithmetic operation must... Remove this comment to see the full error message
return Array.from(indices).sort((a, b) => a - b);
}
/**
* Formats an ISO 8601 date string (e.g., "2008-02-21T17:15:56-08:00")
* into a localized, human-readable string.

View File

@@ -0,0 +1,23 @@
// Rotation state management for PDF pages
const rotationState: number[] = [];
export function getRotationState(): readonly number[] {
return rotationState;
}
export function updateRotationState(pageIndex: number, rotation: number) {
if (pageIndex >= 0 && pageIndex < rotationState.length) {
rotationState[pageIndex] = rotation;
}
}
export function resetRotationState() {
rotationState.length = 0;
}
export function initializeRotationState(pageCount: number) {
rotationState.length = 0;
for (let i = 0; i < pageCount; i++) {
rotationState.push(0);
}
}