Rewrite website as a Hyprland desktop
This commit is contained in:
1 parent
7c52779cf6
commit
3065ad6092
197 files changed
+5609
-17779
No files matched your search
+1
-80
@@ -1,80 +1 @@
|
||||
// Central helper functions and re-exports
|
||||
import { terminalSettings, pageSpeedSettings, speedPresets, pageAutoscrollSettings, user } from './config';
|
||||
|
||||
export type SpeedPreset = 'instant' | 'fast' | 'normal' | 'slow' | 'typewriter';
|
||||
|
||||
/**
|
||||
* Calculate typing speed based on content length and speed multiplier
|
||||
* Longer content types faster to maintain good UX
|
||||
* @param contentLength - Length of the content to type
|
||||
* @param speedMultiplier - Speed multiplier (0 = instant, 0.5 = 2x faster, 2 = 2x slower)
|
||||
*/
|
||||
export function calculateTypeSpeed(contentLength: number, speedMultiplier: number = 1): number {
|
||||
// Instant mode - no delay
|
||||
if (speedMultiplier === 0) return 0;
|
||||
|
||||
const { baseTypeSpeed, minTypeSpeed, maxTypeSpeed } = terminalSettings;
|
||||
|
||||
let speed: number;
|
||||
|
||||
// Shorter content = slower typing (more readable)
|
||||
// Longer content = faster typing (less waiting)
|
||||
if (contentLength < 20) speed = maxTypeSpeed;
|
||||
else if (contentLength < 50) speed = baseTypeSpeed;
|
||||
else if (contentLength < 100) speed = baseTypeSpeed * 0.7;
|
||||
else if (contentLength < 200) speed = baseTypeSpeed * 0.5;
|
||||
else speed = minTypeSpeed;
|
||||
|
||||
// Apply speed multiplier
|
||||
return Math.max(0, Math.round(speed * speedMultiplier));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get speed multiplier for a page
|
||||
* @param pageName - Name of the page (e.g., 'home', 'portfolio')
|
||||
*/
|
||||
export function getPageSpeedMultiplier(pageName: string): number {
|
||||
const setting = pageSpeedSettings[pageName];
|
||||
|
||||
if (setting === undefined) return 1; // Default to normal
|
||||
|
||||
if (typeof setting === 'number') {
|
||||
return setting;
|
||||
}
|
||||
|
||||
return speedPresets[setting] ?? 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get autoscroll setting for a page
|
||||
* @param pageName - Name of the page (e.g., 'home', 'portfolio')
|
||||
* @returns boolean - Whether autoscroll is enabled (default: true)
|
||||
*/
|
||||
export function getPageAutoscroll(pageName: string): boolean {
|
||||
const setting = pageAutoscrollSettings[pageName];
|
||||
return setting ?? true; // Default to enabled
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the terminal prompt string
|
||||
*/
|
||||
export function getPrompt(path: string = '~'): string {
|
||||
const { promptStyle } = terminalSettings;
|
||||
|
||||
switch (promptStyle) {
|
||||
case 'full':
|
||||
return `${user.username}@${user.hostname}:${path}$`;
|
||||
case 'short':
|
||||
return `${user.username}:${path}$`;
|
||||
case 'minimal':
|
||||
return '$';
|
||||
default:
|
||||
return '$';
|
||||
}
|
||||
}
|
||||
|
||||
// Barrel exports (convenience re-exports)
|
||||
export { user, terminalSettings, pageSpeedSettings, speedPresets, pageAutoscrollSettings, pageMeta, site } from './config';
|
||||
|
||||
// Export terminal types
|
||||
export type { TerminalAPI, TerminalLine, LineType, ParsedLine, DisplayedLine } from './components/tui/types';
|
||||
export * from './content';
|
||||
Reference in new issue
Block a user