Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions packages/druid/druid-1.0.0.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/// <library version="1.0.0" src="https://github.com/Insality/druid/archive/refs/tags/1.0.zip" />
/// <reference path="./druid.const.d.ts" />
/// <reference path="./druid.druid.d.ts" />
/// <reference path="./druid.extended.data_list.d.ts" />
/// <reference path="./druid.extended.hotkey.d.ts" />
/// <reference path="./druid.extended.input.d.ts" />
/// <reference path="./druid.extended.lang_text.d.ts" />
/// <reference path="./druid.extended.layout.d.ts" />
/// <reference path="./druid.extended.progress.d.ts" />
/// <reference path="./druid.extended.slider.d.ts" />
/// <reference path="./druid.extended.swipe.d.ts" />
/// <reference path="./druid.extended.timer.d.ts" />
/// <reference path="./druid.custom.rich_input.rich_input.d.ts" />
/// <reference path="./druid.custom.rich_text.rich_text.d.ts" />
/// <reference path="./druid.extended.timer.d.ts" />
/// <reference path="./druid.helper.d.ts" />
123 changes: 123 additions & 0 deletions packages/druid/druid.const.d.ts
Original file line number Diff line number Diff line change
@@ -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<typeof sys.get_sys_info>;
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;
}
33 changes: 33 additions & 0 deletions packages/druid/druid.custom.rich_input.rich_input.d.ts
Original file line number Diff line number Diff line change
@@ -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;
}
79 changes: 79 additions & 0 deletions packages/druid/druid.custom.rich_text.rich_text.d.ts
Original file line number Diff line number Diff line change
@@ -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<number, Metrics>;
};
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<string, string> | 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;
}
Loading