@virtualdisplay.io/client 3.5.0 → 3.6.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 +120 -2
- package/dist/virtualdisplay.client.cjs.js +3 -3
- package/dist/virtualdisplay.client.cjs.js.map +1 -1
- package/dist/virtualdisplay.client.es.js +235 -31
- 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 +10 -10
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.6.0](https://github.com/virtualdisplay-io/client/compare/v3.5.1...v3.6.0) (2025-07-23)
|
|
6
|
+
|
|
7
|
+
### ✨ Features
|
|
8
|
+
|
|
9
|
+
* add camera configuration support ([#6](https://github.com/virtualdisplay-io/client/issues/6)) ([a6bce4b](https://github.com/virtualdisplay-io/client/commit/a6bce4bfd0d55362e76c893ddf5ed28409dc8bec))
|
|
10
|
+
|
|
11
|
+
## [3.5.1](https://github.com/virtualdisplay-io/client/compare/v3.5.0...v3.5.1) (2025-07-18)
|
|
12
|
+
|
|
13
|
+
### ♻️ Code Refactoring
|
|
14
|
+
|
|
15
|
+
* remove validation of outgoing message types ([#5](https://github.com/virtualdisplay-io/client/issues/5)) ([5f4f985](https://github.com/virtualdisplay-io/client/commit/5f4f9853d65af676aec3a865864f43461fdb6ca5))
|
|
16
|
+
|
|
5
17
|
## [3.5.0](https://github.com/virtualdisplay-io/client/compare/v3.4.1...v3.5.0) (2025-07-16)
|
|
6
18
|
|
|
7
19
|
### ✨ Features
|
package/dist/index.d.ts
CHANGED
|
@@ -163,6 +163,19 @@ export declare interface CameraCommand {
|
|
|
163
163
|
readonly value?: number;
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
+
/**
|
|
167
|
+
* Camera configuration options
|
|
168
|
+
*/
|
|
169
|
+
export declare interface CameraConfig {
|
|
170
|
+
readonly initialRotate?: number;
|
|
171
|
+
readonly initialTilt?: number;
|
|
172
|
+
readonly initialZoom?: number;
|
|
173
|
+
readonly minZoom?: number;
|
|
174
|
+
readonly maxZoom?: number;
|
|
175
|
+
readonly minTilt?: number;
|
|
176
|
+
readonly maxTilt?: number;
|
|
177
|
+
}
|
|
178
|
+
|
|
166
179
|
/**
|
|
167
180
|
* Camera message sent to server
|
|
168
181
|
*/
|
|
@@ -183,6 +196,8 @@ export declare interface ClientOptions {
|
|
|
183
196
|
readonly arEnabled?: boolean;
|
|
184
197
|
readonly fullscreenEnabled?: boolean;
|
|
185
198
|
readonly loadingIndicatorEnabled?: boolean;
|
|
199
|
+
readonly ui?: UIConfig;
|
|
200
|
+
readonly camera?: CameraConfig;
|
|
186
201
|
}
|
|
187
202
|
|
|
188
203
|
/**
|
|
@@ -225,6 +240,7 @@ export declare const ERROR_CODES: {
|
|
|
225
240
|
readonly INVALID_MAPPING: "INVALID_MAPPING";
|
|
226
241
|
readonly PARENT_NOT_FOUND: "PARENT_NOT_FOUND";
|
|
227
242
|
readonly INVALID_MUTATIONS: "INVALID_MUTATIONS";
|
|
243
|
+
readonly INVALID_PARAMETER: "INVALID_PARAMETER";
|
|
228
244
|
};
|
|
229
245
|
|
|
230
246
|
export declare type ErrorCode = typeof ERROR_CODES[keyof typeof ERROR_CODES];
|
|
@@ -240,6 +256,8 @@ export declare const EVENT_NAMES: {
|
|
|
240
256
|
readonly MESSAGE_RECEIVED: "message:received";
|
|
241
257
|
readonly STATE_CHANGED: "state:changed";
|
|
242
258
|
readonly INITIAL_STATE_RECEIVED: "state:initial-received";
|
|
259
|
+
readonly SNAPSHOT_MESSAGE: "snapshot:take";
|
|
260
|
+
readonly SNAPSHOT_DEVELOPED: "snapshot:developed";
|
|
243
261
|
};
|
|
244
262
|
|
|
245
263
|
/**
|
|
@@ -358,7 +376,7 @@ export declare class MappingValidator {
|
|
|
358
376
|
/**
|
|
359
377
|
* Union of all possible messages
|
|
360
378
|
*/
|
|
361
|
-
export declare type Message = MutationMessage | StateMessage | ConfigMessage | CameraMessage;
|
|
379
|
+
export declare type Message = MutationMessage | StateMessage | ConfigMessage | CameraMessage | SnapshotRequestMessage | SnapshotDevelopedMessage;
|
|
362
380
|
|
|
363
381
|
/**
|
|
364
382
|
* Types of messages exchanged between client and server
|
|
@@ -369,6 +387,7 @@ export declare const MESSAGE_TYPES: {
|
|
|
369
387
|
readonly STATE: "state";
|
|
370
388
|
readonly CONFIG: "config";
|
|
371
389
|
readonly CAMERA: "camera";
|
|
390
|
+
readonly SNAPSHOT: "snapshot";
|
|
372
391
|
};
|
|
373
392
|
|
|
374
393
|
/**
|
|
@@ -476,6 +495,80 @@ export declare class NodeSelector {
|
|
|
476
495
|
|
|
477
496
|
declare type NodeType = typeof NODE_TYPES[keyof typeof NODE_TYPES];
|
|
478
497
|
|
|
498
|
+
/**
|
|
499
|
+
* Represents a photo being captured
|
|
500
|
+
* Pure domain object that manages callbacks for when the photo is developed
|
|
501
|
+
*/
|
|
502
|
+
export declare class Photo {
|
|
503
|
+
private readonly filename;
|
|
504
|
+
private readonly callbacks;
|
|
505
|
+
private developed;
|
|
506
|
+
private photoData;
|
|
507
|
+
constructor(filename: string);
|
|
508
|
+
/**
|
|
509
|
+
* Register a callback for when the photo is developed
|
|
510
|
+
* If the photo is already developed, the callback is called immediately
|
|
511
|
+
*
|
|
512
|
+
* @param callback Function to call with photo data
|
|
513
|
+
* @returns This Photo instance for chaining
|
|
514
|
+
*/
|
|
515
|
+
onDeveloped(callback: (photo: PhotoData) => void): this;
|
|
516
|
+
/**
|
|
517
|
+
* Get the filename for this photo
|
|
518
|
+
*/
|
|
519
|
+
getFilename(): string;
|
|
520
|
+
/**
|
|
521
|
+
* Mark the photo as developed and notify all callbacks
|
|
522
|
+
* This method is called by the SnapshotMessageHandler when the photo data arrives
|
|
523
|
+
*/
|
|
524
|
+
develop(photoData: PhotoData): void;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
export declare interface PhotoData {
|
|
528
|
+
readonly filename: string;
|
|
529
|
+
readonly data: string;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* API for taking screenshots of the 3D model
|
|
534
|
+
* Following the camera analogy: take() triggers capture, onDeveloped() gets result
|
|
535
|
+
*/
|
|
536
|
+
export declare class Snapshot {
|
|
537
|
+
private readonly eventBus;
|
|
538
|
+
private readonly validExtensions;
|
|
539
|
+
private readonly messageHandler;
|
|
540
|
+
constructor(eventBus: EventBus);
|
|
541
|
+
/**
|
|
542
|
+
* Take a snapshot of the current 3D model view
|
|
543
|
+
*
|
|
544
|
+
* @param filename The filename for the snapshot (must include valid extension)
|
|
545
|
+
* @returns Photo object for registering callbacks
|
|
546
|
+
* @throws VirtualdisplayError if filename is invalid
|
|
547
|
+
*/
|
|
548
|
+
take(filename: string): Photo;
|
|
549
|
+
/**
|
|
550
|
+
* Validate filename has a valid image extension
|
|
551
|
+
*/
|
|
552
|
+
private validateFilename;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* Snapshot developed message received from server
|
|
557
|
+
*/
|
|
558
|
+
export declare interface SnapshotDevelopedMessage {
|
|
559
|
+
readonly type: typeof MESSAGE_TYPES.SNAPSHOT;
|
|
560
|
+
readonly filename: string;
|
|
561
|
+
readonly data: string;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Snapshot request message sent to server
|
|
566
|
+
*/
|
|
567
|
+
export declare interface SnapshotRequestMessage {
|
|
568
|
+
readonly type: typeof MESSAGE_TYPES.SNAPSHOT;
|
|
569
|
+
readonly filename: string;
|
|
570
|
+
}
|
|
571
|
+
|
|
479
572
|
declare interface StateChangedEvent {
|
|
480
573
|
nodes: ModelNode[];
|
|
481
574
|
}
|
|
@@ -524,6 +617,7 @@ export declare interface UIConfig {
|
|
|
524
617
|
*/
|
|
525
618
|
export declare interface ViewerConfig {
|
|
526
619
|
readonly ui?: UIConfig;
|
|
620
|
+
readonly camera?: CameraConfig;
|
|
527
621
|
}
|
|
528
622
|
|
|
529
623
|
/**
|
|
@@ -537,6 +631,7 @@ export declare class VirtualdisplayClient {
|
|
|
537
631
|
private readonly messageHandler;
|
|
538
632
|
private readonly viewerService;
|
|
539
633
|
private readonly cameraApi;
|
|
634
|
+
private readonly snapshotApi;
|
|
540
635
|
private readonly options;
|
|
541
636
|
private iframe;
|
|
542
637
|
constructor(options: ClientOptions);
|
|
@@ -578,6 +673,10 @@ export declare class VirtualdisplayClient {
|
|
|
578
673
|
* Get the camera control API
|
|
579
674
|
*/
|
|
580
675
|
get camera(): Camera;
|
|
676
|
+
/**
|
|
677
|
+
* Get the snapshot API for taking screenshots
|
|
678
|
+
*/
|
|
679
|
+
get snapshot(): Snapshot;
|
|
581
680
|
destroy(): void;
|
|
582
681
|
}
|
|
583
682
|
|
|
@@ -604,9 +703,24 @@ export declare class VirtualdisplayViewerService {
|
|
|
604
703
|
constructor(eventBus: EventBus);
|
|
605
704
|
/**
|
|
606
705
|
* Send initial configuration based on client options
|
|
607
|
-
*
|
|
706
|
+
* Supports both individual properties and ui object
|
|
608
707
|
*/
|
|
609
708
|
sendInitialConfig(options: ClientOptions): void;
|
|
709
|
+
/**
|
|
710
|
+
* Build UI configuration from client options
|
|
711
|
+
*
|
|
712
|
+
* Supports both legacy properties (options.arEnabled) and the newer ui object
|
|
713
|
+
* for backward compatibility. Legacy properties take precedence when both exist.
|
|
714
|
+
*/
|
|
715
|
+
private buildUIConfig;
|
|
716
|
+
/**
|
|
717
|
+
* Extract UI values from options, with legacy properties taking precedence
|
|
718
|
+
*/
|
|
719
|
+
private extractUIValues;
|
|
720
|
+
/**
|
|
721
|
+
* Build viewer configuration from UI config and camera config
|
|
722
|
+
*/
|
|
723
|
+
private buildViewerConfig;
|
|
610
724
|
/**
|
|
611
725
|
* Update AR button visibility
|
|
612
726
|
*/
|
|
@@ -635,6 +749,10 @@ export declare class VirtualdisplayViewerService {
|
|
|
635
749
|
* Send UI configuration to server
|
|
636
750
|
*/
|
|
637
751
|
private sendUIConfig;
|
|
752
|
+
/**
|
|
753
|
+
* Send full viewer configuration to server
|
|
754
|
+
*/
|
|
755
|
+
private sendConfig;
|
|
638
756
|
}
|
|
639
757
|
|
|
640
758
|
declare interface VoidEvent {
|