@preference-sl/pref-viewer 2.11.0-beta.11 → 2.11.0-beta.13

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,5 +1,6 @@
1
1
  import SVGResolver from "./svg-resolver.js";
2
2
  import PanzoomController from "./panzoom-controller.js";
3
+ import { PrefViewer2DStyles } from "./styles.js";
3
4
 
4
5
  /**
5
6
  * PrefViewer2D - Custom element for rendering and interacting with 2D SVG content.
@@ -46,7 +47,7 @@ import PanzoomController from "./panzoom-controller.js";
46
47
  * Notes on extensibility
47
48
  * - Modeled for easy addition of other input sources or interaction modes (e.g., selection callbacks).
48
49
  */
49
- export class PrefViewer2D extends HTMLElement {
50
+ export default class PrefViewer2D extends HTMLElement {
50
51
  // State flags
51
52
  #isInitialized = false;
52
53
  #isLoaded = false;
@@ -143,9 +144,9 @@ export class PrefViewer2D extends HTMLElement {
143
144
  #createDOMElements() {
144
145
  this.#wrapper = document.createElement("div");
145
146
  this.append(this.#wrapper);
147
+
146
148
  const style = document.createElement("style");
147
- const cssUrl = new URL("./css/pref-viewer-2d.css", import.meta.url);
148
- style.textContent = `@import "${cssUrl}";`;
149
+ style.textContent = PrefViewer2DStyles;
149
150
  this.append(style);
150
151
  }
151
152
 
@@ -1,5 +1,6 @@
1
1
  import { CameraData, ContainerData, MaterialData } from "./pref-viewer-3d-data.js";
2
2
  import BabylonJSController from "./babylonjs-controller.js";
3
+ import { PrefViewer3DStyles } from "./styles.js";
3
4
 
4
5
  /**
5
6
  * PrefViewer3D - Custom Web Component for interactive 3D visualization and configuration.
@@ -56,7 +57,7 @@ import BabylonJSController from "./babylonjs-controller.js";
56
57
  * - Designed for extensibility and integration in product configurators and visualization tools.
57
58
  * - All resource management and rendering operations are performed asynchronously for performance.
58
59
  */
59
- export class PrefViewer3D extends HTMLElement {
60
+ export default class PrefViewer3D extends HTMLElement {
60
61
  // State flags
61
62
  #isInitialized = false;
62
63
  #isLoaded = false;
@@ -157,11 +158,12 @@ export class PrefViewer3D extends HTMLElement {
157
158
  #createDOMElements() {
158
159
  this.#wrapper = document.createElement("div");
159
160
  this.append(this.#wrapper);
161
+
160
162
  this.#canvas = document.createElement("canvas");
161
163
  this.#wrapper.appendChild(this.#canvas);
164
+
162
165
  const style = document.createElement("style");
163
- const cssUrl = new URL("./css/pref-viewer-3d.css", import.meta.url);
164
- style.textContent = `@import "${cssUrl}";`;
166
+ style.textContent = PrefViewer3DStyles;
165
167
  this.append(style);
166
168
  }
167
169
 
@@ -461,6 +463,7 @@ export class PrefViewer3D extends HTMLElement {
461
463
  show() {
462
464
  this.#isVisible = true;
463
465
  this.setAttribute("visible", "true");
466
+ this.#canvas.focus();
464
467
  }
465
468
 
466
469
  /**
@@ -1,3 +1,5 @@
1
+ import { PrefViewerDialogStyles } from "./styles.js";
2
+
1
3
  /**
2
4
  * PrefViewerDialog - Custom Web Component for displaying modal dialogs in PrefViewer.
3
5
  *
@@ -20,7 +22,7 @@
20
22
  * - close(): Hides and removes the dialog, refocuses the canvas if available.
21
23
  * - #createDOMElements(): Creates the dialog structure and applies styles.
22
24
  */
23
- export class PrefViewerDialog extends HTMLElement {
25
+ export default class PrefViewerDialog extends HTMLElement {
24
26
  #wrapper = null;
25
27
  #header = null;
26
28
  #content = null;
@@ -68,8 +70,7 @@ export class PrefViewerDialog extends HTMLElement {
68
70
  this.append(this.#wrapper);
69
71
 
70
72
  const style = document.createElement("style");
71
- const cssUrl = new URL("./css/pref-viewer-dialog.css", import.meta.url);
72
- style.textContent = `@import "${cssUrl}";`;
73
+ style.textContent = PrefViewerDialogStyles;
73
74
  this.append(style);
74
75
 
75
76
  this.addEventListener("click", this.#closeOnBackdropClick.bind(this));
@@ -132,7 +133,6 @@ export class PrefViewerDialog extends HTMLElement {
132
133
  component2D.focus();
133
134
  }
134
135
  }
135
-
136
136
  }
137
137
  this.#wrapper = this.#header = this.#content = this.#footer = null;
138
138
  this.remove();
@@ -18,7 +18,7 @@
18
18
  * - Validates the type (case-insensitive) and throws a TypeError if invalid.
19
19
  * - Freezes the instance to prevent further modification.
20
20
  */
21
- export class PrefViewerTask {
21
+ export default class PrefViewerTask {
22
22
  static Types = Object.freeze({
23
23
  Config: "config",
24
24
  Drawing: "drawing",