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.js CHANGED
@@ -72724,6 +72724,7 @@ var Scene = class {
72724
72724
  */
72725
72725
  dispose() {
72726
72726
  this.clear();
72727
+ this._renderer?.remove(this);
72727
72728
  this._renderer = null;
72728
72729
  }
72729
72730
  };
@@ -74032,8 +74033,8 @@ var RenderScene = class {
74032
74033
  const vimIndex = scene.vim?.vimIndex ?? 0;
74033
74034
  this._vimScenesById[vimIndex] = void 0;
74034
74035
  for (let i = 0; i < scene.meshes.length; i++) this.threeScene.remove(scene.meshes[i].mesh);
74035
- const remainingScenes = this._vimScenesById.filter((s) => s !== void 0);
74036
- this._boundingBox = remainingScenes.length > 0 ? remainingScenes.map((s) => s.getBoundingBox()).reduce((b1, b2) => b1.union(b2)) : void 0;
74036
+ const boxes = this._vimScenesById.filter((s) => s !== void 0).map((s) => s.getBoundingBox()).filter((b) => b !== void 0);
74037
+ this._boundingBox = boxes.length > 0 ? boxes.reduce((b1, b2) => b1.union(b2)) : void 0;
74037
74038
  }
74038
74039
  };
74039
74040
  //#endregion
@@ -80913,19 +80914,19 @@ function frameScene({ height = 20, width = 20, fill = "currentColor", className
80913
80914
  }),
80914
80915
  /* @__PURE__ */ jsx("path", {
80915
80916
  fill,
80916
- 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"
80917
+ 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"
80917
80918
  }),
80918
80919
  /* @__PURE__ */ jsx("path", {
80919
80920
  fill,
80920
- 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"
80921
+ 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"
80921
80922
  }),
80922
80923
  /* @__PURE__ */ jsx("path", {
80923
80924
  fill,
80924
- 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"
80925
+ 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"
80925
80926
  }),
80926
80927
  /* @__PURE__ */ jsx("path", {
80927
80928
  fill,
80928
- 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"
80929
+ 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"
80929
80930
  })
80930
80931
  ]
80931
80932
  });
@@ -86213,6 +86214,34 @@ function footer$1() {
86213
86214
  return /* @__PURE__ */ jsx(Fragment, {});
86214
86215
  }
86215
86216
  //#endregion
86217
+ //#region src/vim-web/react-viewers/errors/webglFileError.tsx
86218
+ /**
86219
+ * Error modal shown when a WebGL load fails. Surfaces the underlying error and
86220
+ * the source so the cause isn't hidden. This is the WebGL counterpart to the
86221
+ * Ultra error modals — using an Ultra modal here mislabels the failure.
86222
+ */
86223
+ function webglFileError(url, error) {
86224
+ return {
86225
+ title: "VIM File Error",
86226
+ body: body$6(url, error),
86227
+ footer: footer$1(),
86228
+ canClose: true
86229
+ };
86230
+ }
86231
+ function body$6(url, error) {
86232
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
86233
+ mainText(/* @__PURE__ */ jsx(Fragment, { children: "We encountered an error loading the VIM file." })),
86234
+ subTitle("Details"),
86235
+ dotList([url ? bullet("Source:", url) : null, error ? bullet("Error:", error) : null]),
86236
+ subTitle("Tips"),
86237
+ numList([
86238
+ "Ensure the source points to a valid VIM file",
86239
+ "Check your network connection and access policies",
86240
+ "Reload the page"
86241
+ ])
86242
+ ] });
86243
+ }
86244
+ //#endregion
86216
86245
  //#region src/vim-web/react-viewers/ultra/errors/fileOpeningError.tsx
86217
86246
  function fileOpeningError(url) {
86218
86247
  return {
@@ -86501,7 +86530,7 @@ var ComponentLoader = class {
86501
86530
  * Event emitter for error notifications.
86502
86531
  */
86503
86532
  onError(e) {
86504
- this._modal.current?.message(serverFileDownloadingError(e.url));
86533
+ this._modal.current?.message(webglFileError(e.url, e.error));
86505
86534
  }
86506
86535
  /**
86507
86536
  * Opens a vim file without loading geometry.
@@ -87135,6 +87164,7 @@ function useSharedIsolation(adapter) {
87135
87164
  });
87136
87165
  useEffect(() => {
87137
87166
  adapter.showGhost(showGhost.get());
87167
+ adapter.setGhostOpacity(ghostOpacity.get());
87138
87168
  }, []);
87139
87169
  useSubscribe(adapter.onVisibilityChange, () => onVisibilityChange.call());
87140
87170
  useSubscribe(adapter.onSelectionChanged, () => {
@@ -87205,6 +87235,11 @@ function useRenderSettings(adapter) {
87205
87235
  //#endregion
87206
87236
  //#region src/vim-web/react-viewers/webgl/isolation.ts
87207
87237
  function useWebglIsolation(viewer, initialState) {
87238
+ const seeded = useRef(false);
87239
+ if (!seeded.current) {
87240
+ seeded.current = true;
87241
+ if (initialState?.ghostOpacity !== void 0) viewer.materials.ghostOpacity = initialState.ghostOpacity;
87242
+ }
87208
87243
  const { isolationAdapter, renderSettingsAdapter } = createWebglAdapters(viewer, initialState);
87209
87244
  return {
87210
87245
  isolation: useSharedIsolation(isolationAdapter),