@preference-sl/pref-viewer 2.11.0-beta.1 → 2.11.0-beta.10

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.
@@ -1,6 +1,61 @@
1
- import { ContainerData, MaterialData, CameraData } from "./pref-viewer-3d-data.js";
1
+ import { CameraData, ContainerData, MaterialData } from "./pref-viewer-3d-data.js";
2
2
  import BabylonJSController from "./babylonjs-controller.js";
3
3
 
4
+ /**
5
+ * PrefViewer3D - Custom Web Component for interactive 3D visualization and configuration.
6
+ *
7
+ * Overview:
8
+ * - Encapsulates a Babylon.js-powered 3D viewer for displaying models, environments, and materials.
9
+ * - Manages internal state for containers (model, environment, materials) and options (camera, materials).
10
+ * - Handles asset loading, configuration, and option updates through attributes and public methods.
11
+ * - Provides API for showing/hiding the viewer, model, and environment, and for downloading assets.
12
+ * - Emits custom events for loading, loaded, and option-setting states.
13
+ *
14
+ * Usage:
15
+ * - Use as a custom HTML element: <pref-viewer-3d ...>
16
+ * - Configure via attributes (config, options, show-model, show-scene, visible).
17
+ * - Control viewer state and assets via public methods.
18
+ *
19
+ * Observed Attributes:
20
+ * - show-model: Show or hide the 3D model ("true"/"false").
21
+ * - show-scene: Show or hide the 3D environment ("true"/"false").
22
+ * - visible: Show or hide the entire viewer ("true"/"false").
23
+ *
24
+ * Public Methods:
25
+ * - show(): Shows the 3D viewer component.
26
+ * - hide(): Hides the 3D viewer component.
27
+ * - load(config): Loads the provided configuration into the viewer.
28
+ * - setOptions(options): Sets viewer options such as camera and materials.
29
+ * - showModel(): Shows the 3D model.
30
+ * - hideModel(): Hides the 3D model.
31
+ * - showEnvironment(): Shows the 3D environment/scene.
32
+ * - hideEnvironment(): Hides the 3D environment/scene.
33
+ * - downloadModelGLB(): Downloads the current 3D model as a GLB file.
34
+ * - downloadModelGLTF(): Downloads the current 3D model as a glTF ZIP file.
35
+ * - downloadModelUSDZ(): Downloads the current 3D model as a USDZ file.
36
+ * - downloadModelAndSceneGLB(): Downloads both the model and scene as a GLB file.
37
+ * - downloadModelAndSceneGLTF(): Downloads both the model and scene as a glTF ZIP file.
38
+ * - downloadModelAndSceneUSDZ(): Downloads both the model and scene as a USDZ file.
39
+ * - downloadSceneGLB(): Downloads the environment as a GLB file.
40
+ * - downloadSceneGLTF(): Downloads the environment as a glTF ZIP file.
41
+ * - downloadSceneUSDZ(): Downloads the environment as a USDZ file.
42
+ *
43
+ * Public Properties:
44
+ * - isInitialized: Indicates whether the component has completed initialization.
45
+ * - isLoaded: Indicates whether the GLTF/GLB content is loaded and ready.
46
+ * - isVisible: Indicates whether the component is currently visible.
47
+ *
48
+ * Events:
49
+ * - "scene-loading": Dispatched when a loading operation starts.
50
+ * - "scene-loaded": Dispatched when a loading operation completes.
51
+ * - "scene-setting-options": Dispatched when viewer options are being set.
52
+ * - "scene-set-options": Dispatched when viewer options have been set.
53
+ *
54
+ * Notes:
55
+ * - Internal state and heavy initialization are handled in connectedCallback.
56
+ * - Designed for extensibility and integration in product configurators and visualization tools.
57
+ * - All resource management and rendering operations are performed asynchronously for performance.
58
+ */
4
59
  export class PrefViewer3D extends HTMLElement {
5
60
  // State flags
6
61
  #isInitialized = false;
@@ -15,7 +70,7 @@ export class PrefViewer3D extends HTMLElement {
15
70
  #babylonJSController = null; // BabylonJSController instance
16
71
 
17
72
  /**
18
- * Create a new instance of the 2D viewer component.
73
+ * Create a new instance of the 3D viewer component.
19
74
  * The constructor only calls super(); heavy initialization happens in connectedCallback.
20
75
  */
21
76
  constructor() {
@@ -27,31 +82,22 @@ export class PrefViewer3D extends HTMLElement {
27
82
  * @returns {string[]} Array of attribute names that trigger attributeChangedCallback.
28
83
  */
29
84
  static get observedAttributes() {
30
- return ["config", "options", "show-model", "show-scene", "visible"];
85
+ return ["show-model", "show-scene", "visible"];
31
86
  }
32
87
 
33
88
  /**
34
- * Handle attribute changes.
35
- * @param {string} name - Attribute name.
36
- * @param {string|null} _old - Previous attribute value (unused).
37
- * @param {string|null} value -New attribute value.
89
+ * Handles changes to observed attributes and updates the component state accordingly.
90
+ * @param {string} name - The name of the changed attribute.
91
+ * @param {string|null} _old - The previous value of the attribute.
92
+ * @param {string|null} value - The new value of the attribute.
38
93
  * @returns {void}
39
94
  * @description
40
- * - "svg": triggers load of new SVG content.
95
+ * - "show-model": shows or hides the model according to the attribute value ("true"/"false").
96
+ * - "show-scene": shows or hides the scene according to the attribute value ("true"/"false").
41
97
  * - "visible": shows or hides the component according to the attribute value ("true"/"false").
42
98
  */
43
99
  attributeChangedCallback(name, _old, value) {
44
100
  switch (name) {
45
- case "visible":
46
- if (_old === value) {
47
- return;
48
- }
49
- if (value === "true" && this.#isVisible === false) {
50
- this.show();
51
- } else if (value === "false" && this.#isVisible === true) {
52
- this.hide();
53
- }
54
- break;
55
101
  case "show-model":
56
102
  if (_old === value) {
57
103
  return;
@@ -66,12 +112,23 @@ export class PrefViewer3D extends HTMLElement {
66
112
  const showScene = value.toLowerCase?.() === "true";
67
113
  showScene ? this.showEnvironment() : this.hideEnvironment();
68
114
  break;
115
+ case "visible":
116
+ if (_old === value) {
117
+ return;
118
+ }
119
+ if (value === "true" && this.#isVisible === false) {
120
+ this.show();
121
+ } else if (value === "false" && this.#isVisible === true) {
122
+ this.hide();
123
+ }
124
+ break;
69
125
  }
70
126
  }
71
127
 
72
128
  /**
73
- * Called when the element is inserted into the DOM.
74
- * Sets up DOM nodes, initial visibility and starts loading the SVG if provided.
129
+ * Called when the element is added to the DOM.
130
+ * Creates the DOM structure, sets initial visibility, initializes component data, and sets up the BabylonJSController.
131
+ * Performs heavy initialization tasks required for the 3D viewer.
75
132
  * @returns {void}
76
133
  */
77
134
  connectedCallback() {
@@ -81,6 +138,11 @@ export class PrefViewer3D extends HTMLElement {
81
138
  this.#initializeBabylonJS();
82
139
  }
83
140
 
141
+ /**
142
+ * Called when the element is removed from the DOM.
143
+ * Disables the BabylonJSController to clean up resources and event listeners associated with the 3D viewer.
144
+ * @returns {void}
145
+ */
84
146
  disconnectedCallback() {
85
147
  if (this.#babylonJSController) {
86
148
  this.#babylonJSController.disable();
@@ -98,7 +160,7 @@ export class PrefViewer3D extends HTMLElement {
98
160
  this.#canvas = document.createElement("canvas");
99
161
  this.#wrapper.appendChild(this.#canvas);
100
162
  const style = document.createElement("style");
101
- style.textContent = `pref-viewer-3d[visible="true"] { display: block; } pref-viewer-3d[visible="false"] { display: none; } pref-viewer-3d, pref-viewer-3d > div, pref-viewer-3d > div > canvas { width: 100%; height: 100%; display: block; position: relative; outline: none; box-sizing: border-box; }`;
163
+ style.textContent = `@import "/dist/css/pref-viewer-3d.css";`;
102
164
  this.append(style);
103
165
  }
104
166
 
@@ -113,6 +175,12 @@ export class PrefViewer3D extends HTMLElement {
113
175
  visible ? this.show() : this.hide();
114
176
  }
115
177
 
178
+ /**
179
+ * Initializes the internal data structure for containers and options used by the 3D viewer.
180
+ * Sets up default states for model, environment, materials, camera, and material options.
181
+ * @private
182
+ * @returns {void}
183
+ */
116
184
  #initializeData() {
117
185
  this.#data = {
118
186
  containers: {
@@ -132,17 +200,34 @@ export class PrefViewer3D extends HTMLElement {
132
200
  };
133
201
  }
134
202
 
203
+ /**
204
+ * Initializes the BabylonJSController and enables the Babylon.js engine for rendering.
205
+ * @private
206
+ * @returns {void}
207
+ */
135
208
  #initializeBabylonJS() {
136
209
  this.#babylonJSController = new BabylonJSController(this.#canvas, this.#data.containers, this.#data.options);
137
210
  this.#babylonJSController.enable();
138
211
  }
139
212
 
213
+ /**
214
+ * Resets update flags for all containers and material/camera options after loading or setting options.
215
+ * @private
216
+ * @returns {void}
217
+ */
140
218
  #resetUpdateFlags() {
141
- Object.values(this.#data.containers).forEach(container => container.reset());
142
- Object.values(this.#data.options.materials).forEach(material => material.reset());
219
+ Object.values(this.#data.containers).forEach((container) => container.reset());
220
+ Object.values(this.#data.options.materials).forEach((material) => material.reset());
143
221
  this.#data.options.camera.reset();
144
222
  }
145
223
 
224
+ /**
225
+ * Checks if any container (model, environment, materials) needs to be updated based on the provided config.
226
+ * Sets pending state for containers if storage or visibility changes are detected.
227
+ * @private
228
+ * @param {object} config - Configuration object containing model, scene, and materials info.
229
+ * @returns {void}
230
+ */
146
231
  #checkNeedToUpdateContainers(config) {
147
232
  const modelState = this.#data.containers.model;
148
233
  const modelHasStorage = !!config.model?.storage;
@@ -170,6 +255,13 @@ export class PrefViewer3D extends HTMLElement {
170
255
  }
171
256
  }
172
257
 
258
+ /**
259
+ * Checks if the camera option needs to be updated based on the provided options.
260
+ * Sets pending state for the camera if a change is detected.
261
+ * @private
262
+ * @param {object} options - Options object containing camera info.
263
+ * @returns {boolean} True if camera needs update, false otherwise.
264
+ */
173
265
  #checkNeedToUpdateCamera(options) {
174
266
  if (!options || options.camera === undefined || options.camera === "") {
175
267
  return false;
@@ -182,6 +274,13 @@ export class PrefViewer3D extends HTMLElement {
182
274
  return needUpdate;
183
275
  }
184
276
 
277
+ /**
278
+ * Checks if any material option needs to be updated based on the provided options.
279
+ * Sets pending state for materials if changes are detected.
280
+ * @private
281
+ * @param {object} options - Options object containing material info.
282
+ * @returns {boolean} True if any material needs update, false otherwise.
283
+ */
185
284
  #checkNeedToUpdateMaterials(options) {
186
285
  if (!options) {
187
286
  return false;
@@ -201,24 +300,34 @@ export class PrefViewer3D extends HTMLElement {
201
300
  return someNeedUpdate;
202
301
  }
203
302
 
204
-
303
+ /**
304
+ * Dispatches a "prefviewer3d-loading" event and updates loading state attributes.
305
+ * Used internally when a loading operation starts.
306
+ * @private
307
+ * @returns {void}
308
+ */
205
309
  #onLoading() {
206
- this.dispatchEvent(
207
- new CustomEvent("prefviewer3d-loading", {
208
- bubbles: true,
209
- cancelable: false,
210
- composed: true,
211
- })
212
- );
213
-
310
+ const customEventOptions = {
311
+ bubbles: true, // indicates whether the event bubbles up through the DOM tree or not
312
+ cancelable: true, // indicates whether the event can be canceled, and therefore prevented as if the event never happened
313
+ composed: false, // indicates whether or not the event will propagate across the shadow DOM boundary into the standard DOM
314
+ };
315
+ this.dispatchEvent(new CustomEvent("scene-loading", customEventOptions));
316
+
214
317
  this.removeAttribute("loaded");
215
318
  this.setAttribute("loading", "");
216
-
319
+
217
320
  if (this.#isLoaded === true) {
218
321
  this.#isLoaded = false;
219
322
  }
220
323
  }
221
-
324
+
325
+ /**
326
+ * Dispatches a "prefviewer3d-loaded" event with details about what was loaded and updates state attributes.
327
+ * Used internally when a loading operation completes.
328
+ * @private
329
+ * @returns {object} Detail object describing what was tried and what succeeded.
330
+ */
222
331
  #onLoaded() {
223
332
  const toLoadDetail = {
224
333
  container_model: this.#data.containers.model.isPending,
@@ -245,42 +354,52 @@ export class PrefViewer3D extends HTMLElement {
245
354
  success: loadedDetail,
246
355
  };
247
356
 
248
- this.dispatchEvent(
249
- new CustomEvent("prefviewer3d-loaded", {
250
- bubbles: true,
251
- cancelable: false,
252
- composed: true,
253
- detail: detail,
254
- })
255
- );
256
-
357
+ const customEventOptions = {
358
+ bubbles: true,
359
+ cancelable: true,
360
+ composed: false,
361
+ detail: detail,
362
+ };
363
+ this.dispatchEvent(new CustomEvent("scene-loaded", customEventOptions));
364
+
257
365
  this.removeAttribute("loading");
258
366
  this.setAttribute("loaded", "");
259
-
367
+
260
368
  this.#resetUpdateFlags();
261
369
  this.#isLoaded = true;
262
370
 
263
371
  return detail;
264
372
  }
265
373
 
374
+ /**
375
+ * Dispatches a "prefviewer3d-setting-options" event and updates loading state attributes.
376
+ * Used internally when options are being set.
377
+ * @private
378
+ * @returns {void}
379
+ */
266
380
  #onSettingOptions() {
267
- this.dispatchEvent(
268
- new CustomEvent("prefviewer3d-setting-options", {
269
- bubbles: true,
270
- cancelable: false,
271
- composed: true,
272
- })
273
- );
274
-
381
+ const customEventOptions = {
382
+ bubbles: true,
383
+ cancelable: true,
384
+ composed: false,
385
+ };
386
+ this.dispatchEvent(new CustomEvent("scene-setting-options", customEventOptions));
387
+
275
388
  this.removeAttribute("loaded");
276
389
  this.setAttribute("loading", "");
277
-
390
+
278
391
  if (this.#isLoaded === true) {
279
392
  this.#isLoaded = false;
280
393
  }
281
394
  }
282
-
283
- #onSettedOptions() {
395
+
396
+ /**
397
+ * Dispatches a "prefviewer3d-loaded" event with details about what options were set and updates state attributes.
398
+ * Used internally when options have been set.
399
+ * @private
400
+ * @returns {object} Detail object describing what was tried and what succeeded.
401
+ */
402
+ #onSetOptions() {
284
403
  const toSetDetail = {
285
404
  camera: this.#data.options.camera.isPending,
286
405
  innerWallMaterial: this.#data.options.materials.innerWall.isPending,
@@ -299,19 +418,18 @@ export class PrefViewer3D extends HTMLElement {
299
418
  tried: toSetDetail,
300
419
  success: settedDetail,
301
420
  };
302
-
303
- this.dispatchEvent(
304
- new CustomEvent("prefviewer3d-loaded", {
305
- bubbles: true,
306
- cancelable: false,
307
- composed: true,
308
- detail: detail,
309
- })
310
- );
311
421
 
422
+ const customEventOptions = {
423
+ bubbles: true,
424
+ cancelable: true,
425
+ composed: false,
426
+ detail: detail,
427
+ };
428
+ this.dispatchEvent(new CustomEvent("scene-set-options", customEventOptions));
429
+
312
430
  this.removeAttribute("loading");
313
431
  this.setAttribute("loaded", "");
314
-
432
+
315
433
  this.#resetUpdateFlags();
316
434
  this.#isLoaded = true;
317
435
 
@@ -322,22 +440,40 @@ export class PrefViewer3D extends HTMLElement {
322
440
  * ---------------------------
323
441
  * Public methods
324
442
  * ---------------------------
325
- */
443
+ */
444
+
445
+ /**
446
+ * Hides the 3D viewer component by updating its visibility state and DOM attribute.
447
+ * @public
448
+ * @returns {void}
449
+ */
326
450
  hide() {
327
- this.#isVisible = false;
328
- this.setAttribute("visible", "false");
451
+ this.#isVisible = false;
452
+ this.setAttribute("visible", "false");
329
453
  }
330
-
454
+
455
+ /**
456
+ * Shows the 3D viewer component by updating its visibility state and DOM attribute.
457
+ * @public
458
+ * @returns {void}
459
+ */
331
460
  show() {
332
461
  this.#isVisible = true;
333
462
  this.setAttribute("visible", "true");
334
463
  }
335
464
 
465
+ /**
466
+ * Loads the provided configuration into the 3D viewer.
467
+ * Updates containers and options, triggers loading events, and returns the loading result.
468
+ * @public
469
+ * @param {object} config - Configuration object containing containers and options.
470
+ * @returns {Promise<object>} Resolves with an object containing success and error status and loading details.
471
+ */
336
472
  async load(config) {
337
473
  if (!this.#babylonJSController) {
338
474
  return;
339
475
  }
340
-
476
+
341
477
  this.#onLoading();
342
478
 
343
479
  // Containers
@@ -349,11 +485,18 @@ export class PrefViewer3D extends HTMLElement {
349
485
  this.#checkNeedToUpdateMaterials(config.options);
350
486
  }
351
487
 
352
- const success = await this.#babylonJSController.load();
353
-
354
- return { success: success, detail: this.#onLoaded() };
488
+ const loadDetail = await this.#babylonJSController.load();
489
+
490
+ return { ...loadDetail, load: this.#onLoaded() };
355
491
  }
356
492
 
493
+ /**
494
+ * Sets viewer options such as camera and materials.
495
+ * Updates internal states, triggers option setting events, and returns the result.
496
+ * @public
497
+ * @param {object} options - Options object containing camera and material settings.
498
+ * @returns {object} Object containing success status and details of set options.
499
+ */
357
500
  setOptions(options) {
358
501
  if (!this.#babylonJSController) {
359
502
  return;
@@ -368,10 +511,15 @@ export class PrefViewer3D extends HTMLElement {
368
511
  if (this.#checkNeedToUpdateMaterials(options)) {
369
512
  someSetted = someSetted || this.#babylonJSController.setMaterialOptions();
370
513
  }
371
- const detail = this.#onSettedOptions();
372
- return {success: someSetted, detail: detail};
514
+ const detail = this.#onSetOptions();
515
+ return { success: someSetted, detail: detail };
373
516
  }
374
517
 
518
+ /**
519
+ * Shows the 3D model within the viewer.
520
+ * @public
521
+ * @returns {void}
522
+ */
375
523
  showModel() {
376
524
  if (!this.#babylonJSController) {
377
525
  return;
@@ -379,6 +527,11 @@ export class PrefViewer3D extends HTMLElement {
379
527
  this.#babylonJSController.setContainerVisibility("model", true);
380
528
  }
381
529
 
530
+ /**
531
+ * Hides the 3D model within the viewer.
532
+ * @public
533
+ * @returns {void}
534
+ */
382
535
  hideModel() {
383
536
  if (!this.#babylonJSController) {
384
537
  return;
@@ -386,6 +539,11 @@ export class PrefViewer3D extends HTMLElement {
386
539
  this.#babylonJSController.setContainerVisibility("model", false);
387
540
  }
388
541
 
542
+ /**
543
+ * Shows the 3D environment/scene within the viewer.
544
+ * @public
545
+ * @returns {void}
546
+ */
389
547
  showEnvironment() {
390
548
  if (!this.#babylonJSController) {
391
549
  return;
@@ -393,6 +551,11 @@ export class PrefViewer3D extends HTMLElement {
393
551
  this.#babylonJSController.setContainerVisibility("environment", true);
394
552
  }
395
553
 
554
+ /**
555
+ * Hides the 3D environment/scene within the viewer.
556
+ * @public
557
+ * @returns {void}
558
+ */
396
559
  hideEnvironment() {
397
560
  if (!this.#babylonJSController) {
398
561
  return;
@@ -400,32 +563,112 @@ export class PrefViewer3D extends HTMLElement {
400
563
  this.#babylonJSController.setContainerVisibility("environment", false);
401
564
  }
402
565
 
566
+ /**
567
+ * Downloads the current 3D model as a GLB file.
568
+ * @public
569
+ * @returns {void}
570
+ */
403
571
  downloadModelGLB() {
404
572
  if (!this.#babylonJSController) {
405
573
  return;
406
574
  }
407
- this.#babylonJSController.downloadModelGLB();
575
+ this.#babylonJSController.downloadGLB(1);
576
+ }
577
+
578
+ /**
579
+ * Downloads the current 3D model as a glTF file (ZIP with gltf and all resources (textures, buffers, etc.)).
580
+ * @public
581
+ * @returns {void}
582
+ */
583
+ downloadModelGLTF() {
584
+ if (!this.#babylonJSController) {
585
+ return;
586
+ }
587
+ this.#babylonJSController.downloadGLTF(1);
408
588
  }
409
589
 
590
+ /**
591
+ * Downloads the current 3D model as a USDZ file.
592
+ * @public
593
+ * @returns {void}
594
+ */
410
595
  downloadModelUSDZ() {
411
596
  if (!this.#babylonJSController) {
412
597
  return;
413
598
  }
414
- this.#babylonJSController.downloadModelUSDZ();
599
+ this.#babylonJSController.downloadUSDZ(1);
600
+ }
601
+
602
+ /**
603
+ * Downloads the current 3D complete scene (model and environment) as a GLB file.
604
+ * @public
605
+ * @returns {void}
606
+ */
607
+ downloadModelAndSceneGLB() {
608
+ if (!this.#babylonJSController) {
609
+ return;
610
+ }
611
+ this.#babylonJSController.downloadModelGLB(0);
415
612
  }
416
613
 
614
+ /**
615
+ * Downloads the current 3D complete scene (model and environment) as a glTF file (ZIP with gltf and all resources (textures, buffers, etc.)).
616
+ * @public
617
+ * @returns {void}
618
+ */
619
+ downloadModelAndSceneGLTF() {
620
+ if (!this.#babylonJSController) {
621
+ return;
622
+ }
623
+ this.#babylonJSController.downloadGLTF(0);
624
+ }
625
+
626
+ /**
627
+ * Downloads the current 3D complete scene (model and environment) as a USDZ file.
628
+ * @public
629
+ * @returns {void}
630
+ */
417
631
  downloadModelAndSceneUSDZ() {
418
632
  if (!this.#babylonJSController) {
419
633
  return;
420
634
  }
421
- this.#babylonJSController.downloadModelAndSceneUSDZ();
635
+ this.#babylonJSController.downloadUSDZ(0);
422
636
  }
423
637
 
424
- downloadModelAndSceneGLB() {
638
+ /**
639
+ * Downloads the current 3D environment as a GLB file.
640
+ * @public
641
+ * @returns {void}
642
+ */
643
+ downloadSceneGLB() {
644
+ if (!this.#babylonJSController) {
645
+ return;
646
+ }
647
+ this.#babylonJSController.downloadGLB(2);
648
+ }
649
+
650
+ /**
651
+ * Downloads the current 3D environment as a glTF file (ZIP with gltf and all resources (textures, buffers, etc.)).
652
+ * @public
653
+ * @returns {void}
654
+ */
655
+ downloadSceneGLTF() {
656
+ if (!this.#babylonJSController) {
657
+ return;
658
+ }
659
+ this.#babylonJSController.downloadGLTF(2);
660
+ }
661
+
662
+ /**
663
+ * Downloads the current 3D environment as a USDZ file.
664
+ * @public
665
+ * @returns {void}
666
+ */
667
+ downloadSceneUSDZ() {
425
668
  if (!this.#babylonJSController) {
426
669
  return;
427
670
  }
428
- this.#babylonJSController.downloadModelAndSceneGLB();
671
+ this.#babylonJSController.downloadUSDZ(2);
429
672
  }
430
673
 
431
674
  /**
@@ -433,7 +676,7 @@ export class PrefViewer3D extends HTMLElement {
433
676
  * @public
434
677
  * @returns {boolean} True if the component is initialized; otherwise, false.
435
678
  */
436
- get initialized() {
679
+ get isInitialized() {
437
680
  return this.#isInitialized;
438
681
  }
439
682
 
@@ -442,7 +685,7 @@ export class PrefViewer3D extends HTMLElement {
442
685
  * @public
443
686
  * @returns {boolean} True if the GLTF/GLB is loaded; otherwise, false.
444
687
  */
445
- get loaded() {
688
+ get isLoaded() {
446
689
  return this.#isLoaded;
447
690
  }
448
691
 
@@ -451,7 +694,7 @@ export class PrefViewer3D extends HTMLElement {
451
694
  * @public
452
695
  * @returns {boolean} True if the component is visible; otherwise, false.
453
696
  */
454
- get visible() {
697
+ get isVisible() {
455
698
  return this.#isVisible;
456
699
  }
457
700
  }