Skip to content

@prozilla-os/core

About

@prozilla-os/core is a React Vite component library written in TypeScript for building web-based operating systems, made by Prozilla.

Installation

sh
npm install @prozilla-os/core
yarn add @prozilla-os/core
pnpm add @prozilla-os/core

Usage

Basic setup

tsx
import { Desktop, ModalsView, ProzillaOS, Taskbar, WindowsView } from "@prozilla-os/core";

function App() {
  return (
    <ProzillaOS systemName="Example" tagLine="Powered by ProzillaOS">
      <Taskbar/>
      <WindowsView/>
      <ModalsView/>
      <Desktop/>
    </ProzillaOS>
  );
}

Configuration

ts
interface ProzillaOSProps {
  systemName?: string;
  tagLine?: string;
  skin?: Skin;
  config?: {
    apps?: Partial<AppsConfigOptions>;
    desktop?: Partial<DesktopConfigOptions>;
    misc?: Partial<MiscConfigOptions>;
    modals?: Partial<ModalsConfigOptions>;
    taskbar?: Partial<TaskbarConfigOptions>;
    tracking?: Partial<TrackingConfigOptions>;
    windows?: Partial<WindowsConfigOptions>;
    virtualDrive?: Partial<VirtualDriveConfigOptions>;
  };
  children?: ReactNode;
}
ts
interface SkinOptions {
  systemIcon: string;
  appIcons?: { [key: string]: string };
  appNames?: { [key: string]: string };
  wallpapers: string[];
  defaultWallpaper: string;
  fileIcons: {
    generic: string;
    info?: string;
    text?: string;
    code?: string;
    external?: string;
    video?: string;
    audio?: string;
  };
  folderIcons: {
    generic: string;
    images?: string;
    text?: string;
    link?: string;
    video?: string;
    audio?: string;
  };
  loadStyleSheet?: () => void;
  defaultTheme?: Theme;
}
ts
interface AppsConfigOptions {
  apps: App[];
}

interface DesktopConfigOptions {
  /** @default 1 */
  defaultIconSize: 0 | 1 | 2;
  /** 0: vertical, 1: horizontal @default 0 */
  defaultIconDirection: 0 | 1;
}

interface MiscConfigOptions {
  /** @default 250 */
  doubleClickDelay: number;
}

interface ModalsConfigOptions {
  /** Default size of a dialog box @default new Vector2(400, 200) */
  defaultDialogSize: Vector2;
  /** Default size of a file selector @default new Vector2(700, 400) */
  defaultFileSelectorSize: Vector2;
}

interface TaskbarConfigOptions {
  /** Height of the taskbar in CSS pixels @default 3 * 16 */
  height: number;
}

interface TrackingConfigOptions {
  /** Enable tracking @default true */
  enabled: boolean;
  /** Google Analytics measurement ID */
  GAMeasurementId: string;
}

interface WindowsConfigOptions {
  /** @default 32 */
  screenMargin: number;
  /** @default "-" */
  titleSeparator: string;
  /** If the user's screen is smaller than these values, windows will always be maximized @default new Vector2(350, 350) */
  minScreenSize: Vector2;
}

interface VirtualDriveConfigOptions {
  /** Enables persistent storage of the virtual drive. */
  saveData: false | {
    enableCompression: boolean;
    prefix?: string;
    migrations?: [string, string][];
  };
  /** Configure the data that is loaded initially. */
  defaultData: {
    includePicturesFolder?: boolean;
    includeAudioFolder?: boolean;
    includeVideoFolder?: boolean;
    includeDocumentsFolder?: boolean;
    includeDesktopFolder?: boolean;
    includeSourceTree?: boolean;
    includeAppsFolder?: boolean;
    includeScriptsFolder?: boolean;
    loadData?: (virtualRoot: VirtualRoot) => void;
  };
}

Built by Prozilla