@3dsource/metabox-front-api 0.0.15 → 0.0.16
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 +15 -2
- package/dist/actions/ShowOverlayInterface.d.ts +23 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +38 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +38 -0
- package/dist/index.umd.js.map +1 -1
- package/dist/interfaces/ToMetaboxMessagePayloads.d.ts +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ import { FromMetaBoxApiAction, GetFastRender, GetPdf, integrateMetaBox, saveImag
|
|
|
17
17
|
**OR** work with direct import from `NPM` using `CDN` network `unpkg.com` or `jsdelivr.net` (you can also download package and use it locally):
|
|
18
18
|
|
|
19
19
|
```javascript
|
|
20
|
-
import { FromMetaBoxApiAction, GetFastRender, GetPdf, integrateMetaBox, saveImage, SetEnvironment, SetMaterial, SetProduct, ShowEmbeddedMenu,... } from 'https://cdn.jsdelivr.net/npm/@3dsource/metabox-front-api@latest
|
|
20
|
+
import { FromMetaBoxApiAction, GetFastRender, GetPdf, integrateMetaBox, saveImage, SetEnvironment, SetMaterial, SetProduct, ShowEmbeddedMenu,... } from 'https://cdn.jsdelivr.net/npm/@3dsource/metabox-front-api@latest';
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
**We strongly recommend using the first option with npm and locking it to the latest version at the time of integration, as the second option can change rapidly and may cause unexpected behavior in your existing code.**
|
|
@@ -45,8 +45,10 @@ Insert this code into your HTML file just before the closing `</body>` tag:
|
|
|
45
45
|
|
|
46
46
|
```html
|
|
47
47
|
<script type="module">
|
|
48
|
-
import { integrateMetaBox, SetEnvironment, SetEnvironmentMaterial, SetMaterial, SetProduct, ShowEmbeddedMenu, GetFastRender, GetPdf, saveImage, FromMetaboxApiAction } from 'https://cdn.jsdelivr.net/npm/@3dsource/metabox-front-api@latest
|
|
48
|
+
import { integrateMetaBox, SetEnvironment, SetEnvironmentMaterial, SetMaterial, SetProduct, ShowEmbeddedMenu, GetFastRender, GetPdf, saveImage, FromMetaboxApiAction } from 'https://cdn.jsdelivr.net/npm/@3dsource/metabox-front-api@latest';
|
|
49
|
+
import { ShowOverlayInterface } from './ShowOverlayInterface';
|
|
49
50
|
// Expose API
|
|
51
|
+
window.env3DSource = { ...window.env3DSource };
|
|
50
52
|
window.env3DSource.apiReady = (api) => {
|
|
51
53
|
api.addEventListener('metaboxData', (data) => {
|
|
52
54
|
const { action, payload, eventType } = data;
|
|
@@ -97,6 +99,9 @@ Insert this code into your HTML file just before the closing `</body>` tag:
|
|
|
97
99
|
// Toggle embedded menu
|
|
98
100
|
new ShowEmbeddedMenu(false);
|
|
99
101
|
|
|
102
|
+
// Toggle overlay interface
|
|
103
|
+
new ShowOverlayInterface(false);
|
|
104
|
+
|
|
100
105
|
//Request Pdf, Will execute as stream is ready, will be auto-downloaded
|
|
101
106
|
new GetPdf();
|
|
102
107
|
|
|
@@ -165,6 +170,14 @@ Insert this code into your HTML file just before the closing `</body>` tag:
|
|
|
165
170
|
new ShowEmbeddedMenu(visible: boolean);
|
|
166
171
|
```
|
|
167
172
|
|
|
173
|
+
### `ShowOverlayInterface`
|
|
174
|
+
|
|
175
|
+
- **Description**: Toggles the overlay interface over Unreal viewport.
|
|
176
|
+
- **Constructor**:
|
|
177
|
+
```typescript
|
|
178
|
+
new ShowOverlayInterface(visible: boolean);
|
|
179
|
+
```
|
|
180
|
+
|
|
168
181
|
### `GetFastRender`
|
|
169
182
|
|
|
170
183
|
- **Description**: Retrieves a fast render of the current view.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ApiAction } from './ApiAction';
|
|
2
|
+
/**
|
|
3
|
+
* {@inheritDoc ApiAction}
|
|
4
|
+
*
|
|
5
|
+
* Represents an action to toggle the Unreal Overlay Interface Menu.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* This action sends a message to the MetaBox API to toggle the visibility of the Unreal overlay UI.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* import { ShowOverlayInterface } from 'https://unpkg.com/@3dsource/metabox-front-api@latest/dist/index.js';
|
|
12
|
+
* window.env3DSource.apiReady = (api) => {
|
|
13
|
+
* new ShowOverlayInterface(true);
|
|
14
|
+
* };
|
|
15
|
+
*/
|
|
16
|
+
export declare class ShowOverlayInterface extends ApiAction {
|
|
17
|
+
/**
|
|
18
|
+
* Creates an instance of ShowOverlayInterface.
|
|
19
|
+
*
|
|
20
|
+
* @param visible - A flag indicating whether the Unreal overlay UI should be visible.
|
|
21
|
+
*/
|
|
22
|
+
constructor(visible: boolean);
|
|
23
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -52,9 +52,46 @@ const ToMetaBoxApiAction = {
|
|
|
52
52
|
showEmbeddedMenu: 'showEmbeddedMenu',
|
|
53
53
|
forceSetDeviceType: 'forceSetDeviceType',
|
|
54
54
|
sendCommandToUnreal: 'sendCommandToUnreal',
|
|
55
|
+
showOverlayInterface: 'showOverlayInterface',
|
|
55
56
|
setEnvironmentMaterialById: 'setEnvironmentMaterialById',
|
|
56
57
|
};
|
|
57
58
|
|
|
59
|
+
/*
|
|
60
|
+
* Copyright (c) 2025.
|
|
61
|
+
* 3DSource.com, Sergii Karanda steve@3dsource.com
|
|
62
|
+
* All Rights Reserved
|
|
63
|
+
*/
|
|
64
|
+
/**
|
|
65
|
+
* {@inheritDoc ApiAction}
|
|
66
|
+
*
|
|
67
|
+
* Represents an action to toggle the Unreal Overlay Interface Menu.
|
|
68
|
+
*
|
|
69
|
+
* @remarks
|
|
70
|
+
* This action sends a message to the MetaBox API to toggle the visibility of the Unreal overlay UI.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* import { ShowOverlayInterface } from 'https://unpkg.com/@3dsource/metabox-front-api@latest/dist/index.js';
|
|
74
|
+
* window.env3DSource.apiReady = (api) => {
|
|
75
|
+
* new ShowOverlayInterface(true);
|
|
76
|
+
* };
|
|
77
|
+
*/
|
|
78
|
+
class ShowOverlayInterface extends ApiAction {
|
|
79
|
+
/**
|
|
80
|
+
* Creates an instance of ShowOverlayInterface.
|
|
81
|
+
*
|
|
82
|
+
* @param visible - A flag indicating whether the Unreal overlay UI should be visible.
|
|
83
|
+
*/
|
|
84
|
+
constructor(visible) {
|
|
85
|
+
super();
|
|
86
|
+
this.api.sendMessageToMetaBox({
|
|
87
|
+
action: ToMetaBoxApiAction.showOverlayInterface,
|
|
88
|
+
payload: {
|
|
89
|
+
visible,
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
58
95
|
/*
|
|
59
96
|
* Copyright (c) 2025.
|
|
60
97
|
* 3DSource.com, Sergii Karanda steve@3dsource.com
|
|
@@ -744,5 +781,5 @@ const APPLICATION_DEVICE_TYPES = {
|
|
|
744
781
|
deviceTypeDesktop: 'deviceTypeDesktop',
|
|
745
782
|
};
|
|
746
783
|
|
|
747
|
-
export { APPLICATION_DEVICE_TYPES, ApiAction, Communicator, FromMetaboxApiAction, GetFastRender, GetPdf, SendCommandToUnreal, SetEnvironment, SetEnvironmentMaterial, SetMaterial, SetProduct, ShowEmbeddedMenu, ToMetaBoxApiAction, WatchCallbacks, getUrlParams, integrateMetaBox, saveImage, setUrlParams, sleep };
|
|
784
|
+
export { APPLICATION_DEVICE_TYPES, ApiAction, Communicator, FromMetaboxApiAction, GetFastRender, GetPdf, SendCommandToUnreal, SetEnvironment, SetEnvironmentMaterial, SetMaterial, SetProduct, ShowEmbeddedMenu, ShowOverlayInterface, ToMetaBoxApiAction, WatchCallbacks, getUrlParams, integrateMetaBox, saveImage, setUrlParams, sleep };
|
|
748
785
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.umd.js
CHANGED
|
@@ -58,9 +58,46 @@
|
|
|
58
58
|
showEmbeddedMenu: 'showEmbeddedMenu',
|
|
59
59
|
forceSetDeviceType: 'forceSetDeviceType',
|
|
60
60
|
sendCommandToUnreal: 'sendCommandToUnreal',
|
|
61
|
+
showOverlayInterface: 'showOverlayInterface',
|
|
61
62
|
setEnvironmentMaterialById: 'setEnvironmentMaterialById',
|
|
62
63
|
};
|
|
63
64
|
|
|
65
|
+
/*
|
|
66
|
+
* Copyright (c) 2025.
|
|
67
|
+
* 3DSource.com, Sergii Karanda steve@3dsource.com
|
|
68
|
+
* All Rights Reserved
|
|
69
|
+
*/
|
|
70
|
+
/**
|
|
71
|
+
* {@inheritDoc ApiAction}
|
|
72
|
+
*
|
|
73
|
+
* Represents an action to toggle the Unreal Overlay Interface Menu.
|
|
74
|
+
*
|
|
75
|
+
* @remarks
|
|
76
|
+
* This action sends a message to the MetaBox API to toggle the visibility of the Unreal overlay UI.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* import { ShowOverlayInterface } from 'https://unpkg.com/@3dsource/metabox-front-api@latest/dist/index.js';
|
|
80
|
+
* window.env3DSource.apiReady = (api) => {
|
|
81
|
+
* new ShowOverlayInterface(true);
|
|
82
|
+
* };
|
|
83
|
+
*/
|
|
84
|
+
class ShowOverlayInterface extends ApiAction {
|
|
85
|
+
/**
|
|
86
|
+
* Creates an instance of ShowOverlayInterface.
|
|
87
|
+
*
|
|
88
|
+
* @param visible - A flag indicating whether the Unreal overlay UI should be visible.
|
|
89
|
+
*/
|
|
90
|
+
constructor(visible) {
|
|
91
|
+
super();
|
|
92
|
+
this.api.sendMessageToMetaBox({
|
|
93
|
+
action: ToMetaBoxApiAction.showOverlayInterface,
|
|
94
|
+
payload: {
|
|
95
|
+
visible,
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
64
101
|
/*
|
|
65
102
|
* Copyright (c) 2025.
|
|
66
103
|
* 3DSource.com, Sergii Karanda steve@3dsource.com
|
|
@@ -762,6 +799,7 @@
|
|
|
762
799
|
exports.SetMaterial = SetMaterial;
|
|
763
800
|
exports.SetProduct = SetProduct;
|
|
764
801
|
exports.ShowEmbeddedMenu = ShowEmbeddedMenu;
|
|
802
|
+
exports.ShowOverlayInterface = ShowOverlayInterface;
|
|
765
803
|
exports.ToMetaBoxApiAction = ToMetaBoxApiAction;
|
|
766
804
|
exports.WatchCallbacks = WatchCallbacks;
|
|
767
805
|
exports.getUrlParams = getUrlParams;
|
package/dist/index.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -16,6 +16,7 @@ export declare const ToMetaBoxApiAction: {
|
|
|
16
16
|
readonly showEmbeddedMenu: "showEmbeddedMenu";
|
|
17
17
|
readonly forceSetDeviceType: "forceSetDeviceType";
|
|
18
18
|
readonly sendCommandToUnreal: "sendCommandToUnreal";
|
|
19
|
+
readonly showOverlayInterface: "showOverlayInterface";
|
|
19
20
|
readonly setEnvironmentMaterialById: "setEnvironmentMaterialById";
|
|
20
21
|
};
|
|
21
22
|
export type ToMetaBoxActions = (typeof ToMetaBoxApiAction)[keyof typeof ToMetaBoxApiAction];
|
|
@@ -58,6 +59,9 @@ export interface ToMetaboxMessagePayloads {
|
|
|
58
59
|
showEmbeddedMenu: {
|
|
59
60
|
visible: boolean;
|
|
60
61
|
};
|
|
62
|
+
showOverlayInterface: {
|
|
63
|
+
visible: boolean;
|
|
64
|
+
};
|
|
61
65
|
forceSetDeviceType: {
|
|
62
66
|
deviceType: ApplicationDeviceType;
|
|
63
67
|
};
|