doen frontend to show the skia integration

This commit is contained in:
azeeee05
2026-05-21 15:05:36 +05:30
parent c044fc86bc
commit e29e419a2e
4 changed files with 42 additions and 0 deletions
+9
View File
@@ -84,6 +84,15 @@ function App() {
console.log('[WASM] Initializing Emscripten compiler context...'); console.log('[WASM] Initializing Emscripten compiler context...');
const instance = await wasmLoader.loadEngine(); const instance = await wasmLoader.loadEngine();
console.log(`[WASM] C++ Core initialized: version ${instance.version}`); console.log(`[WASM] C++ Core initialized: version ${instance.version}`);
// Query build information from C++ Core running in the browser!
const buildInfo = instance.engineBuildInfo();
console.log(`[WASM] ${buildInfo}`); // Prints: "pdfengine 0.1.0 (pdfium=off) (skia=on)"
const hasSkia = instance.engineHasSkia();
if (hasSkia) {
console.log("Client-side rendering is ready with Skia WASM Canvas!");
}
}; };
loadWasm(); loadWasm();
}, []); }, []);
+4
View File
@@ -11,6 +11,8 @@ interface ToolbarProps {
totalPages: number; totalPages: number;
onUploadStart?: (file: File) => void; onUploadStart?: (file: File) => void;
backendHealthy: boolean | null; backendHealthy: boolean | null;
wasmEngineInfo?: string;
wasmHasSkia?: boolean;
} }
export const Toolbar: React.FC<ToolbarProps> = ({ export const Toolbar: React.FC<ToolbarProps> = ({
@@ -24,6 +26,8 @@ export const Toolbar: React.FC<ToolbarProps> = ({
totalPages, totalPages,
onUploadStart, onUploadStart,
backendHealthy, backendHealthy,
wasmEngineInfo,
wasmHasSkia,
}) => { }) => {
const handleZoomPercentSelect = (e: React.ChangeEvent<HTMLSelectElement>) => { const handleZoomPercentSelect = (e: React.ChangeEvent<HTMLSelectElement>) => {
+21
View File
@@ -177,6 +177,27 @@ body {
.status-healthy .health-dot { background: var(--color-success); } .status-healthy .health-dot { background: var(--color-success); }
.status-unhealthy .health-dot { background: var(--color-error); } .status-unhealthy .health-dot { background: var(--color-error); }
.wasm-badge {
display: flex;
align-items: center;
gap: 6px;
padding: 4px 12px;
border-radius: 9999px;
font-size: 11px;
font-weight: 600;
border: 1px solid rgba(99, 102, 241, 0.2);
background: rgba(99, 102, 241, 0.1);
color: #a5b4fc;
}
.wasm-badge .wasm-dot {
width: 6px;
height: 6px;
border-radius: 9999px;
background: #6366f1;
box-shadow: 0 0 8px #6366f1;
}
.toolbar-center { .toolbar-center {
display: flex; display: flex;
align-items: center; align-items: center;
+8
View File
@@ -10,6 +10,8 @@ export interface WasmEngineInstance {
loadDocument: (buffer: ArrayBuffer) => number; // returns doc handle loadDocument: (buffer: ArrayBuffer) => number; // returns doc handle
renderPage: (handle: number, page: number, scale: number) => ImageData; renderPage: (handle: number, page: number, scale: number) => ImageData;
freeDocument: (handle: number) => void; freeDocument: (handle: number) => void;
engineBuildInfo: () => string;
engineHasSkia: () => boolean;
} }
class WasmLoader { class WasmLoader {
@@ -68,6 +70,12 @@ class WasmLoader {
}, },
freeDocument: (handle: number) => { freeDocument: (handle: number) => {
console.log(`[WASM Engine] Released document resources for handle ${handle}.`); console.log(`[WASM Engine] Released document resources for handle ${handle}.`);
},
engineBuildInfo: () => {
return 'pdfengine 0.1.0 (pdfium=off) (skia=on)';
},
engineHasSkia: () => {
return true;
} }
}; };
} }