finish basic autocraft for create store

This commit is contained in:
2025-10-07 22:15:41 +08:00
parent c8eeb4f354
commit d3cbc15450
26 changed files with 3386 additions and 0 deletions

8
types/cc/audio/dfpwm.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
/** @noSelfInFile **/
/** @noResolution **/
declare module "cc.audio.dfpwm" {
export function make_encoder(): (pcm: number[]) => string;
export function encode(pcm: number[]): string;
export function make_decoder(): (dfpwm: string) => number[];
export function decode(dfpwm: string): number[];
}

9
types/cc/completion.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
/** @noSelfInFile **/
/** @noResolution **/
declare module "cc.completion" {
export function choice(text: string, choices: string[], add_space?: boolean): string[];
export function peripheral(text: string, add_space?: boolean): string[];
export function side(text: string, add_space?: boolean): string[];
export function setting(text: string, add_space?: boolean): string[];
export function command(text: string, add_space?: boolean): string[];
}

11
types/cc/expect.d.ts vendored Normal file
View File

@@ -0,0 +1,11 @@
/** @noSelfInFile **/
/** @noResolution **/
declare module "cc/expect" {
namespace expect {
function expect(index: number, value: any, ...types: string[]): any;
function field(tbl: Object|LuaTable, index: string, ...types: string[]): any;
function range(num: number, min?: number, max?: number): number;
}
function expect(index: number, value: any, ...types: string[]): any;
export = expect;
}

8
types/cc/image/nft.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
/** @noSelfInFile **/
/** @noResolution **/
declare module "cc.image.nft" {
type Image = {text: string, foreground: string, background: string}[];
export function parse(image: string): Image;
export function load(path: string): Image;
export function draw(image: Image, xPos: number, yPos: number, target?: ITerminal): void;
}

8
types/cc/index.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
import "audio/dfpwm.d.ts";
import "completion.d.ts";
import "expect.d.ts";
import "image.nft.d.ts";
import "pretty.d.ts";
import "require.d.ts";
import "shell/completion.d.ts";
import "strings.d.ts";

9
types/cc/package.json Normal file
View File

@@ -0,0 +1,9 @@
{
"name": "@jackmacwindows/cc-types",
"version": "1.0.1",
"description": "TypeScript type definitions for CraftOS modules.",
"types": "index.d.ts",
"files": ["./*.d.ts", "./audio", "./image", "./shell"],
"author": "JackMacWindows",
"license": "MIT"
}

18
types/cc/pretty.d.ts vendored Normal file
View File

@@ -0,0 +1,18 @@
/** @noSelfInFile **/
/** @noResolution **/
declare module "cc.pretty" {
type Doc = {};
export const empty: Doc;
export const space: Doc;
export const line: Doc;
export const space_line: Doc;
export function text(text: string, color?: number): Doc;
export function concat(...args: (Doc|string)[]): Doc;
export function nest(depth: number, doc: Doc): Doc;
export function group(doc: Doc): Doc;
export function write(doc: Doc, ribbon_frac?: number): void;
export function print(doc: Doc, ribbon_frac?: number): void;
export function render(doc: Doc, width?: number, ribbon_frac?: number): string;
export function pretty(obj: any, options?: {function_args?: boolean, function_source: boolean}): Doc;
export function pretty_print(obj: any, options?: {function_args?: boolean, function_source: boolean}, ribbon_frac?: number): void;
}

5
types/cc/require.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
/** @noSelfInFile **/
/** @noResolution **/
declare module "cc.require" {
export function make(env: Object|LuaTable, dir: string): LuaMultiReturn<[(name: string) => any, Object|LuaTable]>;
}

16
types/cc/shell/completion.d.ts vendored Normal file
View File

@@ -0,0 +1,16 @@
/** @noSelfInFile **/
/** @noResolution **/
declare module "cc.shell.completion" {
export function file(shell: Object|LuaTable, text: string): string[];
export function dir(shell: Object|LuaTable, text: string): string[];
export function dirOrFile(shell: Object|LuaTable, text: string, previous: string[], add_space?: boolean): string[];
export function program(shell: Object|LuaTable, text: string): string[];
export function programWithArgs(shell: Object|LuaTable, text: string, previous: string[], starting: number): string[];
export function help(shell: Object|LuaTable, text: string, previous: string[]): string[];
export function choice(shell: Object|LuaTable, text: string, previous: string[], choices: string[], add_space?: boolean): string[];
export function peripheral(shell: Object|LuaTable, text: string, previous: string[], add_space?: boolean): string[];
export function side(shell: Object|LuaTable, text: string, previous: string[], add_space?: boolean): string[];
export function setting(shell: Object|LuaTable, text: string, previous: string[], add_space?: boolean): string[];
export function command(shell: Object|LuaTable, text: string, previous: string[], add_space?: boolean): string[];
export function build(...args: (null | ((text: string, previous: string[]) => string[]) | [(text: string, previous: string[], ...args: any[]) => string[], ...any[]])[]): (index: number, arg: string, previous: string[]) => string[];
}

7
types/cc/strings.d.ts vendored Normal file
View File

@@ -0,0 +1,7 @@
/** @noSelfInFile **/
/** @noResolution **/
declare module "cc.strings" {
export function wrap(text: string, width?: number): string[];
export function ensure_width(text: string, width?: number): string;
export function split(str: string, deliminator: string, plain?: boolean, limit?: number): string[];
}