@defold-typescript/types 0.33.1 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api-signatures.json +156 -183
- package/api-targets.json +9 -66
- package/generated/buffer.d.ts +2 -2
- package/generated/collectionfactory.d.ts +2 -2
- package/generated/factory.d.ts +2 -2
- package/generated/gui.d.ts +23 -23
- package/generated/kinds/gui-script.d.ts +0 -4
- package/generated/kinds/render-script.d.ts +1 -4
- package/generated/kinds/script.d.ts +0 -4
- package/generated/model.d.ts +2 -2
- package/generated/profiler.d.ts +2 -4
- package/generated/render.d.ts +2 -150
- package/generated/sys.d.ts +1 -1
- package/generated/versions/defold-1.12.4/buffer.d.ts +2 -2
- package/generated/versions/defold-1.12.4/collectionfactory.d.ts +2 -2
- package/generated/versions/defold-1.12.4/factory.d.ts +2 -2
- package/generated/versions/defold-1.12.4/gui.d.ts +23 -23
- package/generated/versions/defold-1.12.4/index.d.ts +9 -4
- package/generated/versions/defold-1.12.4/model.d.ts +2 -2
- package/generated/versions/defold-1.12.4/profiler.d.ts +2 -4
- package/generated/versions/defold-1.12.4/render.d.ts +2 -150
- package/generated/versions/defold-1.12.4/sys.d.ts +1 -1
- package/generated/versions/defold-1.12.4/vmath.d.ts +0 -19
- package/generated/versions/defold-1.12.4/window.d.ts +2 -4
- package/generated/versions/defold-1.13.0/buffer.d.ts +2 -2
- package/generated/versions/defold-1.13.0/collectionfactory.d.ts +2 -2
- package/generated/versions/defold-1.13.0/factory.d.ts +2 -2
- package/generated/versions/defold-1.13.0/gui.d.ts +23 -23
- package/generated/versions/defold-1.13.0/index.d.ts +9 -4
- package/generated/versions/defold-1.13.0/model.d.ts +2 -2
- package/generated/versions/defold-1.13.0/profiler.d.ts +2 -4
- package/generated/versions/defold-1.13.0/render.d.ts +2 -150
- package/generated/versions/defold-1.13.0/sys.d.ts +1 -1
- package/generated/versions/defold-1.13.0/vmath.d.ts +0 -19
- package/generated/versions/defold-1.13.0/window.d.ts +2 -4
- package/generated/vmath.d.ts +0 -19
- package/generated/window.d.ts +2 -4
- package/index.d.ts +1 -4
- package/package.json +4 -2
- package/scripts/extension-goldens.ts +23 -0
- package/scripts/generate-api-signatures.ts +40 -1
- package/scripts/materialize-version.ts +15 -1
- package/scripts/regen.ts +109 -27
- package/scripts/signature-store-fs.ts +1 -0
- package/scripts/sync-api-docs.ts +11 -61
- package/src/doc-comment.ts +10 -6
- package/src/emit-dts.ts +212 -21
- package/src/optional-correction-provenance.ts +13 -2
- package/src/render-overloads.d.ts +29 -0
- package/src/script-api.ts +154 -23
- package/src/vmath-overloads.d.ts +19 -0
- package/generated/iac.d.ts +0 -18
- package/generated/iap.d.ts +0 -60
- package/generated/push.d.ts +0 -66
- package/generated/versions/defold-1.12.4/iac.d.ts +0 -18
- package/generated/versions/defold-1.12.4/iap.d.ts +0 -60
- package/generated/versions/defold-1.12.4/push.d.ts +0 -66
- package/generated/versions/defold-1.12.4/webview.d.ts +0 -68
- package/generated/versions/defold-1.13.0/iac.d.ts +0 -18
- package/generated/versions/defold-1.13.0/iap.d.ts +0 -60
- package/generated/versions/defold-1.13.0/push.d.ts +0 -66
- package/generated/versions/defold-1.13.0/webview.d.ts +0 -68
- package/generated/webview.d.ts +0 -68
- package/scripts/fidelity-audit.ts +0 -684
package/src/script-api.ts
CHANGED
|
@@ -4,14 +4,34 @@ export interface RefDocParameter {
|
|
|
4
4
|
name: string;
|
|
5
5
|
doc: string;
|
|
6
6
|
types: string[];
|
|
7
|
+
fields?: RefDocParameter[];
|
|
8
|
+
is_optional?: "True";
|
|
7
9
|
}
|
|
8
10
|
|
|
9
|
-
export interface
|
|
11
|
+
export interface RefDocFunctionElement {
|
|
10
12
|
type: "FUNCTION";
|
|
11
13
|
name: string;
|
|
12
14
|
description: string;
|
|
13
15
|
parameters: RefDocParameter[];
|
|
14
16
|
returnvalues: RefDocParameter[];
|
|
17
|
+
examples?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface RefDocConstantElement {
|
|
21
|
+
type: "CONSTANT";
|
|
22
|
+
name: string;
|
|
23
|
+
brief: string;
|
|
24
|
+
description: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type RefDocElement = RefDocFunctionElement | RefDocConstantElement;
|
|
28
|
+
|
|
29
|
+
export interface ScriptApiOptions {
|
|
30
|
+
// Also carry scalar members as CONSTANT elements and function `examples:` as
|
|
31
|
+
// ref-doc examples HTML, and nested callback arguments, table fields and
|
|
32
|
+
// optional flags on each slot. Off for the typing lanes, whose emitter and
|
|
33
|
+
// frozen goldens only ever see flat functions without examples.
|
|
34
|
+
complete?: boolean;
|
|
15
35
|
}
|
|
16
36
|
|
|
17
37
|
export interface RefDoc {
|
|
@@ -38,32 +58,115 @@ function splitTypeTokens(type: unknown): string[] {
|
|
|
38
58
|
.filter((token) => token.length > 0);
|
|
39
59
|
}
|
|
40
60
|
|
|
41
|
-
|
|
42
|
-
|
|
61
|
+
// Upstream writes a slot list either as a YAML list or, for a lone slot, as a
|
|
62
|
+
// single mapping (`return: {type: number}`); both mean the same slots.
|
|
63
|
+
function slotList(value: unknown): Record<string, unknown>[] {
|
|
64
|
+
if (Array.isArray(value)) return value.filter(isRecord);
|
|
65
|
+
return isRecord(value) ? [value] : [];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Some generators mark a required slot by suffixing its name (`project_id (REQUIRED)`);
|
|
69
|
+
// every slot is already required unless flagged optional, so the suffix is noise.
|
|
70
|
+
const REQUIRED_SUFFIX = /\s*\(required\)$/i;
|
|
71
|
+
|
|
72
|
+
// Generators emit placeholder or C-signature names (`None`, `int JoinRandomRoom`)
|
|
73
|
+
// that cannot form a Lua member access, so no page or declaration can carry them.
|
|
74
|
+
const FUNCTION_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
75
|
+
|
|
76
|
+
function isFunctionName(name: string): boolean {
|
|
77
|
+
return name !== "None" && FUNCTION_NAME.test(name);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function mapSlot(item: Record<string, unknown>, complete: boolean): RefDocParameter {
|
|
81
|
+
const slot: RefDocParameter = {
|
|
82
|
+
name: stringOr(item.name, "").replace(REQUIRED_SUFFIX, ""),
|
|
83
|
+
doc: stringOr(item.desc, ""),
|
|
84
|
+
types: splitTypeTokens(item.type),
|
|
85
|
+
};
|
|
86
|
+
if (!complete) return slot;
|
|
87
|
+
// A callback lists its arguments under `parameters:` and a table its keys under
|
|
88
|
+
// `fields:` or `members:`; the ref-doc format carries all as `fields`. A
|
|
89
|
+
// callback's own `self` is kept, since the engine really passes it to the callback.
|
|
90
|
+
const nested = [
|
|
91
|
+
...slotList(item.parameters),
|
|
92
|
+
...slotList(item.fields),
|
|
93
|
+
...slotList(item.members),
|
|
94
|
+
];
|
|
95
|
+
if (nested.length > 0) slot.fields = nested.map((child) => mapSlot(child, complete));
|
|
96
|
+
if (item.optional === true) slot.is_optional = "True";
|
|
97
|
+
return slot;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function mapParameters(raw: unknown, complete: boolean): RefDocParameter[] {
|
|
43
101
|
const out: RefDocParameter[] = [];
|
|
44
|
-
for (const item of raw) {
|
|
45
|
-
if (!isRecord(item)) continue;
|
|
46
|
-
const name = stringOr(item.name, "");
|
|
102
|
+
for (const item of slotList(raw)) {
|
|
47
103
|
// The script_api lists the implicit `self` the engine passes; the emitter
|
|
48
104
|
// stamps @noSelfInFile, so generated signatures must not declare it.
|
|
49
|
-
if (name === "self") continue;
|
|
50
|
-
out.push(
|
|
51
|
-
name,
|
|
52
|
-
doc: stringOr(item.desc, ""),
|
|
53
|
-
types: splitTypeTokens(item.type),
|
|
54
|
-
});
|
|
105
|
+
if (stringOr(item.name, "") === "self") continue;
|
|
106
|
+
out.push(mapSlot(item, complete));
|
|
55
107
|
}
|
|
56
108
|
return out;
|
|
57
109
|
}
|
|
58
110
|
|
|
111
|
+
function escapeHtml(text: string): string {
|
|
112
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function proseHtml(markdown: string): string {
|
|
116
|
+
const prose = markdown.trim();
|
|
117
|
+
return prose === "" ? "" : `<p>${escapeHtml(prose)}</p>`;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function codeBlockHtml(lang: string, body: string): string {
|
|
121
|
+
const langClass = lang === "" ? "" : ` class="language-${lang}"`;
|
|
122
|
+
return `<div class="codehilite"><pre><code${langClass}>${escapeHtml(body)}</code></pre></div>`;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const FENCED_BLOCK = /^```([\w+#.-]*)[^\n]*\n([\s\S]*?)^```[ \t]*$/gm;
|
|
126
|
+
|
|
127
|
+
// Renders an example's markdown `desc` as the ref-doc `examples` HTML the engine
|
|
128
|
+
// pages carry, so `examplesHtmlToMarkdown` reads both through one path.
|
|
129
|
+
function exampleHtml(markdown: string): string {
|
|
130
|
+
const parts: string[] = [];
|
|
131
|
+
let lastIndex = 0;
|
|
132
|
+
for (const match of markdown.matchAll(FENCED_BLOCK)) {
|
|
133
|
+
parts.push(proseHtml(markdown.slice(lastIndex, match.index)));
|
|
134
|
+
parts.push(codeBlockHtml(match[1] ?? "", (match[2] ?? "").replace(/\n$/, "")));
|
|
135
|
+
lastIndex = match.index + match[0].length;
|
|
136
|
+
}
|
|
137
|
+
parts.push(proseHtml(markdown.slice(lastIndex)));
|
|
138
|
+
return parts.join("");
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function examplesHtml(raw: unknown): string {
|
|
142
|
+
if (!Array.isArray(raw)) return "";
|
|
143
|
+
return raw
|
|
144
|
+
.map((entry) => (isRecord(entry) ? exampleHtml(stringOr(entry.desc, "")) : ""))
|
|
145
|
+
.join("");
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function isScalar(member: Record<string, unknown>): boolean {
|
|
149
|
+
return member.type !== "function" && member.type !== "table";
|
|
150
|
+
}
|
|
151
|
+
|
|
59
152
|
/**
|
|
60
153
|
* Convert a parsed Defold extension `.script_api` document into the core
|
|
61
|
-
* ref-doc JSON object shape that `parseDefoldApiDoc` consumes.
|
|
154
|
+
* ref-doc JSON object shape that `parseDefoldApiDoc` consumes. By default only
|
|
62
155
|
* `type: function` members are carried; scalar members (constants) are
|
|
63
156
|
* dropped, matching the core ref-doc pipeline where non-function elements
|
|
64
|
-
* never reach the emitter.
|
|
157
|
+
* never reach the emitter. With `complete`, scalar members at the top level and
|
|
158
|
+
* one table deep are also carried as CONSTANT elements, and each function's
|
|
159
|
+
* `examples:` becomes `codehilite` examples HTML that keeps each fence's
|
|
160
|
+
* language, and each slot's nested `parameters:`/`fields:` and `optional: true`
|
|
161
|
+
* become ref-doc `fields` and `is_optional`, for the docs pages.
|
|
162
|
+
*
|
|
163
|
+
* Upstream dialects are normalized in both modes: a function's slots are read
|
|
164
|
+
* from the first present of `parameters:`, `params:` or `members:` and its
|
|
165
|
+
* returns from `returns:` or `return:`, any slot list may be a single mapping,
|
|
166
|
+
* a table slot's `members:` nest like `fields:`, a `(REQUIRED)` name suffix is
|
|
167
|
+
* dropped, and a function named `None` or not a Lua identifier is skipped.
|
|
65
168
|
*/
|
|
66
|
-
export function scriptApiToRefDoc(parsed: unknown): RefDoc {
|
|
169
|
+
export function scriptApiToRefDoc(parsed: unknown, options: ScriptApiOptions = {}): RefDoc {
|
|
67
170
|
if (!Array.isArray(parsed)) {
|
|
68
171
|
throw new Error("scriptApiToRefDoc: expected a top-level YAML list");
|
|
69
172
|
}
|
|
@@ -83,19 +186,41 @@ export function scriptApiToRefDoc(parsed: unknown): RefDoc {
|
|
|
83
186
|
}
|
|
84
187
|
const members = Array.isArray(table.members) ? table.members : [];
|
|
85
188
|
const elements: RefDocElement[] = [];
|
|
86
|
-
const fnElement = (name: string, member: Record<string, unknown>):
|
|
87
|
-
|
|
189
|
+
const fnElement = (name: string, member: Record<string, unknown>): RefDocFunctionElement => {
|
|
190
|
+
const element: RefDocFunctionElement = {
|
|
191
|
+
type: "FUNCTION",
|
|
192
|
+
name,
|
|
193
|
+
description: stringOr(member.desc, ""),
|
|
194
|
+
parameters: mapParameters(
|
|
195
|
+
member.parameters ?? member.params ?? member.members,
|
|
196
|
+
options.complete === true,
|
|
197
|
+
),
|
|
198
|
+
returnvalues: mapParameters(member.returns ?? member.return, options.complete === true),
|
|
199
|
+
};
|
|
200
|
+
const examples = options.complete ? examplesHtml(member.examples) : "";
|
|
201
|
+
if (examples !== "") element.examples = examples;
|
|
202
|
+
return element;
|
|
203
|
+
};
|
|
204
|
+
const constantElement = (
|
|
205
|
+
name: string,
|
|
206
|
+
member: Record<string, unknown>,
|
|
207
|
+
): RefDocConstantElement => ({
|
|
208
|
+
type: "CONSTANT",
|
|
88
209
|
name,
|
|
210
|
+
brief: stringOr(member.desc, ""),
|
|
89
211
|
description: stringOr(member.desc, ""),
|
|
90
|
-
parameters: mapParameters(member.parameters),
|
|
91
|
-
returnvalues: mapParameters(member.returns),
|
|
92
212
|
});
|
|
93
213
|
for (const member of members) {
|
|
94
214
|
if (!isRecord(member)) continue;
|
|
95
215
|
if (member.type === "function") {
|
|
216
|
+
if (!isFunctionName(stringOr(member.name, ""))) continue;
|
|
96
217
|
elements.push(fnElement(`${namespace}.${stringOr(member.name, "")}`, member));
|
|
97
218
|
continue;
|
|
98
219
|
}
|
|
220
|
+
if (options.complete && isScalar(member)) {
|
|
221
|
+
elements.push(constantElement(`${namespace}.${stringOr(member.name, "")}`, member));
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
99
224
|
if (member.type === "table") {
|
|
100
225
|
const sub = stringOr(member.name, "");
|
|
101
226
|
// A nameless sub-namespace can't form a valid dotted name; skip it.
|
|
@@ -104,8 +229,14 @@ export function scriptApiToRefDoc(parsed: unknown): RefDoc {
|
|
|
104
229
|
for (const subMember of subMembers) {
|
|
105
230
|
// Recurse exactly one level: a `type: table` nested here is 2nd-level,
|
|
106
231
|
// whose functions the emitter's one-dot pass would silently drop.
|
|
107
|
-
if (!isRecord(subMember)
|
|
108
|
-
|
|
232
|
+
if (!isRecord(subMember)) continue;
|
|
233
|
+
const name = `${namespace}.${sub}.${stringOr(subMember.name, "")}`;
|
|
234
|
+
if (subMember.type === "function") {
|
|
235
|
+
if (isFunctionName(stringOr(subMember.name, "")))
|
|
236
|
+
elements.push(fnElement(name, subMember));
|
|
237
|
+
} else if (options.complete && isScalar(subMember)) {
|
|
238
|
+
elements.push(constantElement(name, subMember));
|
|
239
|
+
}
|
|
109
240
|
}
|
|
110
241
|
}
|
|
111
242
|
}
|
|
@@ -116,6 +247,6 @@ export function scriptApiToRefDoc(parsed: unknown): RefDoc {
|
|
|
116
247
|
return doc;
|
|
117
248
|
}
|
|
118
249
|
|
|
119
|
-
export function parseScriptApi(yamlText: string): RefDoc {
|
|
120
|
-
return scriptApiToRefDoc(parse(yamlText));
|
|
250
|
+
export function parseScriptApi(yamlText: string, options: ScriptApiOptions = {}): RefDoc {
|
|
251
|
+
return scriptApiToRefDoc(parse(yamlText), options);
|
|
121
252
|
}
|
package/src/vmath-overloads.d.ts
CHANGED
|
@@ -56,6 +56,25 @@ declare global {
|
|
|
56
56
|
* @returns the lerped number
|
|
57
57
|
*/
|
|
58
58
|
function lerp(t: number, n1: number, n2: number): number;
|
|
59
|
+
/**
|
|
60
|
+
* Converts euler angles in degrees into a quaternion, reading the x, y and z
|
|
61
|
+
* angles from a vector3.
|
|
62
|
+
* The error is guaranteed to be less than 0.001.
|
|
63
|
+
*
|
|
64
|
+
* @param v - vector3 with euler angles in degrees
|
|
65
|
+
* @returns quaternion describing an equivalent rotation (231 (YZX) rotation sequence)
|
|
66
|
+
*/
|
|
67
|
+
function euler_to_quat(v: Vector3): Quaternion;
|
|
68
|
+
/**
|
|
69
|
+
* Converts euler angles (x, y, z) in degrees into a quaternion.
|
|
70
|
+
* The error is guaranteed to be less than 0.001.
|
|
71
|
+
*
|
|
72
|
+
* @param x - rotation around x-axis in degrees
|
|
73
|
+
* @param y - rotation around y-axis in degrees
|
|
74
|
+
* @param z - rotation around z-axis in degrees
|
|
75
|
+
* @returns quaternion describing an equivalent rotation (231 (YZX) rotation sequence)
|
|
76
|
+
*/
|
|
77
|
+
function euler_to_quat(x: number, y: number, z: number): Quaternion;
|
|
59
78
|
/**
|
|
60
79
|
* Performs an element wise multiplication between two vectors of the same type
|
|
61
80
|
* The returned value is a vector defined as (e.g. for a vector3):
|
package/generated/iac.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/** @noSelfInFile */
|
|
2
|
-
declare global {
|
|
3
|
-
/**
|
|
4
|
-
* Functions and constants for doing inter-app communication. Supported on iOS and Android. [icon:ios] [icon:android]
|
|
5
|
-
*/
|
|
6
|
-
namespace iac {
|
|
7
|
-
/**
|
|
8
|
-
* Sets the listener function for inter-app communication events.
|
|
9
|
-
*
|
|
10
|
-
* @param payload - The iac payload.
|
|
11
|
-
* @param type - The type of iac, an iac.TYPE_ enumeration. It can be one of the predefined constants below
|
|
12
|
-
* - `iac.TYPE_INVOCATION`
|
|
13
|
-
*/
|
|
14
|
-
function set_listener(payload: Record<string | number, unknown>, type: number): void;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export {};
|
package/generated/iap.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/** @noSelfInFile */
|
|
2
|
-
import type { Opaque } from "../src/core-types";
|
|
3
|
-
|
|
4
|
-
declare global {
|
|
5
|
-
/**
|
|
6
|
-
* Functions and constants for doing in-app purchases. Supported on iOS, Android (Google Play and Amazon) and Facebook Canvas platforms. [icon:ios] [icon:googleplay] [icon:amazon] [icon:facebook]
|
|
7
|
-
*/
|
|
8
|
-
namespace iap {
|
|
9
|
-
/**
|
|
10
|
-
* Acknowledge a transaction. [icon:attention] Calling iap.acknowledge is required on a successful transaction on Google Play unless iap.finish is called. The transaction.state field must equal iap.TRANS_STATE_PURCHASED.
|
|
11
|
-
*
|
|
12
|
-
* @param transaction - transaction table parameter as supplied in listener callback
|
|
13
|
-
*/
|
|
14
|
-
function acknowledge(transaction: { ident?: string; state?: number; trans_ident?: string; date?: string; original_trans?: string; receipt?: string; signature?: string; user_id?: string }): void;
|
|
15
|
-
/**
|
|
16
|
-
* Purchase a product.
|
|
17
|
-
*
|
|
18
|
-
* @param id - product to buy
|
|
19
|
-
* @param options - optional parameters as properties. The following parameters can be set
|
|
20
|
-
*/
|
|
21
|
-
function buy(id: string, options?: { request_id?: string; token?: string }): void;
|
|
22
|
-
/**
|
|
23
|
-
* Explicitly finish a product transaction. [icon:attention] Calling iap.finish is required on a successful transaction if `auto_finish_transactions` is disabled in project settings. Calling this function with `auto_finish_transactions` set will be ignored and a warning is printed. The `transaction.state` field must equal `iap.TRANS_STATE_PURCHASED`.
|
|
24
|
-
*
|
|
25
|
-
* @param transaction - transaction table parameter as supplied in listener callback
|
|
26
|
-
*/
|
|
27
|
-
function finish(transaction: { ident?: string; state?: number; trans_ident?: string; date?: string; original_trans?: string; receipt?: string; signature?: string; user_id?: string }): void;
|
|
28
|
-
/**
|
|
29
|
-
* Get current iap provider
|
|
30
|
-
*
|
|
31
|
-
* @returns one of the following values
|
|
32
|
-
* - `iap.PROVIDER_ID_GOOGLE`
|
|
33
|
-
* - `iap.PROVIDER_ID_AMAZON`
|
|
34
|
-
* - `iap.PROVIDER_ID_APPLE`
|
|
35
|
-
* - `iap.PROVIDER_ID_FACEBOOK`
|
|
36
|
-
*/
|
|
37
|
-
function get_provider_id(): Opaque<"constant">;
|
|
38
|
-
/**
|
|
39
|
-
* Get a list of all avaliable iap products.
|
|
40
|
-
*
|
|
41
|
-
* @param ids - table (array) of identifiers to get products from
|
|
42
|
-
* @param callback - result callback taking the following parameters
|
|
43
|
-
*/
|
|
44
|
-
function list(ids: string[], callback: (...args: unknown[]) => unknown): void;
|
|
45
|
-
/**
|
|
46
|
-
* Restore previously purchased products.
|
|
47
|
-
*
|
|
48
|
-
* @returns value is `true` if current store supports handling restored transactions, otherwise `false`.
|
|
49
|
-
*/
|
|
50
|
-
function restore(): boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Set the callback function to receive purchase transaction events.
|
|
53
|
-
*
|
|
54
|
-
* @param listener - listener callback function. Pass an empty function if you no longer wish to receive callbacks.
|
|
55
|
-
*/
|
|
56
|
-
function set_listener(listener: (...args: unknown[]) => unknown): void;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export {};
|
package/generated/push.d.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/** @noSelfInFile */
|
|
2
|
-
declare global {
|
|
3
|
-
/**
|
|
4
|
-
* Functions and constants for interacting with local, as well as Apple''s and Google''s push notification services. These API's only exist on mobile platforms. [icon:ios] [icon:android]
|
|
5
|
-
*/
|
|
6
|
-
namespace push {
|
|
7
|
-
/**
|
|
8
|
-
* Use this function to cancel a previously scheduled local push notification.
|
|
9
|
-
* The notification is identified by a numeric id as returned by `push.schedule()`.
|
|
10
|
-
*
|
|
11
|
-
* @param id - The numeric id of the local push notification
|
|
12
|
-
*/
|
|
13
|
-
function cancel(id: number): void;
|
|
14
|
-
/**
|
|
15
|
-
* Use this function to cancel a previously issued local push notifications.
|
|
16
|
-
*/
|
|
17
|
-
function cancel_all_issued(): void;
|
|
18
|
-
/**
|
|
19
|
-
* Returns a table with all data associated with all scheduled local push notifications.
|
|
20
|
-
* The table contains key, value pairs where the key is the push notification id and the value is a table with the notification data, corresponding to the data given by `push.get_scheduled(id)`.
|
|
21
|
-
*
|
|
22
|
-
* @returns Table with all data associated with all scheduled notifications.
|
|
23
|
-
*/
|
|
24
|
-
function get_all_scheduled(): Record<string | number, unknown>;
|
|
25
|
-
/**
|
|
26
|
-
* Returns a table with all data associated with a specified local push notification.
|
|
27
|
-
* The notification is identified by a numeric id as returned by `push.schedule()`.
|
|
28
|
-
*
|
|
29
|
-
* @param id - The numeric id of the local push notification.
|
|
30
|
-
* @returns Table with all data associated with the notification.
|
|
31
|
-
*/
|
|
32
|
-
function get_scheduled(id: number): Record<string | number, unknown>;
|
|
33
|
-
/**
|
|
34
|
-
* Send a request for push notifications. Note that the notifications table parameter is iOS only and will be ignored on Android.
|
|
35
|
-
*
|
|
36
|
-
* @param notifications - The types of notifications to listen to. [icon:ios]
|
|
37
|
-
* @param callback - Register callback function.
|
|
38
|
-
*/
|
|
39
|
-
function register(notifications: number[], callback: (...args: unknown[]) => unknown): void;
|
|
40
|
-
/**
|
|
41
|
-
* Local push notifications are scheduled with this function.
|
|
42
|
-
* The returned `id` value is uniquely identifying the scheduled notification and can be stored for later reference.
|
|
43
|
-
*
|
|
44
|
-
* @param time - Number of seconds into the future until the notification should be triggered.
|
|
45
|
-
* @param title - Localized title to be displayed to the user if the application is not running.
|
|
46
|
-
* @param alert - Localized body message of the notification to be displayed to the user if the application is not running.
|
|
47
|
-
* @param payload - JSON string to be passed to the registered listener function.
|
|
48
|
-
* @param notification_settings - Table with notification and platform specific fields
|
|
49
|
-
*/
|
|
50
|
-
function schedule(time: number, title: string, alert: string, payload: string, notification_settings: { action?: string; badge_count?: number; priority?: number }): LuaMultiReturn<[number, string]>;
|
|
51
|
-
/**
|
|
52
|
-
* Set the badge count for application icon. This function is only available on iOS. [icon:ios]
|
|
53
|
-
*
|
|
54
|
-
* @param count - Badge count
|
|
55
|
-
*/
|
|
56
|
-
function set_badge_count(count: number): void;
|
|
57
|
-
/**
|
|
58
|
-
* Sets a listener function to listen to push notifications.
|
|
59
|
-
*
|
|
60
|
-
* @param listener - Listener callback function.
|
|
61
|
-
*/
|
|
62
|
-
function set_listener(listener: (...args: unknown[]) => unknown): void;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/** @noSelfInFile */
|
|
2
|
-
declare global {
|
|
3
|
-
/**
|
|
4
|
-
* Functions and constants for doing inter-app communication. Supported on iOS and Android. [icon:ios] [icon:android]
|
|
5
|
-
*/
|
|
6
|
-
namespace iac {
|
|
7
|
-
/**
|
|
8
|
-
* Sets the listener function for inter-app communication events.
|
|
9
|
-
*
|
|
10
|
-
* @param payload - The iac payload.
|
|
11
|
-
* @param type - The type of iac, an iac.TYPE_ enumeration. It can be one of the predefined constants below
|
|
12
|
-
* - `iac.TYPE_INVOCATION`
|
|
13
|
-
*/
|
|
14
|
-
function set_listener(payload: Record<string | number, unknown>, type: number): void;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export {};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/** @noSelfInFile */
|
|
2
|
-
import type { Opaque } from "../../../src/core-types";
|
|
3
|
-
|
|
4
|
-
declare global {
|
|
5
|
-
/**
|
|
6
|
-
* Functions and constants for doing in-app purchases. Supported on iOS, Android (Google Play and Amazon) and Facebook Canvas platforms. [icon:ios] [icon:googleplay] [icon:amazon] [icon:facebook]
|
|
7
|
-
*/
|
|
8
|
-
namespace iap {
|
|
9
|
-
/**
|
|
10
|
-
* Acknowledge a transaction. [icon:attention] Calling iap.acknowledge is required on a successful transaction on Google Play unless iap.finish is called. The transaction.state field must equal iap.TRANS_STATE_PURCHASED.
|
|
11
|
-
*
|
|
12
|
-
* @param transaction - transaction table parameter as supplied in listener callback
|
|
13
|
-
*/
|
|
14
|
-
function acknowledge(transaction: { ident?: string; state?: number; trans_ident?: string; date?: string; original_trans?: string; receipt?: string; signature?: string; user_id?: string }): void;
|
|
15
|
-
/**
|
|
16
|
-
* Purchase a product.
|
|
17
|
-
*
|
|
18
|
-
* @param id - product to buy
|
|
19
|
-
* @param options - optional parameters as properties. The following parameters can be set
|
|
20
|
-
*/
|
|
21
|
-
function buy(id: string, options?: { request_id?: string; token?: string }): void;
|
|
22
|
-
/**
|
|
23
|
-
* Explicitly finish a product transaction. [icon:attention] Calling iap.finish is required on a successful transaction if `auto_finish_transactions` is disabled in project settings. Calling this function with `auto_finish_transactions` set will be ignored and a warning is printed. The `transaction.state` field must equal `iap.TRANS_STATE_PURCHASED`.
|
|
24
|
-
*
|
|
25
|
-
* @param transaction - transaction table parameter as supplied in listener callback
|
|
26
|
-
*/
|
|
27
|
-
function finish(transaction: { ident?: string; state?: number; trans_ident?: string; date?: string; original_trans?: string; receipt?: string; signature?: string; user_id?: string }): void;
|
|
28
|
-
/**
|
|
29
|
-
* Get current iap provider
|
|
30
|
-
*
|
|
31
|
-
* @returns one of the following values
|
|
32
|
-
* - `iap.PROVIDER_ID_GOOGLE`
|
|
33
|
-
* - `iap.PROVIDER_ID_AMAZON`
|
|
34
|
-
* - `iap.PROVIDER_ID_APPLE`
|
|
35
|
-
* - `iap.PROVIDER_ID_FACEBOOK`
|
|
36
|
-
*/
|
|
37
|
-
function get_provider_id(): Opaque<"constant">;
|
|
38
|
-
/**
|
|
39
|
-
* Get a list of all avaliable iap products.
|
|
40
|
-
*
|
|
41
|
-
* @param ids - table (array) of identifiers to get products from
|
|
42
|
-
* @param callback - result callback taking the following parameters
|
|
43
|
-
*/
|
|
44
|
-
function list(ids: string[], callback: (...args: unknown[]) => unknown): void;
|
|
45
|
-
/**
|
|
46
|
-
* Restore previously purchased products.
|
|
47
|
-
*
|
|
48
|
-
* @returns value is `true` if current store supports handling restored transactions, otherwise `false`.
|
|
49
|
-
*/
|
|
50
|
-
function restore(): boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Set the callback function to receive purchase transaction events.
|
|
53
|
-
*
|
|
54
|
-
* @param listener - listener callback function. Pass an empty function if you no longer wish to receive callbacks.
|
|
55
|
-
*/
|
|
56
|
-
function set_listener(listener: (...args: unknown[]) => unknown): void;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export {};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/** @noSelfInFile */
|
|
2
|
-
declare global {
|
|
3
|
-
/**
|
|
4
|
-
* Functions and constants for interacting with local, as well as Apple''s and Google''s push notification services. These API's only exist on mobile platforms. [icon:ios] [icon:android]
|
|
5
|
-
*/
|
|
6
|
-
namespace push {
|
|
7
|
-
/**
|
|
8
|
-
* Use this function to cancel a previously scheduled local push notification.
|
|
9
|
-
* The notification is identified by a numeric id as returned by `push.schedule()`.
|
|
10
|
-
*
|
|
11
|
-
* @param id - The numeric id of the local push notification
|
|
12
|
-
*/
|
|
13
|
-
function cancel(id: number): void;
|
|
14
|
-
/**
|
|
15
|
-
* Use this function to cancel a previously issued local push notifications.
|
|
16
|
-
*/
|
|
17
|
-
function cancel_all_issued(): void;
|
|
18
|
-
/**
|
|
19
|
-
* Returns a table with all data associated with all scheduled local push notifications.
|
|
20
|
-
* The table contains key, value pairs where the key is the push notification id and the value is a table with the notification data, corresponding to the data given by `push.get_scheduled(id)`.
|
|
21
|
-
*
|
|
22
|
-
* @returns Table with all data associated with all scheduled notifications.
|
|
23
|
-
*/
|
|
24
|
-
function get_all_scheduled(): Record<string | number, unknown>;
|
|
25
|
-
/**
|
|
26
|
-
* Returns a table with all data associated with a specified local push notification.
|
|
27
|
-
* The notification is identified by a numeric id as returned by `push.schedule()`.
|
|
28
|
-
*
|
|
29
|
-
* @param id - The numeric id of the local push notification.
|
|
30
|
-
* @returns Table with all data associated with the notification.
|
|
31
|
-
*/
|
|
32
|
-
function get_scheduled(id: number): Record<string | number, unknown>;
|
|
33
|
-
/**
|
|
34
|
-
* Send a request for push notifications. Note that the notifications table parameter is iOS only and will be ignored on Android.
|
|
35
|
-
*
|
|
36
|
-
* @param notifications - The types of notifications to listen to. [icon:ios]
|
|
37
|
-
* @param callback - Register callback function.
|
|
38
|
-
*/
|
|
39
|
-
function register(notifications: number[], callback: (...args: unknown[]) => unknown): void;
|
|
40
|
-
/**
|
|
41
|
-
* Local push notifications are scheduled with this function.
|
|
42
|
-
* The returned `id` value is uniquely identifying the scheduled notification and can be stored for later reference.
|
|
43
|
-
*
|
|
44
|
-
* @param time - Number of seconds into the future until the notification should be triggered.
|
|
45
|
-
* @param title - Localized title to be displayed to the user if the application is not running.
|
|
46
|
-
* @param alert - Localized body message of the notification to be displayed to the user if the application is not running.
|
|
47
|
-
* @param payload - JSON string to be passed to the registered listener function.
|
|
48
|
-
* @param notification_settings - Table with notification and platform specific fields
|
|
49
|
-
*/
|
|
50
|
-
function schedule(time: number, title: string, alert: string, payload: string, notification_settings: { action?: string; badge_count?: number; priority?: number }): LuaMultiReturn<[number, string]>;
|
|
51
|
-
/**
|
|
52
|
-
* Set the badge count for application icon. This function is only available on iOS. [icon:ios]
|
|
53
|
-
*
|
|
54
|
-
* @param count - Badge count
|
|
55
|
-
*/
|
|
56
|
-
function set_badge_count(count: number): void;
|
|
57
|
-
/**
|
|
58
|
-
* Sets a listener function to listen to push notifications.
|
|
59
|
-
*
|
|
60
|
-
* @param listener - Listener callback function.
|
|
61
|
-
*/
|
|
62
|
-
function set_listener(listener: (...args: unknown[]) => unknown): void;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export {};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/** @noSelfInFile */
|
|
2
|
-
declare global {
|
|
3
|
-
/**
|
|
4
|
-
* Functions and constants for interacting with webview APIs
|
|
5
|
-
*/
|
|
6
|
-
namespace webview {
|
|
7
|
-
/**
|
|
8
|
-
* Creates a webview instance. It can show HTML pages as well as evaluate Javascript. The view remains hidden until the first call. There can exist a maximum of 4 webviews at the same time.
|
|
9
|
-
* On iOS, the callback will never get a `webview.CALLBACK_RESULT_EVAL_ERROR`, due to the iOS SDK implementation."
|
|
10
|
-
*
|
|
11
|
-
* @param callback - A callback which receives info about finished requests taking the following parameters:
|
|
12
|
-
*/
|
|
13
|
-
function create(callback: (...args: unknown[]) => unknown): void;
|
|
14
|
-
/**
|
|
15
|
-
* Destroys an instance of a webview.
|
|
16
|
-
*
|
|
17
|
-
* @param webview_id - The webview id (returned by the `webview.create()` call)
|
|
18
|
-
*/
|
|
19
|
-
function destroy(webview_id: number): void;
|
|
20
|
-
/**
|
|
21
|
-
* Evaluates JavaScript within the context of the currently loaded page (if any). Once the request is done, the callback (registered in `webview.create()`) is invoked. The callback will get the result in the `data["result"]` field.
|
|
22
|
-
*
|
|
23
|
-
* @param webview_id - The webview id
|
|
24
|
-
* @param code - The JavaScript code to evaluate
|
|
25
|
-
*/
|
|
26
|
-
function eval(webview_id: number, code: string): void;
|
|
27
|
-
/**
|
|
28
|
-
* Returns the visibility state of the webview.
|
|
29
|
-
*
|
|
30
|
-
* @param webview_id - The webview id
|
|
31
|
-
*/
|
|
32
|
-
function is_visible(webview_id: number): void;
|
|
33
|
-
/**
|
|
34
|
-
* Opens a web page in the webview, using HTML data. Once the request is done, the callback (registered in `webview.create()`) is invoked.
|
|
35
|
-
*
|
|
36
|
-
* @param webview_id - The webview id
|
|
37
|
-
* @param html - The HTML data to display
|
|
38
|
-
* @param options - A table of options for the request. See `webview.open()`
|
|
39
|
-
*/
|
|
40
|
-
function open_raw(webview_id: number, html: string, options: Record<string | number, unknown>): void;
|
|
41
|
-
/**
|
|
42
|
-
* Sets the position and size of the webview
|
|
43
|
-
*
|
|
44
|
-
* @param webview_id - The webview id
|
|
45
|
-
* @param x - The x position of the webview
|
|
46
|
-
* @param y - The y position of the webview
|
|
47
|
-
* @param width - The width of the webview (-1 to match screen width)
|
|
48
|
-
* @param height - The height of the webview (-1 to match screen height)
|
|
49
|
-
*/
|
|
50
|
-
function set_position(webview_id: number, x: number, y: number, width: number, height: number): void;
|
|
51
|
-
/**
|
|
52
|
-
* Set transparency of webview background
|
|
53
|
-
*
|
|
54
|
-
* @param webview_id - The webview id
|
|
55
|
-
* @param transparent - If `true`, the webview background becomes transparent, otherwise opaque.
|
|
56
|
-
*/
|
|
57
|
-
function set_transparent(webview_id: number, transparent: boolean): void;
|
|
58
|
-
/**
|
|
59
|
-
* Shows or hides a webview
|
|
60
|
-
*
|
|
61
|
-
* @param webview_id - The webview id
|
|
62
|
-
* @param visible - If `0`, hides the webview. If non zero, shows the view
|
|
63
|
-
*/
|
|
64
|
-
function set_visible(webview_id: number, visible: number): void;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/** @noSelfInFile */
|
|
2
|
-
declare global {
|
|
3
|
-
/**
|
|
4
|
-
* Functions and constants for doing inter-app communication. Supported on iOS and Android. [icon:ios] [icon:android]
|
|
5
|
-
*/
|
|
6
|
-
namespace iac {
|
|
7
|
-
/**
|
|
8
|
-
* Sets the listener function for inter-app communication events.
|
|
9
|
-
*
|
|
10
|
-
* @param payload - The iac payload.
|
|
11
|
-
* @param type - The type of iac, an iac.TYPE_ enumeration. It can be one of the predefined constants below
|
|
12
|
-
* - `iac.TYPE_INVOCATION`
|
|
13
|
-
*/
|
|
14
|
-
function set_listener(payload: Record<string | number, unknown>, type: number): void;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export {};
|