@virtualdisplay.io/client 3.7.0 → 4.0.0-alpha.2
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 +44 -76
- package/LICENSE +1 -1
- package/README.md +374 -31
- package/dist/index.d.ts +0 -820
- package/dist/virtualdisplay.client.cjs.js +1 -8
- package/dist/virtualdisplay.client.es.js +794 -8022
- package/dist/virtualdisplay.client.umd.js +1 -8
- package/package.json +14 -98
- package/README.npm.md +0 -78
- package/dist/virtualdisplay.client.cjs.js.map +0 -1
- package/dist/virtualdisplay.client.es.js.map +0 -1
- package/dist/virtualdisplay.client.umd.js.map +0 -1
- package/node_modules/@virtualdisplay-io/logger/CHANGELOG.md +0 -82
- package/node_modules/@virtualdisplay-io/logger/LICENSE +0 -21
- package/node_modules/@virtualdisplay-io/logger/README.md +0 -314
- package/node_modules/@virtualdisplay-io/logger/dist/index.d.ts +0 -167
- package/node_modules/@virtualdisplay-io/logger/dist/virtualdisplay.logger.cjs.js +0 -4
- package/node_modules/@virtualdisplay-io/logger/dist/virtualdisplay.logger.cjs.js.map +0 -1
- package/node_modules/@virtualdisplay-io/logger/dist/virtualdisplay.logger.es.js +0 -377
- package/node_modules/@virtualdisplay-io/logger/dist/virtualdisplay.logger.es.js.map +0 -1
- package/node_modules/@virtualdisplay-io/logger/package.json +0 -79
package/dist/index.d.ts
CHANGED
|
@@ -1,821 +1 @@
|
|
|
1
|
-
import { Logger } from '@virtualdisplay-io/logger';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Pure domain aggregate for managing attribute values
|
|
5
|
-
* No side effects - only business logic and state management
|
|
6
|
-
*/
|
|
7
|
-
declare class Attribute {
|
|
8
|
-
private readonly attributeName;
|
|
9
|
-
private readonly values;
|
|
10
|
-
constructor(name: string);
|
|
11
|
-
addValue(attributeValue: AttributeValue): void;
|
|
12
|
-
getDefaultMutations(): Mutation[];
|
|
13
|
-
getCurrentValue(): AttributeValue | undefined;
|
|
14
|
-
getValue(valueName: string): AttributeValue | undefined;
|
|
15
|
-
getAllValues(): AttributeValue[];
|
|
16
|
-
hasValue(valueName: string): boolean;
|
|
17
|
-
get name(): string;
|
|
18
|
-
get currentSelection(): string | undefined;
|
|
19
|
-
clear(): void;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Configuration for a single attribute
|
|
24
|
-
*/
|
|
25
|
-
export declare interface AttributeConfig {
|
|
26
|
-
readonly name: string;
|
|
27
|
-
readonly values: DynamicValue<AttributeValueConfig[]>;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Public API for selecting attribute values
|
|
32
|
-
* Provides fluent interface for client usage
|
|
33
|
-
*/
|
|
34
|
-
export declare class AttributeSelector {
|
|
35
|
-
private readonly attributeService;
|
|
36
|
-
private readonly attributeName;
|
|
37
|
-
constructor(attributeService: AttributeService, attributeName: string);
|
|
38
|
-
/**
|
|
39
|
-
* Select a value for this attribute
|
|
40
|
-
* Fire-and-forget: returns immediately, 3D updates asynchronously
|
|
41
|
-
* @returns this AttributeSelector for method chaining
|
|
42
|
-
* @throws {VirtualdisplayError} When value not found for attribute
|
|
43
|
-
*/
|
|
44
|
-
select(value: string): AttributeSelector;
|
|
45
|
-
get name(): string;
|
|
46
|
-
get currentValue(): string | undefined;
|
|
47
|
-
get availableValues(): string[];
|
|
48
|
-
/**
|
|
49
|
-
* Register a callback to be called when any value's selection state changes
|
|
50
|
-
* This registers the callback on all AttributeValue objects for this attribute
|
|
51
|
-
* @param callback Function to call when selection state changes
|
|
52
|
-
* @returns this AttributeSelector for method chaining
|
|
53
|
-
*/
|
|
54
|
-
onChange(callback: () => void): AttributeSelector;
|
|
55
|
-
/**
|
|
56
|
-
* Get all AttributeValue objects for direct property access
|
|
57
|
-
* @returns Array of AttributeValue objects
|
|
58
|
-
*/
|
|
59
|
-
getValues(): AttributeValue[];
|
|
60
|
-
/**
|
|
61
|
-
* Get a specific AttributeValue object by value name
|
|
62
|
-
* @param value The value name to find
|
|
63
|
-
* @returns AttributeValue object or undefined if not found
|
|
64
|
-
*/
|
|
65
|
-
getValue(value: string): AttributeValue | undefined;
|
|
66
|
-
private getAttribute;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Application service for managing attributes
|
|
71
|
-
* Handles business logic and coordinates with other domains via events
|
|
72
|
-
*/
|
|
73
|
-
declare class AttributeService {
|
|
74
|
-
private attributes;
|
|
75
|
-
private readonly eventBus;
|
|
76
|
-
private isInitialized;
|
|
77
|
-
private mappingConfig;
|
|
78
|
-
private readonly selections;
|
|
79
|
-
private readonly currentState;
|
|
80
|
-
constructor(eventBus: EventBus);
|
|
81
|
-
/**
|
|
82
|
-
* Load mapping configuration and apply defaults
|
|
83
|
-
* @throws {VirtualdisplayError} When mapping configuration is invalid
|
|
84
|
-
*/
|
|
85
|
-
loadMapping(config: MappingConfiguration): void;
|
|
86
|
-
selectAttributeValue(attributeName: string, value: string): void;
|
|
87
|
-
getAttribute(name: string): Attribute | undefined;
|
|
88
|
-
getAllAttributes(): Attribute[];
|
|
89
|
-
get initialized(): boolean;
|
|
90
|
-
private syncStateWithAttributes;
|
|
91
|
-
clear(): void;
|
|
92
|
-
/**
|
|
93
|
-
* Create context for dynamic evaluation
|
|
94
|
-
*/
|
|
95
|
-
private createContext;
|
|
96
|
-
/**
|
|
97
|
-
* Evaluate a property that might be static or dynamic
|
|
98
|
-
*/
|
|
99
|
-
private evaluateProperty;
|
|
100
|
-
/**
|
|
101
|
-
* Evaluate the entire mapping with current context
|
|
102
|
-
*/
|
|
103
|
-
private evaluateMapping;
|
|
104
|
-
/**
|
|
105
|
-
* Create a single attribute from configuration
|
|
106
|
-
*/
|
|
107
|
-
private createAttributeFromConfig;
|
|
108
|
-
/**
|
|
109
|
-
* Initialize selections from default values
|
|
110
|
-
*/
|
|
111
|
-
private initializeSelections;
|
|
112
|
-
/**
|
|
113
|
-
* Check if the mapping configuration contains dynamic elements
|
|
114
|
-
*/
|
|
115
|
-
private hasDynamicMapping;
|
|
116
|
-
/**
|
|
117
|
-
* Update current state map with visible nodes per attribute
|
|
118
|
-
*/
|
|
119
|
-
private updateCurrentState;
|
|
120
|
-
private getVisibleNodesForAttribute;
|
|
121
|
-
/**
|
|
122
|
-
* Get initial mutations for default selections
|
|
123
|
-
*/
|
|
124
|
-
private getInitialMutations;
|
|
125
|
-
/**
|
|
126
|
-
* Calculate mutations by comparing old and new state
|
|
127
|
-
*/
|
|
128
|
-
private calculateMutations;
|
|
129
|
-
/**
|
|
130
|
-
* Check if a node is visible in the given state
|
|
131
|
-
*/
|
|
132
|
-
private isNodeVisible;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Pure domain entity representing a single attribute value
|
|
137
|
-
* No side effects - only business logic and data
|
|
138
|
-
*/
|
|
139
|
-
declare class AttributeValue {
|
|
140
|
-
private readonly attributeValue;
|
|
141
|
-
private readonly nodeIds;
|
|
142
|
-
private selected;
|
|
143
|
-
onChange?: () => void;
|
|
144
|
-
constructor(value: string, nodeIds: string[], isSelected?: boolean);
|
|
145
|
-
getMutations(): Mutation[];
|
|
146
|
-
setSelected(selected: boolean): void;
|
|
147
|
-
get value(): string;
|
|
148
|
-
get nodeList(): string[];
|
|
149
|
-
hasNode(nodeId: string): boolean;
|
|
150
|
-
get isSelected(): boolean;
|
|
151
|
-
setOnChange(callback: () => void): void;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Configuration for a single attribute value
|
|
156
|
-
* All properties can be static or dynamic
|
|
157
|
-
*/
|
|
158
|
-
export declare interface AttributeValueConfig {
|
|
159
|
-
readonly value: DynamicValue<string>;
|
|
160
|
-
readonly nodeIds: DynamicValue<string[]>;
|
|
161
|
-
readonly isSelected?: DynamicValue<boolean>;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Camera control API for positioning and zoom
|
|
166
|
-
* Uses chaining pattern for building commands
|
|
167
|
-
*/
|
|
168
|
-
export declare class Camera {
|
|
169
|
-
private readonly eventBus;
|
|
170
|
-
private commands;
|
|
171
|
-
constructor(eventBus: EventBus);
|
|
172
|
-
/**
|
|
173
|
-
* Rotate camera horizontally
|
|
174
|
-
* @param degrees - Absolute rotation in degrees (0 = front view)
|
|
175
|
-
*/
|
|
176
|
-
rotate(degrees: number): this;
|
|
177
|
-
/**
|
|
178
|
-
* Tilt camera vertically
|
|
179
|
-
* @param degrees - Absolute tilt in degrees (0 = top view, 90 = horizontal)
|
|
180
|
-
*/
|
|
181
|
-
tilt(degrees: number): this;
|
|
182
|
-
/**
|
|
183
|
-
* Zoom camera
|
|
184
|
-
* @param percentage - Zoom percentage (100 = normal, >100 = zoom in, <100 = zoom out)
|
|
185
|
-
*/
|
|
186
|
-
zoom(percentage: number): this;
|
|
187
|
-
/**
|
|
188
|
-
* Execute accumulated camera commands
|
|
189
|
-
*/
|
|
190
|
-
set(): void;
|
|
191
|
-
/**
|
|
192
|
-
* Reset camera to initial position
|
|
193
|
-
* This is not chainable and executes immediately
|
|
194
|
-
*/
|
|
195
|
-
reset(): void;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Camera command
|
|
200
|
-
*/
|
|
201
|
-
export declare interface CameraCommand {
|
|
202
|
-
readonly action: 'rotate' | 'tilt' | 'zoom' | 'reset';
|
|
203
|
-
readonly value?: number;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Camera configuration options
|
|
208
|
-
*/
|
|
209
|
-
export declare interface CameraConfig {
|
|
210
|
-
readonly initialRotate?: number;
|
|
211
|
-
readonly initialTilt?: number;
|
|
212
|
-
readonly initialZoom?: number;
|
|
213
|
-
readonly minZoom?: number;
|
|
214
|
-
readonly maxZoom?: number;
|
|
215
|
-
readonly minTilt?: number;
|
|
216
|
-
readonly maxTilt?: number;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Camera message sent to server
|
|
221
|
-
*/
|
|
222
|
-
export declare interface CameraMessage {
|
|
223
|
-
readonly type: typeof MESSAGE_TYPES.CAMERA;
|
|
224
|
-
readonly commands: CameraCommand[];
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Configuration options for VirtualdisplayClient
|
|
229
|
-
*/
|
|
230
|
-
export declare interface ClientOptions {
|
|
231
|
-
readonly parent: string | HTMLElement;
|
|
232
|
-
readonly model: string;
|
|
233
|
-
readonly license: string;
|
|
234
|
-
readonly debug?: boolean;
|
|
235
|
-
readonly language?: string;
|
|
236
|
-
readonly arEnabled?: boolean;
|
|
237
|
-
readonly fullscreenEnabled?: boolean;
|
|
238
|
-
readonly loadingIndicatorEnabled?: boolean;
|
|
239
|
-
readonly ui?: UIConfig;
|
|
240
|
-
readonly camera?: CameraConfig;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Configuration message sent to server
|
|
245
|
-
*/
|
|
246
|
-
export declare interface ConfigMessage {
|
|
247
|
-
readonly type: typeof MESSAGE_TYPES.CONFIG;
|
|
248
|
-
readonly config: ViewerConfig;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
declare interface CreateNodeParams {
|
|
252
|
-
id: string;
|
|
253
|
-
name: string;
|
|
254
|
-
type: NodeType;
|
|
255
|
-
visible: boolean;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Central Event Registry
|
|
260
|
-
*/
|
|
261
|
-
export declare interface DomainEvents extends Record<string, unknown> {
|
|
262
|
-
[EVENT_NAMES.IFRAME_READY]: VoidEvent;
|
|
263
|
-
[EVENT_NAMES.MUTATION_MESSAGE]: MessageEvent_2<MutationMessage>;
|
|
264
|
-
[EVENT_NAMES.CONFIG_MESSAGE]: MessageEvent_2<ConfigMessage>;
|
|
265
|
-
[EVENT_NAMES.CAMERA_MESSAGE]: MessageEvent_2<CameraMessage>;
|
|
266
|
-
[EVENT_NAMES.MESSAGE_RECEIVED]: MessageEvent_2;
|
|
267
|
-
[EVENT_NAMES.STATE_CHANGED]: StateChangedEvent;
|
|
268
|
-
[EVENT_NAMES.INITIAL_STATE_RECEIVED]: VoidEvent;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* A value that can be static or dynamically computed
|
|
273
|
-
*/
|
|
274
|
-
declare type DynamicValue<T> = T | ((context: MappingContext) => T);
|
|
275
|
-
|
|
276
|
-
export declare function enableDebugMode(): void;
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Error codes for Virtualdisplay client errors
|
|
280
|
-
*/
|
|
281
|
-
export declare const ERROR_CODES: {
|
|
282
|
-
readonly NO_MAPPING: "NO_MAPPING";
|
|
283
|
-
readonly ATTRIBUTE_NOT_FOUND: "ATTRIBUTE_NOT_FOUND";
|
|
284
|
-
readonly VALUE_NOT_FOUND: "VALUE_NOT_FOUND";
|
|
285
|
-
readonly INVALID_MAPPING: "INVALID_MAPPING";
|
|
286
|
-
readonly PARENT_NOT_FOUND: "PARENT_NOT_FOUND";
|
|
287
|
-
readonly INVALID_MUTATIONS: "INVALID_MUTATIONS";
|
|
288
|
-
readonly INVALID_PARAMETER: "INVALID_PARAMETER";
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
export declare type ErrorCode = typeof ERROR_CODES[keyof typeof ERROR_CODES];
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Event name constants for type-safe event communication
|
|
295
|
-
*/
|
|
296
|
-
export declare const EVENT_NAMES: {
|
|
297
|
-
readonly IFRAME_READY: "iframe:ready";
|
|
298
|
-
readonly MUTATION_MESSAGE: "mutation:message";
|
|
299
|
-
readonly CONFIG_MESSAGE: "config:message";
|
|
300
|
-
readonly CAMERA_MESSAGE: "camera:message";
|
|
301
|
-
readonly MESSAGE_RECEIVED: "message:received";
|
|
302
|
-
readonly STATE_CHANGED: "state:changed";
|
|
303
|
-
readonly INITIAL_STATE_RECEIVED: "state:initial-received";
|
|
304
|
-
readonly SNAPSHOT_MESSAGE: "snapshot:take";
|
|
305
|
-
};
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* EventBus for domain coordination
|
|
309
|
-
* Provides loose coupling between domains via events
|
|
310
|
-
*/
|
|
311
|
-
declare class EventBus {
|
|
312
|
-
private readonly listeners;
|
|
313
|
-
on<K extends keyof DomainEvents>(event: K, listener: EventListener_2<DomainEvents[K]>): void;
|
|
314
|
-
emit<K extends keyof DomainEvents>(event: K, payload: DomainEvents[K]): void;
|
|
315
|
-
/**
|
|
316
|
-
* Register a listener that will be called only once
|
|
317
|
-
* The listener is automatically removed after the first call
|
|
318
|
-
*/
|
|
319
|
-
once<K extends keyof DomainEvents>(event: K, listener: EventListener_2<DomainEvents[K]>): void;
|
|
320
|
-
/**
|
|
321
|
-
* Remove a specific listener for an event
|
|
322
|
-
*/
|
|
323
|
-
off<K extends keyof DomainEvents>(event: K, listener: EventListener_2<DomainEvents[K]>): void;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
declare type EventListener_2<T> = (payload: T) => void;
|
|
327
|
-
|
|
328
|
-
export declare function isDebugMode(): boolean;
|
|
329
|
-
|
|
330
|
-
export declare const logger: Logger;
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Complete mapping configuration
|
|
334
|
-
* Defines how product attributes map to 3D nodes
|
|
335
|
-
*/
|
|
336
|
-
export declare interface MappingConfiguration {
|
|
337
|
-
readonly attributes: AttributeConfig[];
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Context provided to dynamic value functions
|
|
342
|
-
*/
|
|
343
|
-
declare interface MappingContext {
|
|
344
|
-
getValue: (attributeName: string) => string | undefined;
|
|
345
|
-
getAllValues: () => Map<string, string>;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
export declare const mappingSchema: {
|
|
349
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
350
|
-
"title": "Virtualdisplay mapping configuration",
|
|
351
|
-
"description": "Schema for attribute-based 3D model configuration",
|
|
352
|
-
"type": "object",
|
|
353
|
-
"required": ["attributes"],
|
|
354
|
-
"definitions": {
|
|
355
|
-
"attribute": {
|
|
356
|
-
"type": "object",
|
|
357
|
-
"description": "A configurable attribute with multiple possible values",
|
|
358
|
-
"required": ["name", "values"],
|
|
359
|
-
"properties": {
|
|
360
|
-
"name": {
|
|
361
|
-
"type": "string",
|
|
362
|
-
"description": "Unique attribute name (e.g., 'Color', 'Size')",
|
|
363
|
-
"minLength": 1,
|
|
364
|
-
"pattern": "^\\S.*\\S$|^\\S$"
|
|
365
|
-
},
|
|
366
|
-
"values": {
|
|
367
|
-
"type": "array",
|
|
368
|
-
"description": "Possible values for this attribute",
|
|
369
|
-
"minItems": 1,
|
|
370
|
-
"items": {
|
|
371
|
-
"$ref": "#/definitions/attributeValue"
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
},
|
|
376
|
-
"attributeValue": {
|
|
377
|
-
"type": "object",
|
|
378
|
-
"description": "A single value option for an attribute",
|
|
379
|
-
"required": ["value", "nodeIds"],
|
|
380
|
-
"properties": {
|
|
381
|
-
"value": {
|
|
382
|
-
"type": "string",
|
|
383
|
-
"description": "Display value (e.g., 'Red', 'Large')",
|
|
384
|
-
"minLength": 1,
|
|
385
|
-
"pattern": "^\\S.*\\S$|^\\S$"
|
|
386
|
-
},
|
|
387
|
-
"nodeIds": {
|
|
388
|
-
"type": "array",
|
|
389
|
-
"description": "3D model node IDs controlled by this value",
|
|
390
|
-
"items": {
|
|
391
|
-
"type": "string",
|
|
392
|
-
"description": "Node ID in the 3D model"
|
|
393
|
-
}
|
|
394
|
-
},
|
|
395
|
-
"isSelected": {
|
|
396
|
-
"type": "boolean",
|
|
397
|
-
"description": "Whether this value is selected by default",
|
|
398
|
-
"default": false
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
},
|
|
403
|
-
"properties": {
|
|
404
|
-
"attributes": {
|
|
405
|
-
"type": "array",
|
|
406
|
-
"description": "List of all configurable attributes",
|
|
407
|
-
"minItems": 1,
|
|
408
|
-
"items": {
|
|
409
|
-
"$ref": "#/definitions/attribute"
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
};
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* Validator for mapping configuration using AJV
|
|
417
|
-
*/
|
|
418
|
-
export declare class MappingValidator {
|
|
419
|
-
private static readonly ajv;
|
|
420
|
-
private static readonly validateFn;
|
|
421
|
-
/**
|
|
422
|
-
* Validate complete mapping configuration
|
|
423
|
-
* @throws {VirtualdisplayError} When mapping configuration is invalid
|
|
424
|
-
*/
|
|
425
|
-
static validate(config: MappingConfiguration): void;
|
|
426
|
-
/**
|
|
427
|
-
* Check if configuration contains dynamic values (functions)
|
|
428
|
-
*/
|
|
429
|
-
static containsDynamicValues(config: MappingConfiguration): boolean;
|
|
430
|
-
/**
|
|
431
|
-
* Basic structure validation for dynamic mappings
|
|
432
|
-
*/
|
|
433
|
-
private static validateBasicStructure;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* Union of all possible messages
|
|
438
|
-
*/
|
|
439
|
-
export declare type Message = MutationMessage | StateMessage | ConfigMessage | CameraMessage | SnapshotRequestMessage | SnapshotDevelopedMessage;
|
|
440
|
-
|
|
441
|
-
/**
|
|
442
|
-
* Types of messages exchanged between client and server
|
|
443
|
-
* Using lowercase format to match server
|
|
444
|
-
*/
|
|
445
|
-
export declare const MESSAGE_TYPES: {
|
|
446
|
-
readonly MUTATION: "mutation";
|
|
447
|
-
readonly STATE: "state";
|
|
448
|
-
readonly CONFIG: "config";
|
|
449
|
-
readonly CAMERA: "camera";
|
|
450
|
-
readonly SNAPSHOT: "snapshot";
|
|
451
|
-
};
|
|
452
|
-
|
|
453
|
-
/**
|
|
454
|
-
* Generic message event - used for all message passing
|
|
455
|
-
*/
|
|
456
|
-
declare interface MessageEvent_2<T extends Message = Message> {
|
|
457
|
-
message: T;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
/**
|
|
461
|
-
* Represents a 3D node in the scene
|
|
462
|
-
* Live object that can be updated to reflect state changes
|
|
463
|
-
*/
|
|
464
|
-
export declare class ModelNode {
|
|
465
|
-
readonly id: string;
|
|
466
|
-
readonly name: string;
|
|
467
|
-
readonly type: NodeType;
|
|
468
|
-
private visible;
|
|
469
|
-
onChange?: () => void;
|
|
470
|
-
constructor(params: CreateNodeParams);
|
|
471
|
-
get isVisible(): boolean;
|
|
472
|
-
show(): void;
|
|
473
|
-
hide(): void;
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* DTO for model node data received from server
|
|
478
|
-
*/
|
|
479
|
-
export declare interface ModelNodeDto {
|
|
480
|
-
readonly id: string;
|
|
481
|
-
readonly name: string;
|
|
482
|
-
readonly type: string;
|
|
483
|
-
readonly visible: boolean;
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
/**
|
|
487
|
-
* A mutation represents a change to be applied to a 3D node
|
|
488
|
-
* This is a pure data class with no side effects
|
|
489
|
-
*/
|
|
490
|
-
export declare class Mutation {
|
|
491
|
-
readonly type: MutationType;
|
|
492
|
-
readonly nodeId: string;
|
|
493
|
-
constructor(type: MutationType, nodeId: string);
|
|
494
|
-
static show(nodeId: string): Mutation;
|
|
495
|
-
static hide(nodeId: string): Mutation;
|
|
496
|
-
inverse(): Mutation;
|
|
497
|
-
equals(other: Mutation): boolean;
|
|
498
|
-
toDto(): MutationDto;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
/**
|
|
502
|
-
* Types of mutations that can be applied to 3D nodes
|
|
503
|
-
*/
|
|
504
|
-
export declare const MUTATION_TYPES: {
|
|
505
|
-
readonly SHOW: "show";
|
|
506
|
-
readonly HIDE: "hide";
|
|
507
|
-
};
|
|
508
|
-
|
|
509
|
-
/**
|
|
510
|
-
* Data Transfer Object for mutations
|
|
511
|
-
* Plain object for client-server communication without methods
|
|
512
|
-
*/
|
|
513
|
-
export declare interface MutationDto {
|
|
514
|
-
readonly type: MutationType;
|
|
515
|
-
readonly nodeId: string;
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
/**
|
|
519
|
-
* Mutation message sent to server
|
|
520
|
-
*/
|
|
521
|
-
export declare interface MutationMessage {
|
|
522
|
-
readonly type: typeof MESSAGE_TYPES.MUTATION;
|
|
523
|
-
readonly mutations: MutationDto[];
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
export declare type MutationType = typeof MUTATION_TYPES[keyof typeof MUTATION_TYPES];
|
|
527
|
-
|
|
528
|
-
/**
|
|
529
|
-
* Types of nodes in the 3D scene
|
|
530
|
-
*/
|
|
531
|
-
export declare const NODE_TYPES: {
|
|
532
|
-
readonly MESH: "mesh";
|
|
533
|
-
readonly VARIANT: "variant";
|
|
534
|
-
};
|
|
535
|
-
|
|
536
|
-
/**
|
|
537
|
-
* Public API for controlling individual nodes
|
|
538
|
-
* Provides direct node manipulation without attribute mapping
|
|
539
|
-
*/
|
|
540
|
-
export declare class NodeSelector {
|
|
541
|
-
private readonly eventBus;
|
|
542
|
-
private readonly stateService;
|
|
543
|
-
private readonly nodeId;
|
|
544
|
-
constructor(eventBus: EventBus, stateService: StateService, nodeId: string);
|
|
545
|
-
show(): void;
|
|
546
|
-
hide(): void;
|
|
547
|
-
toggle(): void;
|
|
548
|
-
get id(): string;
|
|
549
|
-
get isVisible(): boolean;
|
|
550
|
-
getNode(): ModelNode | undefined;
|
|
551
|
-
get type(): string | undefined;
|
|
552
|
-
get name(): string | undefined;
|
|
553
|
-
private emitMutation;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
declare type NodeType = typeof NODE_TYPES[keyof typeof NODE_TYPES];
|
|
557
|
-
|
|
558
|
-
/**
|
|
559
|
-
* Represents a photo being captured
|
|
560
|
-
* Pure domain object that manages callbacks for when the photo is developed
|
|
561
|
-
*/
|
|
562
|
-
export declare class Photo {
|
|
563
|
-
private readonly filename;
|
|
564
|
-
private readonly callbacks;
|
|
565
|
-
private developed;
|
|
566
|
-
private photoData;
|
|
567
|
-
constructor(filename: string);
|
|
568
|
-
/**
|
|
569
|
-
* Register a callback for when the photo is developed
|
|
570
|
-
* If the photo is already developed, the callback is called immediately
|
|
571
|
-
*
|
|
572
|
-
* @param callback Function to call with photo data
|
|
573
|
-
* @returns This Photo instance for chaining
|
|
574
|
-
*/
|
|
575
|
-
onDeveloped(callback: (photo: PhotoData) => void): this;
|
|
576
|
-
/**
|
|
577
|
-
* Get the filename for this photo
|
|
578
|
-
*/
|
|
579
|
-
getFilename(): string;
|
|
580
|
-
/**
|
|
581
|
-
* Mark the photo as developed and notify all callbacks
|
|
582
|
-
* This method is called by the SnapshotMessageHandler when the photo data arrives
|
|
583
|
-
*/
|
|
584
|
-
develop(photoData: PhotoData): void;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
export declare interface PhotoData {
|
|
588
|
-
readonly filename: string;
|
|
589
|
-
readonly data: string;
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
/**
|
|
593
|
-
* API for taking screenshots of the 3D model
|
|
594
|
-
* Following the camera analogy: take() triggers capture, onDeveloped() gets result
|
|
595
|
-
*/
|
|
596
|
-
export declare class Snapshot {
|
|
597
|
-
private readonly eventBus;
|
|
598
|
-
private readonly validExtensions;
|
|
599
|
-
private readonly messageHandler;
|
|
600
|
-
constructor(eventBus: EventBus);
|
|
601
|
-
/**
|
|
602
|
-
* Take a snapshot of the current 3D model view
|
|
603
|
-
*
|
|
604
|
-
* @param filename The filename for the snapshot (must include valid extension)
|
|
605
|
-
* @returns Photo object for registering callbacks
|
|
606
|
-
* @throws VirtualdisplayError if filename is invalid
|
|
607
|
-
*/
|
|
608
|
-
take(filename: string): Photo;
|
|
609
|
-
/**
|
|
610
|
-
* Validate filename has a valid image extension
|
|
611
|
-
*/
|
|
612
|
-
private validateFilename;
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
/**
|
|
616
|
-
* Snapshot developed message received from server
|
|
617
|
-
*/
|
|
618
|
-
export declare interface SnapshotDevelopedMessage {
|
|
619
|
-
readonly type: typeof MESSAGE_TYPES.SNAPSHOT;
|
|
620
|
-
readonly filename: string;
|
|
621
|
-
readonly data: string;
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
/**
|
|
625
|
-
* Snapshot request message sent to server
|
|
626
|
-
*/
|
|
627
|
-
export declare interface SnapshotRequestMessage {
|
|
628
|
-
readonly type: typeof MESSAGE_TYPES.SNAPSHOT;
|
|
629
|
-
readonly filename: string;
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
declare interface StateChangedEvent {
|
|
633
|
-
nodes: ModelNode[];
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
/**
|
|
637
|
-
* State message received from server
|
|
638
|
-
* Contains array of model node DTOs
|
|
639
|
-
*/
|
|
640
|
-
export declare interface StateMessage {
|
|
641
|
-
readonly type: typeof MESSAGE_TYPES.STATE;
|
|
642
|
-
readonly nodes: ModelNodeDto[];
|
|
643
|
-
readonly isInitial: boolean;
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
/**
|
|
647
|
-
* Application service for managing node state
|
|
648
|
-
* Handles state updates from server and emits node change events
|
|
649
|
-
*/
|
|
650
|
-
declare class StateService {
|
|
651
|
-
private readonly nodes;
|
|
652
|
-
private readonly eventBus;
|
|
653
|
-
private hasReceivedInitialSync;
|
|
654
|
-
constructor(eventBus: EventBus);
|
|
655
|
-
private handleMessage;
|
|
656
|
-
private updateState;
|
|
657
|
-
private updateOrCreateNode;
|
|
658
|
-
private createNewNode;
|
|
659
|
-
getNode(id: string): ModelNode | undefined;
|
|
660
|
-
getAllNodes(): ModelNode[];
|
|
661
|
-
get isReady(): boolean;
|
|
662
|
-
get nodeCount(): number;
|
|
663
|
-
clear(): void;
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
/**
|
|
667
|
-
* UI configuration options
|
|
668
|
-
*/
|
|
669
|
-
export declare interface UIConfig {
|
|
670
|
-
readonly arEnabled?: boolean;
|
|
671
|
-
readonly fullscreenEnabled?: boolean;
|
|
672
|
-
readonly loadingIndicatorEnabled?: boolean;
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
/**
|
|
676
|
-
* Viewer configuration
|
|
677
|
-
*/
|
|
678
|
-
export declare interface ViewerConfig {
|
|
679
|
-
readonly ui?: UIConfig;
|
|
680
|
-
readonly camera?: CameraConfig;
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
/**
|
|
684
|
-
* Main Virtualdisplay Client
|
|
685
|
-
* Provides the public API for 3D product visualization
|
|
686
|
-
*/
|
|
687
|
-
export declare class VirtualdisplayClient {
|
|
688
|
-
private readonly eventBus;
|
|
689
|
-
private readonly attributeService;
|
|
690
|
-
private readonly stateService;
|
|
691
|
-
private readonly messageHandler;
|
|
692
|
-
private readonly viewerService;
|
|
693
|
-
private readonly cameraApi;
|
|
694
|
-
private readonly snapshotApi;
|
|
695
|
-
private readonly options;
|
|
696
|
-
private iframe;
|
|
697
|
-
constructor(options: ClientOptions);
|
|
698
|
-
private initializeLogging;
|
|
699
|
-
private createAndConnectIframe;
|
|
700
|
-
private setupInitialConfig;
|
|
701
|
-
/**
|
|
702
|
-
* Load attribute mapping configuration
|
|
703
|
-
* @throws {VirtualdisplayError} When mapping configuration is invalid
|
|
704
|
-
*/
|
|
705
|
-
setMapping(config: MappingConfiguration): void;
|
|
706
|
-
/**
|
|
707
|
-
* Get attribute selector for fluent API
|
|
708
|
-
* @throws {VirtualdisplayError} When no mapping is configured or attribute not found
|
|
709
|
-
*/
|
|
710
|
-
getAttribute(name: string): AttributeSelector;
|
|
711
|
-
/**
|
|
712
|
-
* Get node selector for direct node control
|
|
713
|
-
* @param nodeId The node ID to control
|
|
714
|
-
* @returns NodeSelector if node exists, undefined otherwise
|
|
715
|
-
*/
|
|
716
|
-
getNodeSelector(nodeId: string): NodeSelector | undefined;
|
|
717
|
-
getNode(id: string): ModelNode | undefined;
|
|
718
|
-
getNodes(): ModelNode[];
|
|
719
|
-
/**
|
|
720
|
-
* Check if the client has received initial state and is ready
|
|
721
|
-
*/
|
|
722
|
-
get isReady(): boolean;
|
|
723
|
-
/**
|
|
724
|
-
* Register a callback to be called when the client is ready
|
|
725
|
-
* If already ready, the callback is called immediately
|
|
726
|
-
*/
|
|
727
|
-
onReady(callback: () => void): void;
|
|
728
|
-
/**
|
|
729
|
-
* Get the viewer service for UI configuration
|
|
730
|
-
*/
|
|
731
|
-
get viewer(): VirtualdisplayViewerService;
|
|
732
|
-
/**
|
|
733
|
-
* Get the camera control API
|
|
734
|
-
*/
|
|
735
|
-
get camera(): Camera;
|
|
736
|
-
/**
|
|
737
|
-
* Get the snapshot API for taking screenshots
|
|
738
|
-
*/
|
|
739
|
-
get snapshot(): Snapshot;
|
|
740
|
-
destroy(): void;
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
/**
|
|
744
|
-
* Custom error class for Virtualdisplay client errors
|
|
745
|
-
*/
|
|
746
|
-
export declare class VirtualdisplayError extends Error {
|
|
747
|
-
readonly code: ErrorCode;
|
|
748
|
-
constructor(message: string, code: ErrorCode);
|
|
749
|
-
static noMapping(): VirtualdisplayError;
|
|
750
|
-
static attributeNotFound(attributeName: string): VirtualdisplayError;
|
|
751
|
-
static valueNotFound(attributeName: string, valueName: string): VirtualdisplayError;
|
|
752
|
-
static invalidMapping(reason?: string): VirtualdisplayError;
|
|
753
|
-
static parentNotFound(selector: string): VirtualdisplayError;
|
|
754
|
-
static invalidMutations(reason?: string): VirtualdisplayError;
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
/**
|
|
758
|
-
* Service responsible for managing viewer UI configuration
|
|
759
|
-
* Sends CONFIG messages to control AR button, fullscreen button, and loading indicator
|
|
760
|
-
*/
|
|
761
|
-
export declare class VirtualdisplayViewerService {
|
|
762
|
-
private readonly eventBus;
|
|
763
|
-
constructor(eventBus: EventBus);
|
|
764
|
-
/**
|
|
765
|
-
* Send initial configuration based on client options
|
|
766
|
-
* Supports both individual properties and ui object
|
|
767
|
-
*/
|
|
768
|
-
sendInitialConfig(options: ClientOptions): void;
|
|
769
|
-
/**
|
|
770
|
-
* Build UI configuration from client options
|
|
771
|
-
*
|
|
772
|
-
* Supports both legacy properties (options.arEnabled) and the newer ui object
|
|
773
|
-
* for backward compatibility. Legacy properties take precedence when both exist.
|
|
774
|
-
*/
|
|
775
|
-
private buildUIConfig;
|
|
776
|
-
/**
|
|
777
|
-
* Extract UI values from options, with legacy properties taking precedence
|
|
778
|
-
*/
|
|
779
|
-
private extractUIValues;
|
|
780
|
-
/**
|
|
781
|
-
* Build viewer configuration from UI config and camera config
|
|
782
|
-
*/
|
|
783
|
-
private buildViewerConfig;
|
|
784
|
-
/**
|
|
785
|
-
* Update AR button visibility
|
|
786
|
-
*/
|
|
787
|
-
setArEnabled(enabled: boolean): void;
|
|
788
|
-
/**
|
|
789
|
-
* Update fullscreen button visibility
|
|
790
|
-
*/
|
|
791
|
-
setFullscreenEnabled(enabled: boolean): void;
|
|
792
|
-
/**
|
|
793
|
-
* Update loading indicator visibility
|
|
794
|
-
*/
|
|
795
|
-
setLoadingIndicatorEnabled(enabled: boolean): void;
|
|
796
|
-
/**
|
|
797
|
-
* Update multiple UI settings at once
|
|
798
|
-
*/
|
|
799
|
-
updateUIConfig(config: Partial<UIConfig>): void;
|
|
800
|
-
/**
|
|
801
|
-
* Hide all UI elements
|
|
802
|
-
*/
|
|
803
|
-
hideAllUI(): void;
|
|
804
|
-
/**
|
|
805
|
-
* Show all UI elements
|
|
806
|
-
*/
|
|
807
|
-
showAllUI(): void;
|
|
808
|
-
/**
|
|
809
|
-
* Send UI configuration to server
|
|
810
|
-
*/
|
|
811
|
-
private sendUIConfig;
|
|
812
|
-
/**
|
|
813
|
-
* Send full viewer configuration to server
|
|
814
|
-
*/
|
|
815
|
-
private sendConfig;
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
declare interface VoidEvent {
|
|
819
|
-
}
|
|
820
|
-
|
|
821
1
|
export { }
|