diff --git a/packages/druid/druid-1.0.0.d.ts b/packages/druid/druid-1.0.0.d.ts
new file mode 100644
index 0000000..e10c467
--- /dev/null
+++ b/packages/druid/druid-1.0.0.d.ts
@@ -0,0 +1,16 @@
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
+///
diff --git a/packages/druid/druid.const.d.ts b/packages/druid/druid.const.d.ts
new file mode 100644
index 0000000..5f2ba1c
--- /dev/null
+++ b/packages/druid/druid.const.d.ts
@@ -0,0 +1,123 @@
+/**
+ * This is a definition stub with incomplete or untested signatures.
+ * Contributions are welcome to improve the accuracy of these types.
+ * @see {@link https://github.com/ts-defold/library|Github Source}
+ * @see {@link https://insality.github.io/druid/modules/Druid.html|Documentation}
+ * @noResolution
+ */
+declare module 'druid.const' {
+ type PivotKey =
+ | typeof gui.PIVOT_CENTER
+ | typeof gui.PIVOT_E
+ | typeof gui.PIVOT_N
+ | typeof gui.PIVOT_NE
+ | typeof gui.PIVOT_NW
+ | typeof gui.PIVOT_S
+ | typeof gui.PIVOT_SE
+ | typeof gui.PIVOT_SW
+ | typeof gui.PIVOT_W;
+
+ export const ACTION_TEXT: hash;
+ export const ACTION_TOUCH: hash;
+ export const ACTION_MARKED_TEXT: hash;
+ export const ACTION_ESC: hash;
+ export const ACTION_BACK: hash;
+ export const ACTION_ENTER: hash;
+ export const ACTION_MULTITOUCH: hash;
+ export const ACTION_BACKSPACE: hash;
+ export const ACTION_SCROLL_UP: hash;
+ export const ACTION_SCROLL_DOWN: hash;
+ export const ACTION_LEFT: hash;
+ export const ACTION_RIGHT: hash;
+ export const ACTION_LSHIFT: hash;
+ export const ACTION_LCTRL: hash;
+ export const ACTION_LCMD: hash;
+
+ export const IS_STENCIL_CHECK: boolean;
+
+ export const ON_INPUT: string;
+ export const ON_UPDATE: string;
+ export const ON_MESSAGE: string;
+ export const ON_LATE_INIT: string;
+ export const ON_FOCUS_LOST: string;
+ export const ON_FOCUS_GAINED: string;
+ export const ON_LAYOUT_CHANGE: string;
+ export const ON_MESSAGE_INPUT: string;
+ export const ON_WINDOW_RESIZED: string;
+ export const ON_LANGUAGE_CHANGE: string;
+
+ export const PRIORITY_INPUT: number;
+ export const PRIORITY_INPUT_HIGH: number;
+ export const PRIORITY_INPUT_MAX: number;
+
+ export const MESSAGE_INPUT: {
+ BUTTON_CLICK: string;
+ BUTTON_LONG_CLICK: string;
+ BUTTON_DOUBLE_CLICK: string;
+ BUTTON_REPEATED_CLICK: string;
+ TEXT_SET: string;
+ };
+
+ export const PIVOTS: {
+ [key: PivotKey]: vmath.vector3;
+ };
+
+ export const REVERSE_PIVOTS: {
+ [key: PivotKey]: PivotKey;
+ };
+
+ export const LAYOUT_MODE: {
+ STRETCH_X: string;
+ STRETCH_Y: string;
+ ZOOM_MIN: string;
+ ZOOM_MAX: string;
+ FIT: typeof gui.ADJUST_FIT;
+ STRETCH: typeof gui.ADJUST_STRETCH;
+ };
+
+ export const VECTOR_ZERO: vmath.vector3;
+ export const SYS_INFO: ReturnType;
+ export const CURRENT_SYSTEM_NAME: string;
+
+ export const OS: {
+ ANDROID: string;
+ IOS: string;
+ MAC: string;
+ LINUX: string;
+ WINDOWS: string;
+ BROWSER: string;
+ };
+
+ export const SHIFT: {
+ NO_SHIFT: number;
+ LEFT: number;
+ RIGHT: number;
+ };
+
+ export const TEXT_ADJUST: {
+ DOWNSCALE: string;
+ TRIM: string;
+ NO_ADJUST: string;
+ DOWNSCALE_LIMITED: string;
+ SCROLL: string;
+ SCALE_THEN_SCROLL: string;
+ };
+
+ export const SIDE: {
+ X: string;
+ Y: string;
+ };
+
+ export const SWIPE: {
+ UP: string;
+ DOWN: string;
+ LEFT: string;
+ RIGHT: string;
+ };
+
+ export const ERRORS: {
+ GRID_DYNAMIC_ANCHOR: string;
+ };
+
+ export const EMPTY_FUNCTION: () => void;
+}
diff --git a/packages/druid/druid.custom.rich_input.rich_input.d.ts b/packages/druid/druid.custom.rich_input.rich_input.d.ts
new file mode 100644
index 0000000..0e7c8e1
--- /dev/null
+++ b/packages/druid/druid.custom.rich_input.rich_input.d.ts
@@ -0,0 +1,33 @@
+/**
+ * @see {@link https://github.com/ts-defold/library|Github Source}
+ * @see {@link https://insality.github.io/druid/modules/Druid.html|Documentation}
+ * @noResolution
+ */
+declare module 'druid.custom.rich_input.rich_input' {
+ type RichInput = typeof import('druid.custom.rich_input.rich_input');
+
+ export function get_text(this: RichInput): void; // TO-DO: is this return value right??
+ export function init(this: RichInput, template: string, nodes: node[]): void;
+ export function select(this: RichInput): void;
+ export function set_allowed_characters(
+ this: RichInput,
+ characters: string,
+ ): RichInput;
+ export function set_font(this: RichInput, font: hash): RichInput;
+ export function set_placeholder(
+ this: RichInput,
+ placeholder_text: string,
+ ): void;
+ export function set_text(this: RichInput, text: string): RichInput;
+
+ export const cursor: node;
+ export const cursor_position: vmath.vector3;
+ export const cursor_text: node;
+ export const drag: typeof import('druid.druid').Drag;
+ export const druid: typeof import('druid.druid').DruidInstance;
+ export const input: typeof import('druid.extended.input');
+ export const input_text: typeof import('druid.druid').Text;
+ export const placeholder: typeof import('druid.druid').Text;
+ export const root: node;
+ export const text_position: vmath.vector3;
+}
diff --git a/packages/druid/druid.custom.rich_text.rich_text.d.ts b/packages/druid/druid.custom.rich_text.rich_text.d.ts
new file mode 100644
index 0000000..365fb92
--- /dev/null
+++ b/packages/druid/druid.custom.rich_text.rich_text.d.ts
@@ -0,0 +1,79 @@
+/**
+ * @see {@link https://github.com/ts-defold/library|Github Source}
+ * @see {@link https://insality.github.io/druid/modules/Druid.html|Documentation}
+ * @noResolution
+ */
+declare module 'druid.custom.rich_text.rich_text' {
+ type RichText = typeof import('druid.custom.rich_text.rich_text');
+ type Word = {
+ node: node;
+ relative_scale: number;
+ color: vmath.vector4;
+ position: vmath.vector3;
+ offset: vmath.vector3;
+ scale: vmath.vector3;
+ size: vmath.vector3;
+ metrics: Metrics;
+ pivot: Pivot;
+ text: string;
+ shadow: vmath.vector4;
+ outline: vmath.vector4;
+ font: string;
+ image: Image;
+ br: boolean;
+ nobr: boolean;
+ };
+ type LineMetrics = {
+ text_width: number;
+ text_height: number;
+ lines: Record;
+ };
+ type Metrics = {
+ width: number;
+ height: number;
+ offset_x?: number;
+ offset_y?: number;
+ node_size?: vmath.vector3;
+ };
+ type Image = {
+ texture: string;
+ anim: string;
+ width: number;
+ height: number;
+ };
+ type Pivot =
+ | typeof gui.PIVOT_CENTER
+ | typeof gui.PIVOT_E
+ | typeof gui.PIVOT_N
+ | typeof gui.PIVOT_NE
+ | typeof gui.PIVOT_NW
+ | typeof gui.PIVOT_S
+ | typeof gui.PIVOT_SE
+ | typeof gui.PIVOT_SW
+ | typeof gui.PIVOT_W;
+
+ export function characters(this: RichText, word: Word): Word[];
+ export function clear(this: RichText): void;
+ export function get_line_metric(this: RichText): LineMetrics;
+ export function get_text(this: RichText): string;
+ export function get_words(this: RichText): Word[];
+ export function init(
+ this: RichText,
+ text_node: node | string,
+ value?: string,
+ ): void;
+ export function set_text(
+ this: RichText,
+ text: string | undefined,
+ ): LuaMultiReturn<[Word[], LineMetrics]>;
+ export function tagged(this: RichText, tag: string): Word[];
+
+ export const style: {
+ COLORS: Record | undefined;
+ ADJUST_STEPS: number | undefined;
+ ADJUST_SCALE_DELTA: number | undefined;
+ };
+ export const druid: typeof import('druid.druid').DruidInstance;
+ export const root: node;
+ export const text_prefab: node;
+}
diff --git a/packages/druid/druid.druid.d.ts b/packages/druid/druid.druid.d.ts
new file mode 100644
index 0000000..f70e2e1
--- /dev/null
+++ b/packages/druid/druid.druid.d.ts
@@ -0,0 +1,512 @@
+/**
+ * @see {@link https://github.com/ts-defold/library|Github Source}
+ * @see {@link https://insality.github.io/druid/modules/Druid.html|Documentation}
+ * @noResolution
+ */
+declare module 'druid.druid' {
+ type Pivot =
+ | typeof gui.PIVOT_CENTER
+ | typeof gui.PIVOT_E
+ | typeof gui.PIVOT_N
+ | typeof gui.PIVOT_NE
+ | typeof gui.PIVOT_NW
+ | typeof gui.PIVOT_S
+ | typeof gui.PIVOT_SE
+ | typeof gui.PIVOT_SW
+ | typeof gui.PIVOT_W;
+ export type Component = {}; // TO-DO
+ type TEXT_ADJUST =
+ (typeof import('druid.const').TEXT_ADJUST)[keyof typeof import('druid.const').TEXT_ADJUST];
+ // Built-in Modules ---------------------------------------------
+ class BaseComponent {
+ /** @returns Array of children of the Druid component instance */
+ get_children: (this: BaseComponent) => node[];
+ /** @returns BaseComponent context */
+ get_context: (this: BaseComponent) => {};
+ get_druid(
+ this: BaseComponent,
+ template: string,
+ nodes: node[],
+ ): BaseComponent;
+ get_input_priority: (this: BaseComponent) => number;
+ get_name: (this: BaseComponent) => string;
+ get_node: (this: BaseComponent, node_or_name: node | string) => node;
+ get_parent_component: (this: BaseComponent) => BaseComponent | undefined;
+ get_parent_name: (this: BaseComponent) => string | undefined;
+ get_template: (this: BaseComponent) => string;
+ get_uid: (this: BaseComponent) => number;
+ reset_input_priority: (this: BaseComponent) => number;
+ set_input_enabled: (this: BaseComponent, state?: boolean) => BaseComponent;
+ set_input_priority: (
+ this: BaseComponent,
+ value: number,
+ is_temporary?: boolean,
+ ) => number;
+ }
+ class BackHandler extends BaseComponent {
+ on_back: DruidEvent;
+ params?: any[];
+ }
+ class Blocker extends BaseComponent {
+ init(this: Blocker, node: node): void;
+ is_enabled(this: Blocker): boolean;
+ set_enabled(this: Blocker, state?: boolean): void;
+ node: node;
+ }
+ class Button {
+ get_key_trigger(this: Button): hash;
+ init(
+ this: Button,
+ node: node | string,
+ callback: Function, // TO-DO
+ custom_args?: any,
+ anim_node?: node | string,
+ ): void;
+ is_enabled(this: Button): boolean;
+ set_check_function(
+ this: Button,
+ check_function?: Function, // TO-DO
+ failure_callback?: Function, // TO-DO
+ ): Button;
+ set_click_zone(this: Button, zone?: node | string): Button;
+ set_enabled(this: Button, state?: boolean): Button;
+ set_key_trigger(this: Button, key: hash | string): Button;
+ set_web_user_interaction(this: Button, is_web_mode?: boolean): Button;
+
+ style: {
+ LONGTAP_TIME: number | undefined;
+ AUTOHOLD_TRIGGER: number | undefined;
+ DOUBLETAP_TIME: number | undefined;
+ on_click: Function; // TO-DO
+ on_click_disabled: Function; // TO-DO
+ on_hover: Function; // TO-DO
+ on_mouse_hover: Function; // TO-DO
+ on_set_enabled: Function; // TO-DO
+ };
+ anim_node: node | undefined;
+ click_zone: node | undefined;
+ hover: Hover;
+ node: node;
+ node_id: hash;
+ on_click: DruidEvent;
+ on_click_outside: DruidEvent;
+ on_double_click: DruidEvent;
+ on_hold_callback: DruidEvent;
+ on_long_click: DruidEvent;
+ on_pressed: DruidEvent;
+ on_repeated_click: DruidEvent;
+ params: any[] | undefined;
+ }
+ class Drag {
+ init(this: Drag, node: node, on_drag_callback: Function): void; // TO-DO
+ is_enabled(this: Drag): boolean;
+ set_click_zone(this: Drag, node?: node | string): void;
+ set_enabled(this: Drag, is_enabled?: boolean): void;
+
+ style: {
+ DRAG_DEADZONE: number | undefined;
+ NO_USE_SCREEN_KOEF: boolean | undefined;
+ };
+ can_x: boolean;
+ can_y: boolean;
+ is_drag: boolean;
+ is_touch: boolean;
+ on_drag: DruidEvent;
+ on_drag_end: DruidEvent;
+ on_drag_start: DruidEvent;
+ on_touch_end: DruidEvent;
+ on_touch_start: DruidEvent;
+ screen_x: number;
+ screen_y: number;
+ touch_start_pos: vmath.vector3;
+ x: number;
+ y: number;
+ }
+ class DruidEvent {
+ clear(this: DruidEvent): void;
+ create(this: DruidEvent, callback_context?: any): void;
+ is_empty(this: DruidEvent): boolean;
+ is_exist(this: DruidEvent): boolean;
+ is_subscribed(
+ this: DruidEvent,
+ callback: Function,
+ callback_context?: any,
+ ): boolean; // TO-DO
+ subscribe(
+ this: DruidEvent,
+ callback: Function,
+ callback_context?: any,
+ ): void; // TO-DO
+ trigger(this: DruidEvent, ...args: any[]): void;
+ unsubscribe(
+ this: DruidEvent,
+ callback: Function,
+ callback_context?: any,
+ ): void;
+ }
+ class Hover {
+ init(
+ this: Hover,
+ node: node,
+ on_hover_callback: Function,
+ on_mouse_hover: Function,
+ ): void; // TO-DO
+ is_enabled(this: Hover): boolean;
+ is_hovered(this: Hover): boolean;
+ is_mouse_hovered(this: Hover): boolean;
+ set_click_zone(this: Hover, zone?: node | string): void;
+ set_enabled(this: Hover, state?: boolean): void;
+ set_hover(this: Hover, state?: boolean): void;
+ set_mouse_hover(this: Hover, state?: boolean): void;
+
+ style: {
+ ON_HOVER_CURSOR: string | undefined;
+ ON_MOUSE_HOVER_CURSOR: string | undefined;
+ };
+ node: node;
+ on_hover: (this: Hover, state: boolean, hover_instance: any) => void;
+ on_mouse_hover: (this: Hover, state: boolean, hover_instance: any) => void;
+ }
+ class Scroll {
+ bind_grid(this: Scroll, grid: StaticGrid): Scroll;
+ get_percent(this: Scroll): vmath.vector3;
+ get_scroll_size(this: Scroll): vmath.vector3;
+ init(
+ this: Scroll,
+ view_node: node | string,
+ content_node: node | string,
+ ): void;
+ is_inert(this: Scroll): boolean;
+ is_node_in_view(this: Scroll, node: node): boolean;
+ scroll_to(this: Scroll, point: vmath.vector3, is_instant?: boolean): void;
+ scroll_to_index(this: Scroll, index: number, skip_cb?: boolean): void;
+ scroll_to_percent(
+ this: Scroll,
+ percent: vmath.vector3,
+ is_instant?: boolean,
+ ): void;
+ set_click_zone(this: Scroll, node: node | string): void;
+ set_extra_stretch_size(this: Scroll, stretch_size?: number): Scroll;
+ set_horizontal_scroll(this: Scroll, state?: boolean): Scroll;
+ set_inert(this: Scroll, state: boolean): Scroll;
+ set_points(this: Scroll, points: vmath.vector3[]): Scroll;
+ set_size(this: Scroll, size: vmath.vector3, offset?: vmath.vector3): Scroll;
+ set_vertical_scroll(this: Scroll, state?: boolean): Scroll;
+ set_view_size(this: Scroll, size: vmath.vector3): Scroll;
+ update_view_size(this: Scroll): void;
+
+ style: {
+ FRICT: number | undefined;
+ FRICT_HOLD: number | undefined;
+ INERT_THRESHOLD: number | undefined;
+ INERT_SPEED: number | undefined;
+ POINTS_DEADZONE: number | undefined;
+ BACK_SPEED: number | undefined;
+ ANIM_SPEED: number | undefined;
+ EXTRA_STRETCH_SIZE: number | undefined;
+ SMALL_CONTENT_SCROLL: boolean | undefined;
+ WHEEL_SCROLL_SPEED: number | undefined;
+ WHEEL_SCROLL_INVERTED: boolean | undefined;
+ WHEEL_SCROLL_BY_INERTION: boolean | undefined;
+ };
+ _is_inert: boolean;
+ /** min_x, max_y, max_x, min_y */
+ available_pos: vmath.vector4;
+ available_size: vmath.vector3;
+ content_node: node;
+ drag: Drag;
+ inertion: vmath.vector3;
+ is_animate: boolean;
+ on_point_scroll: DruidEvent;
+ on_scroll: DruidEvent;
+ on_scroll_to: DruidEvent;
+ position: vmath.vector3;
+ selected: number | undefined;
+ target_position: vmath.vector3;
+ view_node: node;
+ view_size: vmath.vector3;
+ }
+ class StaticGrid {
+ add(
+ this: StaticGrid,
+ item: node,
+ index?: number,
+ shift_policy?: number,
+ is_instant?: boolean,
+ ): void;
+ clear(this: StaticGrid): StaticGrid;
+ get_all_pos(this: StaticGrid): vmath.vector3[];
+ get_borders(this: StaticGrid): vmath.vector3;
+ get_index(this: StaticGrid, pos: vmath.vector3): number;
+ get_index_by_node(this: StaticGrid, node: node): number;
+ get_offset(this: StaticGrid): vmath.vector3;
+ get_pos(this: StaticGrid, index: number): vmath.vector3;
+ get_size(this: StaticGrid): vmath.vector3;
+ init(
+ this: StaticGrid,
+ parent: node | string,
+ element: node,
+ in_row?: number,
+ ): void;
+ refresh(this: StaticGrid): void;
+ remove(
+ this: StaticGrid,
+ index: number,
+ shift_policy?: number,
+ is_instant?: boolean,
+ ): node;
+ set_anchor(this: StaticGrid, anchor: vmath.vector3): void;
+ set_in_row(this: StaticGrid, in_row: number): StaticGrid;
+
+ set_item_size(
+ this: StaticGrid,
+ width?: number,
+ height?: number,
+ ): StaticGrid;
+ set_items(this: StaticGrid, nodes: node[], is_instant?: boolean): void;
+ set_position_function(this: StaticGrid, callback: Function): StaticGrid; // TO-DO
+ sort_nodes(
+ this: StaticGrid,
+ comparator: (a: any, b: any) => boolean,
+ ): StaticGrid;
+
+ style: {
+ IS_DYNAMIC_NODE_POSES: boolean | undefined;
+ IS_ALIGN_LAST_ROW: boolean | undefined;
+ };
+ anchor: vmath.vector3;
+ border: vmath.vector4;
+ first_index: number;
+ last_index: number;
+ node_size: vmath.vector3;
+ nodes: node[];
+ on_add_item: DruidEvent;
+ on_change_items: DruidEvent;
+ on_clear: DruidEvent;
+ on_remove_item: DruidEvent;
+ on_update_positions: DruidEvent;
+ parent: node;
+ pivot: vmath.vector3;
+ }
+ class Text {
+ get_text_adjust(this: Text, adjust_type: TEXT_ADJUST): number;
+ get_text_index_by_width(this: Text, width: number): number;
+ /** @returns width, height */
+ get_text_size(this: Text, text?: string): LuaMultiReturn<[number, number]>;
+ init(
+ this: Text,
+ node: node | string,
+ value?: string,
+ adjust_type?: TEXT_ADJUST,
+ ): void;
+ is_multiline(this: Text): boolean;
+ set_alpha(this: Text, alpha: number): Text;
+ set_color(this: Text, color: vmath.vector4): Text;
+ set_minimal_scale(this: Text, minimal_scale?: number): Text;
+ set_pivot(this: Text, pivot: Pivot): Text;
+ set_scale(this: Text, scale: vmath.vector3): Text;
+ set_size(this: Text, size: vmath.vector3): Text;
+ set_text_adjust(
+ this: Text,
+ adjust_type?: TEXT_ADJUST,
+ minimal_scale?: number,
+ ): Text;
+ set_to(this: Text, set_to: string): Text;
+
+ style: {
+ TRIM_POSTFIX: string | undefined;
+ DEFAULT_ADJUST: string | undefined;
+ ADJUST_STEPS: number | undefined;
+ ADJUST_SCALE_DELTA: number | undefined;
+ };
+ adjust_type: number;
+ color: vmath.vector3;
+ last_value: string;
+ node: node;
+ node_id: hash;
+ on_set_pivot: DruidEvent;
+ on_set_text: DruidEvent;
+ on_update_text_scale: DruidEvent;
+ pos: vmath.vector3;
+ scale: vmath.vector3;
+ start_scale: vmath.vector3;
+ start_size: vmath.vector3;
+ text_area: vmath.vector3;
+ }
+
+ export { type BackHandler };
+ export { type BaseComponent };
+ export { type Blocker };
+ export { type Button };
+ export { type Drag };
+ export { type DruidEvent };
+ export { type Hover };
+ export { type Scroll };
+ export { type StaticGrid };
+ export { type Text };
+
+ export type DruidExtendedModule =
+ | typeof import('druid.extended.data_list')
+ | typeof import('druid.extended.hotkey')
+ | typeof import('druid.extended.input')
+ | typeof import('druid.extended.lang_text')
+ | typeof import('druid.extended.layout')
+ | typeof import('druid.extended.progress')
+ | typeof import('druid.extended.slider')
+ | typeof import('druid.extended.swipe')
+ | typeof import('druid.extended.timer');
+
+ class DruidInstance {
+ final(this: DruidInstance): void;
+ new_back_handler(
+ this: DruidInstance,
+ callback: (...args: any[]) => void,
+ params?: any,
+ ): BackHandler;
+ new_blocker(this: DruidInstance, node: node | string): Blocker;
+ new_button(
+ this: DruidInstance,
+ node: node | string,
+ callback: (...args: any[]) => void,
+ params?: any[],
+ anim_node?: node | string,
+ ): Button;
+ new_data_list(
+ this: DruidInstance,
+ druid_scroll: Scroll,
+ druid_grid: StaticGrid,
+ create_function: (
+ this: DruidInstance,
+ data: any,
+ index: number,
+ data_list: typeof import('druid.extended.data_list'),
+ ) => LuaMultiReturn<[node, Component | undefined]>,
+ ): typeof import('druid.extended.data_list');
+ new_drag(
+ this: DruidInstance,
+ node: node | string,
+ on_drag_callback: (dx: number, dy: number) => void,
+ ): Drag;
+ new_hotkey(
+ this: DruidInstance,
+ keys_array: string[] | string,
+ callback: (...args: any[]) => void,
+ callback_argument?: any,
+ ): typeof import('druid.extended.hotkey');
+ new_hover(
+ this: DruidInstance,
+ node: node | string,
+ on_hover_callback: (...args: any[]) => void,
+ on_mouse_hover_callback: (...args: any[]) => void,
+ ): Hover;
+ new_input(
+ this: DruidInstance,
+ click_node: node | string,
+ text_node: node | Text | string,
+ keyboard_type?: number,
+ ): typeof import('druid.extended.input');
+ new_lang_text(
+ this: DruidInstance,
+ node: node | string,
+ locale_id?: string,
+ adjust_type?: TEXT_ADJUST,
+ ): typeof import('druid.extended.lang_text');
+ new_layout(
+ this: DruidInstance,
+ node: node | string,
+ mode: string,
+ ): typeof import('druid.extended.layout');
+ new_progress(
+ this: DruidInstance,
+ node: node | string,
+ key: (typeof import('druid.const').SIDE)[keyof typeof import('druid.const').SIDE],
+ init_value?: number,
+ ): typeof import('druid.extended.progress');
+ new_rich_input(
+ this: DruidInstance,
+ template: string,
+ nodes: ReturnType,
+ ): typeof import('druid.custom.rich_input.rich_input');
+ new_rich_text(
+ this: DruidInstance,
+ text_node: node | string,
+ value?: string,
+ ): typeof import('druid.custom.rich_text.rich_text');
+ new_scroll(
+ this: DruidInstance,
+ view_node: node | string,
+ content_node: node | string,
+ ): Scroll;
+ new_slider(
+ this: DruidInstance,
+ node: node | string,
+ end_pos: vmath.vector3,
+ callback?: (...args: any[]) => void,
+ ): typeof import('druid.extended.slider');
+ new_static_grid(
+ this: DruidInstance,
+ parent_node: node | string,
+ item: node | string,
+ in_row?: number,
+ ): StaticGrid;
+ new_swipe(
+ this: DruidInstance,
+ node: node | string,
+ on_swipe_callback: (...args: any[]) => void,
+ ): typeof import('druid.extended.swipe');
+ new_text(
+ this: DruidInstance,
+ node: node | string,
+ value?: string,
+ no_adjust?: boolean,
+ ): Text;
+ new_timer(
+ this: DruidInstance,
+ node: node | string,
+ seconds_from: number,
+ seconds_to?: number,
+ callback?: (...args: any[]) => void,
+ ): typeof import('druid.extended.timer');
+ on_input(this: DruidInstance, action_id: hash, action: any): boolean; // TO-DO: action type is `input_message` table from GO/GUI
+ on_message(
+ this: DruidInstance,
+ message_id: hash,
+ message: any,
+ sender: url,
+ ): void;
+ /** @returns True if component was removed */
+ remove(this: DruidInstance, component: Component): boolean;
+ set_blacklist(
+ this: DruidInstance,
+ blacklist_components?: any[] | Component,
+ ): DruidInstance;
+ set_whitelist(
+ this: DruidInstance,
+ whitelist_components?: any[] | Component,
+ ): DruidInstance;
+ update(this: DruidInstance, dt: number): void;
+ new: (this: DruidInstance, module: T, name: string) => T;
+ }
+ export { type DruidInstance };
+
+ export type DruidStyle = {}; // TO-DO
+
+ function ___new(this: void, context: any, style?: DruidStyle): DruidInstance;
+ export { ___new as new };
+ export function on_language_change(this: void): void;
+ export function on_window_callback(this: void, event: string): void;
+ export function register(
+ this: void,
+ name: string,
+ module: DruidExtendedModule | BaseComponent, // TO-DO
+ ): void;
+ export function set_default_style(this: void, style: DruidStyle): void;
+ export function set_sound_function(
+ this: void,
+ callback: (this: void, sound_id: unknown) => void,
+ ): void;
+ export function set_text_function(
+ this: void,
+ callback: (this: void, text_id: unknown) => void,
+ ): void;
+}
diff --git a/packages/druid/druid.extended.data_list.d.ts b/packages/druid/druid.extended.data_list.d.ts
new file mode 100644
index 0000000..fd97684
--- /dev/null
+++ b/packages/druid/druid.extended.data_list.d.ts
@@ -0,0 +1,57 @@
+/**
+ * @see {@link https://github.com/ts-defold/library|Github Source}
+ * @see {@link https://insality.github.io/druid/modules/Druid.html|Documentation}
+ * @noResolution
+ */
+declare module 'druid.extended.data_list' {
+ type DataList = typeof import('druid.extended.data_list');
+ type SHIFT_POLICY =
+ (typeof import('druid.const').SHIFT)[keyof typeof import('druid.const').SHIFT];
+
+ export function add(
+ this: DataList,
+ data: {},
+ index?: number,
+ shift_policy?: SHIFT_POLICY,
+ ): void;
+ export function clear(this: DataList): void;
+ export function get_created_components(
+ this: DataList,
+ ): import('druid.druid').Component[];
+ export function get_created_nodes(this: DataList): node[];
+ export function get_data(this: DataList): {};
+ export function get_index(this: DataList, data: {}): number; // TO-DO
+ export function init(
+ this: DataList,
+ scroll: typeof import('druid.druid').Scroll,
+ grid: typeof import('druid.druid').StaticGrid,
+ // The create function callback(self, data, index, data_list). Function should return (node, [component])
+ create_function: Function, // TO-DO
+ ): void;
+ export function on_remove(this: DataList): void;
+ export function remove(
+ this: DataList,
+ index: number | undefined,
+ shift_policy?: SHIFT_POLICY,
+ ): void;
+ export function remove_by_data(
+ this: DataList,
+ data: {},
+ shift_policy?: SHIFT_POLICY,
+ ): void;
+ export function scroll_to_index(this: DataList, index: number): void;
+ export function set_data(this: DataList, data: {}): DataList; // TO-DO
+ export function set_use_cache(
+ this: DataList,
+ is_use_cache: boolean,
+ ): DataList;
+
+ export const grid: typeof import('druid.druid').StaticGrid;
+ export const last_index: number;
+ export const on_element_add: typeof import('druid.druid').DruidEvent;
+ export const on_element_remove: typeof import('druid.druid').DruidEvent;
+ export const on_scroll_progress_change: typeof import('druid.druid').DruidEvent;
+ export const scroll: typeof import('druid.druid').Scroll;
+ export const scroll_progress: number;
+ export const top_index: number;
+}
diff --git a/packages/druid/druid.extended.hotkey.d.ts b/packages/druid/druid.extended.hotkey.d.ts
new file mode 100644
index 0000000..30ad368
--- /dev/null
+++ b/packages/druid/druid.extended.hotkey.d.ts
@@ -0,0 +1,31 @@
+/**
+ * @see {@link https://github.com/ts-defold/library|Github Source}
+ * @see {@link https://insality.github.io/druid/modules/Druid.html|Documentation}
+ * @noResolution
+ */
+declare module 'druid.extended.hotkey' {
+ type Hotkey = typeof import('druid.extended.hotkey');
+
+ export function add_hotkey(
+ this: Hotkey,
+ keys: hash[] | string[] | string | hash,
+ callback_argument?: any,
+ ): void;
+ export function init(
+ this: Hotkey,
+ keys: string[] | string,
+ callback: (...args: any[]) => void,
+ callback_argument?: any,
+ ): void;
+ export function set_repeat(
+ this: Hotkey,
+ is_enabled_repeated: boolean,
+ ): Hotkey;
+
+ export const style: { MODIFICATORS: string[] };
+ export const button: import('druid.druid').Button;
+ export const click_node: node;
+ export const node: node;
+ export const on_hotkey_pressed: typeof import('druid.druid').DruidEvent;
+ export const on_change_state: typeof import('druid.druid').DruidEvent;
+}
diff --git a/packages/druid/druid.extended.input.d.ts b/packages/druid/druid.extended.input.d.ts
new file mode 100644
index 0000000..f570aed
--- /dev/null
+++ b/packages/druid/druid.extended.input.d.ts
@@ -0,0 +1,71 @@
+/**
+ * @see {@link https://github.com/ts-defold/library|Github Source}
+ * @see {@link https://insality.github.io/druid/modules/Druid.html|Documentation}
+ * @noResolution
+ */
+declare module 'druid.extended.input' {
+ type Input = typeof import('druid.extended.input');
+
+ export function get_text(this: Input): string;
+ export function get_text_selected_replaced(this: Input, text: string): string;
+ export function init(
+ this: Input,
+ click_node: node,
+ text_node: node | import('druid.druid').Text,
+ keyboard_type?: number,
+ ): void;
+ export function move_selection(
+ this: Input,
+ delta: number,
+ is_add_to_selection: boolean,
+ is_move_to_end: boolean,
+ ): void;
+ export function reset_changes(this: Input): void;
+ export function select(this: Input): void;
+ export function select_cursor(
+ this: Input,
+ cursor_index: number | undefined,
+ start_index: number | undefined,
+ end_index: number | undefined,
+ ): Input;
+ export function set_allowed_characters(
+ this: Input,
+ characters: string,
+ ): Input;
+ export function set_max_length(this: Input, max_length: number): Input;
+ export function set_text(this: Input, input_text: string): void;
+ export function unselect(this: Input): void;
+ export const style: {
+ IS_LONGTAP_ERASE: boolean;
+ MASK_DEFAULT_CHAR: string;
+ IS_UNSELECT_ON_RESELECT: boolean;
+ // NO_CONSUME_INPUT_WHILE_SELECTED: boolean;
+ on_select: (this: Input, button_node: node) => void;
+ on_unselect: (this: Input, button_node: node) => void;
+ on_input_wrong: (this: Input, button_node: node) => void;
+ // button_style: {};
+ };
+ export const allowerd_characters: string | undefined;
+ export const button: import('druid.druid').Button;
+ export const current_value: string;
+ export const cursor_index: number;
+ export const end_index: number;
+ export const is_empty: boolean;
+ export const is_selected: boolean;
+ export const keyboard_type: number;
+ export const marked_text_width: number;
+ export const marked_value: string;
+ export const max_length: number | undefined;
+ export const on_input_empty: import('druid.druid').DruidEvent;
+ export const on_input_full: import('druid.druid').DruidEvent;
+ export const on_input_select: import('druid.druid').DruidEvent;
+ export const on_input_text: import('druid.druid').DruidEvent;
+ export const on_input_unselect: import('druid.druid').DruidEvent;
+ export const on_input_wrong: import('druid.druid').DruidEvent;
+ export const on_select_cursor_change: import('druid.druid').DruidEvent;
+ export const previous_value: string;
+ export const start_index: number;
+ export const text: import('druid.druid').Text;
+ export const text_width: number;
+ export const value: string;
+}
diff --git a/packages/druid/druid.extended.lang_text.d.ts b/packages/druid/druid.extended.lang_text.d.ts
new file mode 100644
index 0000000..13238f1
--- /dev/null
+++ b/packages/druid/druid.extended.lang_text.d.ts
@@ -0,0 +1,43 @@
+/**
+ * @see {@link https://github.com/ts-defold/library|Github Source}
+ * @see {@link https://insality.github.io/druid/modules/Druid.html|Documentation}
+ * @noResolution
+ */
+declare module 'druid.extended.lang_text' {
+ type LangText = typeof import('druid.extended.lang_text');
+ type TEXT_ADJUST =
+ (typeof import('druid.const').TEXT_ADJUST)[keyof typeof import('druid.const').TEXT_ADJUST];
+
+ export function format(
+ this: LangText,
+ a?: string,
+ b?: string,
+ c?: string,
+ d?: string,
+ e?: string,
+ f?: string,
+ g?: string,
+ ): LangText;
+ export function init(
+ this: LangText,
+ node: node | string,
+ locale_id: string | undefined,
+ adjust_type?: TEXT_ADJUST | undefined,
+ ): void;
+ export function set_to(this: LangText, text: string): LangText;
+ export function translate(
+ this: LangText,
+ locale_id: string,
+ a?: string,
+ b?: string,
+ c?: string,
+ d?: string,
+ e?: string,
+ f?: string,
+ g?: string,
+ ): LangText;
+
+ export const node: node;
+ export const on_change: import('druid.druid').DruidEvent;
+ export const text: import('druid.druid').Text;
+}
diff --git a/packages/druid/druid.extended.layout.d.ts b/packages/druid/druid.extended.layout.d.ts
new file mode 100644
index 0000000..c81a0f8
--- /dev/null
+++ b/packages/druid/druid.extended.layout.d.ts
@@ -0,0 +1,72 @@
+/**
+ * @see {@link https://github.com/ts-defold/library|Github Source}
+ * @see {@link https://insality.github.io/druid/modules/Druid.html|Documentation}
+ * @noResolution
+ */
+declare module 'druid.extended.layout' {
+ // TO-DO
+ type Layout = typeof import('druid.extended.layout');
+
+ interface RowData {
+ width: number;
+ height: number;
+ count: number;
+ }
+
+ interface RowsData {
+ total_width: number;
+ total_height: number;
+ nodes_width: LuaMap;
+ nodes_height: LuaMap;
+ rows: RowData[];
+ }
+
+ export function init(
+ this: Layout,
+ node: node,
+ layout_type: string,
+ on_size_changed_callback?: Function, // TO-DO
+ ): Layout;
+ export function update(this: Layout): void;
+ export function set_margin(
+ this: Layout,
+ margin_x: number,
+ margin_y: number,
+ ): Layout;
+ export function set_padding(this: Layout, padding: vmath.vector4): Layout;
+ export function set_dirty(this: Layout): Layout;
+ export function set_justify(this: Layout, is_justify: boolean): Layout;
+ export function set_type(this: Layout, type: string): Layout;
+
+ export function set_hug_content(
+ this: Layout,
+ is_hug_width: boolean,
+ is_hug_height: boolean,
+ ): Layout;
+ export function add(this: Layout, node_or_node_id: node | string): Layout;
+ export function refresh_layout(this: Layout): Layout;
+ export function clear_layout(this: Layout): Layout;
+
+ export function get_node_size(
+ this: Layout,
+ node: node,
+ ): LuaMultiReturn<[number, number]>;
+ export function calculate_rows_data(this: Layout): RowsData;
+ export function set_node_position(
+ this: Layout,
+ node: node,
+ x: number,
+ y: number,
+ ): node;
+
+ export const mode: string; // TO-DO is this real?
+ export const node: node;
+ export const type: string;
+ export const margin: { x: number; y: number };
+ export const padding: ReturnType;
+ export const isDirty: boolean;
+ export const entities: node[];
+ export const isJustify: boolean;
+ export const isResizeWidth: boolean;
+ export const isResizeHeight: boolean;
+}
diff --git a/packages/druid/druid.extended.progress.d.ts b/packages/druid/druid.extended.progress.d.ts
new file mode 100644
index 0000000..727351f
--- /dev/null
+++ b/packages/druid/druid.extended.progress.d.ts
@@ -0,0 +1,41 @@
+/**
+ * @see {@link https://github.com/ts-defold/library|Github Source}
+ * @see {@link https://insality.github.io/druid/modules/Druid.html|Documentation}
+ * @noResolution
+ */
+declare module 'druid.extended.progress' {
+ type Progress = typeof import('druid.extended.progress');
+
+ export function empty(this: Progress): void;
+ export function fill(this: Progress): void;
+ export function get(this: Progress): number;
+ export function init(
+ this: Progress,
+ node: node | string,
+ key: string,
+ init_value?: number,
+ ): void;
+ export function set_max_size(
+ this: Progress,
+ max_size: vmath.vector3,
+ ): Progress;
+ export function set_steps(
+ this: Progress,
+ steps: number[],
+ callback: (this: Progress, step: number) => void,
+ ): void;
+ export function set_to(this: Progress, to: number, callback?: Function): void; // TO-DO
+ export function to(this: Progress, to: number, callback?: Function): void; // TO-DO
+
+ export const style: {
+ SPEED: number | undefined;
+ MIN_DELTA: number | undefined;
+ };
+ export const key: string;
+ export const max_size: number;
+ export const node: node;
+ export const on_change: import('druid.druid').DruidEvent;
+ export const scale: vmath.vector3;
+ export const size: vmath.vector3;
+ export const slice: vmath.vector4;
+}
diff --git a/packages/druid/druid.extended.slider.d.ts b/packages/druid/druid.extended.slider.d.ts
new file mode 100644
index 0000000..66dbe63
--- /dev/null
+++ b/packages/druid/druid.extended.slider.d.ts
@@ -0,0 +1,32 @@
+/**
+ * @see {@link https://github.com/ts-defold/library|Github Source}
+ * @see {@link https://insality.github.io/druid/modules/Druid.html|Documentation}
+ * @noResolution
+ */
+declare module 'druid.extended.slider' {
+ type Slider = typeof import('druid.extended.slider');
+ export function init(
+ this: Slider,
+ node: node,
+ end_pos: vmath.vector3,
+ callback?: Function, // TO-DO
+ ): void;
+ export function is_enabled(this: Slider): boolean;
+ export function set(this: Slider, value: number, is_silent?: boolean): void;
+ export function set_enabled(this: Slider, is_enabled: boolean): void;
+ export function set_input_node(
+ this: Slider,
+ input_node: node | string | undefined,
+ ): Slider;
+ export function set_steps(this: Slider, steps: number[]): Slider;
+
+ export const dist: vmath.vector3;
+ export const end_pos: vmath.vector3;
+ export const is_drag: boolean;
+ export const node: node;
+ export const on_change_value: import('druid.druid').DruidEvent;
+ export const pos: vmath.vector3;
+ export const start_pos: vmath.vector3;
+ export const target_pos: vmath.vector3;
+ export const value: number;
+}
diff --git a/packages/druid/druid.extended.swipe.d.ts b/packages/druid/druid.extended.swipe.d.ts
new file mode 100644
index 0000000..c981ade
--- /dev/null
+++ b/packages/druid/druid.extended.swipe.d.ts
@@ -0,0 +1,32 @@
+/**
+ * @see {@link https://github.com/ts-defold/library|Github Source}
+ * @see {@link https://insality.github.io/druid/modules/Druid.html|Documentation}
+ * @noResolution
+ */
+declare module 'druid.extended.swipe' {
+ type Swipe = typeof import('druid.extended.swipe');
+
+ export function init(
+ this: Swipe,
+ node: node,
+ on_swipe_callback: (
+ this: Swipe,
+ swipe_side: string,
+ dist: number,
+ delta_time: number,
+ ) => void,
+ ): void;
+ export function set_click_zone(
+ this: Swipe,
+ zone: node | string | undefined,
+ ): void;
+
+ export const style: {
+ SWIPE_TIME: number | undefined;
+ SWIPE_THRESHOLD: number | undefined;
+ SWIPE_TRIGGER_ON_MOVE: boolean | undefined;
+ };
+ export const click_zone: node | undefined;
+ export const node: node;
+ export const on_swipe: import('druid.druid').DruidEvent;
+}
diff --git a/packages/druid/druid.extended.timer.d.ts b/packages/druid/druid.extended.timer.d.ts
new file mode 100644
index 0000000..fe451d1
--- /dev/null
+++ b/packages/druid/druid.extended.timer.d.ts
@@ -0,0 +1,27 @@
+/**
+ * @see {@link https://github.com/ts-defold/library|Github Source}
+ * @see {@link https://insality.github.io/druid/modules/Druid.html|Documentation}
+ * @noResolution
+ */
+declare module 'druid.extended.timer' {
+ type Timer = typeof import('druid.extended.timer');
+
+ export function init(
+ this: Timer,
+ node: node,
+ seconds_from: number | undefined,
+ seconds_to?: number | undefined,
+ callback?: Function | undefined,
+ ): void;
+ export function set_interval(this: Timer, from: number, to: number): void;
+ export function set_state(this: Timer, is_on: boolean | undefined): void;
+ export function set_to(this: Timer, set_to: number): void;
+
+ export const from: number;
+ export const node: node;
+ export const on_set_enabled: import('druid.druid').DruidEvent;
+ export const on_tick: import('druid.druid').DruidEvent;
+ export const on_timer_end: import('druid.druid').DruidEvent;
+ export const target: number;
+ export const value: number;
+}
diff --git a/packages/druid/druid.helper.d.ts b/packages/druid/druid.helper.d.ts
new file mode 100644
index 0000000..3cf3ae0
--- /dev/null
+++ b/packages/druid/druid.helper.d.ts
@@ -0,0 +1,74 @@
+/**
+ * @see {@link https://github.com/ts-defold/library|Github Source}
+ * @see {@link https://insality.github.io/druid/modules/Druid.html|Documentation}
+ * @noResolution
+ */
+declare module 'druid.helper' {
+ type Pivot =
+ | typeof gui.PIVOT_CENTER
+ | typeof gui.PIVOT_E
+ | typeof gui.PIVOT_N
+ | typeof gui.PIVOT_NE
+ | typeof gui.PIVOT_NW
+ | typeof gui.PIVOT_S
+ | typeof gui.PIVOT_SE
+ | typeof gui.PIVOT_SW
+ | typeof gui.PIVOT_W;
+ type GUITextMetrics = {
+ width: number;
+ height: number;
+ max_ascent: number;
+ max_descent: number;
+ };
+ type SHIFT_POLICY =
+ (typeof import('druid.const').SHIFT)[keyof typeof import('druid.const').SHIFT];
+
+ export function add_array(target: T1[], source: T2[]): (T1 | T2)[];
+ export function centrate_nodes(margin?: number, ...nodes: node[]): void;
+ export function clamp(a: number, min: number, max: number): number;
+ /** @returns Index of value or undefined */
+ export function contains(t: any[], value: any): number | undefined;
+ export function deepcopy(orig_table: T): T;
+ export function distance(
+ x1: number,
+ y1: number,
+ x2: number,
+ y2: number,
+ ): number;
+ /** @returns border values (left, top, right, down) */
+ export function get_border(node: node, offset?: vmath.vector3): vmath.vector4;
+ export function get_closest_stencil_node(node: node): node | undefined;
+ /** @returns scale_x, scale_y */
+ export function get_gui_scale(): LuaMultiReturn<[number, number]>;
+ export function get_pivot_offset(pivot: Pivot): vmath.vector3;
+ export function get_scaled_size(node: node): vmath.vector3;
+ export function get_scene_scale(
+ node: node,
+ include_passed_node_scale?: boolean,
+ ): vmath.vector3;
+ /** @returns stretch_x, stretch_y */
+ export function get_screen_aspect_koef(): LuaMultiReturn<[number, number]>;
+ export function get_text_metrics_from_node(text_node: any): GUITextMetrics;
+ export function insert_with_shift(
+ array: any[],
+ item: T,
+ index?: number,
+ shift_policy?: SHIFT_POLICY,
+ ): T;
+ export function is_mobile(): boolean;
+ export function is_multitouch_supported(): boolean;
+ export function is_web(): boolean;
+ export function is_web_mobile(): boolean;
+ export function lerp(a: number, b: number, t: number): number;
+ export function remove_with_shift(
+ array: T[],
+ index?: number,
+ shift_policy?: SHIFT_POLICY,
+ ): T;
+ export function round(num: number, num_decimal_places?: number): number;
+ export function sign(val: number): -1 | 0 | 1;
+ export function step(current: number, target: number, step: number): number;
+ export function table_to_string(
+ t: any[] | LuaMap | LuaSet | LuaTable | object,
+ ): string;
+}
diff --git a/packages/druid/library.json b/packages/druid/library.json
new file mode 100644
index 0000000..4cf0d18
--- /dev/null
+++ b/packages/druid/library.json
@@ -0,0 +1,4 @@
+{
+ "name": "druid",
+ "url": "https://github.com/Insality/druid"
+}