vim-web 0.3.44-dev.15 → 0.3.44-dev.17

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
@@ -45819,7 +45819,7 @@ class ElementNoMapping {
45819
45819
  }
45820
45820
  }
45821
45821
  class ElementMapping {
45822
- constructor(instances, instanceToElement, elementIds2, instanceMeshes) {
45822
+ constructor(instances, instanceToElement, elementIds, instanceMeshes) {
45823
45823
  __publicField(this, "_instanceToElement");
45824
45824
  __publicField(this, "_instanceMeshes");
45825
45825
  __publicField(this, "_elementToInstances");
@@ -45832,17 +45832,17 @@ class ElementMapping {
45832
45832
  this._elementToInstances = ElementMapping.invertMap(
45833
45833
  this._instanceToElement
45834
45834
  );
45835
- this._elementIds = elementIds2;
45836
- this._elementIdToElements = ElementMapping.invertArray(elementIds2);
45835
+ this._elementIds = elementIds;
45836
+ this._elementIdToElements = ElementMapping.invertArray(elementIds);
45837
45837
  this._instanceMeshes = instanceMeshes;
45838
45838
  }
45839
45839
  static async fromG3d(g3d2, bim) {
45840
45840
  const instanceToElement = await bim.node.getAllElementIndex();
45841
- const elementIds2 = await bim.element.getAllId();
45841
+ const elementIds = await bim.element.getAllId();
45842
45842
  return new ElementMapping(
45843
45843
  Array.from(g3d2.instanceNodes),
45844
45844
  instanceToElement,
45845
- elementIds2,
45845
+ elementIds,
45846
45846
  g3d2.instanceMeshes
45847
45847
  );
45848
45848
  }
@@ -60796,8 +60796,8 @@ class Vim2 {
60796
60796
  if (nodes === "all") {
60797
60797
  this._rpc.RPCClearMaterialOverrides(this._handle);
60798
60798
  } else {
60799
- const ids = new Array(nodes.length).fill(MaterialHandles.Invalid);
60800
- this._rpc.RPCSetMaterialOverrides(this._handle, nodes, ids);
60799
+ const ids2 = new Array(nodes.length).fill(MaterialHandles.Invalid);
60800
+ this._rpc.RPCSetMaterialOverrides(this._handle, nodes, ids2);
60801
60801
  }
60802
60802
  }
60803
60803
  updateMap(nodes, state) {
@@ -67561,7 +67561,7 @@ function createSection$1(section) {
67561
67561
  if (section.enable !== void 0 && !section.enable()) return null;
67562
67562
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `vim-control-bar-section ${section.style ?? sectionDefaultStyle}`, children: section.buttons.map((b) => createButton(b)) }, section.id);
67563
67563
  }
67564
- const elementIds = {
67564
+ const ids = {
67565
67565
  // Sections
67566
67566
  sectionCamera: "controlBar.sectionCamera",
67567
67567
  sectionActions: "controlBar.sectionActions",
@@ -67623,7 +67623,7 @@ const controlBar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
67623
67623
  buttonExpandStyle,
67624
67624
  createButton,
67625
67625
  createSection: createSection$1,
67626
- elementIds,
67626
+ ids,
67627
67627
  sectionBlueStyle,
67628
67628
  sectionDefaultStyle,
67629
67629
  sectionNoPadStyle
@@ -67811,12 +67811,12 @@ function getMeasureState(viewer, cursor) {
67811
67811
  }
67812
67812
  function controlBarSectionBox(section, hasSelection) {
67813
67813
  return {
67814
- id: elementIds.sectionSectionBox,
67814
+ id: ids.sectionSectionBox,
67815
67815
  style: section.enable.get() ? sectionNoPadStyle : sectionDefaultStyle,
67816
67816
  //enable: () => section.getEnable(),
67817
67817
  buttons: [
67818
67818
  {
67819
- id: elementIds.buttonSectionBoxEnable,
67819
+ id: ids.buttonSectionBoxEnable,
67820
67820
  tip: "Enable Section Box",
67821
67821
  isOn: () => section.enable.get(),
67822
67822
  style: (on) => buttonExpandStyle(on),
@@ -67824,7 +67824,7 @@ function controlBarSectionBox(section, hasSelection) {
67824
67824
  icon: sectionBox
67825
67825
  },
67826
67826
  {
67827
- id: elementIds.buttonSectionBoxShrinkToSelection,
67827
+ id: ids.buttonSectionBoxShrinkToSelection,
67828
67828
  tip: "Fit Section",
67829
67829
  enabled: () => section.enable.get(),
67830
67830
  isOn: () => hasSelection,
@@ -67833,7 +67833,7 @@ function controlBarSectionBox(section, hasSelection) {
67833
67833
  icon: sectionBoxShrink
67834
67834
  },
67835
67835
  {
67836
- id: elementIds.buttonSectionBoxClip,
67836
+ id: ids.buttonSectionBoxClip,
67837
67837
  tip: "Reset Section",
67838
67838
  enabled: () => section.enable.get(),
67839
67839
  style: (on) => buttonDefaultStyle(on),
@@ -67841,7 +67841,7 @@ function controlBarSectionBox(section, hasSelection) {
67841
67841
  icon: sectionBoxReset
67842
67842
  },
67843
67843
  {
67844
- id: elementIds.buttonSectionBoxVisible,
67844
+ id: ids.buttonSectionBoxVisible,
67845
67845
  tip: "Show Section Box",
67846
67846
  enabled: () => section.enable.get(),
67847
67847
  isOn: () => section.visible.get(),
@@ -67850,7 +67850,7 @@ function controlBarSectionBox(section, hasSelection) {
67850
67850
  icon: visible
67851
67851
  },
67852
67852
  {
67853
- id: elementIds.buttonSectionBoxAuto,
67853
+ id: ids.buttonSectionBoxAuto,
67854
67854
  tip: "Auto Section",
67855
67855
  enabled: () => section.enable.get(),
67856
67856
  isOn: () => section.auto.get(),
@@ -67859,7 +67859,7 @@ function controlBarSectionBox(section, hasSelection) {
67859
67859
  icon: sectionBoxAuto
67860
67860
  },
67861
67861
  {
67862
- id: elementIds.buttonSectionBoxSettings,
67862
+ id: ids.buttonSectionBoxSettings,
67863
67863
  tip: "Section Settings",
67864
67864
  enabled: () => section.enable.get(),
67865
67865
  isOn: () => section.showOffsetPanel.get(),
@@ -67873,12 +67873,12 @@ function controlBarSectionBox(section, hasSelection) {
67873
67873
  function controlBarPointer(viewer, camera2, settings2, section) {
67874
67874
  const pointer = getPointerState(viewer);
67875
67875
  return {
67876
- id: elementIds.sectionCamera,
67876
+ id: ids.sectionCamera,
67877
67877
  enable: () => anyUiCursorButton(settings2),
67878
67878
  style: sectionDefaultStyle,
67879
67879
  buttons: [
67880
67880
  {
67881
- id: elementIds.buttonCameraOrbit,
67881
+ id: ids.buttonCameraOrbit,
67882
67882
  enabled: () => isTrue(settings2.ui.orbit),
67883
67883
  tip: "Orbit",
67884
67884
  action: () => pointer.onButton("orbit"),
@@ -67887,7 +67887,7 @@ function controlBarPointer(viewer, camera2, settings2, section) {
67887
67887
  style: buttonDefaultStyle
67888
67888
  },
67889
67889
  {
67890
- id: elementIds.buttonCameraLook,
67890
+ id: ids.buttonCameraLook,
67891
67891
  enabled: () => isTrue(settings2.ui.lookAround),
67892
67892
  tip: "Look Around",
67893
67893
  action: () => pointer.onButton("look"),
@@ -67896,7 +67896,7 @@ function controlBarPointer(viewer, camera2, settings2, section) {
67896
67896
  style: buttonDefaultStyle
67897
67897
  },
67898
67898
  {
67899
- id: elementIds.buttonCameraPan,
67899
+ id: ids.buttonCameraPan,
67900
67900
  enabled: () => isTrue(settings2.ui.pan),
67901
67901
  tip: "Pan",
67902
67902
  action: () => pointer.onButton("pan"),
@@ -67905,7 +67905,7 @@ function controlBarPointer(viewer, camera2, settings2, section) {
67905
67905
  style: buttonDefaultStyle
67906
67906
  },
67907
67907
  {
67908
- id: elementIds.buttonCameraZoom,
67908
+ id: ids.buttonCameraZoom,
67909
67909
  enabled: () => isTrue(settings2.ui.zoom),
67910
67910
  tip: "Zoom",
67911
67911
  action: () => pointer.onButton("zoom"),
@@ -67914,7 +67914,7 @@ function controlBarPointer(viewer, camera2, settings2, section) {
67914
67914
  style: buttonDefaultStyle
67915
67915
  },
67916
67916
  {
67917
- id: elementIds.buttonCameraZoomWindow,
67917
+ id: ids.buttonCameraZoomWindow,
67918
67918
  enabled: () => isTrue(settings2.ui.zoomWindow),
67919
67919
  tip: "Zoom Window",
67920
67920
  action: () => {
@@ -67929,12 +67929,12 @@ function controlBarPointer(viewer, camera2, settings2, section) {
67929
67929
  }
67930
67930
  function controlBarActions(camera2, settings2, isolation, measure$1) {
67931
67931
  return {
67932
- id: elementIds.sectionActions,
67932
+ id: ids.sectionActions,
67933
67933
  enable: () => true,
67934
67934
  style: sectionDefaultStyle,
67935
67935
  buttons: [
67936
67936
  {
67937
- id: elementIds.buttonZoomToFit,
67937
+ id: ids.buttonZoomToFit,
67938
67938
  enabled: () => isTrue(settings2.ui.zoomToFit),
67939
67939
  tip: "Zoom to Fit",
67940
67940
  action: () => camera2.frameContext(),
@@ -67943,7 +67943,7 @@ function controlBarActions(camera2, settings2, isolation, measure$1) {
67943
67943
  style: buttonDefaultStyle
67944
67944
  },
67945
67945
  {
67946
- id: elementIds.buttonToggleIsolation,
67946
+ id: ids.buttonToggleIsolation,
67947
67947
  enabled: () => isTrue(settings2.ui.toggleIsolation),
67948
67948
  tip: "Toggle Isolation",
67949
67949
  action: () => isolation.toggle("controlBar"),
@@ -67951,7 +67951,7 @@ function controlBarActions(camera2, settings2, isolation, measure$1) {
67951
67951
  style: buttonDefaultStyle
67952
67952
  },
67953
67953
  {
67954
- id: elementIds.buttonMeasure,
67954
+ id: ids.buttonMeasure,
67955
67955
  enabled: () => isTrue(settings2.ui.measuringMode),
67956
67956
  isOn: () => measure$1.active,
67957
67957
  tip: "Measuring Mode",
@@ -67965,12 +67965,12 @@ function controlBarActions(camera2, settings2, isolation, measure$1) {
67965
67965
  function controlBarSettings(modal, side, settings$1) {
67966
67966
  const fullScreen = getFullScreenState();
67967
67967
  return {
67968
- id: elementIds.sectionSettings,
67968
+ id: ids.sectionSettings,
67969
67969
  enable: () => anyUiSettingButton(settings$1),
67970
67970
  style: sectionDefaultStyle,
67971
67971
  buttons: [
67972
67972
  {
67973
- id: elementIds.buttonProjectInspector,
67973
+ id: ids.buttonProjectInspector,
67974
67974
  enabled: () => isTrue(settings$1.ui.projectInspector) && (isTrue(settings$1.ui.bimTreePanel) || isTrue(settings$1.ui.bimInfoPanel)),
67975
67975
  tip: "Project Inspector",
67976
67976
  action: () => side.toggleContent("bim"),
@@ -67978,7 +67978,7 @@ function controlBarSettings(modal, side, settings$1) {
67978
67978
  style: buttonDefaultStyle
67979
67979
  },
67980
67980
  {
67981
- id: elementIds.buttonSettings,
67981
+ id: ids.buttonSettings,
67982
67982
  enabled: () => isTrue(settings$1.ui.settings),
67983
67983
  tip: "Settings",
67984
67984
  action: () => side.toggleContent("settings"),
@@ -67986,7 +67986,7 @@ function controlBarSettings(modal, side, settings$1) {
67986
67986
  style: buttonDefaultStyle
67987
67987
  },
67988
67988
  {
67989
- id: elementIds.buttonHelp,
67989
+ id: ids.buttonHelp,
67990
67990
  enabled: () => isTrue(settings$1.ui.help),
67991
67991
  tip: "Help",
67992
67992
  action: () => modal.help(true),
@@ -67994,7 +67994,7 @@ function controlBarSettings(modal, side, settings$1) {
67994
67994
  style: buttonDefaultStyle
67995
67995
  },
67996
67996
  {
67997
- id: elementIds.buttonMaximize,
67997
+ id: ids.buttonMaximize,
67998
67998
  enabled: () => isTrue(settings$1.ui.maximise) && settings$1.capacity.canGoFullScreen,
67999
67999
  tip: fullScreen.get() ? "Minimize" : "Fullscreen",
68000
68000
  action: () => fullScreen.toggle(),
@@ -75872,19 +75872,15 @@ function useSectionBox(adapter) {
75872
75872
  const boxRef = useRef(adapter.getBox());
75873
75873
  enable.useOnChange((v) => {
75874
75874
  visible2.set(v);
75875
- auto.set(false);
75876
75875
  showOffsetPanel.set(false);
75877
- topOffset.set("1");
75878
- sideOffset.set("1");
75879
- bottomOffset.set("1");
75880
- void sectionReset.call();
75876
+ if (v && auto.get()) {
75877
+ sectionSelection.call();
75878
+ } else {
75879
+ sectionReset.call();
75880
+ }
75881
75881
  });
75882
- auto.useValidate((v) => v && enable.get());
75883
75882
  visible2.useValidate((v) => enable.get() && v);
75884
75883
  showOffsetPanel.useValidate((v) => enable.get() && v);
75885
- topOffset.useValidate((v) => enable.get() ? sanitize(v, false) : "1");
75886
- sideOffset.useValidate((v) => enable.get() ? sanitize(v, false) : "1");
75887
- bottomOffset.useValidate((v) => enable.get() ? sanitize(v, false) : "1");
75888
75884
  topOffset.useConfirm((v) => sanitize(v, true));
75889
75885
  sideOffset.useConfirm((v) => sanitize(v, true));
75890
75886
  bottomOffset.useConfirm((v) => sanitize(v, true));
@@ -75897,7 +75893,7 @@ function useSectionBox(adapter) {
75897
75893
  visible2.useOnChange((v) => adapter.setVisible(v));
75898
75894
  useEffect(() => {
75899
75895
  return adapter.onSelectionChanged.sub(() => {
75900
- if (auto.get()) sectionSelection.call();
75896
+ if (auto.get() && enable.get()) sectionSelection.call();
75901
75897
  });
75902
75898
  }, []);
75903
75899
  const section = useArgActionRef((baseBox) => {
@@ -76498,15 +76494,26 @@ function createUltraComponent(container) {
76498
76494
  function UltraComponent(props) {
76499
76495
  const modal = useModal(true);
76500
76496
  const sectionBox2 = useUltraSectionBox(props.viewer);
76501
- const controlBar2 = useUltraControlBar(props.viewer, sectionBox2, (_2) => _2);
76502
76497
  const side = useSideState(true, 400);
76503
76498
  const [_, setSelectState] = useState(0);
76499
+ const [controlBarCustom, setControlBarCustom] = useState(() => (c) => c);
76500
+ const controlBar2 = useUltraControlBar(props.viewer, sectionBox2, (_2) => _2);
76504
76501
  useEffect(() => {
76505
76502
  props.viewer.onStateChanged.subscribe((state) => updateModal(modal, state));
76506
76503
  props.viewer.selection.onValueChanged.subscribe(() => {
76507
76504
  setSelectState((i) => (i + 1) % 2);
76508
76505
  });
76509
- props.onMount(createComponentRef(props.viewer, modal, sectionBox2));
76506
+ props.onMount({
76507
+ viewer: props.viewer,
76508
+ modal,
76509
+ sectionBox: sectionBox2,
76510
+ dispose: () => {
76511
+ },
76512
+ controlBar: {
76513
+ customize: (v) => setControlBarCustom(() => v)
76514
+ },
76515
+ load: patchLoad(props.viewer, modal)
76516
+ });
76510
76517
  }, []);
76511
76518
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
76512
76519
  /* @__PURE__ */ jsxRuntimeExports.jsx(RestOfScreen, { side, content: () => {
@@ -76516,18 +76523,28 @@ function UltraComponent(props) {
76516
76523
  /* @__PURE__ */ jsxRuntimeExports.jsx(
76517
76524
  ControlBar,
76518
76525
  {
76519
- content: controlBar2,
76526
+ content: controlBarCustom(controlBar2),
76520
76527
  show: true
76521
76528
  }
76522
76529
  ),
76523
76530
  /* @__PURE__ */ jsxRuntimeExports.jsx(SectionBoxPanel, { state: sectionBox2 })
76524
76531
  ] });
76525
76532
  } }),
76526
- /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { state: modal })
76533
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { state: modal }),
76534
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
76535
+ ReactTooltip,
76536
+ {
76537
+ multiline: true,
76538
+ arrowColor: "transparent",
76539
+ type: "light",
76540
+ className: "!vc-max-w-xs !vc-border !vc-border-solid !vc-border-gray-medium !vc-bg-white !vc-text-xs !vc-text-gray-darkest !vc-opacity-100 !vc-shadow-[2px_6px_15px_rgba(0,0,0,0.3)] !vc-transition-opacity",
76541
+ delayShow: 200
76542
+ }
76543
+ )
76527
76544
  ] });
76528
76545
  }
76529
- function createComponentRef(viewer, modal, sectionBox2) {
76530
- function load(source) {
76546
+ function patchLoad(viewer, modal) {
76547
+ return function load(source) {
76531
76548
  const request2 = viewer.loadVim(source);
76532
76549
  void updateProgress(request2, modal);
76533
76550
  void request2.getResult().then(
@@ -76542,18 +76559,11 @@ function createComponentRef(viewer, modal, sectionBox2) {
76542
76559
  }
76543
76560
  );
76544
76561
  return request2;
76545
- }
76546
- return {
76547
- viewer,
76548
- modal,
76549
- sectionBox: sectionBox2,
76550
- dispose: () => {
76551
- },
76552
- load
76553
76562
  };
76554
76563
  }
76555
76564
  const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
76556
76565
  __proto__: null,
76566
+ ControlBar: controlBar,
76557
76567
  UltraComponent,
76558
76568
  createUltraComponent
76559
76569
  }, Symbol.toStringTag, { value: "Module" }));