vim-web 1.0.0-beta.2 → 1.0.0-beta.3

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/dist/vim-web.d.ts CHANGED
@@ -2644,6 +2644,12 @@ type IsolationSettings = {
2644
2644
  showGhost: boolean;
2645
2645
  showTransparent: boolean;
2646
2646
  showRooms: boolean;
2647
+ /**
2648
+ * Initial ghost (hidden-element) opacity, 0-1. When omitted the material's
2649
+ * built-in default is used. A persisted value from the settings panel (saved
2650
+ * to localStorage) takes precedence over this.
2651
+ */
2652
+ ghostOpacity?: number;
2647
2653
  };
2648
2654
  type SectionBoxSettings = {
2649
2655
  active: boolean;
@@ -72722,6 +72722,7 @@ while (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] &
72722
72722
  */
72723
72723
  dispose() {
72724
72724
  this.clear();
72725
+ this._renderer?.remove(this);
72725
72726
  this._renderer = null;
72726
72727
  }
72727
72728
  };
@@ -74030,8 +74031,8 @@ while (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] &
74030
74031
  const vimIndex = scene.vim?.vimIndex ?? 0;
74031
74032
  this._vimScenesById[vimIndex] = void 0;
74032
74033
  for (let i = 0; i < scene.meshes.length; i++) this.threeScene.remove(scene.meshes[i].mesh);
74033
- const remainingScenes = this._vimScenesById.filter((s) => s !== void 0);
74034
- this._boundingBox = remainingScenes.length > 0 ? remainingScenes.map((s) => s.getBoundingBox()).reduce((b1, b2) => b1.union(b2)) : void 0;
74034
+ const boxes = this._vimScenesById.filter((s) => s !== void 0).map((s) => s.getBoundingBox()).filter((b) => b !== void 0);
74035
+ this._boundingBox = boxes.length > 0 ? boxes.reduce((b1, b2) => b1.union(b2)) : void 0;
74035
74036
  }
74036
74037
  };
74037
74038
  //#endregion
@@ -80918,19 +80919,19 @@ Averrage Date/Second ${avgDataRatePS} kb
80918
80919
  }),
80919
80920
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
80920
80921
  fill,
80921
- d: "M210,204h-42c-6.627,0-12-5.373-12-12h0c0-6.627,5.373-12,12-12h24s0-24,0-24c0-6.627,5.373-12,12-12h0\n c6.627,0,12,5.373,12,12v42c0,3.314-2.686,6-6,6Z"
80922
+ d: "M210,204h-42c-6.627,0-12-5.373-12-12h0c0-6.627,5.373-12,12-12h24s0-24,0-24c0-6.627,5.373-12,12-12h0\r\n c6.627,0,12,5.373,12,12v42c0,3.314-2.686,6-6,6Z"
80922
80923
  }),
80923
80924
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
80924
80925
  fill,
80925
- d: "M40,198v-42c0-6.627,5.373-12,12-12h0c6.627,0,12,5.373,12,12v24s24,0,24,0\n c6.627,0,12,5.373,12,12h0c0,6.627-5.373,12-12,12H46c-3.314,0-6-2.686-6-6Z"
80926
+ d: "M40,198v-42c0-6.627,5.373-12,12-12h0c6.627,0,12,5.373,12,12v24s24,0,24,0\r\n c6.627,0,12,5.373,12,12h0c0,6.627-5.373,12-12,12H46c-3.314,0-6-2.686-6-6Z"
80926
80927
  }),
80927
80928
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
80928
80929
  fill,
80929
- d: "M46,52h42c6.627,0,12,5.373,12,12h0c0,6.627-5.373,12-12,12h-24s0,24,0,24\n c0,6.627-5.373,12-12,12h0c-6.627,0-12-5.373-12-12V58c0-3.314,2.686-6,6-6Z"
80930
+ d: "M46,52h42c6.627,0,12,5.373,12,12h0c0,6.627-5.373,12-12,12h-24s0,24,0,24\r\n c0,6.627-5.373,12-12,12h0c-6.627,0-12-5.373-12-12V58c0-3.314,2.686-6,6-6Z"
80930
80931
  }),
80931
80932
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
80932
80933
  fill,
80933
- d: "M216,58v42c0,6.627-5.373,12-12,12h0c-6.627,0-12-5.373-12-12v-24s-24,0-24,0\n c-6.627,0-12-5.373-12-12h0c0-6.627,5.373-12,12-12h42c3.314,0,6,2.686,6,6Z"
80934
+ d: "M216,58v42c0,6.627-5.373,12-12,12h0c-6.627,0-12-5.373-12-12v-24s-24,0-24,0\r\n c-6.627,0-12-5.373-12-12h0c0-6.627,5.373-12,12-12h42c3.314,0,6,2.686,6,6Z"
80934
80935
  })
80935
80936
  ]
80936
80937
  });
@@ -86218,6 +86219,34 @@ Averrage Date/Second ${avgDataRatePS} kb
86218
86219
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {});
86219
86220
  }
86220
86221
  //#endregion
86222
+ //#region src/vim-web/react-viewers/errors/webglFileError.tsx
86223
+ /**
86224
+ * Error modal shown when a WebGL load fails. Surfaces the underlying error and
86225
+ * the source so the cause isn't hidden. This is the WebGL counterpart to the
86226
+ * Ultra error modals — using an Ultra modal here mislabels the failure.
86227
+ */
86228
+ function webglFileError(url, error) {
86229
+ return {
86230
+ title: "VIM File Error",
86231
+ body: body$6(url, error),
86232
+ footer: footer$1(),
86233
+ canClose: true
86234
+ };
86235
+ }
86236
+ function body$6(url, error) {
86237
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
86238
+ mainText(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: "We encountered an error loading the VIM file." })),
86239
+ subTitle("Details"),
86240
+ dotList([url ? bullet("Source:", url) : null, error ? bullet("Error:", error) : null]),
86241
+ subTitle("Tips"),
86242
+ numList([
86243
+ "Ensure the source points to a valid VIM file",
86244
+ "Check your network connection and access policies",
86245
+ "Reload the page"
86246
+ ])
86247
+ ] });
86248
+ }
86249
+ //#endregion
86221
86250
  //#region src/vim-web/react-viewers/ultra/errors/fileOpeningError.tsx
86222
86251
  function fileOpeningError(url) {
86223
86252
  return {
@@ -86509,7 +86538,7 @@ Averrage Date/Second ${avgDataRatePS} kb
86509
86538
  * Event emitter for error notifications.
86510
86539
  */
86511
86540
  onError(e) {
86512
- this._modal.current?.message(serverFileDownloadingError(e.url));
86541
+ this._modal.current?.message(webglFileError(e.url, e.error));
86513
86542
  }
86514
86543
  /**
86515
86544
  * Opens a vim file without loading geometry.
@@ -87143,6 +87172,7 @@ Averrage Date/Second ${avgDataRatePS} kb
87143
87172
  });
87144
87173
  (0, react.useEffect)(() => {
87145
87174
  adapter.showGhost(showGhost.get());
87175
+ adapter.setGhostOpacity(ghostOpacity.get());
87146
87176
  }, []);
87147
87177
  useSubscribe(adapter.onVisibilityChange, () => onVisibilityChange.call());
87148
87178
  useSubscribe(adapter.onSelectionChanged, () => {
@@ -87213,6 +87243,11 @@ Averrage Date/Second ${avgDataRatePS} kb
87213
87243
  //#endregion
87214
87244
  //#region src/vim-web/react-viewers/webgl/isolation.ts
87215
87245
  function useWebglIsolation(viewer, initialState) {
87246
+ const seeded = (0, react.useRef)(false);
87247
+ if (!seeded.current) {
87248
+ seeded.current = true;
87249
+ if (initialState?.ghostOpacity !== void 0) viewer.materials.ghostOpacity = initialState.ghostOpacity;
87250
+ }
87216
87251
  const { isolationAdapter, renderSettingsAdapter } = createWebglAdapters(viewer, initialState);
87217
87252
  return {
87218
87253
  isolation: useSharedIsolation(isolationAdapter),