@virtualdisplay.io/client 3.2.2 → 3.4.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/CHANGELOG.md +12 -0
- package/dist/index.d.ts +100 -25
- package/dist/virtualdisplay.client.cjs.js +3 -3
- package/dist/virtualdisplay.client.cjs.js.map +1 -1
- package/dist/virtualdisplay.client.es.js +162 -17
- 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 +8 -8
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.0](https://github.com/virtualdisplay-io/client/compare/v3.3.0...v3.4.0) (2025-07-09)
|
|
6
|
+
|
|
7
|
+
### ✨ Features
|
|
8
|
+
|
|
9
|
+
* 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))
|
|
10
|
+
|
|
11
|
+
## [3.3.0](https://github.com/virtualdisplay-io/client/compare/v3.2.2...v3.3.0) (2025-07-07)
|
|
12
|
+
|
|
13
|
+
### ✨ Features
|
|
14
|
+
|
|
15
|
+
* add isInitial flag to StateMessage ([#50](https://github.com/virtualdisplay-io/client/issues/50)) ([8590354](https://github.com/virtualdisplay-io/client/commit/859035423e161f43791433baac203b2adb95c9fd))
|
|
16
|
+
|
|
5
17
|
## [3.2.2](https://github.com/virtualdisplay-io/client/compare/v3.2.1...v3.2.2) (2025-07-01)
|
|
6
18
|
|
|
7
19
|
### 🐛 Bug Fixes
|
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,8 +184,10 @@ 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";
|
|
190
|
+
readonly INITIAL_STATE_RECEIVED: "state:initial-received";
|
|
183
191
|
};
|
|
184
192
|
|
|
185
193
|
/**
|
|
@@ -291,7 +299,7 @@ export declare class MappingValidator {
|
|
|
291
299
|
/**
|
|
292
300
|
* Union of all possible messages
|
|
293
301
|
*/
|
|
294
|
-
export declare type Message = MutationMessage | StateMessage;
|
|
302
|
+
export declare type Message = MutationMessage | StateMessage | ConfigMessage;
|
|
295
303
|
|
|
296
304
|
/**
|
|
297
305
|
* Types of messages exchanged between client and server
|
|
@@ -300,17 +308,16 @@ export declare type Message = MutationMessage | StateMessage;
|
|
|
300
308
|
export declare const MESSAGE_TYPES: {
|
|
301
309
|
readonly MUTATION: "mutation";
|
|
302
310
|
readonly STATE: "state";
|
|
311
|
+
readonly CONFIG: "config";
|
|
303
312
|
};
|
|
304
313
|
|
|
305
314
|
/**
|
|
306
|
-
*
|
|
315
|
+
* Generic message event - used for all message passing
|
|
307
316
|
*/
|
|
308
|
-
declare interface
|
|
309
|
-
message:
|
|
317
|
+
declare interface MessageEvent_2<T extends Message = Message> {
|
|
318
|
+
message: T;
|
|
310
319
|
}
|
|
311
320
|
|
|
312
|
-
declare type MessageType = typeof MESSAGE_TYPES[keyof typeof MESSAGE_TYPES];
|
|
313
|
-
|
|
314
321
|
/**
|
|
315
322
|
* Represents a 3D node in the scene
|
|
316
323
|
* Live object that can be updated to reflect state changes
|
|
@@ -320,6 +327,7 @@ export declare class ModelNode {
|
|
|
320
327
|
readonly name: string;
|
|
321
328
|
readonly type: NodeType;
|
|
322
329
|
private visible;
|
|
330
|
+
onChange?: () => void;
|
|
323
331
|
constructor(params: CreateNodeParams);
|
|
324
332
|
get isVisible(): boolean;
|
|
325
333
|
show(): void;
|
|
@@ -371,18 +379,11 @@ export declare interface MutationDto {
|
|
|
371
379
|
/**
|
|
372
380
|
* Mutation message sent to server
|
|
373
381
|
*/
|
|
374
|
-
export declare interface MutationMessage
|
|
382
|
+
export declare interface MutationMessage {
|
|
375
383
|
readonly type: typeof MESSAGE_TYPES.MUTATION;
|
|
376
384
|
readonly mutations: MutationDto[];
|
|
377
385
|
}
|
|
378
386
|
|
|
379
|
-
/**
|
|
380
|
-
* Mutation Flow Events (Client → Server)
|
|
381
|
-
*/
|
|
382
|
-
declare interface MutationMessageEvent {
|
|
383
|
-
message: MutationMessage;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
387
|
export declare type MutationType = typeof MUTATION_TYPES[keyof typeof MUTATION_TYPES];
|
|
387
388
|
|
|
388
389
|
/**
|
|
@@ -423,9 +424,10 @@ declare interface StateChangedEvent {
|
|
|
423
424
|
* State message received from server
|
|
424
425
|
* Contains array of model node DTOs
|
|
425
426
|
*/
|
|
426
|
-
export declare interface StateMessage
|
|
427
|
+
export declare interface StateMessage {
|
|
427
428
|
readonly type: typeof MESSAGE_TYPES.STATE;
|
|
428
429
|
readonly nodes: ModelNodeDto[];
|
|
430
|
+
readonly isInitial: boolean;
|
|
429
431
|
}
|
|
430
432
|
|
|
431
433
|
/**
|
|
@@ -435,6 +437,7 @@ export declare interface StateMessage extends BaseMessage {
|
|
|
435
437
|
declare class StateService {
|
|
436
438
|
private readonly nodes;
|
|
437
439
|
private readonly eventBus;
|
|
440
|
+
private hasReceivedInitialSync;
|
|
438
441
|
constructor(eventBus: EventBus);
|
|
439
442
|
private handleMessage;
|
|
440
443
|
private updateState;
|
|
@@ -444,10 +447,25 @@ declare class StateService {
|
|
|
444
447
|
getAllNodes(): ModelNode[];
|
|
445
448
|
get isReady(): boolean;
|
|
446
449
|
get nodeCount(): number;
|
|
447
|
-
private get hasInitialState();
|
|
448
450
|
clear(): void;
|
|
449
451
|
}
|
|
450
452
|
|
|
453
|
+
/**
|
|
454
|
+
* UI configuration options
|
|
455
|
+
*/
|
|
456
|
+
export declare interface UIConfig {
|
|
457
|
+
readonly arEnabled?: boolean;
|
|
458
|
+
readonly fullscreenEnabled?: boolean;
|
|
459
|
+
readonly loadingIndicatorEnabled?: boolean;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Viewer configuration
|
|
464
|
+
*/
|
|
465
|
+
export declare interface ViewerConfig {
|
|
466
|
+
readonly ui?: UIConfig;
|
|
467
|
+
}
|
|
468
|
+
|
|
451
469
|
/**
|
|
452
470
|
* Main Virtualdisplay Client
|
|
453
471
|
* Provides the public API for 3D product visualization
|
|
@@ -457,11 +475,13 @@ export declare class VirtualdisplayClient {
|
|
|
457
475
|
private readonly attributeService;
|
|
458
476
|
private readonly stateService;
|
|
459
477
|
private readonly messageHandler;
|
|
478
|
+
private readonly viewerService;
|
|
460
479
|
private readonly options;
|
|
461
480
|
private iframe;
|
|
462
481
|
constructor(options: ClientOptions);
|
|
463
482
|
private initializeLogging;
|
|
464
483
|
private createAndConnectIframe;
|
|
484
|
+
private setupInitialConfig;
|
|
465
485
|
/**
|
|
466
486
|
* Load attribute mapping configuration
|
|
467
487
|
* @throws {VirtualdisplayError} When mapping configuration is invalid
|
|
@@ -480,6 +500,19 @@ export declare class VirtualdisplayClient {
|
|
|
480
500
|
getNodeSelector(nodeId: string): NodeSelector | undefined;
|
|
481
501
|
getNode(id: string): ModelNode | undefined;
|
|
482
502
|
getNodes(): ModelNode[];
|
|
503
|
+
/**
|
|
504
|
+
* Check if the client has received initial state and is ready
|
|
505
|
+
*/
|
|
506
|
+
get isReady(): boolean;
|
|
507
|
+
/**
|
|
508
|
+
* Register a callback to be called when the client is ready
|
|
509
|
+
* If already ready, the callback is called immediately
|
|
510
|
+
*/
|
|
511
|
+
onReady(callback: () => void): void;
|
|
512
|
+
/**
|
|
513
|
+
* Get the viewer service for UI configuration
|
|
514
|
+
*/
|
|
515
|
+
get viewer(): VirtualdisplayViewerService;
|
|
483
516
|
destroy(): void;
|
|
484
517
|
}
|
|
485
518
|
|
|
@@ -497,6 +530,48 @@ export declare class VirtualdisplayError extends Error {
|
|
|
497
530
|
static invalidMutations(reason?: string): VirtualdisplayError;
|
|
498
531
|
}
|
|
499
532
|
|
|
533
|
+
/**
|
|
534
|
+
* Service responsible for managing viewer UI configuration
|
|
535
|
+
* Sends CONFIG messages to control AR button, fullscreen button, and loading indicator
|
|
536
|
+
*/
|
|
537
|
+
export declare class VirtualdisplayViewerService {
|
|
538
|
+
private readonly eventBus;
|
|
539
|
+
constructor(eventBus: EventBus);
|
|
540
|
+
/**
|
|
541
|
+
* Send initial configuration based on client options
|
|
542
|
+
* Only sends config when values are false (server defaults to true)
|
|
543
|
+
*/
|
|
544
|
+
sendInitialConfig(options: ClientOptions): void;
|
|
545
|
+
/**
|
|
546
|
+
* Update AR button visibility
|
|
547
|
+
*/
|
|
548
|
+
setArEnabled(enabled: boolean): void;
|
|
549
|
+
/**
|
|
550
|
+
* Update fullscreen button visibility
|
|
551
|
+
*/
|
|
552
|
+
setFullscreenEnabled(enabled: boolean): void;
|
|
553
|
+
/**
|
|
554
|
+
* Update loading indicator visibility
|
|
555
|
+
*/
|
|
556
|
+
setLoadingIndicatorEnabled(enabled: boolean): void;
|
|
557
|
+
/**
|
|
558
|
+
* Update multiple UI settings at once
|
|
559
|
+
*/
|
|
560
|
+
updateUIConfig(config: Partial<UIConfig>): void;
|
|
561
|
+
/**
|
|
562
|
+
* Hide all UI elements
|
|
563
|
+
*/
|
|
564
|
+
hideAllUI(): void;
|
|
565
|
+
/**
|
|
566
|
+
* Show all UI elements
|
|
567
|
+
*/
|
|
568
|
+
showAllUI(): void;
|
|
569
|
+
/**
|
|
570
|
+
* Send UI configuration to server
|
|
571
|
+
*/
|
|
572
|
+
private sendUIConfig;
|
|
573
|
+
}
|
|
574
|
+
|
|
500
575
|
declare interface VoidEvent {
|
|
501
576
|
}
|
|
502
577
|
|