vim-web 0.3.44-dev.16 → 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.
@@ -1,4 +1,4 @@
1
- export declare const elementIds: {
1
+ export declare const ids: {
2
2
  sectionCamera: string;
3
3
  sectionActions: string;
4
4
  sectionTools: string;
@@ -1 +1,3 @@
1
1
  export * from './ultraComponent';
2
+ export * from './ultraComponentRef';
3
+ export * as ControlBar from '../controlbar/controlBar';
@@ -1,30 +1,6 @@
1
1
  import * as Ultra from '../../core-viewers/ultra/index';
2
2
  import { Container } from '../container';
3
- import { ModalRef } from '../panels/modal';
4
- import { SectionBoxRef } from '../state/sectionBoxState';
5
- export type UltraComponentRef = {
6
- /**
7
- * The Vim viewer instance associated with the component.
8
- */
9
- viewer: Ultra.Viewer;
10
- /**
11
- * API to manage the modal dialog.
12
- */
13
- modal: ModalRef;
14
- /**
15
- * API to manage the section box.
16
- */
17
- sectionBox: SectionBoxRef;
18
- /**
19
- * Disposes of the component and its resources.
20
- */
21
- dispose: () => void;
22
- /**
23
- * Loads a file into the viewer.
24
- * @param url The URL of the file to load.
25
- */
26
- load(url: Ultra.VimSource): Ultra.ILoadRequest;
27
- };
3
+ import { UltraComponentRef } from './ultraComponentRef';
28
4
  /**
29
5
  * Creates a UI container along with a VIM.Viewer and its associated React component.
30
6
  * @param container An optional container object. If none is provided, a container will be created.
@@ -0,0 +1,31 @@
1
+ import * as Ultra from '../../core-viewers/ultra';
2
+ import { ModalRef } from '../panels/modal';
3
+ import { SectionBoxRef } from '../state/sectionBoxState';
4
+ import { ControlBarRef } from '../webgl/webglComponentRef';
5
+ export type UltraComponentRef = {
6
+ /**
7
+ * The Vim viewer instance associated with the component.
8
+ */
9
+ viewer: Ultra.Viewer;
10
+ /**
11
+ * API to manage the modal dialog.
12
+ */
13
+ modal: ModalRef;
14
+ /**
15
+ * API to manage the section box.
16
+ */
17
+ sectionBox: SectionBoxRef;
18
+ /**
19
+ * API to customize the control.
20
+ */
21
+ controlBar: ControlBarRef;
22
+ /**
23
+ * Disposes of the component and its resources.
24
+ */
25
+ dispose: () => void;
26
+ /**
27
+ * Loads a file into the viewer.
28
+ * @param url The URL of the file to load.
29
+ */
30
+ load(url: Ultra.VimSource): Ultra.ILoadRequest;
31
+ };
@@ -45835,7 +45835,7 @@ void main() {
45835
45835
  }
45836
45836
  }
45837
45837
  class ElementMapping {
45838
- constructor(instances, instanceToElement, elementIds2, instanceMeshes) {
45838
+ constructor(instances, instanceToElement, elementIds, instanceMeshes) {
45839
45839
  __publicField(this, "_instanceToElement");
45840
45840
  __publicField(this, "_instanceMeshes");
45841
45841
  __publicField(this, "_elementToInstances");
@@ -45848,17 +45848,17 @@ void main() {
45848
45848
  this._elementToInstances = ElementMapping.invertMap(
45849
45849
  this._instanceToElement
45850
45850
  );
45851
- this._elementIds = elementIds2;
45852
- this._elementIdToElements = ElementMapping.invertArray(elementIds2);
45851
+ this._elementIds = elementIds;
45852
+ this._elementIdToElements = ElementMapping.invertArray(elementIds);
45853
45853
  this._instanceMeshes = instanceMeshes;
45854
45854
  }
45855
45855
  static async fromG3d(g3d2, bim) {
45856
45856
  const instanceToElement = await bim.node.getAllElementIndex();
45857
- const elementIds2 = await bim.element.getAllId();
45857
+ const elementIds = await bim.element.getAllId();
45858
45858
  return new ElementMapping(
45859
45859
  Array.from(g3d2.instanceNodes),
45860
45860
  instanceToElement,
45861
- elementIds2,
45861
+ elementIds,
45862
45862
  g3d2.instanceMeshes
45863
45863
  );
45864
45864
  }
@@ -60812,8 +60812,8 @@ Averrage Date/Second ${avgDataRatePS} kb
60812
60812
  if (nodes === "all") {
60813
60813
  this._rpc.RPCClearMaterialOverrides(this._handle);
60814
60814
  } else {
60815
- const ids = new Array(nodes.length).fill(MaterialHandles.Invalid);
60816
- this._rpc.RPCSetMaterialOverrides(this._handle, nodes, ids);
60815
+ const ids2 = new Array(nodes.length).fill(MaterialHandles.Invalid);
60816
+ this._rpc.RPCSetMaterialOverrides(this._handle, nodes, ids2);
60817
60817
  }
60818
60818
  }
60819
60819
  updateMap(nodes, state) {
@@ -67577,7 +67577,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67577
67577
  if (section.enable !== void 0 && !section.enable()) return null;
67578
67578
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `vim-control-bar-section ${section.style ?? sectionDefaultStyle}`, children: section.buttons.map((b) => createButton(b)) }, section.id);
67579
67579
  }
67580
- const elementIds = {
67580
+ const ids = {
67581
67581
  // Sections
67582
67582
  sectionCamera: "controlBar.sectionCamera",
67583
67583
  sectionActions: "controlBar.sectionActions",
@@ -67639,7 +67639,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67639
67639
  buttonExpandStyle,
67640
67640
  createButton,
67641
67641
  createSection: createSection$1,
67642
- elementIds,
67642
+ ids,
67643
67643
  sectionBlueStyle,
67644
67644
  sectionDefaultStyle,
67645
67645
  sectionNoPadStyle
@@ -67827,12 +67827,12 @@ Averrage Date/Second ${avgDataRatePS} kb
67827
67827
  }
67828
67828
  function controlBarSectionBox(section, hasSelection) {
67829
67829
  return {
67830
- id: elementIds.sectionSectionBox,
67830
+ id: ids.sectionSectionBox,
67831
67831
  style: section.enable.get() ? sectionNoPadStyle : sectionDefaultStyle,
67832
67832
  //enable: () => section.getEnable(),
67833
67833
  buttons: [
67834
67834
  {
67835
- id: elementIds.buttonSectionBoxEnable,
67835
+ id: ids.buttonSectionBoxEnable,
67836
67836
  tip: "Enable Section Box",
67837
67837
  isOn: () => section.enable.get(),
67838
67838
  style: (on) => buttonExpandStyle(on),
@@ -67840,7 +67840,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67840
67840
  icon: sectionBox
67841
67841
  },
67842
67842
  {
67843
- id: elementIds.buttonSectionBoxShrinkToSelection,
67843
+ id: ids.buttonSectionBoxShrinkToSelection,
67844
67844
  tip: "Fit Section",
67845
67845
  enabled: () => section.enable.get(),
67846
67846
  isOn: () => hasSelection,
@@ -67849,7 +67849,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67849
67849
  icon: sectionBoxShrink
67850
67850
  },
67851
67851
  {
67852
- id: elementIds.buttonSectionBoxClip,
67852
+ id: ids.buttonSectionBoxClip,
67853
67853
  tip: "Reset Section",
67854
67854
  enabled: () => section.enable.get(),
67855
67855
  style: (on) => buttonDefaultStyle(on),
@@ -67857,7 +67857,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67857
67857
  icon: sectionBoxReset
67858
67858
  },
67859
67859
  {
67860
- id: elementIds.buttonSectionBoxVisible,
67860
+ id: ids.buttonSectionBoxVisible,
67861
67861
  tip: "Show Section Box",
67862
67862
  enabled: () => section.enable.get(),
67863
67863
  isOn: () => section.visible.get(),
@@ -67866,7 +67866,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67866
67866
  icon: visible
67867
67867
  },
67868
67868
  {
67869
- id: elementIds.buttonSectionBoxAuto,
67869
+ id: ids.buttonSectionBoxAuto,
67870
67870
  tip: "Auto Section",
67871
67871
  enabled: () => section.enable.get(),
67872
67872
  isOn: () => section.auto.get(),
@@ -67875,7 +67875,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67875
67875
  icon: sectionBoxAuto
67876
67876
  },
67877
67877
  {
67878
- id: elementIds.buttonSectionBoxSettings,
67878
+ id: ids.buttonSectionBoxSettings,
67879
67879
  tip: "Section Settings",
67880
67880
  enabled: () => section.enable.get(),
67881
67881
  isOn: () => section.showOffsetPanel.get(),
@@ -67889,12 +67889,12 @@ Averrage Date/Second ${avgDataRatePS} kb
67889
67889
  function controlBarPointer(viewer, camera2, settings2, section) {
67890
67890
  const pointer = getPointerState(viewer);
67891
67891
  return {
67892
- id: elementIds.sectionCamera,
67892
+ id: ids.sectionCamera,
67893
67893
  enable: () => anyUiCursorButton(settings2),
67894
67894
  style: sectionDefaultStyle,
67895
67895
  buttons: [
67896
67896
  {
67897
- id: elementIds.buttonCameraOrbit,
67897
+ id: ids.buttonCameraOrbit,
67898
67898
  enabled: () => isTrue(settings2.ui.orbit),
67899
67899
  tip: "Orbit",
67900
67900
  action: () => pointer.onButton("orbit"),
@@ -67903,7 +67903,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67903
67903
  style: buttonDefaultStyle
67904
67904
  },
67905
67905
  {
67906
- id: elementIds.buttonCameraLook,
67906
+ id: ids.buttonCameraLook,
67907
67907
  enabled: () => isTrue(settings2.ui.lookAround),
67908
67908
  tip: "Look Around",
67909
67909
  action: () => pointer.onButton("look"),
@@ -67912,7 +67912,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67912
67912
  style: buttonDefaultStyle
67913
67913
  },
67914
67914
  {
67915
- id: elementIds.buttonCameraPan,
67915
+ id: ids.buttonCameraPan,
67916
67916
  enabled: () => isTrue(settings2.ui.pan),
67917
67917
  tip: "Pan",
67918
67918
  action: () => pointer.onButton("pan"),
@@ -67921,7 +67921,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67921
67921
  style: buttonDefaultStyle
67922
67922
  },
67923
67923
  {
67924
- id: elementIds.buttonCameraZoom,
67924
+ id: ids.buttonCameraZoom,
67925
67925
  enabled: () => isTrue(settings2.ui.zoom),
67926
67926
  tip: "Zoom",
67927
67927
  action: () => pointer.onButton("zoom"),
@@ -67930,7 +67930,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67930
67930
  style: buttonDefaultStyle
67931
67931
  },
67932
67932
  {
67933
- id: elementIds.buttonCameraZoomWindow,
67933
+ id: ids.buttonCameraZoomWindow,
67934
67934
  enabled: () => isTrue(settings2.ui.zoomWindow),
67935
67935
  tip: "Zoom Window",
67936
67936
  action: () => {
@@ -67945,12 +67945,12 @@ Averrage Date/Second ${avgDataRatePS} kb
67945
67945
  }
67946
67946
  function controlBarActions(camera2, settings2, isolation, measure$1) {
67947
67947
  return {
67948
- id: elementIds.sectionActions,
67948
+ id: ids.sectionActions,
67949
67949
  enable: () => true,
67950
67950
  style: sectionDefaultStyle,
67951
67951
  buttons: [
67952
67952
  {
67953
- id: elementIds.buttonZoomToFit,
67953
+ id: ids.buttonZoomToFit,
67954
67954
  enabled: () => isTrue(settings2.ui.zoomToFit),
67955
67955
  tip: "Zoom to Fit",
67956
67956
  action: () => camera2.frameContext(),
@@ -67959,7 +67959,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67959
67959
  style: buttonDefaultStyle
67960
67960
  },
67961
67961
  {
67962
- id: elementIds.buttonToggleIsolation,
67962
+ id: ids.buttonToggleIsolation,
67963
67963
  enabled: () => isTrue(settings2.ui.toggleIsolation),
67964
67964
  tip: "Toggle Isolation",
67965
67965
  action: () => isolation.toggle("controlBar"),
@@ -67967,7 +67967,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67967
67967
  style: buttonDefaultStyle
67968
67968
  },
67969
67969
  {
67970
- id: elementIds.buttonMeasure,
67970
+ id: ids.buttonMeasure,
67971
67971
  enabled: () => isTrue(settings2.ui.measuringMode),
67972
67972
  isOn: () => measure$1.active,
67973
67973
  tip: "Measuring Mode",
@@ -67981,12 +67981,12 @@ Averrage Date/Second ${avgDataRatePS} kb
67981
67981
  function controlBarSettings(modal, side, settings$1) {
67982
67982
  const fullScreen = getFullScreenState();
67983
67983
  return {
67984
- id: elementIds.sectionSettings,
67984
+ id: ids.sectionSettings,
67985
67985
  enable: () => anyUiSettingButton(settings$1),
67986
67986
  style: sectionDefaultStyle,
67987
67987
  buttons: [
67988
67988
  {
67989
- id: elementIds.buttonProjectInspector,
67989
+ id: ids.buttonProjectInspector,
67990
67990
  enabled: () => isTrue(settings$1.ui.projectInspector) && (isTrue(settings$1.ui.bimTreePanel) || isTrue(settings$1.ui.bimInfoPanel)),
67991
67991
  tip: "Project Inspector",
67992
67992
  action: () => side.toggleContent("bim"),
@@ -67994,7 +67994,7 @@ Averrage Date/Second ${avgDataRatePS} kb
67994
67994
  style: buttonDefaultStyle
67995
67995
  },
67996
67996
  {
67997
- id: elementIds.buttonSettings,
67997
+ id: ids.buttonSettings,
67998
67998
  enabled: () => isTrue(settings$1.ui.settings),
67999
67999
  tip: "Settings",
68000
68000
  action: () => side.toggleContent("settings"),
@@ -68002,7 +68002,7 @@ Averrage Date/Second ${avgDataRatePS} kb
68002
68002
  style: buttonDefaultStyle
68003
68003
  },
68004
68004
  {
68005
- id: elementIds.buttonHelp,
68005
+ id: ids.buttonHelp,
68006
68006
  enabled: () => isTrue(settings$1.ui.help),
68007
68007
  tip: "Help",
68008
68008
  action: () => modal.help(true),
@@ -68010,7 +68010,7 @@ Averrage Date/Second ${avgDataRatePS} kb
68010
68010
  style: buttonDefaultStyle
68011
68011
  },
68012
68012
  {
68013
- id: elementIds.buttonMaximize,
68013
+ id: ids.buttonMaximize,
68014
68014
  enabled: () => isTrue(settings$1.ui.maximise) && settings$1.capacity.canGoFullScreen,
68015
68015
  tip: fullScreen.get() ? "Minimize" : "Fullscreen",
68016
68016
  action: () => fullScreen.toggle(),
@@ -76510,15 +76510,26 @@ Averrage Date/Second ${avgDataRatePS} kb
76510
76510
  function UltraComponent(props) {
76511
76511
  const modal = useModal(true);
76512
76512
  const sectionBox2 = useUltraSectionBox(props.viewer);
76513
- const controlBar2 = useUltraControlBar(props.viewer, sectionBox2, (_2) => _2);
76514
76513
  const side = useSideState(true, 400);
76515
76514
  const [_, setSelectState] = React2.useState(0);
76515
+ const [controlBarCustom, setControlBarCustom] = React2.useState(() => (c) => c);
76516
+ const controlBar2 = useUltraControlBar(props.viewer, sectionBox2, (_2) => _2);
76516
76517
  React2.useEffect(() => {
76517
76518
  props.viewer.onStateChanged.subscribe((state) => updateModal(modal, state));
76518
76519
  props.viewer.selection.onValueChanged.subscribe(() => {
76519
76520
  setSelectState((i2) => (i2 + 1) % 2);
76520
76521
  });
76521
- props.onMount(createComponentRef(props.viewer, modal, sectionBox2));
76522
+ props.onMount({
76523
+ viewer: props.viewer,
76524
+ modal,
76525
+ sectionBox: sectionBox2,
76526
+ dispose: () => {
76527
+ },
76528
+ controlBar: {
76529
+ customize: (v) => setControlBarCustom(() => v)
76530
+ },
76531
+ load: patchLoad(props.viewer, modal)
76532
+ });
76522
76533
  }, []);
76523
76534
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
76524
76535
  /* @__PURE__ */ jsxRuntimeExports.jsx(RestOfScreen, { side, content: () => {
@@ -76528,18 +76539,28 @@ Averrage Date/Second ${avgDataRatePS} kb
76528
76539
  /* @__PURE__ */ jsxRuntimeExports.jsx(
76529
76540
  ControlBar,
76530
76541
  {
76531
- content: controlBar2,
76542
+ content: controlBarCustom(controlBar2),
76532
76543
  show: true
76533
76544
  }
76534
76545
  ),
76535
76546
  /* @__PURE__ */ jsxRuntimeExports.jsx(SectionBoxPanel, { state: sectionBox2 })
76536
76547
  ] });
76537
76548
  } }),
76538
- /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { state: modal })
76549
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { state: modal }),
76550
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
76551
+ ReactTooltip,
76552
+ {
76553
+ multiline: true,
76554
+ arrowColor: "transparent",
76555
+ type: "light",
76556
+ 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",
76557
+ delayShow: 200
76558
+ }
76559
+ )
76539
76560
  ] });
76540
76561
  }
76541
- function createComponentRef(viewer, modal, sectionBox2) {
76542
- function load(source) {
76562
+ function patchLoad(viewer, modal) {
76563
+ return function load(source) {
76543
76564
  const request2 = viewer.loadVim(source);
76544
76565
  void updateProgress(request2, modal);
76545
76566
  void request2.getResult().then(
@@ -76554,18 +76575,11 @@ Averrage Date/Second ${avgDataRatePS} kb
76554
76575
  }
76555
76576
  );
76556
76577
  return request2;
76557
- }
76558
- return {
76559
- viewer,
76560
- modal,
76561
- sectionBox: sectionBox2,
76562
- dispose: () => {
76563
- },
76564
- load
76565
76578
  };
76566
76579
  }
76567
76580
  const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
76568
76581
  __proto__: null,
76582
+ ControlBar: controlBar,
76569
76583
  UltraComponent,
76570
76584
  createUltraComponent
76571
76585
  }, Symbol.toStringTag, { value: "Module" }));