@leverege/tpi-viz 0.2.0 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/tpi-viz",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "3D scene viewer for TPI manufacturing data — renders blade geometry, PTZ cameras, defects, ply layers, and flows. Exports mountViewer()/destroy() for embedding (e.g. an Imaginarium React route); also runs standalone.",
5
5
  "type": "module",
6
6
  "exports": {
package/src/main.js CHANGED
@@ -2580,6 +2580,7 @@ function fmtN(v, d) {
2580
2580
  export async function mountViewer( container, opts = {} ) {
2581
2581
  if ( _alive ) { destroy(); } // idempotent re-mount
2582
2582
  _container = container || document.body;
2583
+ _container.classList.add( 'tpi-viz' ); // scopes all viewer CSS to this subtree
2583
2584
  if ( !_container.querySelector( '#app' ) ) { _container.innerHTML = VIEWER_SKELETON; }
2584
2585
  _opts = opts || {};
2585
2586
  _alive = true;
@@ -2612,5 +2613,5 @@ export function destroy() {
2612
2613
  selectedCameraIdx = -1;
2613
2614
  povCameraIdx = -1;
2614
2615
  activeFlowName = null;
2615
- if ( _container ) { _container.innerHTML = ''; _container = null; }
2616
+ if ( _container ) { _container.classList.remove( 'tpi-viz' ); _container.innerHTML = ''; _container = null; }
2616
2617
  }
@@ -747,7 +747,7 @@
747
747
  font-weight: bold;
748
748
  }
749
749
 
750
- input[type="range"] {
750
+ .tpi-viz input[type="range"] {
751
751
  width: 100%;
752
752
  height: 4px;
753
753
  appearance: none;
@@ -757,7 +757,7 @@ input[type="range"] {
757
757
  cursor: pointer;
758
758
  }
759
759
 
760
- input[type="range"]::-webkit-slider-thumb {
760
+ .tpi-viz input[type="range"]::-webkit-slider-thumb {
761
761
  appearance: none;
762
762
  width: 14px;
763
763
  height: 14px;
@@ -766,7 +766,7 @@ input[type="range"]::-webkit-slider-thumb {
766
766
  cursor: pointer;
767
767
  }
768
768
 
769
- input[type="range"]::-moz-range-thumb {
769
+ .tpi-viz input[type="range"]::-moz-range-thumb {
770
770
  width: 14px;
771
771
  height: 14px;
772
772
  background: var(--accent-blue);
@@ -52,15 +52,17 @@
52
52
  --shadow-med: 0 4px 18px rgba(0, 0, 0, 0.45);
53
53
  }
54
54
 
55
- /* Reset and base */
56
- * { margin: 0; padding: 0; box-sizing: border-box; }
55
+ /* Reset and base. Everything is scoped under .tpi-viz (the viewer root that
56
+ mountViewer adds to its container) so these rules NEVER leak into a host app
57
+ when the viewer is embedded — only the viewer's own subtree is affected. */
58
+ .tpi-viz, .tpi-viz * { margin: 0; padding: 0; box-sizing: border-box; }
57
59
 
58
- body {
60
+ .tpi-viz {
59
61
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
60
62
  font-feature-settings: 'tnum' 1, 'cv11' 1; /* tabular numerals */
61
63
  background: var(--bg-canvas);
62
64
  color: var(--text-1);
63
- height: 100vh;
65
+ height: 100%; /* fill the mount container (standalone: #viewer-root @ 100vh; embedded: the host's sized div) */
64
66
  overflow: hidden;
65
67
  -webkit-font-smoothing: antialiased;
66
68
  text-rendering: optimizeLegibility;
@@ -82,35 +84,35 @@ body {
82
84
  }
83
85
 
84
86
  /* Custom scrollbars — thin, blend with the dark surface */
85
- * {
87
+ .tpi-viz, .tpi-viz * {
86
88
  scrollbar-width: thin;
87
89
  scrollbar-color: var(--border-strong) transparent;
88
90
  }
89
- *::-webkit-scrollbar {
91
+ .tpi-viz ::-webkit-scrollbar {
90
92
  width: 8px;
91
93
  height: 8px;
92
94
  }
93
- *::-webkit-scrollbar-track { background: transparent; }
94
- *::-webkit-scrollbar-thumb {
95
+ .tpi-viz ::-webkit-scrollbar-track { background: transparent; }
96
+ .tpi-viz ::-webkit-scrollbar-thumb {
95
97
  background: var(--border-subtle);
96
98
  border-radius: 999px;
97
99
  border: 2px solid transparent;
98
100
  background-clip: padding-box;
99
101
  }
100
- *::-webkit-scrollbar-thumb:hover {
102
+ .tpi-viz ::-webkit-scrollbar-thumb:hover {
101
103
  background: var(--border-strong);
102
104
  background-clip: padding-box;
103
105
  border: 2px solid transparent;
104
106
  }
105
107
 
106
108
  /* Selection styling */
107
- ::selection {
109
+ .tpi-viz ::selection {
108
110
  background: rgba(122, 155, 255, 0.32);
109
111
  color: var(--text-1);
110
112
  }
111
113
 
112
114
  /* Focus ring for keyboard nav (subtle but visible) */
113
- :focus-visible {
115
+ .tpi-viz :focus-visible {
114
116
  outline: 2px solid var(--accent-blue);
115
117
  outline-offset: 2px;
116
118
  border-radius: var(--r-sm);
@@ -119,7 +121,7 @@ body {
119
121
  /* Layout */
120
122
  .container {
121
123
  display: flex;
122
- height: 100vh;
124
+ height: 100%;
123
125
  }
124
126
 
125
127
  .sidebar {