pback
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v20View latest version
This folder contains utility functions and types that are shared between the frontend and backend components of Text Studio.
Common utility functions for:
- Color manipulation and conversion
- Contrast ratio calculations
- File handling and validation
- Gradient generation
- Performance optimizations (debounce)
- Type-safe deep cloning
import { hexToRgb, getContrastRatio, debounce } from '/shared/utils.ts';
// Convert hex to RGB
const rgb = hexToRgb('#007AFF');
// Check color contrast
const ratio = getContrastRatio('#FFFFFF', '#000000');
// Debounce function calls
const debouncedUpdate = debounce(updateFunction, 300);
- Universal Compatibility: All functions work in both browser and server environments
- Type Safety: Full TypeScript support with proper type definitions
- Performance: Optimized for real-time canvas operations
- Accessibility: Includes contrast checking for WCAG compliance