@virtualdisplay.io/client 3.5.0 → 3.5.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 CHANGED
@@ -2,6 +2,12 @@
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.5.1](https://github.com/virtualdisplay-io/client/compare/v3.5.0...v3.5.1) (2025-07-18)
6
+
7
+ ### ♻️ Code Refactoring
8
+
9
+ * remove validation of outgoing message types ([#5](https://github.com/virtualdisplay-io/client/issues/5)) ([5f4f985](https://github.com/virtualdisplay-io/client/commit/5f4f9853d65af676aec3a865864f43461fdb6ca5))
10
+
5
11
  ## [3.5.0](https://github.com/virtualdisplay-io/client/compare/v3.4.1...v3.5.0) (2025-07-16)
6
12
 
7
13
  ### ✨ Features
package/dist/index.d.ts CHANGED
@@ -225,6 +225,7 @@ export declare const ERROR_CODES: {
225
225
  readonly INVALID_MAPPING: "INVALID_MAPPING";
226
226
  readonly PARENT_NOT_FOUND: "PARENT_NOT_FOUND";
227
227
  readonly INVALID_MUTATIONS: "INVALID_MUTATIONS";
228
+ readonly INVALID_PARAMETER: "INVALID_PARAMETER";
228
229
  };
229
230
 
230
231
  export declare type ErrorCode = typeof ERROR_CODES[keyof typeof ERROR_CODES];
@@ -240,6 +241,8 @@ export declare const EVENT_NAMES: {
240
241
  readonly MESSAGE_RECEIVED: "message:received";
241
242
  readonly STATE_CHANGED: "state:changed";
242
243
  readonly INITIAL_STATE_RECEIVED: "state:initial-received";
244
+ readonly SNAPSHOT_MESSAGE: "snapshot:take";
245
+ readonly SNAPSHOT_DEVELOPED: "snapshot:developed";
243
246
  };
244
247
 
245
248
  /**
@@ -358,7 +361,7 @@ export declare class MappingValidator {
358
361
  /**
359
362
  * Union of all possible messages
360
363
  */
361
- export declare type Message = MutationMessage | StateMessage | ConfigMessage | CameraMessage;
364
+ export declare type Message = MutationMessage | StateMessage | ConfigMessage | CameraMessage | SnapshotRequestMessage | SnapshotDevelopedMessage;
362
365
 
363
366
  /**
364
367
  * Types of messages exchanged between client and server
@@ -369,6 +372,7 @@ export declare const MESSAGE_TYPES: {
369
372
  readonly STATE: "state";
370
373
  readonly CONFIG: "config";
371
374
  readonly CAMERA: "camera";
375
+ readonly SNAPSHOT: "snapshot";
372
376
  };
373
377
 
374
378
  /**
@@ -476,6 +480,80 @@ export declare class NodeSelector {
476
480
 
477
481
  declare type NodeType = typeof NODE_TYPES[keyof typeof NODE_TYPES];
478
482
 
483
+ /**
484
+ * Represents a photo being captured
485
+ * Pure domain object that manages callbacks for when the photo is developed
486
+ */
487
+ export declare class Photo {
488
+ private readonly filename;
489
+ private readonly callbacks;
490
+ private developed;
491
+ private photoData;
492
+ constructor(filename: string);
493
+ /**
494
+ * Register a callback for when the photo is developed
495
+ * If the photo is already developed, the callback is called immediately
496
+ *
497
+ * @param callback Function to call with photo data
498
+ * @returns This Photo instance for chaining
499
+ */
500
+ onDeveloped(callback: (photo: PhotoData) => void): this;
501
+ /**
502
+ * Get the filename for this photo
503
+ */
504
+ getFilename(): string;
505
+ /**
506
+ * Mark the photo as developed and notify all callbacks
507
+ * This method is called by the SnapshotMessageHandler when the photo data arrives
508
+ */
509
+ develop(photoData: PhotoData): void;
510
+ }
511
+
512
+ export declare interface PhotoData {
513
+ readonly filename: string;
514
+ readonly data: string;
515
+ }
516
+
517
+ /**
518
+ * API for taking screenshots of the 3D model
519
+ * Following the camera analogy: take() triggers capture, onDeveloped() gets result
520
+ */
521
+ export declare class Snapshot {
522
+ private readonly eventBus;
523
+ private readonly validExtensions;
524
+ private readonly messageHandler;
525
+ constructor(eventBus: EventBus);
526
+ /**
527
+ * Take a snapshot of the current 3D model view
528
+ *
529
+ * @param filename The filename for the snapshot (must include valid extension)
530
+ * @returns Photo object for registering callbacks
531
+ * @throws VirtualdisplayError if filename is invalid
532
+ */
533
+ take(filename: string): Photo;
534
+ /**
535
+ * Validate filename has a valid image extension
536
+ */
537
+ private validateFilename;
538
+ }
539
+
540
+ /**
541
+ * Snapshot developed message received from server
542
+ */
543
+ export declare interface SnapshotDevelopedMessage {
544
+ readonly type: typeof MESSAGE_TYPES.SNAPSHOT;
545
+ readonly filename: string;
546
+ readonly data: string;
547
+ }
548
+
549
+ /**
550
+ * Snapshot request message sent to server
551
+ */
552
+ export declare interface SnapshotRequestMessage {
553
+ readonly type: typeof MESSAGE_TYPES.SNAPSHOT;
554
+ readonly filename: string;
555
+ }
556
+
479
557
  declare interface StateChangedEvent {
480
558
  nodes: ModelNode[];
481
559
  }
@@ -537,6 +615,7 @@ export declare class VirtualdisplayClient {
537
615
  private readonly messageHandler;
538
616
  private readonly viewerService;
539
617
  private readonly cameraApi;
618
+ private readonly snapshotApi;
540
619
  private readonly options;
541
620
  private iframe;
542
621
  constructor(options: ClientOptions);
@@ -578,6 +657,10 @@ export declare class VirtualdisplayClient {
578
657
  * Get the camera control API
579
658
  */
580
659
  get camera(): Camera;
660
+ /**
661
+ * Get the snapshot API for taking screenshots
662
+ */
663
+ get snapshot(): Snapshot;
581
664
  destroy(): void;
582
665
  }
583
666