12
bun.lock
12
bun.lock
@@ -37,6 +37,12 @@
|
||||
"packages/react-godot-renderer": {
|
||||
"name": "react-godot-renderer",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"react-reconciler": "~0.32.0",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react-reconciler": "~0.32.0",
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "^19.2.0",
|
||||
"react": "^19.2.0",
|
||||
@@ -188,6 +194,8 @@
|
||||
|
||||
"@types/react": ["@types/react@19.2.7", "", { "dependencies": { "csstype": "^3.2.2" } }, "sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg=="],
|
||||
|
||||
"@types/react-reconciler": ["@types/react-reconciler@0.32.3", "", { "peerDependencies": { "@types/react": "*" } }, "sha512-cMi5ZrLG7UtbL7LTK6hq9w/EZIRk4Mf1Z5qHoI+qBh7/WkYkFXQ7gOto2yfUvPzF5ERMAhaXS5eTQ2SAnHjLzA=="],
|
||||
|
||||
"@types/resolve": ["@types/resolve@1.20.2", "", {}, "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q=="],
|
||||
|
||||
"braces": ["braces@3.0.3", "", { "dependencies": { "fill-range": "^7.1.1" } }, "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA=="],
|
||||
@@ -288,6 +296,8 @@
|
||||
|
||||
"react-godot-renderer": ["react-godot-renderer@workspace:packages/react-godot-renderer"],
|
||||
|
||||
"react-reconciler": ["react-reconciler@0.32.0", "", { "dependencies": { "scheduler": "^0.26.0" }, "peerDependencies": { "react": "^19.1.0" } }, "sha512-2NPMOzgTlG0ZWdIf3qG+dcbLSoAc/uLfOwckc3ofy5sSK0pLJqnQLpUFxvGcN2rlXSjnVtGeeFLNimCQEj5gOQ=="],
|
||||
|
||||
"resolve": ["resolve@1.22.11", "", { "dependencies": { "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ=="],
|
||||
|
||||
"resolve-pkg-maps": ["resolve-pkg-maps@1.0.0", "", {}, "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw=="],
|
||||
@@ -304,6 +314,8 @@
|
||||
|
||||
"run-parallel": ["run-parallel@1.2.0", "", { "dependencies": { "queue-microtask": "^1.2.2" } }, "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA=="],
|
||||
|
||||
"scheduler": ["scheduler@0.26.0", "", {}, "sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA=="],
|
||||
|
||||
"slash": ["slash@5.1.0", "", {}, "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg=="],
|
||||
|
||||
"supports-preserve-symlinks-flag": ["supports-preserve-symlinks-flag@1.0.0", "", {}, "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w=="],
|
||||
|
||||
@@ -37,6 +37,12 @@
|
||||
"clean:dist": "rm -rf dist",
|
||||
"clean:modules": "rm -rf node_modules"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react-reconciler": "~0.32.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"react-reconciler": "~0.32.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "^19.2.0",
|
||||
"react": "^19.2.0"
|
||||
|
||||
155
packages/react-godot-renderer/src/Reconciler.ts
Normal file
155
packages/react-godot-renderer/src/Reconciler.ts
Normal file
@@ -0,0 +1,155 @@
|
||||
import { Predicate, String } from "effect"
|
||||
import { ClassDB, Node } from "godot"
|
||||
import ReactReconciler from "react-reconciler"
|
||||
import { DefaultEventPriority } from "react-reconciler/constants"
|
||||
|
||||
|
||||
export const make = () => {
|
||||
let eventTime = 0
|
||||
let currentPriority = DefaultEventPriority
|
||||
|
||||
return ReactReconciler<
|
||||
string,
|
||||
Record<string, unknown>,
|
||||
Node,
|
||||
Node,
|
||||
Node,
|
||||
Node,
|
||||
Node,
|
||||
Node,
|
||||
Node,
|
||||
unknown,
|
||||
unknown,
|
||||
unknown,
|
||||
unknown,
|
||||
unknown
|
||||
>({
|
||||
supportsMutation: true,
|
||||
|
||||
createInstance(type, props) {
|
||||
let instance: Node
|
||||
if (type === "custom") {
|
||||
if (!Predicate.hasProperty(props, "class"))
|
||||
throw new Error("Property 'class' required when using the 'custom' intrinsic type")
|
||||
instance = new (props.class as any)()
|
||||
}
|
||||
else {
|
||||
const className = String.capitalize(type)
|
||||
if (!ClassDB.class_exists(className))
|
||||
throw new Error(`Class is invalid: '${className}' (declared as '${type}') is not a valid engine or GDExtension class`)
|
||||
instance = ClassDB.instantiate(className)
|
||||
}
|
||||
|
||||
if (!(instance instanceof Node))
|
||||
throw new Error("Class is not a subclass of 'Node'")
|
||||
applyNextProps(instance, props)
|
||||
|
||||
return instance
|
||||
},
|
||||
|
||||
createTextInstance(_text) {
|
||||
throw new Error("createTextInstance not supported")
|
||||
},
|
||||
|
||||
appendInitialChild(parent, child) {
|
||||
parent.add_child(child)
|
||||
},
|
||||
|
||||
appendChild(parent, child) {
|
||||
parent.add_child(child)
|
||||
},
|
||||
|
||||
appendChildToContainer(container, child) {
|
||||
container.add_child(child)
|
||||
},
|
||||
|
||||
removeChild(parent, child) {
|
||||
parent.remove_child(child)
|
||||
},
|
||||
|
||||
removeChildFromContainer(container, child) {
|
||||
container.remove_child(child)
|
||||
},
|
||||
|
||||
insertBefore(_parent, child, before) {
|
||||
before.add_sibling(child)
|
||||
},
|
||||
|
||||
finalizeInitialChildren() {
|
||||
return false
|
||||
},
|
||||
|
||||
prepareForCommit() {},
|
||||
resetAfterCommit() {},
|
||||
|
||||
getRootHostContext() {
|
||||
return {};
|
||||
},
|
||||
|
||||
getChildHostContext(parentHostContext, type, rootContainer) {
|
||||
return parentHostContext
|
||||
},
|
||||
|
||||
shouldSetTextContent() {
|
||||
return false
|
||||
},
|
||||
|
||||
commitUpdate(instance, _type, _prevProps, nextProps, _internalHandle) {
|
||||
applyNextProps(instance, nextProps)
|
||||
},
|
||||
|
||||
commitTextUpdate(_textInstance, _oldText, _newText) {
|
||||
throw new Error("commitTextUpdate not supported")
|
||||
},
|
||||
|
||||
getPublicInstance(instance) {
|
||||
return instance;
|
||||
},
|
||||
|
||||
resolveUpdatePriority() {
|
||||
return DefaultEventPriority
|
||||
},
|
||||
|
||||
resolveEventTimeStamp() {
|
||||
return ++eventTime
|
||||
},
|
||||
|
||||
trackSchedulerEvent() {},
|
||||
|
||||
resolveEventType() {
|
||||
return null
|
||||
},
|
||||
|
||||
getCurrentUpdatePriority() {
|
||||
return currentPriority
|
||||
},
|
||||
|
||||
setCurrentUpdatePriority(newPriority) {
|
||||
currentPriority = newPriority
|
||||
},
|
||||
|
||||
clearContainer(container) {
|
||||
for (const child of container.get_children()) {
|
||||
container.remove_child(child)
|
||||
}
|
||||
},
|
||||
|
||||
scheduleTimeout: setTimeout,
|
||||
cancelTimeout: clearTimeout,
|
||||
noTimeout: -1,
|
||||
|
||||
isPrimaryRenderer: true,
|
||||
})
|
||||
}
|
||||
|
||||
const applyNextProps = (instance: Node, nextProps: Record<string, unknown>) => {
|
||||
Object.keys(nextProps).forEach(name => {
|
||||
(instance as any)[name] = nextProps[name]
|
||||
})
|
||||
|
||||
if (Predicate.hasProperty(nextProps, "name")) {
|
||||
if (typeof nextProps.name !== "string")
|
||||
throw new Error("Prop 'name' should be a string")
|
||||
instance.set_name(nextProps.name)
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
// Enable latest features
|
||||
"lib": ["ESNext", "DOM"],
|
||||
"lib": ["ESNext"],
|
||||
"target": "ESNext",
|
||||
"module": "NodeNext",
|
||||
"moduleDetection": "force",
|
||||
@@ -13,6 +13,7 @@
|
||||
// "allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
// "noEmit": true,
|
||||
"typeRoots": ["./node_modules/@types", "./typings"],
|
||||
|
||||
// Best practices
|
||||
"strict": true,
|
||||
@@ -27,11 +28,7 @@
|
||||
// Build
|
||||
"outDir": "./dist",
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
|
||||
"plugins": [
|
||||
{ "name": "@effect/language-service" }
|
||||
]
|
||||
"sourceMap": true
|
||||
},
|
||||
|
||||
"include": ["./src"]
|
||||
|
||||
368
packages/react-godot-renderer/typings/godot.minimal.d.ts
vendored
Normal file
368
packages/react-godot-renderer/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;
|
||||
418
packages/react-godot-renderer/typings/godot.mix.d.ts
vendored
Normal file
418
packages/react-godot-renderer/typings/godot.mix.d.ts
vendored
Normal file
@@ -0,0 +1,418 @@
|
||||
declare module "godot" {
|
||||
const IntegerType: unique symbol;
|
||||
const FloatType: unique symbol;
|
||||
/**
|
||||
* Proxy objects are typically transparent by design, allowing a proxy to impersonate a type. However, GodotJS also
|
||||
* makes use of proxies to wrap existing objects in order to provide a more convenient API. In such cases, it is
|
||||
* convenient to be able to unwrap the object i.e. obtain access to the target object. In order to achieve this,
|
||||
* GodotJS exposes a property with the key ProxyTarget. You can access this to, for example, obtain direct access
|
||||
* to the original GDictionary wrapped via a call to .proxy(). Additionally, GodotJS uses this property internally
|
||||
* to unwrap proxies, thus allowing you to pass a proxy wrapped GArray/GDictionary as an argument to any function
|
||||
* expecting a GArray/GDictionary parameter.
|
||||
*/
|
||||
const ProxyTarget: unique symbol;
|
||||
|
||||
/**
|
||||
* FOR BACKWARD COMPATIBILITY ONLY
|
||||
* @deprecated [WARNING] Use Callable/Callable<T>.
|
||||
*/
|
||||
type AnyCallable = Callable;
|
||||
|
||||
/**
|
||||
* FOR BACKWARD COMPATIBILITY ONLY
|
||||
* @deprecated [WARNING] Use Signal/Signal<T>.
|
||||
*/
|
||||
type AnySignal = Signal;
|
||||
|
||||
/**
|
||||
* FOR BACKWARD COMPATIBILITY ONLY
|
||||
* @deprecated [WARNING] Use Callable<T>.
|
||||
*/
|
||||
type Callable0<R = void> = Callable<() => R>;
|
||||
|
||||
/**
|
||||
* FOR BACKWARD COMPATIBILITY ONLY
|
||||
* @deprecated [WARNING] Use Callable<T>.
|
||||
*/
|
||||
type Callable1<T1, R = void> = Callable<(v1: T1) => R>;
|
||||
|
||||
/**
|
||||
* FOR BACKWARD COMPATIBILITY ONLY
|
||||
* @deprecated [WARNING] Use Callable<T>.
|
||||
*/
|
||||
type Callable2<T1, T2, R = void> = Callable<(v1: T1, v2: T2) => R>;
|
||||
|
||||
/**
|
||||
* FOR BACKWARD COMPATIBILITY ONLY
|
||||
* @deprecated [WARNING] Use Callable<T>.
|
||||
*/
|
||||
type Callable3<T1, T2, T3, R = void> = Callable<(v1: T1, v2: T2, v3: T3) => R>;
|
||||
|
||||
/**
|
||||
* FOR BACKWARD COMPATIBILITY ONLY
|
||||
* @deprecated [WARNING] Use Callable<T>.
|
||||
*/
|
||||
type Callable4<T1, T2, T3, T4, R = void> = Callable<(v1: T1, v2: T2, v3: T3, v4: T4) => R>;
|
||||
|
||||
/**
|
||||
* FOR BACKWARD COMPATIBILITY ONLY
|
||||
* @deprecated [WARNING] Use Callable<T>.
|
||||
*/
|
||||
type Callable5<T1, T2, T3, T4, T5, R = void> = Callable<(v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) => R>;
|
||||
|
||||
/**
|
||||
* FOR BACKWARD COMPATIBILITY ONLY
|
||||
* @deprecated [WARNING] Use Signal<T>.
|
||||
*/
|
||||
type Signal0 = Signal<() => void>;
|
||||
|
||||
/**
|
||||
* FOR BACKWARD COMPATIBILITY ONLY
|
||||
* @deprecated [WARNING] Use Signal<T>.
|
||||
*/
|
||||
type Signal1<T1> = Signal<(v1: T1) => void>;
|
||||
|
||||
/**
|
||||
* FOR BACKWARD COMPATIBILITY ONLY
|
||||
* @deprecated [WARNING] Use Signal<T>.
|
||||
*/
|
||||
type Signal2<T1, T2> = Signal<(v1: T1, v2: T2) => void>;
|
||||
|
||||
/**
|
||||
* FOR BACKWARD COMPATIBILITY ONLY
|
||||
* @deprecated [WARNING] Use Signal<T>.
|
||||
*/
|
||||
type Signal3<T1, T2, T3> = Signal<(v1: T1, v2: T2, v3: T3) => void>;
|
||||
|
||||
/**
|
||||
* FOR BACKWARD COMPATIBILITY ONLY
|
||||
* @deprecated [WARNING] Use Signal<T>.
|
||||
*/
|
||||
type Signal4<T1, T2, T3, T4> = Signal<(v1: T1, v2: T2, v3: T3, v4: T4) => void>;
|
||||
|
||||
/**
|
||||
* FOR BACKWARD COMPATIBILITY ONLY
|
||||
* @deprecated [WARNING] Use Signal<T>.
|
||||
*/
|
||||
type Signal5<T1, T2, T3, T4, T5> = Signal<(v1: T1, v2: T2, v3: T3, v4: T4, v5: T5) => void>;
|
||||
|
||||
type ExtractValueKeys<T, V> = { [K in keyof T]: T[K] extends V ? K : never }[keyof T];
|
||||
type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
|
||||
|
||||
type UndefinedToNull<T> = T extends undefined ? null : T;
|
||||
|
||||
// A bit convoluted, but written this way to mitigate type definitions circularly depending on themselves.
|
||||
type GodotNames<T> = "__godotNameMap" extends keyof T
|
||||
? keyof T["__godotNameMap"] | Exclude<keyof T, T["__godotNameMap"][keyof T["__godotNameMap"]]>
|
||||
: keyof T;
|
||||
type ResolveGodotName<T, Name> = Name extends keyof T
|
||||
? Name
|
||||
: "__godotNameMap" extends keyof T
|
||||
? Name extends keyof T["__godotNameMap"]
|
||||
? T["__godotNameMap"][Name]
|
||||
: never
|
||||
: never;
|
||||
type ResolveGodotNameValue<T, Name> = Name extends keyof T
|
||||
? T[Name]
|
||||
: "__godotNameMap" extends keyof T
|
||||
? Name extends keyof T["__godotNameMap"]
|
||||
? T["__godotNameMap"][Name] extends keyof T
|
||||
? T[T["__godotNameMap"][Name]]
|
||||
: never
|
||||
: never
|
||||
: never;
|
||||
type ResolveGodotNameParameters<T, Name> = Name extends GodotDynamicDispatchName
|
||||
? GAny[]
|
||||
: ResolveGodotName<T, Name> extends keyof T
|
||||
? T[ResolveGodotName<T, Name>] extends {
|
||||
bivarianceHack(...args: infer P extends GAny[]): void | GAny;
|
||||
}["bivarianceHack"]
|
||||
? P
|
||||
: never
|
||||
: never;
|
||||
type ResolveGodotReturnType<T, Name> = Name extends GodotDynamicDispatchName
|
||||
? void | GAny
|
||||
: ResolveGodotName<T, Name> extends keyof T
|
||||
? T[ResolveGodotName<T, Name>] extends (...args: any[]) => infer R
|
||||
? R
|
||||
: never
|
||||
: never;
|
||||
|
||||
/**
|
||||
* Godot has many APIs that are a form of dynamic dispatch, i.e., they take the name of a function or property and
|
||||
* then operate on the value matching the name. TypeScript is powerful enough to allow us to type these APIs.
|
||||
* However, since these APIs can be used to call each other, the type checker can get hung up trying to infinitely
|
||||
* recurse on these types. What follows is an interface with the built-in dynamic dispatch names. GodotJS' types
|
||||
* will not recurse through methods matching these names. If you want to build your own dynamic dispatch APIs, you
|
||||
* can use interface merging to insert additional method names.
|
||||
*/
|
||||
interface GodotDynamicDispatchNames {
|
||||
call: "call";
|
||||
callv: "callv";
|
||||
call_deferred: "call_deferred";
|
||||
add_do_method: "add_do_method";
|
||||
add_undo_method: "add_undo_method";
|
||||
}
|
||||
|
||||
type GodotDynamicDispatchName = GodotDynamicDispatchNames[keyof GodotDynamicDispatchNames];
|
||||
|
||||
/**
|
||||
* This namespace and the values within do not exist at runtime. They're declared here, for internal use only, as a
|
||||
* work-around for limitations of TypeScript's type system.
|
||||
*/
|
||||
namespace __PathMappableDummyKeys {}
|
||||
|
||||
type PathMappable<DummyKey extends symbol, Map extends PathMap = PathMap> = {
|
||||
[K in DummyKey]: Map;
|
||||
};
|
||||
|
||||
type PathMap<T = unknown> = Record<string, T>;
|
||||
|
||||
type StaticPath<
|
||||
Map extends PathMap,
|
||||
Permitted = any,
|
||||
DefaultKey extends string = never,
|
||||
DummyKey extends symbol = (typeof __PathMappableDummyKeys)[keyof typeof __PathMappableDummyKeys],
|
||||
> = IfAny<
|
||||
Map,
|
||||
string,
|
||||
| (ExtractValueKeys<Map, Permitted> & string)
|
||||
| (DummyKey extends any
|
||||
?
|
||||
| (Map[DefaultKey] extends never
|
||||
? never
|
||||
: Map[DefaultKey] extends PathMappable<DummyKey, infer ChildMap>
|
||||
? StaticPath<ChildMap, Permitted, DefaultKey>
|
||||
: never)
|
||||
| {
|
||||
[K in Exclude<keyof Map, DefaultKey> & string]: Map[K] extends PathMappable<
|
||||
DummyKey,
|
||||
infer ChildMap
|
||||
>
|
||||
? `${K}/${StaticPath<ChildMap, Permitted, DefaultKey>}`
|
||||
: never;
|
||||
}[Exclude<keyof Map, DefaultKey> & string]
|
||||
: never)
|
||||
>;
|
||||
|
||||
type ResolvePath<
|
||||
Map extends PathMap,
|
||||
Path extends string,
|
||||
Default,
|
||||
Permitted,
|
||||
DefaultKey extends string = never,
|
||||
DummyKey extends symbol = (typeof __PathMappableDummyKeys)[keyof typeof __PathMappableDummyKeys],
|
||||
> = IfAny<
|
||||
Map,
|
||||
Permitted,
|
||||
DummyKey extends any
|
||||
? Path extends keyof Map
|
||||
? [Map[Path]] extends [Permitted]
|
||||
? [undefined] extends [Map[Path]]
|
||||
? null | Exclude<Map[Path], undefined>
|
||||
: Map[Path]
|
||||
: Default
|
||||
: Path extends `${infer Key extends Exclude<keyof Map, DefaultKey> & string}/${infer SubPath}`
|
||||
? Map[Key] extends PathMappable<DummyKey, infer ChildMap>
|
||||
? ResolvePath<ChildMap, SubPath, Default, Permitted>
|
||||
: Default
|
||||
: Map[DefaultKey] extends PathMappable<DummyKey, infer ChildMap>
|
||||
? ResolvePath<ChildMap, Path, Default, Permitted>
|
||||
: never
|
||||
: never
|
||||
>;
|
||||
|
||||
type PathMapChild<Map extends NodePathMap, Permitted, Default> = IfAny<
|
||||
Map,
|
||||
Permitted,
|
||||
Map[keyof Map] extends undefined | Permitted ? Exclude<Map[keyof Map], undefined> : Default
|
||||
>;
|
||||
|
||||
type NodePathMap = PathMap<undefined | Node>;
|
||||
type StaticNodePath<Map extends NodePathMap, Permitted = Node> = StaticPath<
|
||||
Map,
|
||||
Permitted,
|
||||
never,
|
||||
typeof __PathMappableDummyKeys.Node
|
||||
>;
|
||||
type ResolveNodePath<Map extends NodePathMap, Path extends string, Default = never, Permitted = Node> = ResolvePath<
|
||||
Map,
|
||||
Path,
|
||||
Default,
|
||||
Permitted,
|
||||
never,
|
||||
typeof __PathMappableDummyKeys.Node
|
||||
>;
|
||||
type ResolveNodePathMap<Map extends NodePathMap, Path extends string, Default = never> = Path extends keyof Map
|
||||
? Map[Path] extends Node<infer ChildMap>
|
||||
? ChildMap
|
||||
: Default
|
||||
: Path extends `${infer Key extends keyof Map & string}/${infer SubPath}`
|
||||
? Map[Key] extends Node<infer ChildMap>
|
||||
? ResolveNodePathMap<ChildMap, SubPath, Default>
|
||||
: Default
|
||||
: Default;
|
||||
type NodePathMapChild<Map extends NodePathMap> = PathMapChild<Map, Node, Node>;
|
||||
|
||||
type AnimationMixerPathMap = PathMap<AnimationLibrary>;
|
||||
type StaticAnimationMixerPath<Map extends AnimationMixerPathMap> = StaticPath<
|
||||
Map,
|
||||
Animation,
|
||||
"",
|
||||
(typeof __PathMappableDummyKeys)["AnimationLibrary" | "AnimationMixer"]
|
||||
>;
|
||||
type ResolveAnimationMixerPath<
|
||||
Map extends AnimationMixerPathMap,
|
||||
Path extends string,
|
||||
Default = never,
|
||||
> = ResolvePath<
|
||||
Map,
|
||||
Path,
|
||||
Default,
|
||||
Animation,
|
||||
"",
|
||||
(typeof __PathMappableDummyKeys)["AnimationLibrary" | "AnimationMixer"]
|
||||
>;
|
||||
|
||||
type GArrayElement<T extends GAny | GAny[], I extends int64 = int64> = T extends any[] ? T[I] : T;
|
||||
|
||||
/**
|
||||
* GArray elements are exposed with a subset of JavaScript's standard Array API. Array indexes are exposed as
|
||||
* enumerable properties, thus if you want to perform more complex operations you can convert to a regular
|
||||
* JavaScript array with [...g_array.proxy()].
|
||||
*/
|
||||
class GArrayProxy<T> {
|
||||
[Symbol.iterator](): IteratorObject<GProxyValueWrap<T>>;
|
||||
|
||||
/**
|
||||
* Gets the length of the array. This is a number one higher than the highest index in the array.
|
||||
*/
|
||||
get length(): number;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
* @param callback A function that accepts up to three arguments. forEach calls the callback function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callback function. If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
forEach<S = GArrayProxy<T>>(
|
||||
callback: (this: GArrayProxy<T>, value: GProxyValueWrap<T>, index: number) => void,
|
||||
thisArg?: S,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Removes the last element from an array and returns it.
|
||||
* If the array is empty, undefined is returned and the array is not modified.
|
||||
*/
|
||||
pop(): GProxyValueWrap<T> | undefined;
|
||||
|
||||
/**
|
||||
* Appends new elements to the end of an array, and returns the new length of the array.
|
||||
* @param item New element to add to the array.
|
||||
* @param additionalItems Additional new elements to add to the array.
|
||||
*/
|
||||
push(item: T | GProxyValueWrap<T>, ...additionalItems: Array<T | GProxyValueWrap<T>>): number;
|
||||
|
||||
/**
|
||||
* Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
|
||||
* @param searchElement The value to locate in the array.
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
|
||||
*/
|
||||
indexOf(searchElement: T | GProxyValueWrap<T>, fromIndex?: number): number;
|
||||
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
*/
|
||||
includes(searchElement: T | GProxyValueWrap<T>): boolean;
|
||||
|
||||
toJSON(key?: any): any;
|
||||
|
||||
toString(): string;
|
||||
|
||||
[n: number]: T | GProxyValueWrap<T>; // More accurate get type blocked by https://github.com/microsoft/TypeScript/issues/43826
|
||||
}
|
||||
|
||||
// Ideally this would be a class, but TS currently doesn't provide a way to type a class with mapped properties.
|
||||
/**
|
||||
* GObject entries are exposed as enumerable properties, so Object.keys(), GObject.entries() etc. will work.
|
||||
*/
|
||||
type GDictionaryProxy<T> = {
|
||||
[K in keyof T]: T[K] | GProxyValueWrap<T[K]>; // More accurate get type blocked by https://github.com/microsoft/TypeScript/issues/43826
|
||||
};
|
||||
|
||||
type GProxyValueWrap<V> =
|
||||
V extends GArray<infer T>
|
||||
? GArrayProxy<GArrayElement<T>>
|
||||
: V extends GDictionary<infer T>
|
||||
? GDictionaryProxy<T>
|
||||
: V;
|
||||
|
||||
type GProxyValueUnwrap<V> = V extends GArrayProxy<infer E> ? E : V extends GDictionaryProxy<infer T> ? T : V;
|
||||
|
||||
type GWrappableValue = GAny | GWrappableValue[] | { [key: number | string]: GWrappableValue };
|
||||
type GValueWrapUnchecked<V> = V extends any[]
|
||||
? number extends V["length"]
|
||||
? GArray<GValueWrapUnchecked<V[number]>>
|
||||
: GArray<{ [I in keyof V]: GValueWrapUnchecked<V[I]> }>
|
||||
: V extends GAny
|
||||
? V
|
||||
: GDictionary<{ [K in keyof V]: GValueWrapUnchecked<V[K]> }>;
|
||||
type GValueWrap<V> = [keyof V] extends [never]
|
||||
? GDictionary<{}>
|
||||
: [V] extends [GWrappableValue]
|
||||
? GValueWrapUnchecked<V>
|
||||
: never;
|
||||
|
||||
type GValueUnwrap<V> =
|
||||
V extends GArray<infer T>
|
||||
? T extends any[]
|
||||
? { [I in keyof T]: GValueUnwrap<T[I]> }
|
||||
: Array<GValueUnwrap<T>>
|
||||
: V extends GDictionary<infer T>
|
||||
? { [K in keyof T]: GValueUnwrap<T[K]> }
|
||||
: V;
|
||||
|
||||
/**
|
||||
* Semi-workaround for https://github.com/microsoft/TypeScript/issues/43826.
|
||||
* @see GReadProxyValueWrap
|
||||
*/
|
||||
type GArrayReadProxy<T> = Omit<GArrayProxy<T>, "forEach"> & {
|
||||
[Symbol.iterator](): IteratorObject<GReadProxyValueWrap<T>>;
|
||||
forEach<S = GArrayReadProxy<T>>(
|
||||
callback: (this: GArrayReadProxy<T>, value: GReadProxyValueWrap<T>, index: number) => void,
|
||||
thisArg?: S,
|
||||
): void;
|
||||
[n: number]: GReadProxyValueWrap<T>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Semi-workaround for https://github.com/microsoft/TypeScript/issues/43826.
|
||||
* @see GReadProxyValueWrap
|
||||
*/
|
||||
type GDictionaryReadProxy<T> = {
|
||||
[K in keyof T]: GReadProxyValueWrap<T[K]>;
|
||||
};
|
||||
|
||||
// At runtime we only have the one kind of dictionary proxy and one kind of array proxy. The read interfaces have
|
||||
// indexers typed correctly for access i.e. return proxied types. The non-read interfaces have indexers accurate for
|
||||
// assignment and will accept both GArray/GDictionary and proxies. The read interfaces exist for convenience only,
|
||||
// you can safely cast between the two interfaces types as desired.
|
||||
type GReadProxyValueWrap<V> =
|
||||
V extends GArray<infer E> ? GArrayReadProxy<E> : V extends GDictionary<infer T> ? GDictionaryReadProxy<T> : V;
|
||||
|
||||
interface PropertyInfo {
|
||||
name: string;
|
||||
type: Variant.Type;
|
||||
class_name: string;
|
||||
hint: PropertyHint;
|
||||
hint_string: string;
|
||||
usage: PropertyUsageFlags;
|
||||
}
|
||||
|
||||
type BindRight<F extends Function, B extends any[]> = F extends (
|
||||
this: infer T,
|
||||
...args: [...infer A, ...B]
|
||||
) => infer R
|
||||
? (this: T, ...args: A) => R
|
||||
: never;
|
||||
}
|
||||
39
packages/react-godot-renderer/typings/godot.worker.d.ts
vendored
Normal file
39
packages/react-godot-renderer/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/react-godot-renderer/typings/godot0.gen.d.ts
vendored
Normal file
10147
packages/react-godot-renderer/typings/godot0.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9534
packages/react-godot-renderer/typings/godot1.gen.d.ts
vendored
Normal file
9534
packages/react-godot-renderer/typings/godot1.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9252
packages/react-godot-renderer/typings/godot2.gen.d.ts
vendored
Normal file
9252
packages/react-godot-renderer/typings/godot2.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9206
packages/react-godot-renderer/typings/godot3.gen.d.ts
vendored
Normal file
9206
packages/react-godot-renderer/typings/godot3.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9217
packages/react-godot-renderer/typings/godot4.gen.d.ts
vendored
Normal file
9217
packages/react-godot-renderer/typings/godot4.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9222
packages/react-godot-renderer/typings/godot5.gen.d.ts
vendored
Normal file
9222
packages/react-godot-renderer/typings/godot5.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9236
packages/react-godot-renderer/typings/godot6.gen.d.ts
vendored
Normal file
9236
packages/react-godot-renderer/typings/godot6.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9271
packages/react-godot-renderer/typings/godot7.gen.d.ts
vendored
Normal file
9271
packages/react-godot-renderer/typings/godot7.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9267
packages/react-godot-renderer/typings/godot8.gen.d.ts
vendored
Normal file
9267
packages/react-godot-renderer/typings/godot8.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6202
packages/react-godot-renderer/typings/godot9.gen.d.ts
vendored
Normal file
6202
packages/react-godot-renderer/typings/godot9.gen.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
238
packages/react-godot-renderer/typings/jsb.editor.bundle.d.ts
vendored
Normal file
238
packages/react-godot-renderer/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/react-godot-renderer/typings/jsb.runtime.bundle.d.ts
vendored
Normal file
209
packages/react-godot-renderer/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/react-godot-renderer/typings/jsb.runtime.gen.d.ts
vendored
Normal file
144
packages/react-godot-renderer/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