@wonderlandengine/editor-api 1.2.3-dev.2 → 1.3.1
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/README.md +3 -3
- package/dist/data.d.ts +201 -143
- package/dist/data.js +211 -185
- package/dist/index.d.ts +30 -5
- package/dist/index.js +7 -4
- package/dist/native.d.ts +8 -1
- package/dist/ui.d.ts +52 -2
- package/dist/ui.js +51 -1
- package/dist/workspace.d.ts +10 -0
- package/dist/workspace.js +2 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
@@ -2,12 +2,37 @@ export * from './data.js';
|
|
2
2
|
export * as ui from './ui.js';
|
3
3
|
export * as tools from './tools.js';
|
4
4
|
export * from './project.js';
|
5
|
+
export * from './workspace.js';
|
5
6
|
/** Editor plugin */
|
6
7
|
export declare class EditorPlugin {
|
8
|
+
/** Name of the plugin */
|
7
9
|
name: string;
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
/**
|
11
|
+
* Called to let the plugin draw it's ui. See {@link ui}.
|
12
|
+
*/
|
13
|
+
draw?(): void;
|
14
|
+
/**
|
15
|
+
* Called before a project is saved
|
16
|
+
*
|
17
|
+
* @returns `false` to indicate failure to save.
|
18
|
+
*/
|
19
|
+
preProjectSave?(): boolean;
|
20
|
+
/**
|
21
|
+
* Called after a project is loaded
|
22
|
+
*
|
23
|
+
* @returns `false` to indicate failure to load.
|
24
|
+
*/
|
25
|
+
postProjectLoad?: boolean;
|
26
|
+
/**
|
27
|
+
* Called before a project is packaged
|
28
|
+
*
|
29
|
+
* @returns `false` to abort packaging.
|
30
|
+
*/
|
31
|
+
prePackage?(): boolean;
|
32
|
+
/**
|
33
|
+
* Called after a project is packaged
|
34
|
+
*
|
35
|
+
* @returns `false` to abort packaging.
|
36
|
+
*/
|
37
|
+
postPackage?(): boolean;
|
13
38
|
}
|
package/dist/index.js
CHANGED
@@ -4,12 +4,15 @@ export { ui_1 as ui };
|
|
4
4
|
import * as tools_1 from './tools.js';
|
5
5
|
export { tools_1 as tools };
|
6
6
|
export * from './project.js';
|
7
|
+
export * from './workspace.js';
|
7
8
|
/** Editor plugin */
|
8
9
|
export class EditorPlugin {
|
10
|
+
/** Name of the plugin */
|
9
11
|
name = 'Editor Plugin';
|
10
|
-
|
11
|
-
|
12
|
+
/**
|
13
|
+
* Called after a project is loaded
|
14
|
+
*
|
15
|
+
* @returns `false` to indicate failure to load.
|
16
|
+
*/
|
12
17
|
postProjectLoad;
|
13
|
-
prePackage;
|
14
|
-
postPackage;
|
15
18
|
}
|
package/dist/native.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import { EditorData } from './data.js';
|
2
|
+
import { Workspace } from './workspace.js';
|
2
3
|
interface NativeToolsAPI {
|
3
4
|
packageProject(destDir?: string): number;
|
4
5
|
loadFile(filename: string): number;
|
@@ -17,12 +18,17 @@ interface NativeUiAPI {
|
|
17
18
|
checkbox(label: string, value: boolean): boolean | null;
|
18
19
|
colorEdit4(label: string, value: Float32Array): boolean;
|
19
20
|
dummy(width: number, height: number): void;
|
20
|
-
sameLine(offset
|
21
|
+
sameLine(offset?: number): void;
|
21
22
|
separator(): void;
|
22
23
|
spinner(): void;
|
23
24
|
beginGroup(): void;
|
24
25
|
endGroup(): void;
|
26
|
+
inputFloat(label: string, value: number): number | null;
|
27
|
+
inputFloat3(label: string, value: Float32Array): boolean;
|
28
|
+
inputInt(label: string, value: number): number | null;
|
29
|
+
inputInt3(label: string, value: Int32Array): boolean;
|
25
30
|
}
|
31
|
+
/** Project paths */
|
26
32
|
export interface Project {
|
27
33
|
/**
|
28
34
|
* Root directory of the project
|
@@ -67,5 +73,6 @@ declare global {
|
|
67
73
|
function _wl_internalBinding(moduleName: 'ui'): NativeUiAPI;
|
68
74
|
function _wl_internalBinding(moduleName: 'data'): EditorData;
|
69
75
|
function _wl_internalBinding(moduleName: 'project'): Project;
|
76
|
+
function _wl_internalBinding(moduleName: 'workspace'): Workspace;
|
70
77
|
}
|
71
78
|
export {};
|
package/dist/ui.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
2
|
-
/** Image to be used in
|
2
|
+
/** Image to be used in {@link ui}. */
|
3
3
|
export declare class UiImage {
|
4
4
|
_id: number;
|
5
5
|
constructor(id: number);
|
@@ -91,7 +91,7 @@ export declare const dummy: (width: number, height: number) => void;
|
|
91
91
|
*
|
92
92
|
* @param offset Offset on the x axis.
|
93
93
|
*/
|
94
|
-
export declare const sameLine: (offset
|
94
|
+
export declare const sameLine: (offset?: number) => void;
|
95
95
|
/** Separator line. */
|
96
96
|
export declare const separator: () => void;
|
97
97
|
/** Begin a widget group. */
|
@@ -100,3 +100,53 @@ export declare const beginGroup: () => void;
|
|
100
100
|
export declare const endGroup: () => void;
|
101
101
|
/** Spinner to indicate loading. */
|
102
102
|
export declare const spinner: () => void;
|
103
|
+
/**
|
104
|
+
* Draggable float input
|
105
|
+
* @param label Label for the input.
|
106
|
+
* @param value Current value.
|
107
|
+
* @returns The new value when changed by the user this frame, otherwise `null`.
|
108
|
+
*
|
109
|
+
* @example
|
110
|
+
* let myFloat = 0;
|
111
|
+
* const n = ui.inputFloat("change this:", myFloat);
|
112
|
+
* if(n !== null) myFloat = n;
|
113
|
+
*/
|
114
|
+
export declare const inputFloat: (label: string, value: number) => number | null;
|
115
|
+
/**
|
116
|
+
* Draggable float3 input
|
117
|
+
* @param label Label for the input.
|
118
|
+
* @param value Current value.
|
119
|
+
* @returns `true` if changed by the user this frame, `false` otherwise.
|
120
|
+
*
|
121
|
+
* @example
|
122
|
+
* const myFloat3 = new Float32Array(3);
|
123
|
+
* if(ui.inputFloat3("change this:", myFloat3)) {
|
124
|
+
* console.log("changed");
|
125
|
+
* }
|
126
|
+
*/
|
127
|
+
export declare const inputFloat3: (label: string, value: Float32Array) => boolean;
|
128
|
+
/**
|
129
|
+
* Draggable int input
|
130
|
+
* @param label Label for the input.
|
131
|
+
* @param value Current value.
|
132
|
+
* @returns The new value when changed by the user this frame, otherwise `null`.
|
133
|
+
*
|
134
|
+
* @example
|
135
|
+
* let myInt = 0;
|
136
|
+
* const n = ui.inputInt("change this:", myInt);
|
137
|
+
* if(n !== null) myInt = n;
|
138
|
+
*/
|
139
|
+
export declare const inputInt: (label: string, value: number) => number | null;
|
140
|
+
/**
|
141
|
+
* Draggable int3 input
|
142
|
+
* @param label Label for the input.
|
143
|
+
* @param value Current value.
|
144
|
+
* @returns `true` if changed by the user this frame, `false` otherwise.
|
145
|
+
*
|
146
|
+
* @example
|
147
|
+
* const myInt3 = new Int32Array(3);
|
148
|
+
* if(ui.inputInt3("change this:", myInt3)) {
|
149
|
+
* console.log("changed");
|
150
|
+
* }
|
151
|
+
*/
|
152
|
+
export declare const inputInt3: (label: string, value: Int32Array) => boolean;
|
package/dist/ui.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { awaitJob } from './tools.js';
|
2
2
|
const ui = _wl_internalBinding('ui');
|
3
|
-
/** Image to be used in
|
3
|
+
/** Image to be used in {@link ui}. */
|
4
4
|
export class UiImage {
|
5
5
|
_id = -1;
|
6
6
|
constructor(id) {
|
@@ -124,3 +124,53 @@ export const beginGroup = ui.beginGroup.bind(ui);
|
|
124
124
|
export const endGroup = ui.endGroup.bind(ui);
|
125
125
|
/** Spinner to indicate loading. */
|
126
126
|
export const spinner = ui.spinner.bind(ui);
|
127
|
+
/**
|
128
|
+
* Draggable float input
|
129
|
+
* @param label Label for the input.
|
130
|
+
* @param value Current value.
|
131
|
+
* @returns The new value when changed by the user this frame, otherwise `null`.
|
132
|
+
*
|
133
|
+
* @example
|
134
|
+
* let myFloat = 0;
|
135
|
+
* const n = ui.inputFloat("change this:", myFloat);
|
136
|
+
* if(n !== null) myFloat = n;
|
137
|
+
*/
|
138
|
+
export const inputFloat = ui.inputFloat.bind(ui);
|
139
|
+
/**
|
140
|
+
* Draggable float3 input
|
141
|
+
* @param label Label for the input.
|
142
|
+
* @param value Current value.
|
143
|
+
* @returns `true` if changed by the user this frame, `false` otherwise.
|
144
|
+
*
|
145
|
+
* @example
|
146
|
+
* const myFloat3 = new Float32Array(3);
|
147
|
+
* if(ui.inputFloat3("change this:", myFloat3)) {
|
148
|
+
* console.log("changed");
|
149
|
+
* }
|
150
|
+
*/
|
151
|
+
export const inputFloat3 = ui.inputFloat3.bind(ui);
|
152
|
+
/**
|
153
|
+
* Draggable int input
|
154
|
+
* @param label Label for the input.
|
155
|
+
* @param value Current value.
|
156
|
+
* @returns The new value when changed by the user this frame, otherwise `null`.
|
157
|
+
*
|
158
|
+
* @example
|
159
|
+
* let myInt = 0;
|
160
|
+
* const n = ui.inputInt("change this:", myInt);
|
161
|
+
* if(n !== null) myInt = n;
|
162
|
+
*/
|
163
|
+
export const inputInt = ui.inputInt.bind(ui);
|
164
|
+
/**
|
165
|
+
* Draggable int3 input
|
166
|
+
* @param label Label for the input.
|
167
|
+
* @param value Current value.
|
168
|
+
* @returns `true` if changed by the user this frame, `false` otherwise.
|
169
|
+
*
|
170
|
+
* @example
|
171
|
+
* const myInt3 = new Int32Array(3);
|
172
|
+
* if(ui.inputInt3("change this:", myInt3)) {
|
173
|
+
* console.log("changed");
|
174
|
+
* }
|
175
|
+
*/
|
176
|
+
export const inputInt3 = ui.inputInt3.bind(ui);
|
@@ -0,0 +1,10 @@
|
|
1
|
+
/** @todo: Give access to each projects using: getProject(filename). */
|
2
|
+
/**
|
3
|
+
* Workspace access.
|
4
|
+
*
|
5
|
+
* Allows to read the current workspace setup.
|
6
|
+
*/
|
7
|
+
export interface Workspace {
|
8
|
+
mainFilename: string;
|
9
|
+
}
|
10
|
+
export declare const workspace: Workspace;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wonderlandengine/editor-api",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.3.1",
|
4
4
|
"description": "Wonderland Engine's Editor API for plugins - very experimental.",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"module": "./dist/index.js",
|
@@ -11,7 +11,7 @@
|
|
11
11
|
},
|
12
12
|
"repository": {
|
13
13
|
"type": "git",
|
14
|
-
"url": "git+https://github.com/WonderlandEngine/api.git"
|
14
|
+
"url": "git+https://github.com/WonderlandEngine/editor-api.git"
|
15
15
|
},
|
16
16
|
"keywords": [
|
17
17
|
"webxr",
|