vim-web 0.3.44-dev.70 → 0.3.44-dev.72

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.
Files changed (26) hide show
  1. package/dist/types/react-viewers/generic/genericField.d.ts +26 -0
  2. package/dist/types/react-viewers/generic/genericPanel.d.ts +12 -0
  3. package/dist/types/react-viewers/generic/index.d.ts +2 -0
  4. package/dist/types/react-viewers/helpers/customizer.d.ts +4 -0
  5. package/dist/types/react-viewers/helpers/index.d.ts +6 -9
  6. package/dist/types/react-viewers/helpers/layout.d.ts +24 -0
  7. package/dist/types/react-viewers/index.d.ts +2 -1
  8. package/dist/types/react-viewers/panels/contextMenu.d.ts +2 -2
  9. package/dist/types/react-viewers/panels/index.d.ts +1 -2
  10. package/dist/types/react-viewers/panels/isolationPanel.d.ts +5 -0
  11. package/dist/types/react-viewers/panels/modal.d.ts +2 -2
  12. package/dist/types/react-viewers/panels/sectionBoxPanel.d.ts +3 -2
  13. package/dist/types/react-viewers/state/controlBarState.d.ts +2 -2
  14. package/dist/types/react-viewers/ultra/modal.d.ts +3 -3
  15. package/dist/types/react-viewers/ultra/viewerRef.d.ts +11 -2
  16. package/dist/types/react-viewers/webgl/loading.d.ts +2 -2
  17. package/dist/types/react-viewers/webgl/viewerRef.d.ts +11 -2
  18. package/dist/types/react-viewers/webgl/viewerState.d.ts +1 -1
  19. package/dist/vim-web.iife.js +304 -201
  20. package/dist/vim-web.iife.js.map +1 -1
  21. package/dist/vim-web.js +305 -202
  22. package/dist/vim-web.js.map +1 -1
  23. package/package.json +1 -1
  24. package/dist/types/react-viewers/panels/genericPanel.d.ts +0 -26
  25. package/dist/types/react-viewers/panels/renderSettingsPanel.d.ts +0 -4
  26. /package/dist/types/react-viewers/{components → generic}/inputNumber.d.ts +0 -0
package/dist/vim-web.js CHANGED
@@ -3,7 +3,7 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  var _a2;
5
5
  import * as React from "react";
6
- import React__default, { useState, useRef, useEffect, useMemo, useCallback, useImperativeHandle, useContext, Component, forwardRef, useSyncExternalStore, useLayoutEffect } from "react";
6
+ import React__default, { useState, useRef, useEffect, useMemo, useCallback, useImperativeHandle, useContext, Component, forwardRef, useLayoutEffect, useSyncExternalStore } from "react";
7
7
  import ReactDOM, { flushSync as flushSync$1 } from "react-dom";
8
8
  function getDefaultExportFromCjs(x) {
9
9
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
@@ -74567,92 +74567,13 @@ async function getFamilyTypeNameMap(document2) {
74567
74567
  })
74568
74568
  );
74569
74569
  }
74570
- class DeferredPromise extends Promise {
74571
- constructor(executor = () => {
74572
- }) {
74573
- var _a3;
74574
- let resolver;
74575
- let rejector;
74576
- super((resolve, reject) => {
74577
- resolver = resolve;
74578
- rejector = reject;
74579
- return executor(resolve, reject);
74580
- });
74581
- __publicField(this, "resolve");
74582
- __publicField(this, "reject");
74583
- __publicField(this, "initialCallStack");
74584
- this.resolve = resolver;
74585
- this.reject = rejector;
74586
- this.initialCallStack = (_a3 = Error().stack) == null ? void 0 : _a3.split("\n").slice(2).join("\n");
74587
- }
74588
- /** @throws error with amended call stack */
74589
- rejectWithError(error) {
74590
- var _a3;
74591
- error.stack = [(_a3 = error.stack) == null ? void 0 : _a3.split("\n")[0], this.initialCallStack].join("\n");
74592
- this.reject(error);
74593
- }
74594
- }
74595
- class LoadRequest2 {
74596
- constructor(callbacks, source, settings2) {
74597
- __publicField(this, "source");
74598
- __publicField(this, "_callbacks");
74599
- __publicField(this, "_request");
74600
- __publicField(this, "_progress", { loaded: 0, total: 0, all: /* @__PURE__ */ new Map() });
74601
- __publicField(this, "_progressPromise", new DeferredPromise());
74602
- __publicField(this, "_isDone", false);
74603
- __publicField(this, "_completionPromise", new DeferredPromise());
74604
- this.source = source;
74605
- this._callbacks = callbacks;
74606
- this.startRequest(source, settings2);
74607
- }
74608
- async startRequest(source, settings2) {
74609
- this._request = await requestVim(source, settings2);
74610
- for await (const progress of this._request.getProgress()) {
74611
- this.onProgress(progress);
74612
- }
74613
- const result = await this._request.getResult();
74614
- if (result.isError()) {
74615
- this.onError(result.error);
74616
- } else {
74617
- this.onSuccess();
74618
- }
74619
- }
74620
- onProgress(progress) {
74621
- this._callbacks.onProgress(progress);
74622
- this._progress = progress;
74623
- this._progressPromise.resolve();
74624
- this._progressPromise = new DeferredPromise();
74625
- }
74626
- onSuccess() {
74627
- this._callbacks.onDone();
74628
- this.end();
74629
- }
74630
- onError(error) {
74631
- this._callbacks.onError({
74632
- url: this.source.url,
74633
- error
74634
- });
74635
- this.end();
74636
- }
74637
- end() {
74638
- this._isDone = true;
74639
- this._progressPromise.resolve();
74640
- this._completionPromise.resolve();
74641
- }
74642
- async *getProgress() {
74643
- while (!this._isDone) {
74644
- await this._progressPromise;
74645
- yield this._progress;
74570
+ function useRefresher() {
74571
+ const [refresh, setRefresh] = useState(false);
74572
+ return {
74573
+ refresh: () => {
74574
+ setRefresh(!refresh);
74646
74575
  }
74647
- }
74648
- async getResult() {
74649
- await this._completionPromise;
74650
- return this._request.getResult();
74651
- }
74652
- abort() {
74653
- this._request.abort();
74654
- this.onError("Request aborted");
74655
- }
74576
+ };
74656
74577
  }
74657
74578
  function useStateRef(initialValue) {
74658
74579
  const [value, setValue] = useState(initialValue);
@@ -74849,6 +74770,45 @@ function useAsyncFuncRef(fn) {
74849
74770
  }
74850
74771
  };
74851
74772
  }
74773
+ function useArgFuncRef(fn) {
74774
+ const ref = useRef(fn);
74775
+ return {
74776
+ call(arg) {
74777
+ return ref == null ? void 0 : ref.current(arg);
74778
+ },
74779
+ get() {
74780
+ return ref.current;
74781
+ },
74782
+ set(fn2) {
74783
+ ref.current = fn2;
74784
+ },
74785
+ prepend(fn2) {
74786
+ const oldFn = ref.current;
74787
+ ref.current = (arg) => {
74788
+ fn2(arg);
74789
+ return oldFn(arg);
74790
+ };
74791
+ },
74792
+ append(fn2) {
74793
+ const oldFn = ref.current;
74794
+ ref.current = (arg) => {
74795
+ const result = oldFn(arg);
74796
+ fn2(arg);
74797
+ return result;
74798
+ };
74799
+ }
74800
+ };
74801
+ }
74802
+ const reactUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
74803
+ __proto__: null,
74804
+ useActionRef,
74805
+ useArgActionRef,
74806
+ useArgFuncRef,
74807
+ useAsyncFuncRef,
74808
+ useFuncRef,
74809
+ useRefresher,
74810
+ useStateRef
74811
+ }, Symbol.toStringTag, { value: "Module" }));
74852
74812
  function useViewerState(viewer) {
74853
74813
  const getVim = () => {
74854
74814
  var _a3;
@@ -74980,6 +74940,31 @@ function useBimInfo() {
74980
74940
  }
74981
74941
  };
74982
74942
  }
74943
+ class DeferredPromise extends Promise {
74944
+ constructor(executor = () => {
74945
+ }) {
74946
+ var _a3;
74947
+ let resolver;
74948
+ let rejector;
74949
+ super((resolve, reject) => {
74950
+ resolver = resolve;
74951
+ rejector = reject;
74952
+ return executor(resolve, reject);
74953
+ });
74954
+ __publicField(this, "resolve");
74955
+ __publicField(this, "reject");
74956
+ __publicField(this, "initialCallStack");
74957
+ this.resolve = resolver;
74958
+ this.reject = rejector;
74959
+ this.initialCallStack = (_a3 = Error().stack) == null ? void 0 : _a3.split("\n").slice(2).join("\n");
74960
+ }
74961
+ /** @throws error with amended call stack */
74962
+ rejectWithError(error) {
74963
+ var _a3;
74964
+ error.stack = [(_a3 = error.stack) == null ? void 0 : _a3.split("\n")[0], this.initialCallStack].join("\n");
74965
+ this.reject(error);
74966
+ }
74967
+ }
74983
74968
  const vcColorPrimary = "vc-text-[#212733]";
74984
74969
  const vcColorSecondary = "vc-text-[#787C83]";
74985
74970
  const vcColorLink = "vc-text-[#0590CC]";
@@ -75215,6 +75200,68 @@ const index$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
75215
75200
  serverFileLoadingError,
75216
75201
  serverStreamError
75217
75202
  }, Symbol.toStringTag, { value: "Module" }));
75203
+ class LoadRequest2 {
75204
+ constructor(callbacks, source, settings2) {
75205
+ __publicField(this, "source");
75206
+ __publicField(this, "_callbacks");
75207
+ __publicField(this, "_request");
75208
+ __publicField(this, "_progress", { loaded: 0, total: 0, all: /* @__PURE__ */ new Map() });
75209
+ __publicField(this, "_progressPromise", new DeferredPromise());
75210
+ __publicField(this, "_isDone", false);
75211
+ __publicField(this, "_completionPromise", new DeferredPromise());
75212
+ this.source = source;
75213
+ this._callbacks = callbacks;
75214
+ this.startRequest(source, settings2);
75215
+ }
75216
+ async startRequest(source, settings2) {
75217
+ this._request = await requestVim(source, settings2);
75218
+ for await (const progress of this._request.getProgress()) {
75219
+ this.onProgress(progress);
75220
+ }
75221
+ const result = await this._request.getResult();
75222
+ if (result.isError()) {
75223
+ this.onError(result.error);
75224
+ } else {
75225
+ this.onSuccess();
75226
+ }
75227
+ }
75228
+ onProgress(progress) {
75229
+ this._callbacks.onProgress(progress);
75230
+ this._progress = progress;
75231
+ this._progressPromise.resolve();
75232
+ this._progressPromise = new DeferredPromise();
75233
+ }
75234
+ onSuccess() {
75235
+ this._callbacks.onDone();
75236
+ this.end();
75237
+ }
75238
+ onError(error) {
75239
+ this._callbacks.onError({
75240
+ url: this.source.url,
75241
+ error
75242
+ });
75243
+ this.end();
75244
+ }
75245
+ end() {
75246
+ this._isDone = true;
75247
+ this._progressPromise.resolve();
75248
+ this._completionPromise.resolve();
75249
+ }
75250
+ async *getProgress() {
75251
+ while (!this._isDone) {
75252
+ await this._progressPromise;
75253
+ yield this._progress;
75254
+ }
75255
+ }
75256
+ async getResult() {
75257
+ await this._completionPromise;
75258
+ return this._request.getResult();
75259
+ }
75260
+ abort() {
75261
+ this._request.abort();
75262
+ this.onError("Request aborted");
75263
+ }
75264
+ }
75218
75265
  class ComponentLoader {
75219
75266
  constructor(viewer, modal) {
75220
75267
  __publicField(this, "_viewer");
@@ -75459,7 +75506,6 @@ const Modal = forwardRef((props, ref) => {
75459
75506
  const getActiveState = () => {
75460
75507
  return (state == null ? void 0 : state[0]) ?? (state == null ? void 0 : state[1]) ?? (state == null ? void 0 : state[2]);
75461
75508
  };
75462
- console.log("REnder Modal and setup Imperative handle");
75463
75509
  useImperativeHandle(ref, () => ({
75464
75510
  getActiveState,
75465
75511
  loading(content2) {
@@ -75533,6 +75579,35 @@ function modalContent(modal) {
75533
75579
  return /* @__PURE__ */ jsxRuntimeExports.jsx(LoadingBox, { content: modal });
75534
75580
  }
75535
75581
  }
75582
+ function computeFloatingPosition(originRect, panelRect) {
75583
+ let left = originRect.left + originRect.width / 2 - panelRect.width / 2;
75584
+ let top = originRect.top - 10 - panelRect.height;
75585
+ if (top < 10) {
75586
+ top = originRect.bottom + 10;
75587
+ }
75588
+ if (left < 10) {
75589
+ left = 10;
75590
+ } else if (left + panelRect.width > window.innerWidth - 10) {
75591
+ left = window.innerWidth - panelRect.width - 10;
75592
+ }
75593
+ return { top, left };
75594
+ }
75595
+ function useFloatingPanelPosition(panelRef, anchorElement, enabled) {
75596
+ const [position, setPosition] = useState({ top: 0, left: 0 });
75597
+ useLayoutEffect(() => {
75598
+ if (!enabled || !anchorElement || !panelRef.current) return;
75599
+ const updatePosition = () => {
75600
+ const originRect = anchorElement.getBoundingClientRect();
75601
+ const panelRect = panelRef.current.getBoundingClientRect();
75602
+ setPosition(computeFloatingPosition(originRect, panelRect));
75603
+ };
75604
+ updatePosition();
75605
+ const resizeObserver = new ResizeObserver(updatePosition);
75606
+ panelRef.current.parentElement && resizeObserver.observe(panelRef.current.parentElement);
75607
+ return () => resizeObserver.disconnect();
75608
+ }, [anchorElement, enabled]);
75609
+ return position;
75610
+ }
75536
75611
  function InputNumber(props) {
75537
75612
  const defaultValue = useRef(props.state.get());
75538
75613
  const externalValue = useSyncExternalStore(
@@ -75571,74 +75646,91 @@ function InputNumber(props) {
75571
75646
  }
75572
75647
  );
75573
75648
  }
75574
- function GenericPanel(props) {
75575
- const [panelPosition, setPanelPosition] = useState({
75576
- top: 0,
75577
- left: 0
75578
- });
75579
- const panelRef = useRef(null);
75580
- useLayoutEffect(() => {
75581
- const updatePosition = () => {
75582
- const { top, left } = computePosition(panelRef);
75583
- setPanelPosition({ top, left });
75584
- };
75585
- updatePosition();
75586
- let resizeObserver = null;
75587
- if (panelRef.current && panelRef.current.parentElement) {
75588
- resizeObserver = new ResizeObserver(updatePosition);
75589
- resizeObserver.observe(panelRef.current.parentElement);
75649
+ function GenericEntry(field) {
75650
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
75651
+ "div",
75652
+ {
75653
+ className: "vim-sectionbox-offsets-entry vc-text-xs vc-flex vc-items-center vc-justify-between vc-my-2",
75654
+ children: [
75655
+ /* @__PURE__ */ jsxRuntimeExports.jsx("dt", { className: "vc-w-1/2 vc-inline", children: field.label }),
75656
+ /* @__PURE__ */ jsxRuntimeExports.jsx("dd", { className: "vc-w-1/3 vc-inline", children: /* @__PURE__ */ jsxRuntimeExports.jsx(GenericField, { field }) })
75657
+ ]
75658
+ },
75659
+ field.id
75660
+ );
75661
+ }
75662
+ function GenericField(props) {
75663
+ switch (props.field.type) {
75664
+ case "number":
75665
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(InputNumber, { state: props.field.state });
75666
+ case "text":
75667
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(GenericTextField, { field: props.field });
75668
+ case "bool":
75669
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(GenericBoolField, { field: props.field });
75670
+ default:
75671
+ return null;
75672
+ }
75673
+ }
75674
+ function GenericTextField(props) {
75675
+ const refresher = useRefresher();
75676
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
75677
+ "input",
75678
+ {
75679
+ id: props.field.id,
75680
+ type: "text",
75681
+ value: props.field.state.get(),
75682
+ onChange: (e) => {
75683
+ refresher.refresh();
75684
+ props.field.state.set(e.target.value);
75685
+ },
75686
+ className: "vc-border vc-inline vc-border-gray-300 vc-py-1 vc-w-full vc-px-1",
75687
+ onBlur: () => props.field.state.confirm()
75590
75688
  }
75591
- return () => {
75592
- if (resizeObserver) {
75593
- resizeObserver.disconnect();
75594
- }
75595
- };
75596
- }, [props.showPanel.get()]);
75597
- if (!props.showPanel.get()) return null;
75598
- const createTextBox = (field) => {
75599
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
75600
- "input",
75601
- {
75602
- id: field.id,
75603
- type: "number",
75604
- value: field.state.get(),
75605
- onChange: (e) => field.state.set(e.target.value),
75606
- className: "vc-border vc-inline vc-border-gray-300 vc-py-1 vc-w-full vc-px-1",
75607
- onBlur: () => field.state.confirm()
75608
- }
75609
- );
75610
- };
75611
- const createCheckbox = (field) => /* @__PURE__ */ jsxRuntimeExports.jsx(
75689
+ );
75690
+ }
75691
+ function GenericBoolField(props) {
75692
+ const refresher = useRefresher();
75693
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
75612
75694
  "input",
75613
75695
  {
75614
- id: field.id,
75696
+ id: props.field.id,
75615
75697
  type: "checkbox",
75616
- checked: field.state.get(),
75617
- onChange: (e) => field.state.set(e.target.checked),
75698
+ checked: props.field.state.get(),
75699
+ onChange: (e) => {
75700
+ refresher.refresh();
75701
+ props.field.state.set(e.target.checked);
75702
+ },
75618
75703
  className: "vc-border vc-inline vc-border-gray-300 vc-py-1 vc-w-full vc-px-1"
75619
75704
  }
75620
75705
  );
75621
- const renderField = (field) => {
75622
- let fieldElement = null;
75623
- if (field.type === "number") {
75624
- fieldElement = /* @__PURE__ */ jsxRuntimeExports.jsx(InputNumber, { state: field.state });
75625
- } else if (field.type === "text") {
75626
- fieldElement = createTextBox(field);
75627
- } else if (field.type === "bool") {
75628
- fieldElement = createCheckbox(field);
75629
- }
75630
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
75631
- "div",
75632
- {
75633
- className: "vim-sectionbox-offsets-entry vc-text-xs vc-flex vc-items-center vc-justify-between vc-my-2",
75634
- children: [
75635
- /* @__PURE__ */ jsxRuntimeExports.jsx("dt", { className: "vc-w-1/2 vc-inline", children: field.label }),
75636
- /* @__PURE__ */ jsxRuntimeExports.jsx("dd", { className: "vc-w-1/3 vc-inline", children: fieldElement })
75637
- ]
75638
- },
75639
- field.id
75640
- );
75706
+ }
75707
+ function useCustomizer(baseEntries, ref) {
75708
+ const customization = useRef();
75709
+ const [entries, setEntries] = useState(baseEntries);
75710
+ const applyCustomization = () => {
75711
+ setEntries(customization.current ? customization.current(baseEntries) : baseEntries);
75641
75712
  };
75713
+ const setCustomization = (fn) => {
75714
+ customization.current = fn;
75715
+ applyCustomization();
75716
+ };
75717
+ useEffect(() => {
75718
+ applyCustomization();
75719
+ }, [baseEntries]);
75720
+ useImperativeHandle(ref, () => ({
75721
+ customize: setCustomization
75722
+ }));
75723
+ return entries;
75724
+ }
75725
+ const GenericPanel = forwardRef((props, ref) => {
75726
+ const panelRef = useRef(null);
75727
+ const panelPosition = useFloatingPanelPosition(
75728
+ panelRef,
75729
+ props.anchorElement,
75730
+ props.showPanel.get()
75731
+ );
75732
+ const entries = useCustomizer(props.entries, ref);
75733
+ if (!props.showPanel.get()) return null;
75642
75734
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "vc-fixed vc-inset-0 vc-flex vc-pointer-events-none", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
75643
75735
  "div",
75644
75736
  {
@@ -75658,47 +75750,34 @@ function GenericPanel(props) {
75658
75750
  "button",
75659
75751
  {
75660
75752
  className: "vc-flex vc-border-none vc-bg-transparent vc-text-sm vc-cursor-pointer",
75661
- onClick: props.onClose ? props.onClose : () => props.showPanel.set(false),
75753
+ onClick: props.onClose ?? (() => props.showPanel.set(false)),
75662
75754
  children: close({ height: 12, width: 12, fill: "currentColor" })
75663
75755
  }
75664
75756
  )
75665
75757
  ] }),
75666
- /* @__PURE__ */ jsxRuntimeExports.jsx("dl", { className: "vc-text-xl vc-text-gray-darker vc-mb-2 vc-mx-2", children: props.fields.map(renderField) })
75758
+ /* @__PURE__ */ jsxRuntimeExports.jsx("dl", { className: "vc-text-xl vc-text-gray-darker vc-mb-2 vc-mx-2", children: entries.map(GenericEntry) })
75667
75759
  ]
75668
75760
  }
75669
75761
  ) });
75670
- }
75671
- function computePosition(panelRef) {
75672
- const origin = document.getElementById("vim-control-bar");
75673
- if (origin && panelRef.current) {
75674
- const originRect = origin.getBoundingClientRect();
75675
- const panelRect = panelRef.current.getBoundingClientRect();
75676
- let left = originRect.left + originRect.width / 2 - panelRect.width / 2;
75677
- let top = originRect.top - 10 - panelRect.height;
75678
- if (top < 10) {
75679
- top = originRect.bottom + 10;
75680
- }
75681
- if (left < 10) {
75682
- left = 10;
75683
- }
75684
- if (left + panelRect.width > window.innerWidth - 10) {
75685
- left = window.innerWidth - panelRect.width - 10;
75686
- }
75687
- return { top, left };
75688
- }
75689
- return { top: 0, left: 0 };
75690
- }
75691
- function SectionBoxPanel(props) {
75692
- return GenericPanel({
75693
- header: "Section Box Offsets",
75694
- showPanel: props.state.showOffsetPanel,
75695
- fields: [
75696
- { type: "number", id: "topOffset", label: "Top Offset", state: props.state.topOffset },
75697
- { type: "number", id: "sideOffset", label: "Side Offset", state: props.state.sideOffset },
75698
- { type: "number", id: "bottomOffset", label: "Bottom Offset", state: props.state.bottomOffset }
75699
- ]
75700
- });
75701
- }
75762
+ });
75763
+ const SectionBoxPanel = forwardRef(
75764
+ (props, ref) => {
75765
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
75766
+ GenericPanel,
75767
+ {
75768
+ ref,
75769
+ header: "Section Box Offsets",
75770
+ anchorElement: document.getElementById("vim-control-bar"),
75771
+ showPanel: props.state.showOffsetPanel,
75772
+ entries: [
75773
+ { type: "number", id: "topOffset", label: "Top Offset", state: props.state.topOffset },
75774
+ { type: "number", id: "sideOffset", label: "Side Offset", state: props.state.sideOffset },
75775
+ { type: "number", id: "bottomOffset", label: "Bottom Offset", state: props.state.bottomOffset }
75776
+ ]
75777
+ }
75778
+ );
75779
+ }
75780
+ );
75702
75781
  function useSectionBox(adapter) {
75703
75782
  const enable = useStateRef(false);
75704
75783
  const visible2 = useStateRef(false);
@@ -75854,17 +75933,24 @@ function useViewerInput(handler, camera2) {
75854
75933
  handler.keyboard.registerKeyUp("KeyF", "replace", () => camera2.frameSelection.call());
75855
75934
  }, []);
75856
75935
  }
75857
- function IsolationSettingsPanel(props) {
75858
- return GenericPanel({
75859
- header: "Render Settings",
75860
- showPanel: props.state.showPanel,
75861
- fields: [
75862
- { type: "bool", id: "showGhost", label: "Show Ghost", state: props.state.showGhost },
75863
- // { type: 'bool', id: 'showRooms', label: 'Show Rooms', state: props.state.showRooms },
75864
- { type: "number", id: "ghostOpacity", label: "Ghost Opacity", state: props.state.ghostOpacity }
75865
- ]
75866
- });
75867
- }
75936
+ const IsolationPanel = forwardRef(
75937
+ (props, ref) => {
75938
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
75939
+ GenericPanel,
75940
+ {
75941
+ ref,
75942
+ header: "Render Settings",
75943
+ anchorElement: document.getElementById("vim-control-bar"),
75944
+ showPanel: props.state.showPanel,
75945
+ entries: [
75946
+ { type: "bool", id: "showGhost", label: "Show Ghost", state: props.state.showGhost },
75947
+ // { type: "bool", id: "showRooms", label: "Show Rooms", state: props.state.showRooms },
75948
+ { type: "number", id: "ghostOpacity", label: "Ghost Opacity", state: props.state.ghostOpacity }
75949
+ ]
75950
+ }
75951
+ );
75952
+ }
75953
+ );
75868
75954
  function useSharedIsolation(adapter) {
75869
75955
  const _adapter = useRef(adapter);
75870
75956
  const visibility = useStateRef(() => adapter.computeVisibility());
@@ -76034,6 +76120,8 @@ function Viewer$1(props) {
76034
76120
  const settings2 = useSettings(props.viewer, props.settings ?? {});
76035
76121
  const modal = useRef(null);
76036
76122
  const sectionBoxRef = useWebglSectionBox(props.viewer);
76123
+ const isolationPanelHandle = useRef(null);
76124
+ const sectionBoxPanelHandle = useRef(null);
76037
76125
  const camera2 = useWebglCamera(props.viewer, sectionBoxRef);
76038
76126
  const cursor = useMemo(() => new CursorManager(props.viewer), []);
76039
76127
  const loader = useRef(new ComponentLoader(props.viewer, modal));
@@ -76062,7 +76150,6 @@ function Viewer$1(props) {
76062
76150
  props.viewer.viewport.canvas.tabIndex = 0;
76063
76151
  applyWebglBindings(props.viewer, camera2, isolationRef, side);
76064
76152
  const subContext = props.viewer.inputs.onContextMenu.subscribe(showContextMenu);
76065
- console.log("ON MOUNT");
76066
76153
  props.onMount({
76067
76154
  container: props.container,
76068
76155
  core: props.viewer,
@@ -76070,6 +76157,12 @@ function Viewer$1(props) {
76070
76157
  isolation: isolationRef,
76071
76158
  camera: camera2,
76072
76159
  settings: settings2,
76160
+ get isolationPanel() {
76161
+ return isolationPanelHandle.current;
76162
+ },
76163
+ get sectionBoxPanel() {
76164
+ return sectionBoxPanelHandle.current;
76165
+ },
76073
76166
  get sectionBox() {
76074
76167
  return sectionBoxRef;
76075
76168
  },
@@ -76137,8 +76230,8 @@ function Viewer$1(props) {
76137
76230
  show: isTrue(settings2.value.ui.controlBar)
76138
76231
  }
76139
76232
  ),
76140
- /* @__PURE__ */ jsxRuntimeExports.jsx(SectionBoxPanel, { state: sectionBoxRef }),
76141
- /* @__PURE__ */ jsxRuntimeExports.jsx(IsolationSettingsPanel, { state: isolationRef }),
76233
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SectionBoxPanel, { ref: sectionBoxPanelHandle, state: sectionBoxRef }),
76234
+ /* @__PURE__ */ jsxRuntimeExports.jsx(IsolationPanel, { ref: isolationPanelHandle, state: isolationRef }),
76142
76235
  /* @__PURE__ */ jsxRuntimeExports.jsx(
76143
76236
  AxesPanelMemo,
76144
76237
  {
@@ -76416,9 +76509,11 @@ function createViewer(container) {
76416
76509
  return promise;
76417
76510
  }
76418
76511
  function Viewer3(props) {
76419
- const modal = useRef(null);
76420
76512
  const sectionBox2 = useUltraSectionBox(props.core);
76421
76513
  const camera2 = useUltraCamera(props.core, sectionBox2);
76514
+ const isolationPanelHandle = useRef(null);
76515
+ const sectionBoxPanelHandle = useRef(null);
76516
+ const modalHandle = useRef(null);
76422
76517
  const side = useSideState(true, 400);
76423
76518
  const [_, setSelectState] = useState(0);
76424
76519
  const [controlBarCustom, setControlBarCustom] = useState(() => (c) => c);
@@ -76426,24 +76521,30 @@ function Viewer3(props) {
76426
76521
  const controlBar = useUltraControlBar(props.core, sectionBox2, isolation, camera2, (_2) => _2);
76427
76522
  useViewerInput(props.core.inputs, camera2);
76428
76523
  useEffect(() => {
76429
- props.core.onStateChanged.subscribe((state) => updateModal(modal, state));
76524
+ props.core.onStateChanged.subscribe((state) => updateModal(modalHandle, state));
76430
76525
  props.core.selection.onSelectionChanged.subscribe(() => {
76431
76526
  setSelectState((i) => (i + 1) % 2);
76432
76527
  });
76433
76528
  props.onMount({
76434
76529
  core: props.core,
76435
76530
  get modal() {
76436
- return modal.current;
76531
+ return modalHandle.current;
76437
76532
  },
76438
76533
  isolation,
76439
76534
  sectionBox: sectionBox2,
76440
76535
  camera: camera2,
76536
+ get isolationPanel() {
76537
+ return isolationPanelHandle.current;
76538
+ },
76539
+ get sectionBoxPanel() {
76540
+ return sectionBoxPanelHandle.current;
76541
+ },
76441
76542
  dispose: () => {
76442
76543
  },
76443
76544
  controlBar: {
76444
76545
  customize: (v) => setControlBarCustom(() => v)
76445
76546
  },
76446
- load: patchLoad(props.core, modal)
76547
+ load: patchLoad(props.core, modalHandle)
76447
76548
  });
76448
76549
  }, []);
76449
76550
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
@@ -76458,11 +76559,11 @@ function Viewer3(props) {
76458
76559
  show: true
76459
76560
  }
76460
76561
  ),
76461
- /* @__PURE__ */ jsxRuntimeExports.jsx(SectionBoxPanel, { state: sectionBox2 }),
76462
- /* @__PURE__ */ jsxRuntimeExports.jsx(IsolationSettingsPanel, { state: isolation })
76562
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SectionBoxPanel, { ref: sectionBoxPanelHandle, state: sectionBox2 }),
76563
+ /* @__PURE__ */ jsxRuntimeExports.jsx(IsolationPanel, { ref: isolationPanelHandle, state: isolation })
76463
76564
  ] });
76464
76565
  } }),
76465
- /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { ref: modal, canFollowLinks: true }),
76566
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { ref: modalHandle, canFollowLinks: true }),
76466
76567
  /* @__PURE__ */ jsxRuntimeExports.jsx(
76467
76568
  ReactTooltip,
76468
76569
  {
@@ -76503,8 +76604,10 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
76503
76604
  __proto__: null,
76504
76605
  ContextMenu: contextMenu,
76505
76606
  ControlBar: index$5,
76607
+ DeferredPromise,
76506
76608
  Errors: index$3,
76507
76609
  Icons: icons,
76610
+ ReactUtils: reactUtils,
76508
76611
  Settings: index$4,
76509
76612
  Ultra: index$1,
76510
76613
  Urls: urls,