@virtualdisplay.io/client 3.3.0 → 3.4.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/CHANGELOG.md +12 -0
- package/dist/index.d.ts +94 -24
- package/dist/virtualdisplay.client.cjs.js +3 -3
- package/dist/virtualdisplay.client.cjs.js.map +1 -1
- package/dist/virtualdisplay.client.es.js +138 -14
- package/dist/virtualdisplay.client.es.js.map +1 -1
- package/dist/virtualdisplay.client.umd.js +3 -3
- package/dist/virtualdisplay.client.umd.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [3.4.1](https://github.com/virtualdisplay-io/client/compare/v3.4.0...v3.4.1) (2025-07-10)
|
|
6
|
+
|
|
7
|
+
### 🐛 Bug Fixes
|
|
8
|
+
|
|
9
|
+
* EventBus once handlers and logging improvements ([#3](https://github.com/virtualdisplay-io/client/issues/3)) ([5a99d8d](https://github.com/virtualdisplay-io/client/commit/5a99d8d6ef82d058799734b54c98ca171d17dd36))
|
|
10
|
+
|
|
11
|
+
## [3.4.0](https://github.com/virtualdisplay-io/client/compare/v3.3.0...v3.4.0) (2025-07-09)
|
|
12
|
+
|
|
13
|
+
### ✨ Features
|
|
14
|
+
|
|
15
|
+
* implement UI configuration via PostMessage CONFIG messages ([#2](https://github.com/virtualdisplay-io/client/issues/2)) ([abc2294](https://github.com/virtualdisplay-io/client/commit/abc229414f9f70c54f37db903c46c0612c5eb6cf))
|
|
16
|
+
|
|
5
17
|
## [3.3.0](https://github.com/virtualdisplay-io/client/compare/v3.2.2...v3.3.0) (2025-07-07)
|
|
6
18
|
|
|
7
19
|
### ✨ Features
|
package/dist/index.d.ts
CHANGED
|
@@ -121,13 +121,6 @@ export declare interface AttributeValueConfig {
|
|
|
121
121
|
readonly isSelected?: boolean;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
/**
|
|
125
|
-
* Base message interface
|
|
126
|
-
*/
|
|
127
|
-
declare interface BaseMessage {
|
|
128
|
-
readonly type: MessageType;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
124
|
/**
|
|
132
125
|
* Configuration options for VirtualdisplayClient
|
|
133
126
|
*/
|
|
@@ -137,6 +130,17 @@ export declare interface ClientOptions {
|
|
|
137
130
|
readonly license: string;
|
|
138
131
|
readonly debug?: boolean;
|
|
139
132
|
readonly language?: string;
|
|
133
|
+
readonly arEnabled?: boolean;
|
|
134
|
+
readonly fullscreenEnabled?: boolean;
|
|
135
|
+
readonly loadingIndicatorEnabled?: boolean;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Configuration message sent to server
|
|
140
|
+
*/
|
|
141
|
+
export declare interface ConfigMessage {
|
|
142
|
+
readonly type: typeof MESSAGE_TYPES.CONFIG;
|
|
143
|
+
readonly config: ViewerConfig;
|
|
140
144
|
}
|
|
141
145
|
|
|
142
146
|
declare interface CreateNodeParams {
|
|
@@ -151,9 +155,11 @@ declare interface CreateNodeParams {
|
|
|
151
155
|
*/
|
|
152
156
|
export declare interface DomainEvents extends Record<string, unknown> {
|
|
153
157
|
[EVENT_NAMES.IFRAME_READY]: VoidEvent;
|
|
154
|
-
[EVENT_NAMES.MUTATION_MESSAGE]:
|
|
155
|
-
[EVENT_NAMES.
|
|
158
|
+
[EVENT_NAMES.MUTATION_MESSAGE]: MessageEvent_2<MutationMessage>;
|
|
159
|
+
[EVENT_NAMES.CONFIG_MESSAGE]: MessageEvent_2<ConfigMessage>;
|
|
160
|
+
[EVENT_NAMES.MESSAGE_RECEIVED]: MessageEvent_2;
|
|
156
161
|
[EVENT_NAMES.STATE_CHANGED]: StateChangedEvent;
|
|
162
|
+
[EVENT_NAMES.INITIAL_STATE_RECEIVED]: VoidEvent;
|
|
157
163
|
}
|
|
158
164
|
|
|
159
165
|
export declare function enableDebugMode(): void;
|
|
@@ -178,6 +184,7 @@ export declare type ErrorCode = typeof ERROR_CODES[keyof typeof ERROR_CODES];
|
|
|
178
184
|
export declare const EVENT_NAMES: {
|
|
179
185
|
readonly IFRAME_READY: "iframe:ready";
|
|
180
186
|
readonly MUTATION_MESSAGE: "mutation:message";
|
|
187
|
+
readonly CONFIG_MESSAGE: "config:message";
|
|
181
188
|
readonly MESSAGE_RECEIVED: "message:received";
|
|
182
189
|
readonly STATE_CHANGED: "state:changed";
|
|
183
190
|
readonly INITIAL_STATE_RECEIVED: "state:initial-received";
|
|
@@ -191,7 +198,14 @@ declare class EventBus {
|
|
|
191
198
|
private readonly listeners;
|
|
192
199
|
on<K extends keyof DomainEvents>(event: K, listener: EventListener_2<DomainEvents[K]>): void;
|
|
193
200
|
emit<K extends keyof DomainEvents>(event: K, payload: DomainEvents[K]): void;
|
|
201
|
+
/**
|
|
202
|
+
* Register a listener that will be called only once
|
|
203
|
+
* The listener is automatically removed after the first call
|
|
204
|
+
*/
|
|
194
205
|
once<K extends keyof DomainEvents>(event: K, listener: EventListener_2<DomainEvents[K]>): void;
|
|
206
|
+
/**
|
|
207
|
+
* Remove a specific listener for an event
|
|
208
|
+
*/
|
|
195
209
|
off<K extends keyof DomainEvents>(event: K, listener: EventListener_2<DomainEvents[K]>): void;
|
|
196
210
|
}
|
|
197
211
|
|
|
@@ -292,7 +306,7 @@ export declare class MappingValidator {
|
|
|
292
306
|
/**
|
|
293
307
|
* Union of all possible messages
|
|
294
308
|
*/
|
|
295
|
-
export declare type Message = MutationMessage | StateMessage;
|
|
309
|
+
export declare type Message = MutationMessage | StateMessage | ConfigMessage;
|
|
296
310
|
|
|
297
311
|
/**
|
|
298
312
|
* Types of messages exchanged between client and server
|
|
@@ -301,17 +315,16 @@ export declare type Message = MutationMessage | StateMessage;
|
|
|
301
315
|
export declare const MESSAGE_TYPES: {
|
|
302
316
|
readonly MUTATION: "mutation";
|
|
303
317
|
readonly STATE: "state";
|
|
318
|
+
readonly CONFIG: "config";
|
|
304
319
|
};
|
|
305
320
|
|
|
306
321
|
/**
|
|
307
|
-
*
|
|
322
|
+
* Generic message event - used for all message passing
|
|
308
323
|
*/
|
|
309
|
-
declare interface
|
|
310
|
-
message:
|
|
324
|
+
declare interface MessageEvent_2<T extends Message = Message> {
|
|
325
|
+
message: T;
|
|
311
326
|
}
|
|
312
327
|
|
|
313
|
-
declare type MessageType = typeof MESSAGE_TYPES[keyof typeof MESSAGE_TYPES];
|
|
314
|
-
|
|
315
328
|
/**
|
|
316
329
|
* Represents a 3D node in the scene
|
|
317
330
|
* Live object that can be updated to reflect state changes
|
|
@@ -373,18 +386,11 @@ export declare interface MutationDto {
|
|
|
373
386
|
/**
|
|
374
387
|
* Mutation message sent to server
|
|
375
388
|
*/
|
|
376
|
-
export declare interface MutationMessage
|
|
389
|
+
export declare interface MutationMessage {
|
|
377
390
|
readonly type: typeof MESSAGE_TYPES.MUTATION;
|
|
378
391
|
readonly mutations: MutationDto[];
|
|
379
392
|
}
|
|
380
393
|
|
|
381
|
-
/**
|
|
382
|
-
* Mutation Flow Events (Client → Server)
|
|
383
|
-
*/
|
|
384
|
-
declare interface MutationMessageEvent {
|
|
385
|
-
message: MutationMessage;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
394
|
export declare type MutationType = typeof MUTATION_TYPES[keyof typeof MUTATION_TYPES];
|
|
389
395
|
|
|
390
396
|
/**
|
|
@@ -425,7 +431,7 @@ declare interface StateChangedEvent {
|
|
|
425
431
|
* State message received from server
|
|
426
432
|
* Contains array of model node DTOs
|
|
427
433
|
*/
|
|
428
|
-
export declare interface StateMessage
|
|
434
|
+
export declare interface StateMessage {
|
|
429
435
|
readonly type: typeof MESSAGE_TYPES.STATE;
|
|
430
436
|
readonly nodes: ModelNodeDto[];
|
|
431
437
|
readonly isInitial: boolean;
|
|
@@ -451,6 +457,22 @@ declare class StateService {
|
|
|
451
457
|
clear(): void;
|
|
452
458
|
}
|
|
453
459
|
|
|
460
|
+
/**
|
|
461
|
+
* UI configuration options
|
|
462
|
+
*/
|
|
463
|
+
export declare interface UIConfig {
|
|
464
|
+
readonly arEnabled?: boolean;
|
|
465
|
+
readonly fullscreenEnabled?: boolean;
|
|
466
|
+
readonly loadingIndicatorEnabled?: boolean;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Viewer configuration
|
|
471
|
+
*/
|
|
472
|
+
export declare interface ViewerConfig {
|
|
473
|
+
readonly ui?: UIConfig;
|
|
474
|
+
}
|
|
475
|
+
|
|
454
476
|
/**
|
|
455
477
|
* Main Virtualdisplay Client
|
|
456
478
|
* Provides the public API for 3D product visualization
|
|
@@ -460,11 +482,13 @@ export declare class VirtualdisplayClient {
|
|
|
460
482
|
private readonly attributeService;
|
|
461
483
|
private readonly stateService;
|
|
462
484
|
private readonly messageHandler;
|
|
485
|
+
private readonly viewerService;
|
|
463
486
|
private readonly options;
|
|
464
487
|
private iframe;
|
|
465
488
|
constructor(options: ClientOptions);
|
|
466
489
|
private initializeLogging;
|
|
467
490
|
private createAndConnectIframe;
|
|
491
|
+
private setupInitialConfig;
|
|
468
492
|
/**
|
|
469
493
|
* Load attribute mapping configuration
|
|
470
494
|
* @throws {VirtualdisplayError} When mapping configuration is invalid
|
|
@@ -492,6 +516,10 @@ export declare class VirtualdisplayClient {
|
|
|
492
516
|
* If already ready, the callback is called immediately
|
|
493
517
|
*/
|
|
494
518
|
onReady(callback: () => void): void;
|
|
519
|
+
/**
|
|
520
|
+
* Get the viewer service for UI configuration
|
|
521
|
+
*/
|
|
522
|
+
get viewer(): VirtualdisplayViewerService;
|
|
495
523
|
destroy(): void;
|
|
496
524
|
}
|
|
497
525
|
|
|
@@ -509,6 +537,48 @@ export declare class VirtualdisplayError extends Error {
|
|
|
509
537
|
static invalidMutations(reason?: string): VirtualdisplayError;
|
|
510
538
|
}
|
|
511
539
|
|
|
540
|
+
/**
|
|
541
|
+
* Service responsible for managing viewer UI configuration
|
|
542
|
+
* Sends CONFIG messages to control AR button, fullscreen button, and loading indicator
|
|
543
|
+
*/
|
|
544
|
+
export declare class VirtualdisplayViewerService {
|
|
545
|
+
private readonly eventBus;
|
|
546
|
+
constructor(eventBus: EventBus);
|
|
547
|
+
/**
|
|
548
|
+
* Send initial configuration based on client options
|
|
549
|
+
* Only sends config when values are false (server defaults to true)
|
|
550
|
+
*/
|
|
551
|
+
sendInitialConfig(options: ClientOptions): void;
|
|
552
|
+
/**
|
|
553
|
+
* Update AR button visibility
|
|
554
|
+
*/
|
|
555
|
+
setArEnabled(enabled: boolean): void;
|
|
556
|
+
/**
|
|
557
|
+
* Update fullscreen button visibility
|
|
558
|
+
*/
|
|
559
|
+
setFullscreenEnabled(enabled: boolean): void;
|
|
560
|
+
/**
|
|
561
|
+
* Update loading indicator visibility
|
|
562
|
+
*/
|
|
563
|
+
setLoadingIndicatorEnabled(enabled: boolean): void;
|
|
564
|
+
/**
|
|
565
|
+
* Update multiple UI settings at once
|
|
566
|
+
*/
|
|
567
|
+
updateUIConfig(config: Partial<UIConfig>): void;
|
|
568
|
+
/**
|
|
569
|
+
* Hide all UI elements
|
|
570
|
+
*/
|
|
571
|
+
hideAllUI(): void;
|
|
572
|
+
/**
|
|
573
|
+
* Show all UI elements
|
|
574
|
+
*/
|
|
575
|
+
showAllUI(): void;
|
|
576
|
+
/**
|
|
577
|
+
* Send UI configuration to server
|
|
578
|
+
*/
|
|
579
|
+
private sendUIConfig;
|
|
580
|
+
}
|
|
581
|
+
|
|
512
582
|
declare interface VoidEvent {
|
|
513
583
|
}
|
|
514
584
|
|