This commit is contained in:
4
packages/example/.editorconfig
Normal file
4
packages/example/.editorconfig
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
2
packages/example/.gitattributes
vendored
Normal file
2
packages/example/.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# Normalize EOL for all files that Git considers text files.
|
||||||
|
* text=auto eol=lf
|
||||||
7
packages/example/.gitignore
vendored
Normal file
7
packages/example/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# Godot 4+ specific ignores
|
||||||
|
.godot/
|
||||||
|
/android/
|
||||||
|
|
||||||
|
!node_modules/
|
||||||
|
node_modules/**/*
|
||||||
|
!node_modules/.gdignore
|
||||||
1
packages/example/gen/godot/.gdignore
Normal file
1
packages/example/gen/godot/.gdignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
5
packages/example/gen/godot/biome.json.gen.ts
Normal file
5
packages/example/gen/godot/biome.json.gen.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
declare module "godot" {
|
||||||
|
interface ResourceTypes {
|
||||||
|
"res://biome.json": JSON;
|
||||||
|
}
|
||||||
|
}
|
||||||
5
packages/example/gen/godot/icon.svg.gen.ts
Normal file
5
packages/example/gen/godot/icon.svg.gen.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
declare module "godot" {
|
||||||
|
interface ResourceTypes {
|
||||||
|
"res://icon.svg": CompressedTexture2D;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
packages/example/icon.svg
Normal file
1
packages/example/icon.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>
|
||||||
|
After Width: | Height: | Size: 995 B |
43
packages/example/icon.svg.import
Normal file
43
packages/example/icon.svg.import
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bn14p8nl4khp"
|
||||||
|
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://icon.svg"
|
||||||
|
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
|
svg/scale=1.0
|
||||||
|
editor/scale_with_editor_scale=false
|
||||||
|
editor/convert_colors_with_editor_theme=false
|
||||||
1
packages/example/node_modules/.gdignore
generated
vendored
Normal file
1
packages/example/node_modules/.gdignore
generated
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
15
packages/example/project.godot
Normal file
15
packages/example/project.godot
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
; Engine configuration file.
|
||||||
|
; It's best edited using the editor UI and not directly,
|
||||||
|
; since the parameters that go here are not all obvious.
|
||||||
|
;
|
||||||
|
; Format:
|
||||||
|
; [section] ; section goes between []
|
||||||
|
; param=value ; assign values to parameters
|
||||||
|
|
||||||
|
config_version=5
|
||||||
|
|
||||||
|
[application]
|
||||||
|
|
||||||
|
config/name="example"
|
||||||
|
config/features=PackedStringArray("4.5", "Forward Plus")
|
||||||
|
config/icon="res://icon.svg"
|
||||||
1
packages/example/typings/.gdignore
Normal file
1
packages/example/typings/.gdignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
368
packages/example/typings/godot.minimal.d.ts
vendored
Normal file
368
packages/example/typings/godot.minimal.d.ts
vendored
Normal file
@@ -0,0 +1,368 @@
|
|||||||
|
|
||||||
|
declare module "godot-jsb" {
|
||||||
|
import {
|
||||||
|
Callable,
|
||||||
|
MethodFlags,
|
||||||
|
MultiplayerAPI,
|
||||||
|
MultiplayerPeer,
|
||||||
|
Object as GObject,
|
||||||
|
PackedByteArray,
|
||||||
|
PropertyInfo,
|
||||||
|
Signal,
|
||||||
|
StringName,
|
||||||
|
Variant,
|
||||||
|
} from "godot";
|
||||||
|
|
||||||
|
const CAMEL_CASE_BINDINGS_ENABLED: boolean;
|
||||||
|
|
||||||
|
const DEV_ENABLED: boolean;
|
||||||
|
const TOOLS_ENABLED: boolean;
|
||||||
|
|
||||||
|
/** version of GodotJS */
|
||||||
|
const version: string;
|
||||||
|
|
||||||
|
/** impl currently used */
|
||||||
|
const impl: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create godot Callable without a bound object.
|
||||||
|
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
|
||||||
|
*/
|
||||||
|
function callable<F extends Function>(fn: F): Callable<F>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create godot Callable with a bound object `self`.
|
||||||
|
* @deprecated [WARNING] avoid using this function directly, use `Callable.create` instead.
|
||||||
|
*/
|
||||||
|
function callable<S extends GObject, F extends (this: S, ...args: any[]) => any>(self: S, fn: F): Callable<F>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Explicitly convert a `PackedByteArray`(aka `Vector<uint8_t>`) into a javascript `ArrayBuffer`
|
||||||
|
* @deprecated [WARNING] This free function '_to_array_buffer' is deprecated and will be removed in a future version, use 'PackedByteArray.to_array_buffer()' instead.
|
||||||
|
*/
|
||||||
|
function to_array_buffer(packed: PackedByteArray): ArrayBuffer;
|
||||||
|
|
||||||
|
type AsyncModuleSourceLoaderResolveFunc = (source: string) => void;
|
||||||
|
type AsyncModuleSourceLoaderRejectFunc = (error: string) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a callback function to handle the load of source code of asynchronous modules.
|
||||||
|
* Only use this function if it's not set in C++.
|
||||||
|
*/
|
||||||
|
function set_async_module_loader(
|
||||||
|
fn: (
|
||||||
|
module_id: string,
|
||||||
|
resolve: AsyncModuleSourceLoaderResolveFunc,
|
||||||
|
reject: AsyncModuleSourceLoaderRejectFunc,
|
||||||
|
) => void,
|
||||||
|
): void;
|
||||||
|
|
||||||
|
interface MinimalCommonJSModule {
|
||||||
|
exports: any;
|
||||||
|
loaded: boolean;
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import a CommonJS module asynchronously.
|
||||||
|
*
|
||||||
|
* NOTE: Only the source code is loaded asynchronously, the module is still evaluated on the script thread.
|
||||||
|
* NOTE: Calling the $import() function without a async module loader set in advance will return undefined.
|
||||||
|
* @param module_id the module id to import
|
||||||
|
* @example
|
||||||
|
* ```js
|
||||||
|
* // [init.js]
|
||||||
|
* import * as jsb from "godot-jsb";
|
||||||
|
* jsb.set_async_module_loader((id, resolve, reject) => {
|
||||||
|
* console.log("[test] async module loader start", id);
|
||||||
|
* // here should be the actual async loading of the module, HTTP request, etc.
|
||||||
|
* // we just simulate it with a timeout
|
||||||
|
* setTimeout(() => {
|
||||||
|
* console.log("[test] async module loader resolve", id);
|
||||||
|
* resolve("exports.foo = function () { console.log('hello, module imported'); }");
|
||||||
|
* }, 3000);
|
||||||
|
* });
|
||||||
|
* // [somescript.js]
|
||||||
|
* jsb.$import("http://localhost/async_loaded.js").then(mod => {
|
||||||
|
* console.log("[test] async module loader", mod);
|
||||||
|
* mod.exports.foo();
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
function $import(module_id: string): Promise<MinimalCommonJSModule>;
|
||||||
|
|
||||||
|
interface ScriptPropertyInfo {
|
||||||
|
name: string;
|
||||||
|
type: Variant.Type;
|
||||||
|
class_?: Function;
|
||||||
|
hint?: number;
|
||||||
|
hint_string?: string;
|
||||||
|
usage?: number;
|
||||||
|
cache?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace internal {
|
||||||
|
type OnReadyEvaluatorFunc = (self: any) => any;
|
||||||
|
type GObjectConstructor = abstract new (...args: any[]) => GObject;
|
||||||
|
|
||||||
|
function add_script_signal(prototype: GObject, name: string): void;
|
||||||
|
function add_script_property(prototype: GObject, details: ScriptPropertyInfo): void;
|
||||||
|
function add_script_ready(
|
||||||
|
prototype: GObject,
|
||||||
|
details: {
|
||||||
|
name: string;
|
||||||
|
evaluator: string | OnReadyEvaluatorFunc;
|
||||||
|
},
|
||||||
|
): void;
|
||||||
|
function add_script_tool(constructor: GObjectConstructor): void;
|
||||||
|
function add_script_icon(constructor: GObjectConstructor, path: string): void;
|
||||||
|
function add_script_rpc(
|
||||||
|
prototype: GObject,
|
||||||
|
property_key: string,
|
||||||
|
config: {
|
||||||
|
rpc_mode?: MultiplayerAPI.RPCMode;
|
||||||
|
call_local?: boolean;
|
||||||
|
transfer_mode?: MultiplayerPeer.TransferMode;
|
||||||
|
channel?: number;
|
||||||
|
},
|
||||||
|
): void;
|
||||||
|
|
||||||
|
function create_script_signal_getter(name: string): (this: GObject) => Signal;
|
||||||
|
function create_script_cached_property_updater(name: string): (this: GObject, value?: unknown) => void;
|
||||||
|
|
||||||
|
// 0: deprecated, 1: experimental, 2: help
|
||||||
|
function set_script_doc(
|
||||||
|
target: GObjectConstructor,
|
||||||
|
property_key: undefined,
|
||||||
|
field: 0 | 1 | 2,
|
||||||
|
message: string,
|
||||||
|
): void;
|
||||||
|
function set_script_doc(target: GObject, property_key: string, field: 0 | 1 | 2, message: string): void;
|
||||||
|
|
||||||
|
function add_module(id: string, obj: any): void;
|
||||||
|
function find_module(id: string): any;
|
||||||
|
function notify_microtasks_run(): void;
|
||||||
|
|
||||||
|
namespace names {
|
||||||
|
/**
|
||||||
|
* Get the transformed name of a Godot class
|
||||||
|
*/
|
||||||
|
function get_class<T extends string>(godot_class: T): T;
|
||||||
|
/**
|
||||||
|
* Get the transformed name of a Godot enum
|
||||||
|
*/
|
||||||
|
function get_enum<T extends string>(godot_enum: T): T;
|
||||||
|
/**
|
||||||
|
* Get the transformed name of a Godot enum
|
||||||
|
*/
|
||||||
|
function get_enum_value<T extends string>(godot_enum_value: T): T;
|
||||||
|
/**
|
||||||
|
* Get the transformed name of a Godot class member
|
||||||
|
*/
|
||||||
|
function get_member<T extends string>(godot_member: T): T;
|
||||||
|
/**
|
||||||
|
* Get the internal Godot name/identifier from a transformed name i.e. the inverse of the other accessors.
|
||||||
|
*/
|
||||||
|
function get_internal_mapping(name: string): string;
|
||||||
|
/**
|
||||||
|
* Get the transformed name of a Godot function parameter
|
||||||
|
*/
|
||||||
|
function get_parameter<T extends string>(parameter: T): T;
|
||||||
|
/**
|
||||||
|
* Get the transformed type name of a Variant.Type
|
||||||
|
*/
|
||||||
|
function get_variant_type<T extends string>(type: Variant.Type): StringName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace editor {
|
||||||
|
interface PrimitiveConstantInfo {
|
||||||
|
name: string;
|
||||||
|
type: Variant.Type;
|
||||||
|
value: number /* only if type is literal */;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ConstantInfo {
|
||||||
|
name: string;
|
||||||
|
value: number /** int64_t */;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EnumInfo {
|
||||||
|
name: string;
|
||||||
|
literals: Record<string, number>;
|
||||||
|
is_bitfield: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DefaultArgumentInfo {
|
||||||
|
type: Variant.Type;
|
||||||
|
value: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
// we treat godot MethodInfo/MethodBind as the same thing here for simplicity
|
||||||
|
//NOTE some fields will not be set if it's actually a MethodInfo struct
|
||||||
|
interface MethodBind {
|
||||||
|
internal_name: string;
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
hint_flags: MethodFlags;
|
||||||
|
is_static: boolean;
|
||||||
|
is_const: boolean;
|
||||||
|
is_vararg: boolean;
|
||||||
|
argument_count: number /** int32_t */;
|
||||||
|
|
||||||
|
args_: Array<PropertyInfo>;
|
||||||
|
default_arguments?: Array<DefaultArgumentInfo>;
|
||||||
|
return_: PropertyInfo | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface PropertySetGetInfo {
|
||||||
|
internal_name: string;
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
type: Variant.Type;
|
||||||
|
index: number;
|
||||||
|
setter: string;
|
||||||
|
getter: string;
|
||||||
|
|
||||||
|
info: PropertyInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface PrimitiveGetSetInfo {
|
||||||
|
name: string;
|
||||||
|
type: Variant.Type;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SignalInfo {
|
||||||
|
internal_name: string;
|
||||||
|
name: string;
|
||||||
|
method_: MethodBind;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ArgumentInfo {
|
||||||
|
name: string;
|
||||||
|
type: Variant.Type;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ConstructorInfo {
|
||||||
|
arguments: Array<ArgumentInfo>;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface OperatorInfo {
|
||||||
|
name: string;
|
||||||
|
return_type: Variant.Type;
|
||||||
|
left_type: Variant.Type;
|
||||||
|
right_type: Variant.Type;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface BasicClassInfo {
|
||||||
|
name: string;
|
||||||
|
methods: Array<MethodBind>;
|
||||||
|
enums?: Array<EnumInfo>;
|
||||||
|
}
|
||||||
|
|
||||||
|
// godot class
|
||||||
|
interface ClassInfo extends BasicClassInfo {
|
||||||
|
internal_name: string;
|
||||||
|
super: string;
|
||||||
|
|
||||||
|
properties: Array<PropertySetGetInfo>;
|
||||||
|
virtual_methods: Array<MethodBind>;
|
||||||
|
signals: Array<SignalInfo>;
|
||||||
|
constants?: Array<ConstantInfo>;
|
||||||
|
}
|
||||||
|
|
||||||
|
// variant class
|
||||||
|
interface PrimitiveClassInfo extends BasicClassInfo {
|
||||||
|
// self type
|
||||||
|
type: Variant.Type;
|
||||||
|
|
||||||
|
// valid only if has_indexing
|
||||||
|
element_type?: Variant.Type;
|
||||||
|
|
||||||
|
// true only if is_keyed
|
||||||
|
is_keyed: boolean;
|
||||||
|
|
||||||
|
constructors?: Array<ConstructorInfo>;
|
||||||
|
operators?: Array<OperatorInfo>;
|
||||||
|
properties?: Array<PrimitiveGetSetInfo>;
|
||||||
|
constants?: Array<PrimitiveConstantInfo>;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SingletonInfo {
|
||||||
|
name: string;
|
||||||
|
class_name: string;
|
||||||
|
user_created: boolean;
|
||||||
|
editor_only: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface GlobalConstantInfo {
|
||||||
|
name: string;
|
||||||
|
values: { [name: string]: number /** int64_t */ };
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ClassDoc {
|
||||||
|
brief_description: string;
|
||||||
|
|
||||||
|
constants: { [name: string]: { description: string } };
|
||||||
|
methods: { [name: string]: { description: string } };
|
||||||
|
properties: { [name: string]: { description: string } };
|
||||||
|
signals: { [name: string]: { description: string } };
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_class_doc(class_name: string): ClassDoc | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get a list of all classes registered in ClassDB
|
||||||
|
*/
|
||||||
|
function get_classes(): Array<ClassInfo>;
|
||||||
|
|
||||||
|
function get_primitive_types(): Array<PrimitiveClassInfo>;
|
||||||
|
|
||||||
|
function get_singletons(): Array<SingletonInfo>;
|
||||||
|
|
||||||
|
function get_global_constants(): Array<GlobalConstantInfo>;
|
||||||
|
|
||||||
|
function get_utility_functions(): Array<MethodBind>;
|
||||||
|
|
||||||
|
function get_input_actions(): Array<string>;
|
||||||
|
|
||||||
|
function delete_file(filepath: string): void;
|
||||||
|
|
||||||
|
const VERSION_DOCS_URL: string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Globals
|
||||||
|
|
||||||
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console) */
|
||||||
|
interface Console {
|
||||||
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/assert_static) */
|
||||||
|
assert(condition?: boolean, ...data: any[]): void;
|
||||||
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static) */
|
||||||
|
debug(...data: any[]): void;
|
||||||
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static) */
|
||||||
|
error(...data: any[]): void;
|
||||||
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static) */
|
||||||
|
info(...data: any[]): void;
|
||||||
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static) */
|
||||||
|
log(...data: any[]): void;
|
||||||
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static) */
|
||||||
|
time(label?: string): void;
|
||||||
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static) */
|
||||||
|
timeEnd(label?: string): void;
|
||||||
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static) */
|
||||||
|
trace(...data: any[]): void;
|
||||||
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static) */
|
||||||
|
warn(...data: any[]): void;
|
||||||
|
}
|
||||||
|
declare const console: Console;
|
||||||
|
|
||||||
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearInterval) */
|
||||||
|
declare function clearInterval(id: number | undefined): void;
|
||||||
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearTimeout) */
|
||||||
|
declare function clearTimeout(id: number | undefined): void;
|
||||||
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */
|
||||||
|
declare function setInterval(handler: () => void, timeout?: number, ...arguments: any[]): number;
|
||||||
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */
|
||||||
|
declare function setTimeout(handler: () => void, timeout?: number, ...arguments: any[]): number;
|
||||||
1
packages/example/typings/godot.mix.d.ts
vendored
Normal file
1
packages/example/typings/godot.mix.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
d
|
||||||
39
packages/example/typings/godot.worker.d.ts
vendored
Normal file
39
packages/example/typings/godot.worker.d.ts
vendored
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
declare module "godot.worker" {
|
||||||
|
import { GAny, GArray, Object as GObject } from "godot";
|
||||||
|
|
||||||
|
class JSWorker {
|
||||||
|
constructor(path: string);
|
||||||
|
|
||||||
|
postMessage(message: any, transfer?: GArray | ReadonlyArray<NonNullable<GAny>>): void;
|
||||||
|
terminate(): void;
|
||||||
|
|
||||||
|
onready?: () => void;
|
||||||
|
onmessage?: (message: any) => void;
|
||||||
|
|
||||||
|
//TODO not implemented yet
|
||||||
|
onerror?: (error: any) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use onmessage to receive messages sent from postMessage() with transfers included.
|
||||||
|
* @param obj
|
||||||
|
*/
|
||||||
|
ontransfer?: (obj: GObject) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
// only available in worker scripts
|
||||||
|
const JSWorkerParent:
|
||||||
|
| {
|
||||||
|
onmessage?: (message: any) => void;
|
||||||
|
|
||||||
|
close(): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use the transfer parameter of postMessage instead.
|
||||||
|
* @param obj
|
||||||
|
*/
|
||||||
|
transfer(obj: GObject): void;
|
||||||
|
|
||||||
|
postMessage(message: any, transfer?: GArray | ReadonlyArray<NonNullable<GAny>>): void;
|
||||||
|
}
|
||||||
|
| undefined;
|
||||||
|
}
|
||||||
10147
packages/example/typings/godot0.gen.d.ts
vendored
Normal file
10147
packages/example/typings/godot0.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9534
packages/example/typings/godot1.gen.d.ts
vendored
Normal file
9534
packages/example/typings/godot1.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9252
packages/example/typings/godot2.gen.d.ts
vendored
Normal file
9252
packages/example/typings/godot2.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9206
packages/example/typings/godot3.gen.d.ts
vendored
Normal file
9206
packages/example/typings/godot3.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9217
packages/example/typings/godot4.gen.d.ts
vendored
Normal file
9217
packages/example/typings/godot4.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9222
packages/example/typings/godot5.gen.d.ts
vendored
Normal file
9222
packages/example/typings/godot5.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9236
packages/example/typings/godot6.gen.d.ts
vendored
Normal file
9236
packages/example/typings/godot6.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9271
packages/example/typings/godot7.gen.d.ts
vendored
Normal file
9271
packages/example/typings/godot7.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9267
packages/example/typings/godot8.gen.d.ts
vendored
Normal file
9267
packages/example/typings/godot8.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6202
packages/example/typings/godot9.gen.d.ts
vendored
Normal file
6202
packages/example/typings/godot9.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
238
packages/example/typings/jsb.editor.bundle.d.ts
vendored
Normal file
238
packages/example/typings/jsb.editor.bundle.d.ts
vendored
Normal file
@@ -0,0 +1,238 @@
|
|||||||
|
declare module "jsb.editor.codegen" {
|
||||||
|
import type { ExtractValueKeys, GArray, GDictionary, Node, PropertyInfo, Resource, ResourceTypes, Script } from "godot";
|
||||||
|
import type * as GodotJsb from "godot-jsb";
|
||||||
|
export enum DescriptorType {
|
||||||
|
Godot = 0,
|
||||||
|
User = 1,
|
||||||
|
FunctionLiteral = 2,
|
||||||
|
ObjectLiteral = 3,
|
||||||
|
StringLiteral = 4,
|
||||||
|
NumericLiteral = 5,
|
||||||
|
BooleanLiteral = 6,
|
||||||
|
Union = 7,
|
||||||
|
Intersection = 8,
|
||||||
|
Conditional = 9,
|
||||||
|
Tuple = 10,
|
||||||
|
Infer = 11,
|
||||||
|
Mapped = 12,
|
||||||
|
Indexed = 13
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Reference to a built-in type, either declared in the 'godot' namespace, or available as part of the standard library.
|
||||||
|
*/
|
||||||
|
export type GodotTypeDescriptor = GDictionary<{
|
||||||
|
type: DescriptorType.Godot;
|
||||||
|
name: string;
|
||||||
|
/**
|
||||||
|
* Generic arguments.
|
||||||
|
*/
|
||||||
|
arguments?: GArray<TypeDescriptor>;
|
||||||
|
}>;
|
||||||
|
/**
|
||||||
|
* Reference to a user defined type. A path must be specified so that the generated code is able to import the file
|
||||||
|
* where the type is declared/exported.
|
||||||
|
*/
|
||||||
|
export type UserTypeDescriptor = GDictionary<{
|
||||||
|
type: DescriptorType.User;
|
||||||
|
/**
|
||||||
|
* res:// style path to the TypeScript module where this type is exported.
|
||||||
|
*/
|
||||||
|
resource: ExtractValueKeys<ResourceTypes, Script>;
|
||||||
|
/**
|
||||||
|
* Preferred type name to use when importing.
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
/**
|
||||||
|
* Named module export that is being imported. When omitted, the default export is imported.
|
||||||
|
*/
|
||||||
|
export?: string;
|
||||||
|
/**
|
||||||
|
* Generic arguments.
|
||||||
|
*/
|
||||||
|
arguments?: GArray<TypeDescriptor>;
|
||||||
|
}>;
|
||||||
|
export type GenericParameterDescriptor = GDictionary<{
|
||||||
|
name: string;
|
||||||
|
extends?: TypeDescriptor;
|
||||||
|
default?: TypeDescriptor;
|
||||||
|
}>;
|
||||||
|
export type ParameterDescriptor = GDictionary<{
|
||||||
|
name: string;
|
||||||
|
type: TypeDescriptor;
|
||||||
|
optional?: boolean;
|
||||||
|
}>;
|
||||||
|
export type FunctionLiteralTypeDescriptor = GDictionary<{
|
||||||
|
type: DescriptorType.FunctionLiteral;
|
||||||
|
generics?: GArray<GenericParameterDescriptor>;
|
||||||
|
parameters?: GArray<ParameterDescriptor>;
|
||||||
|
returns?: TypeDescriptor;
|
||||||
|
}>;
|
||||||
|
export type OptionalTypeDescriptor<Descriptor extends GDictionary> = Descriptor extends GDictionary<infer T> ? GDictionary<T & {
|
||||||
|
optional?: boolean;
|
||||||
|
}> : never;
|
||||||
|
export type ObjectLiteralTypeDescriptor = GDictionary<{
|
||||||
|
type: DescriptorType.ObjectLiteral;
|
||||||
|
properties?: GDictionary<Partial<Record<string, OptionalTypeDescriptor<TypeDescriptor>>>>;
|
||||||
|
index?: GDictionary<{
|
||||||
|
key: TypeDescriptor;
|
||||||
|
value: TypeDescriptor;
|
||||||
|
}>;
|
||||||
|
}>;
|
||||||
|
export type StringLiteralTypeDescriptor = GDictionary<{
|
||||||
|
type: DescriptorType.StringLiteral;
|
||||||
|
value: string;
|
||||||
|
template?: boolean;
|
||||||
|
}>;
|
||||||
|
export type NumberLiteralTypeDescriptor = GDictionary<{
|
||||||
|
type: DescriptorType.NumericLiteral;
|
||||||
|
value: number;
|
||||||
|
}>;
|
||||||
|
export type BooleanLiteralTypeDescriptor = GDictionary<{
|
||||||
|
type: DescriptorType.BooleanLiteral;
|
||||||
|
value: boolean;
|
||||||
|
}>;
|
||||||
|
export type TupleElementDescriptor = GDictionary<{
|
||||||
|
name?: string;
|
||||||
|
type: TypeDescriptor;
|
||||||
|
}>;
|
||||||
|
export type TupleTypeDescriptor = GDictionary<{
|
||||||
|
type: DescriptorType.Tuple;
|
||||||
|
elements: GArray<TupleElementDescriptor>;
|
||||||
|
}>;
|
||||||
|
export type UnionTypeDescriptor = GDictionary<{
|
||||||
|
type: DescriptorType.Union;
|
||||||
|
types: GArray<TypeDescriptor>;
|
||||||
|
}>;
|
||||||
|
export type IntersectionTypeDescriptor = GDictionary<{
|
||||||
|
type: DescriptorType.Intersection;
|
||||||
|
types: GArray<TypeDescriptor>;
|
||||||
|
}>;
|
||||||
|
export type InferTypeDescriptor = GDictionary<{
|
||||||
|
type: DescriptorType.Infer;
|
||||||
|
name: string;
|
||||||
|
}>;
|
||||||
|
export type ConditionalTypeDescriptor = GDictionary<{
|
||||||
|
type: DescriptorType.Conditional;
|
||||||
|
check: TypeDescriptor;
|
||||||
|
extends: TypeDescriptor;
|
||||||
|
true: TypeDescriptor;
|
||||||
|
false: TypeDescriptor;
|
||||||
|
}>;
|
||||||
|
export type MappedTypeDescriptor = GDictionary<{
|
||||||
|
type: DescriptorType.Mapped;
|
||||||
|
key: string;
|
||||||
|
in: TypeDescriptor;
|
||||||
|
as?: TypeDescriptor;
|
||||||
|
value: TypeDescriptor;
|
||||||
|
}>;
|
||||||
|
export type IndexedTypeDescriptor = GDictionary<{
|
||||||
|
type: DescriptorType.Indexed;
|
||||||
|
base: TypeDescriptor;
|
||||||
|
index: TypeDescriptor;
|
||||||
|
}>;
|
||||||
|
export type TypeDescriptor = GodotTypeDescriptor | UserTypeDescriptor | FunctionLiteralTypeDescriptor | ObjectLiteralTypeDescriptor | StringLiteralTypeDescriptor | NumberLiteralTypeDescriptor | BooleanLiteralTypeDescriptor | TupleTypeDescriptor | UnionTypeDescriptor | IntersectionTypeDescriptor | InferTypeDescriptor | ConditionalTypeDescriptor | MappedTypeDescriptor | IndexedTypeDescriptor;
|
||||||
|
/**
|
||||||
|
* Codegen analogue of NodePathMap.
|
||||||
|
*/
|
||||||
|
export type NodeTypeDescriptorPathMap = GDictionary<Partial<Record<string, TypeDescriptor>>>;
|
||||||
|
export enum CodeGenType {
|
||||||
|
ScriptNodeTypeDescriptor = 0,
|
||||||
|
ScriptResourceTypeDescriptor = 1
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Handle a NodeTypeDescriptorCodeGenRequest to overwrite the generated type for nodes using this script.
|
||||||
|
*/
|
||||||
|
export type ScriptNodeTypeDescriptorCodeGenRequest = GDictionary<{
|
||||||
|
type: CodeGenType.ScriptNodeTypeDescriptor;
|
||||||
|
node: Node;
|
||||||
|
children: NodeTypeDescriptorPathMap;
|
||||||
|
}>;
|
||||||
|
/**
|
||||||
|
* Handle a ScriptResourceTypeDescriptorCodeGenRequest to overwrite the generated type for resources using this script.
|
||||||
|
*/
|
||||||
|
export type ScriptResourceTypeDescriptorCodeGenRequest = GDictionary<{
|
||||||
|
type: CodeGenType.ScriptResourceTypeDescriptor;
|
||||||
|
resource: Resource;
|
||||||
|
}>;
|
||||||
|
export type CodeGenRequest = ScriptNodeTypeDescriptorCodeGenRequest | ScriptResourceTypeDescriptorCodeGenRequest;
|
||||||
|
/**
|
||||||
|
* You can manipulate GodotJS' codegen by exporting a function from your script/module called `codegen`.
|
||||||
|
*/
|
||||||
|
export type CodeGenHandler = (request: CodeGenRequest) => undefined | TypeDescriptor;
|
||||||
|
export class TypeDB {
|
||||||
|
singletons: {
|
||||||
|
[name: string]: GodotJsb.editor.SingletonInfo;
|
||||||
|
};
|
||||||
|
classes: {
|
||||||
|
[name: string]: GodotJsb.editor.ClassInfo;
|
||||||
|
};
|
||||||
|
primitive_types: {
|
||||||
|
[name: string]: GodotJsb.editor.PrimitiveClassInfo;
|
||||||
|
};
|
||||||
|
globals: {
|
||||||
|
[name: string]: GodotJsb.editor.GlobalConstantInfo;
|
||||||
|
};
|
||||||
|
utilities: {
|
||||||
|
[name: string]: GodotJsb.editor.MethodBind;
|
||||||
|
};
|
||||||
|
class_docs: {
|
||||||
|
[name: string]: GodotJsb.editor.ClassDoc | false;
|
||||||
|
};
|
||||||
|
constructor();
|
||||||
|
find_doc(class_name: string): GodotJsb.editor.ClassDoc | undefined;
|
||||||
|
is_primitive_type(name: string): boolean;
|
||||||
|
is_valid_method_name(name: string): boolean;
|
||||||
|
make_classname(class_name: string, internal?: boolean): string;
|
||||||
|
make_typename(info: PropertyInfo, used_as_input: boolean, non_nullable: boolean): string;
|
||||||
|
make_arg(info: PropertyInfo, optional?: boolean): string;
|
||||||
|
make_literal_value(value: GodotJsb.editor.DefaultArgumentInfo): string;
|
||||||
|
make_arg_default_value(method_info: GodotJsb.editor.MethodBind, index: number): string;
|
||||||
|
make_args(method_info: GodotJsb.editor.MethodBind): string;
|
||||||
|
make_return(method_info: GodotJsb.editor.MethodBind): string;
|
||||||
|
make_signal_type(method_info: GodotJsb.editor.MethodBind): string;
|
||||||
|
}
|
||||||
|
export class TSDCodeGen {
|
||||||
|
private _split_index;
|
||||||
|
private _out_dir;
|
||||||
|
private _splitter;
|
||||||
|
private _types;
|
||||||
|
private _use_project_settings;
|
||||||
|
constructor(outDir: string, use_project_settings: boolean);
|
||||||
|
private make_path;
|
||||||
|
private new_splitter;
|
||||||
|
private split;
|
||||||
|
private cleanup;
|
||||||
|
has_class(name?: string): boolean;
|
||||||
|
emit(): Promise<void>;
|
||||||
|
private emit_utility;
|
||||||
|
private emit_global;
|
||||||
|
private emit_aliases;
|
||||||
|
private emit_singleton;
|
||||||
|
private emit_godot_primitive;
|
||||||
|
private emit_godot_class;
|
||||||
|
}
|
||||||
|
export class SceneTSDCodeGen {
|
||||||
|
private _out_dir;
|
||||||
|
private _scene_paths;
|
||||||
|
private _types;
|
||||||
|
constructor(out_dir: string, scene_paths: string[]);
|
||||||
|
private make_scene_path;
|
||||||
|
emit(): Promise<void>;
|
||||||
|
private emit_children_node_types;
|
||||||
|
private emit_scene_node_types;
|
||||||
|
}
|
||||||
|
export class ResourceTSDCodeGen {
|
||||||
|
private _out_dir;
|
||||||
|
private _resource_paths;
|
||||||
|
private _types;
|
||||||
|
constructor(out_dir: string, resource_paths: string[]);
|
||||||
|
private make_resource_path;
|
||||||
|
emit(): Promise<void>;
|
||||||
|
private emit_resource_type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module "jsb.editor.main" {
|
||||||
|
import { PackedStringArray } from "godot";
|
||||||
|
export function auto_complete(pattern: string): PackedStringArray;
|
||||||
|
export function run_npm_install(): void;
|
||||||
|
}
|
||||||
209
packages/example/typings/jsb.runtime.bundle.d.ts
vendored
Normal file
209
packages/example/typings/jsb.runtime.bundle.d.ts
vendored
Normal file
@@ -0,0 +1,209 @@
|
|||||||
|
declare module "godot.lib.api" {
|
||||||
|
import type * as Godot from "godot";
|
||||||
|
import type * as GodotJsb from "godot-jsb";
|
||||||
|
function proxy_unwrap_value<T>(value: T): T;
|
||||||
|
function proxy_wrap_value<T>(value: T): T;
|
||||||
|
function array_proxy<T extends any[]>(arr: T): T;
|
||||||
|
function object_proxy<T extends object>(obj: T, remap_properties?: boolean): T;
|
||||||
|
function key_only_proxy<T extends object | ((...args: any[]) => any)>(target: T): any;
|
||||||
|
function instance_proxy<T extends object>(target_instance: T): T;
|
||||||
|
function class_proxy<T extends object>(target_class: T): T;
|
||||||
|
function function_proxy<T extends (...args: any[]) => any>(fn: T): T;
|
||||||
|
function enum_proxy<T extends object>(target_enum: T): T;
|
||||||
|
const proxy: {
|
||||||
|
array_proxy: typeof array_proxy;
|
||||||
|
class_proxy: typeof class_proxy;
|
||||||
|
enum_proxy: typeof enum_proxy;
|
||||||
|
function_proxy: typeof function_proxy;
|
||||||
|
instance_proxy: typeof instance_proxy;
|
||||||
|
key_only_proxy: typeof key_only_proxy;
|
||||||
|
object_proxy: typeof object_proxy;
|
||||||
|
proxy_unwrap_value: typeof proxy_unwrap_value;
|
||||||
|
proxy_wrap_value: typeof proxy_wrap_value;
|
||||||
|
};
|
||||||
|
type GodotLibApi = typeof Godot & {
|
||||||
|
jsb: typeof GodotJsb;
|
||||||
|
proxy: typeof proxy;
|
||||||
|
};
|
||||||
|
const api: GodotLibApi;
|
||||||
|
/**
|
||||||
|
* This is a starting point for writing GodotJS code that is camel-case binding agnostic at runtime.
|
||||||
|
*
|
||||||
|
* Library code must consume this API rather than "godot", and be built with camel case bindings disabled. This is to
|
||||||
|
* ensure that the library will function at runtime for all projects irrespective of whether they have camel-case
|
||||||
|
* bindings enabled.
|
||||||
|
*/
|
||||||
|
export = api;
|
||||||
|
}
|
||||||
|
declare module "godot.annotations" {
|
||||||
|
import type * as Godot from "godot";
|
||||||
|
import type { ClassBinder, RPCConfig } from "godot.annotations";
|
||||||
|
type VariantConstructor = abstract new (...args: any[]) => NonNullable<Godot.GAny> | Number | String | Boolean;
|
||||||
|
type GObjectConstructor = abstract new (...args: any[]) => Godot.Object;
|
||||||
|
type ClassSpecifier = VariantConstructor | Symbol | EnumPlaceholder | TypePairPlaceholder;
|
||||||
|
interface EnumPlaceholder {
|
||||||
|
target: Record<string, string | number>;
|
||||||
|
}
|
||||||
|
interface TypePairPlaceholder {
|
||||||
|
key: VariantConstructor;
|
||||||
|
value: VariantConstructor;
|
||||||
|
}
|
||||||
|
export function EnumType(type: Record<string, string | number>): EnumPlaceholder;
|
||||||
|
export function TypePair(key: VariantConstructor, value: VariantConstructor): TypePairPlaceholder;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export function signal(): (target: any, name: string) => void;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export const ExportSignal: typeof signal;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export function export_multiline(): (target: any, name: string) => void;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export const ExportMultiline: typeof export_multiline;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export function export_range(min: number, max: number, step?: number, ...extra_hints: string[]): (target: any, name: string) => void;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export const ExportRange: typeof export_range;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export function export_range_i(min: number, max: number, step?: number, ...extra_hints: string[]): (target: any, name: string) => void;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export const ExportIntRange: typeof export_range_i;
|
||||||
|
/** String as a path to a file, custom filter provided as hint. */
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export function export_file(filter: string): (target: any, name: string) => void;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export const ExportFile: typeof export_file;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export function export_dir(filter: string): (target: any, name: string) => void;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export function export_global_file(filter: string): (target: any, name: string) => void;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export const ExportGlobalFile: typeof export_global_file;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export function export_global_dir(filter: string): (target: any, name: string) => void;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export const ExportGlobalDir: typeof export_global_dir;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export function export_exp_easing(hint?: "" | "attenuation" | "positive_only" | "attenuation,positive_only"): (target: any, name: string) => void;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export const ExportExpEasing: typeof export_exp_easing;
|
||||||
|
/**
|
||||||
|
* A Shortcut for `export_(Variant.Type.TYPE_ARRAY, { class_: clazz })`
|
||||||
|
*/
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export function export_array(clazz: ClassSpecifier): (target: any, name: string) => void;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export const ExportArray: typeof export_array;
|
||||||
|
/**
|
||||||
|
* A Shortcut for exporting a dictionary { class_: [key_class, value_class] })`
|
||||||
|
*/
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export function export_dictionary(key_class: VariantConstructor, value_class: VariantConstructor): (target: any, name: string) => void;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export const ExportDictionary: typeof export_dictionary;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export function export_object(clazz: GObjectConstructor): (target: any, name: string) => void;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export const ExportObject: typeof export_object;
|
||||||
|
/**
|
||||||
|
* [low level export]
|
||||||
|
* @deprecated Use createClassBinder() instead.
|
||||||
|
* */
|
||||||
|
export function export_(type: Godot.Variant.Type, details?: {
|
||||||
|
class_?: ClassSpecifier;
|
||||||
|
hint?: Godot.PropertyHint;
|
||||||
|
hint_string?: string;
|
||||||
|
usage?: Godot.PropertyUsageFlags;
|
||||||
|
}): (target: any, name: string) => void;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export function Export(type: Godot.Variant.Type, details?: {
|
||||||
|
class?: ClassSpecifier;
|
||||||
|
hint?: Godot.PropertyHint;
|
||||||
|
hintString?: string;
|
||||||
|
usage?: Godot.PropertyUsageFlags;
|
||||||
|
}): (target: any, name: string) => void;
|
||||||
|
/**
|
||||||
|
* In Godot, class members can be exported.
|
||||||
|
* This means their value gets saved along with the resource (such as the scene) they're attached to.
|
||||||
|
* They will also be available for editing in the property editor.
|
||||||
|
* Exporting is done by using the `@export_var` (or `@export_`) annotation.
|
||||||
|
*/
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export function export_var(type: Godot.Variant.Type, details?: {
|
||||||
|
class_?: ClassSpecifier;
|
||||||
|
hint?: Godot.PropertyHint;
|
||||||
|
hint_string?: string;
|
||||||
|
usage?: Godot.PropertyUsageFlags;
|
||||||
|
}): (target: any, name: string) => void;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export const ExportVar: typeof export_var;
|
||||||
|
/**
|
||||||
|
* NOTE only int value enums are allowed
|
||||||
|
*/
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export function export_enum(enum_type: Record<string, string | number>): (target: any, name: string) => void;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export const ExportEnum: typeof export_enum;
|
||||||
|
/**
|
||||||
|
* NOTE only int value enums are allowed
|
||||||
|
*/
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export function export_flags(enum_type: Record<string, string | number>): (target: any, name: string) => void;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export const ExportFlags: typeof export_flags;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export function rpc(config?: RPCConfig): (target: any, name: string) => void;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export const Rpc: typeof rpc;
|
||||||
|
/**
|
||||||
|
* auto initialized on ready (before _ready called)
|
||||||
|
*
|
||||||
|
* @deprecated Use createClassBinder() instead.
|
||||||
|
*/
|
||||||
|
export function onready(evaluator: string): (target: any, name: string) => void;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export const OnReady: typeof onready;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export function tool(): (target: any, name: undefined) => void;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export const Tool: typeof tool;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export function icon(path: string): (target: any, name: undefined) => void;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export const Icon: typeof icon;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export function deprecated(message?: string): (target: any, name?: string) => void;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export const Deprecated: typeof deprecated;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export function experimental(message?: string): (target: any, name?: string) => void;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export const Experimental: typeof experimental;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export function help(message?: string): (target: any, name?: string) => void;
|
||||||
|
/** @deprecated Use createClassBinder() instead. */
|
||||||
|
export const Help: typeof help;
|
||||||
|
export type ClassMemberDecorator<RestrictedContext extends ClassMemberDecoratorContext = ClassMemberDecoratorContext> = <Context extends RestrictedContext>(target: ClassMemberDecoratorTarget<Context>, context: Context) => void | ClassMemberDecoratorReturn<Context>;
|
||||||
|
export type ClassMemberDecoratorTarget<Context extends ClassMemberDecoratorContext> = Context extends ClassMethodDecoratorContext<infer _, infer Value> ? (...args: unknown[]) => Value : Context extends ClassGetterDecoratorContext<infer _, infer Value> ? () => Value : Context extends ClassSetterDecoratorContext<infer _, infer Value> ? (value: Value) => void : Context extends ClassFieldDecoratorContext ? undefined : Context extends ClassAccessorDecoratorContext<infer _, infer Value> ? {
|
||||||
|
get: () => Value;
|
||||||
|
set: (value: Value) => void;
|
||||||
|
} : never;
|
||||||
|
export type ClassMemberDecoratorReturn<Context extends ClassMemberDecoratorContext> = Context extends ClassMethodDecoratorContext<infer This, infer Value> ? (this: This, ...args: unknown[]) => Value : Context extends ClassGetterDecoratorContext<infer This, infer Value> ? (this: This) => Value : Context extends ClassSetterDecoratorContext<infer This, infer Value> ? (this: This, value: Value) => void : Context extends ClassFieldDecoratorContext<infer This, infer Value> ? (this: This, initialValue: Value) => Value : Context extends ClassAccessorDecoratorContext<infer This, infer Value> ? {
|
||||||
|
get?(this: This): Value;
|
||||||
|
set?(this: This, value: Value): void;
|
||||||
|
init?(this: This, initialValue: Value): Value;
|
||||||
|
} : never;
|
||||||
|
export type ClassDecorator<This extends abstract new (...args: any) => any = abstract new (...args: any) => any> = (target: This, context: ClassDecoratorContext<This>) => void;
|
||||||
|
export type ClassDecoratorClass<Context extends ClassDecoratorContext> = Context extends ClassDecoratorContext<infer Class> ? Class : never;
|
||||||
|
export type Decorator<RestrictedContext extends DecoratorContext = DecoratorContext> = RestrictedContext extends ClassDecoratorContext ? <Context extends RestrictedContext>(target: ClassDecoratorClass<Context>, context: Context) => void : RestrictedContext extends ClassMemberDecoratorContext ? <Context extends RestrictedContext>(target: ClassMemberDecoratorTarget<Context>, context: Context) => void | ClassMemberDecoratorReturn<Context> : never;
|
||||||
|
export type AnyDecorator = (value: unknown, context: DecoratorContext) => unknown;
|
||||||
|
export type ClassValueMemberDecoratorContext<This = unknown, Value = unknown> = ClassGetterDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value> | ClassFieldDecoratorContext<This, Value> | ClassAccessorDecoratorContext<This, Value>;
|
||||||
|
export function createClassBinder(): ClassBinder;
|
||||||
|
}
|
||||||
|
declare module "godot.typeloader" {
|
||||||
|
/**
|
||||||
|
* @param type the loaded type or function in godot module
|
||||||
|
*/
|
||||||
|
export type TypeLoadedCallback = (type: any) => void;
|
||||||
|
export function on_type_loaded(type_name: string | string[], callback: TypeLoadedCallback): void;
|
||||||
|
}
|
||||||
|
declare module "jsb.core" { }
|
||||||
|
declare module "jsb.inject" { }
|
||||||
144
packages/example/typings/jsb.runtime.gen.d.ts
vendored
Normal file
144
packages/example/typings/jsb.runtime.gen.d.ts
vendored
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
declare module "godot.annotations" {
|
||||||
|
import * as Godot from "godot";
|
||||||
|
import * as GodotJsb from "godot-jsb";
|
||||||
|
type ClassBinder = (() =>
|
||||||
|
((
|
||||||
|
target: GObjectConstructor,
|
||||||
|
context: ClassDecoratorContext
|
||||||
|
) => void))
|
||||||
|
& {
|
||||||
|
tool: () =>
|
||||||
|
((
|
||||||
|
target: GObjectConstructor,
|
||||||
|
_context: ClassDecoratorContext
|
||||||
|
) => void);
|
||||||
|
icon: (path: string) =>
|
||||||
|
((
|
||||||
|
target: GObjectConstructor,
|
||||||
|
_context: ClassDecoratorContext
|
||||||
|
) => void);
|
||||||
|
export: ((
|
||||||
|
type: Godot.Variant.Type,
|
||||||
|
options?: ExportOptions
|
||||||
|
) => ClassMemberDecorator)
|
||||||
|
& {
|
||||||
|
multiline: () => ClassMemberDecorator;
|
||||||
|
range: (
|
||||||
|
min: number,
|
||||||
|
max: number,
|
||||||
|
step: number,
|
||||||
|
...extra_hints: string[]
|
||||||
|
) => ClassMemberDecorator;
|
||||||
|
range_int: (
|
||||||
|
min: number,
|
||||||
|
max: number,
|
||||||
|
step: number,
|
||||||
|
...extra_hints: string[]
|
||||||
|
) => ClassMemberDecorator;
|
||||||
|
file: (filter: string) => ClassMemberDecorator;
|
||||||
|
dir: (filter: string) => ClassMemberDecorator;
|
||||||
|
global_file: (filter: string) => ClassMemberDecorator;
|
||||||
|
global_dir: (filter: string) => ClassMemberDecorator;
|
||||||
|
exp_easing: (
|
||||||
|
hint?: ""
|
||||||
|
| "attenuation"
|
||||||
|
| "positive_only"
|
||||||
|
| "attenuation,positive_only"
|
||||||
|
) => ClassMemberDecorator;
|
||||||
|
array: (clazz: ClassSpecifier) => ClassMemberDecorator;
|
||||||
|
dictionary: (
|
||||||
|
key_class: VariantConstructor,
|
||||||
|
value_class: VariantConstructor
|
||||||
|
) => ClassMemberDecorator;
|
||||||
|
object: <
|
||||||
|
Constructor extends GObjectConstructor>(clazz: Constructor
|
||||||
|
) =>
|
||||||
|
ClassMemberDecorator<
|
||||||
|
ClassValueMemberDecoratorContext<
|
||||||
|
unknown,
|
||||||
|
null
|
||||||
|
| InstanceType<Constructor>
|
||||||
|
>
|
||||||
|
>;
|
||||||
|
"enum": (
|
||||||
|
enum_type: Record<
|
||||||
|
string,
|
||||||
|
string
|
||||||
|
| number
|
||||||
|
>
|
||||||
|
) => ClassMemberDecorator;
|
||||||
|
flags: (
|
||||||
|
enum_type: Record<
|
||||||
|
string,
|
||||||
|
string
|
||||||
|
| number
|
||||||
|
>
|
||||||
|
) => ClassMemberDecorator;
|
||||||
|
cache: () =>
|
||||||
|
ClassMemberDecorator<
|
||||||
|
ClassAccessorDecoratorContext<Godot.Object>
|
||||||
|
| ClassSetterDecoratorContext<Godot.Object>
|
||||||
|
>;
|
||||||
|
};
|
||||||
|
signal: () =>
|
||||||
|
(<
|
||||||
|
Context extends ClassAccessorDecoratorContext<
|
||||||
|
Godot.Object,
|
||||||
|
Godot.Signal
|
||||||
|
>
|
||||||
|
| ClassGetterDecoratorContext<
|
||||||
|
Godot.Object,
|
||||||
|
Godot.Signal
|
||||||
|
>
|
||||||
|
| ClassFieldDecoratorContext<
|
||||||
|
Godot.Object,
|
||||||
|
Godot.Signal
|
||||||
|
>>(
|
||||||
|
_target: unknown,
|
||||||
|
context: Context
|
||||||
|
) => ClassMemberDecoratorReturn<Context>);
|
||||||
|
rpc: (config?: RPCConfig) =>
|
||||||
|
((
|
||||||
|
_target: Function,
|
||||||
|
context: string
|
||||||
|
| ClassMethodDecoratorContext
|
||||||
|
) => void);
|
||||||
|
onready: (
|
||||||
|
evaluator: string
|
||||||
|
| GodotJsb.internal.OnReadyEvaluatorFunc
|
||||||
|
) =>
|
||||||
|
((
|
||||||
|
_target: undefined,
|
||||||
|
context: string
|
||||||
|
| ClassMethodDecoratorContext
|
||||||
|
) => void);
|
||||||
|
deprecated: (message?: string) =>
|
||||||
|
Decorator<
|
||||||
|
ClassDecoratorContext<GObjectConstructor>
|
||||||
|
| ClassValueMemberDecoratorContext<GObjectConstructor>
|
||||||
|
>;
|
||||||
|
experimental: (message?: string) =>
|
||||||
|
Decorator<
|
||||||
|
ClassDecoratorContext<GObjectConstructor>
|
||||||
|
| ClassValueMemberDecoratorContext<GObjectConstructor>
|
||||||
|
>;
|
||||||
|
help: (message?: string) =>
|
||||||
|
Decorator<
|
||||||
|
ClassDecoratorContext<GObjectConstructor>
|
||||||
|
| ClassValueMemberDecoratorContext<GObjectConstructor>
|
||||||
|
>;
|
||||||
|
}
|
||||||
|
type ExportOptions = {
|
||||||
|
"class"?: any;
|
||||||
|
hint?: Godot.PropertyHint;
|
||||||
|
hint_string?: string;
|
||||||
|
usage?: Godot.PropertyUsageFlags;
|
||||||
|
}
|
||||||
|
type RPCConfig = {
|
||||||
|
mode?: Godot.MultiplayerAPI.RPCMode;
|
||||||
|
sync?: "call_remote"
|
||||||
|
| "call_local";
|
||||||
|
transfer_mode?: Godot.MultiplayerPeer.TransferMode;
|
||||||
|
transfer_channel?: number;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user