@zerospacegg/iolin
Version:
Pure TypeScript implementation of ZeroSpace game data processing (PKL-free)
66 lines • 2.81 kB
TypeScript
/**
* Core types and utilities for the PKL-free engine
* Ported from types.pkl
*/
export type Slug = string;
export type Id = string;
export type Tier = "" | "T0" | "T1" | "T1.5" | "T2" | "T2.5" | "T3" | "T3.5" | "T4" | "Hero" | "ultimate";
export type UpgradeTier = "T1.5" | "T2.5" | "T3.5";
export type CommanderType = "frontline" | "support" | "specialist";
export type FactionSlug = "grell" | "protectorate" | "legion" | "xol" | "neutral" | "arandi" | "chakru" | "marran" | "dread" | "valkaru";
export type HotKey = "" | "Q" | "W" | "E" | "R" | "T" | "Y" | "U" | "I" | "O" | "P" | "A" | "S" | "D" | "F" | "G" | "H" | "J" | "K" | "L" | "Z" | "X" | "C" | "V" | "B" | "N" | "M" | "Ctrl-Q" | "Ctrl-W" | "Ctrl-E" | "Ctrl-R" | "Ctrl-T" | "Ctrl-Y" | "Ctrl-U" | "Ctrl-I" | "Ctrl-O" | "Ctrl-P" | "Ctrl-A" | "Ctrl-S" | "Ctrl-D" | "Ctrl-F" | "Ctrl-G" | "Ctrl-H" | "Ctrl-J" | "Ctrl-K" | "Ctrl-L" | "Ctrl-Z" | "Ctrl-X" | "Ctrl-C" | "Ctrl-V" | "Ctrl-B" | "Ctrl-N" | "Ctrl-M";
export type ArmorType = "none" | "light" | "medium" | "heavy" | "building" | "hero";
/**
* Tech tree node in hierarchical structure (matches original faction.techTree API)
*/
export interface TechTreeNode {
readonly id: string;
readonly name: string;
readonly type: string;
readonly subtype: string;
readonly createdBy: string[];
readonly upgradedBy: string[];
readonly children: TechTreeNode[];
}
/**
* Complete tech tree data for a faction (matches original faction.techTree API)
*/
export interface TechTree {
readonly faction: string;
readonly mainBase: string;
readonly builder?: string;
readonly harvester?: string;
readonly supply?: string;
readonly tree: TechTreeNode;
}
/**
* Convert a pretty name to a slug
*/
export declare function slugify(name: string): string;
/**
* Convert a slug back to a pretty name (capitalize words)
*/
export declare function prettifySlug(slug: string): string;
/**
* Convert a slug to camelCase
* Usage: slugToCamelCase("symbiotic-surge") => "symbioticSurge"
*/
export declare function slugToCamelCase(slug: string): string;
/**
* Create recursive slug (from PKL makeRecursiveSlug function)
*/
export declare function makeRecursiveSlug(name: string, ofKey: string, typeKey: string): string;
/**
* Parse filename to extract path-based ID and slug
* Extracts everything after "zerospace/" and removes file extensions
* Converts underscores to hyphens for slugs
*
* Examples:
* - "/path/to/zerospace/faction/grell/unit/seedling.ts" → { id: "faction/grell/unit/seedling", slug: "seedling" }
* - "zerospace/faction/grell/unit/man_eater.ts" → { id: "faction/grell/unit/man-eater", slug: "man-eater" }
*/
export declare function parseFilename(filename: string): {
id: string;
slug: string;
};
//# sourceMappingURL=core.d.ts.map