@wonderlandengine/editor-api 1.4.6 → 1.5.0-rc.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/dist/data.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare let data: EditorData;
1
+ export declare let data: ProjectData;
2
2
  /** Object reference */
3
3
  export type ObjectReference = string | null;
4
4
  /** Mesh reference */
@@ -23,6 +23,8 @@ export type ImageReference = string | null;
23
23
  export type AnimationReference = string | null;
24
24
  /** Particle effect reference */
25
25
  export type ParticleEffectReference = string | null;
26
+ /** Plugin reference */
27
+ export type PluginReference = string | null;
26
28
  /** Project type */
27
29
  export declare enum ProjectType {
28
30
  Website = "website",
@@ -155,9 +157,6 @@ export declare class EditorSettings extends Access {
155
157
  };
156
158
  importPhysicalAsPhongMaterials: boolean;
157
159
  }
158
- /** Plugins settings */
159
- export declare class PluginsSettings extends Access {
160
- }
161
160
  /** PWA settings */
162
161
  export declare class PWASettings extends Access {
163
162
  enable: boolean;
@@ -279,7 +278,6 @@ export interface Settings extends Access {
279
278
  editor: EditorSettings;
280
279
  runtime: RuntimeSettings;
281
280
  scripting: ScriptingSettings;
282
- plugins: PluginsSettings;
283
281
  xr: XRSettings;
284
282
  physx: PhysXSettings;
285
283
  localization: LocalizationSettings;
@@ -809,6 +807,12 @@ export declare class LanguageResource extends Resource {
809
807
  export declare class ParticleEffectResource extends Resource {
810
808
  name: string;
811
809
  }
810
+ /** Plugin resource */
811
+ export declare class PluginResource extends Resource {
812
+ name: string;
813
+ /** Whether this plugin is enabled */
814
+ enabled: boolean;
815
+ }
812
816
  /** File resource */
813
817
  export declare class FileResource extends Resource {
814
818
  fileName: string;
@@ -835,7 +839,7 @@ export declare class ResourceSection<T> {
835
839
  * WL.data.objects[123].components[0].text.text
836
840
  * ```
837
841
  */
838
- export interface EditorData {
842
+ export interface ProjectData {
839
843
  /** Project settings */
840
844
  settings: Settings;
841
845
  /** List of scene file paths */
@@ -864,4 +868,6 @@ export interface EditorData {
864
868
  languages: ResourceSection<LanguageResource>;
865
869
  /** Particle effect resources */
866
870
  particleEffects: ResourceSection<ParticleEffectResource>;
871
+ /** Particle effect resources */
872
+ plugins: ResourceSection<PluginResource>;
867
873
  }
package/dist/data.js CHANGED
@@ -167,9 +167,6 @@ export class EditorSettings extends Access {
167
167
  };
168
168
  importPhysicalAsPhongMaterials = true;
169
169
  }
170
- /** Plugins settings */
171
- export class PluginsSettings extends Access {
172
- }
173
170
  /** PWA settings */
174
171
  export class PWASettings extends Access {
175
172
  enable = false;
@@ -829,6 +826,12 @@ export class LanguageResource extends Resource {
829
826
  export class ParticleEffectResource extends Resource {
830
827
  name = 'particleEffect';
831
828
  }
829
+ /** Plugin resource */
830
+ export class PluginResource extends Resource {
831
+ name = 'plugin';
832
+ /** Whether this plugin is enabled */
833
+ enabled = true;
834
+ }
832
835
  /** File resource */
833
836
  export class FileResource extends Resource {
834
837
  fileName = '';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  export * from './data.js';
2
2
  export * as ui from './ui.js';
3
3
  export * as tools from './tools.js';
4
- export * from './project.js';
5
4
  export * from './workspace.js';
6
5
  /** Editor plugin */
7
6
  export declare class EditorPlugin {
package/dist/index.js CHANGED
@@ -3,7 +3,6 @@ import * as ui_1 from './ui.js';
3
3
  export { ui_1 as ui };
4
4
  import * as tools_1 from './tools.js';
5
5
  export { tools_1 as tools };
6
- export * from './project.js';
7
6
  export * from './workspace.js';
8
7
  /** Editor plugin */
9
8
  export class EditorPlugin {
package/dist/native.d.ts CHANGED
@@ -1,6 +1,8 @@
1
- import { EditorData } from './data.js';
1
+ import { ProjectData } from './data.js';
2
2
  import { Workspace } from './workspace.js';
3
3
  interface NativeToolsAPI {
4
+ newSubProject(name: string, filename?: string, projectKind?: string): boolean;
5
+ switchProject(id: number): void;
4
6
  packageProject(destDir?: string): number;
5
7
  loadFile(filename: string): number;
6
8
  loadScene(filename: string, parent?: string): number;
@@ -30,51 +32,11 @@ interface NativeUiAPI {
30
32
  inputInt(label: string, value: number): number | null;
31
33
  inputInt3(label: string, value: Int32Array): boolean;
32
34
  }
33
- /** Project paths */
34
- export interface Project {
35
- /**
36
- * Root directory of the project
37
- *
38
- * Directory in which the project file resides in.
39
- */
40
- readonly root: string;
41
- /**
42
- * Project filename
43
- *
44
- * File only without the root directory.
45
- */
46
- readonly filename: string;
47
- /**
48
- * Project deploy path
49
- * @returns `<root>/deploy`
50
- */
51
- readonly deployPath: string;
52
- /**
53
- * Project cache path
54
- * @returns `<root>/cache`
55
- */
56
- readonly cachePath: string;
57
- /**
58
- * Project package.json path
59
- * @returns `<root>/package.json`
60
- */
61
- readonly packageJsonPath: string;
62
- /**
63
- * Project node_modules path
64
- * @returns `<root>/node_modules`
65
- */
66
- readonly nodeModulesPath: string;
67
- /**
68
- * Project shaders path
69
- * @returns `<root>/shaders`
70
- */
71
- readonly shadersPath: string;
72
- }
73
35
  declare global {
74
36
  function _wl_internalBinding(moduleName: 'tools'): NativeToolsAPI;
75
37
  function _wl_internalBinding(moduleName: 'ui'): NativeUiAPI;
76
- function _wl_internalBinding(moduleName: 'data'): EditorData;
77
- function _wl_internalBinding(moduleName: 'project'): Project;
38
+ /** @todo Remove/deprecate */
39
+ function _wl_internalBinding(moduleName: 'data'): ProjectData;
78
40
  function _wl_internalBinding(moduleName: 'workspace'): Workspace;
79
41
  }
80
42
  export {};
package/dist/tools.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  /** @hidden */
2
2
  export declare function awaitJob(jobId: number): Promise<void>;
3
+ export declare const newSubProject: (name: string, filename?: string, projectKind?: string) => boolean;
4
+ export declare const switchProject: (id: number) => void;
3
5
  /**
4
6
  * Package the current project
5
7
  * @param destDir Destination directory into which to package, default `'<project-root>/deploy'`.
package/dist/tools.js CHANGED
@@ -10,6 +10,8 @@ export function awaitJob(jobId) {
10
10
  });
11
11
  });
12
12
  }
13
+ export const newSubProject = tools.newSubProject.bind(tools);
14
+ export const switchProject = tools.switchProject.bind(tools);
13
15
  /**
14
16
  * Package the current project
15
17
  * @param destDir Destination directory into which to package, default `'<project-root>/deploy'`.
@@ -1,10 +1,65 @@
1
- /** @todo: Give access to each projects using: getProject(filename). */
1
+ import { ProjectData } from './data.js';
2
2
  /**
3
3
  * Workspace access.
4
4
  *
5
5
  * Allows to read the current workspace setup.
6
6
  */
7
7
  export interface Workspace {
8
- mainFilename: string;
8
+ /**
9
+ * Workspace projects
10
+ *
11
+ * The main project is always at index/id 0
12
+ */
13
+ readonly projects: Array<ProjectData>;
14
+ projectId(filename: String): number;
15
+ /**
16
+ * Root directory of the project
17
+ *
18
+ * Directory in which the project file resides in.
19
+ */
20
+ readonly root: string;
21
+ /**
22
+ * Main project filename
23
+ *
24
+ * Filename relative to the workspace root directory.
25
+ *
26
+ * @deprecated Use the per-project accessors instead
27
+ */
28
+ readonly filename: string;
29
+ /**
30
+ * Main project filename
31
+ *
32
+ * Filename relative to the workspace root directory.
33
+ */
34
+ readonly mainFilename: string;
35
+ /**
36
+ * Project deploy path
37
+ * @returns `<root>/deploy`
38
+ */
39
+ readonly deployPath: string;
40
+ /**
41
+ * Project cache path
42
+ * @returns `<root>/cache`
43
+ */
44
+ readonly cachePath: string;
45
+ /**
46
+ * Project package.json path
47
+ * @returns `<root>/package.json`
48
+ */
49
+ readonly packageJsonPath: string;
50
+ /**
51
+ * Project node_modules path
52
+ * @returns `<root>/node_modules`
53
+ */
54
+ readonly nodeModulesPath: string;
55
+ /**
56
+ * Project shaders path
57
+ * @returns `<root>/shaders`
58
+ */
59
+ readonly shadersPath: string;
9
60
  }
10
61
  export declare const workspace: Workspace;
62
+ /**
63
+ * @deprecated Use the {@link workspace} export instead
64
+ */
65
+ export declare const project: Workspace;
package/dist/workspace.js CHANGED
@@ -1,2 +1,5 @@
1
- /** @todo: Give access to each projects using: getProject(filename). */
2
1
  export const workspace = _wl_internalBinding('workspace');
2
+ /**
3
+ * @deprecated Use the {@link workspace} export instead
4
+ */
5
+ export const project = workspace;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wonderlandengine/editor-api",
3
- "version": "1.4.6",
3
+ "version": "1.5.0-rc.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",
package/dist/project.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const project: import("./native.js").Project;
package/dist/project.js DELETED
@@ -1 +0,0 @@
1
- export const project = _wl_internalBinding('project');