vim-web 0.3.44-dev.71 → 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.
@@ -1,5 +1,6 @@
1
1
  import { StateRef } from "../helpers/reactUtils";
2
2
  import { GenericEntryType } from "./genericField";
3
+ import { Customizer } from "../helpers/customizer";
3
4
  export interface GenericPanelProps {
4
5
  showPanel: StateRef<boolean>;
5
6
  header?: React.ReactNode;
@@ -7,9 +8,5 @@ export interface GenericPanelProps {
7
8
  onClose?: () => void;
8
9
  anchorElement: HTMLElement | null;
9
10
  }
10
- export declare const GenericPanel: import("react").ForwardRefExoticComponent<GenericPanelProps & import("react").RefAttributes<GenericPanelRef>>;
11
- export type GenericPanelRef = Customizer<GenericEntryType[]>;
12
- export interface Customizer<TData> {
13
- customize(fn: (entries: TData) => TData): any;
14
- }
15
- export declare function useCustomizer<TData>(baseEntries: TData, ref: React.Ref<Customizer<TData>>): TData;
11
+ export type GenericPanelHandle = Customizer<GenericEntryType[]>;
12
+ export declare const GenericPanel: import("react").ForwardRefExoticComponent<GenericPanelProps & import("react").RefAttributes<GenericPanelHandle>>;
@@ -0,0 +1,2 @@
1
+ export type * from './genericField';
2
+ export { type GenericPanelHandle } from './genericPanel';
@@ -0,0 +1,4 @@
1
+ export interface Customizer<TData> {
2
+ customize(fn: (entries: TData) => TData): any;
3
+ }
4
+ export declare function useCustomizer<TData>(baseEntries: TData, ref: React.Ref<Customizer<TData>>): TData;
@@ -10,4 +10,5 @@ export * as Urls from './urls';
10
10
  export * from './container';
11
11
  export * from './panels';
12
12
  export * from './helpers';
13
+ export * from './generic';
13
14
  export type * from './state';
@@ -4,7 +4,7 @@
4
4
  import React from 'react';
5
5
  import { CameraRef } from '../state/cameraState';
6
6
  import { TreeActionRef } from '../bim/bimTree';
7
- import { ModalRef } from './modal';
7
+ import { ModalHandle } from './modal';
8
8
  import { IsolationRef } from '../state/sharedIsolation';
9
9
  import * as Core from '../../core-viewers';
10
10
  type ClickCallback = React.MouseEvent<HTMLDivElement, MouseEvent>;
@@ -76,7 +76,7 @@ export declare const VimContextMenuMemo: React.MemoExoticComponent<typeof Contex
76
76
  export declare function ContextMenu(props: {
77
77
  viewer: Core.Webgl.Viewer;
78
78
  camera: CameraRef;
79
- modal: ModalRef;
79
+ modal: ModalHandle;
80
80
  isolation: IsolationRef;
81
81
  selection: Core.Webgl.Element3D[];
82
82
  customization?: (e: ContextMenuElement[]) => ContextMenuElement[];
@@ -1,6 +1,5 @@
1
1
  export * as ContextMenu from './contextMenu';
2
2
  export type * from './axesPanel';
3
- export type * from '../generic/genericPanel';
4
3
  export type * from './help';
5
4
  export type * from './loadingBox';
6
5
  export type * from './logo';
@@ -1,5 +1,5 @@
1
1
  import { IsolationRef } from "../state/sharedIsolation";
2
- import { GenericPanelRef } from "../generic/genericPanel";
2
+ import { GenericPanelHandle } from "../generic/genericPanel";
3
3
  export declare const IsolationPanel: import("react").ForwardRefExoticComponent<{
4
4
  state: IsolationRef;
5
- } & import("react").RefAttributes<GenericPanelRef>>;
5
+ } & import("react").RefAttributes<GenericPanelHandle>>;
@@ -7,7 +7,7 @@ export type ModalPropsTyped = (MessageBoxPropsTyped | LoadingBoxPropsTyped | Hel
7
7
  canClose?: boolean;
8
8
  onClose?: () => void;
9
9
  };
10
- export type ModalRef = {
10
+ export type ModalHandle = {
11
11
  getActiveState(): ModalPropsTyped | undefined;
12
12
  loading(content: LoadingBoxProps | undefined): void;
13
13
  message(content: MessageBoxProps | undefined): void;
@@ -15,4 +15,4 @@ export type ModalRef = {
15
15
  };
16
16
  export declare const Modal: React.ForwardRefExoticComponent<{
17
17
  canFollowLinks: boolean;
18
- } & React.RefAttributes<ModalRef>>;
18
+ } & React.RefAttributes<ModalHandle>>;
@@ -1,5 +1,5 @@
1
1
  import { SectionBoxRef } from "../state/sectionBoxState";
2
- import { GenericPanelRef } from "../generic/genericPanel";
2
+ import { GenericPanelHandle } from "../generic/genericPanel";
3
3
  export declare const SectionBoxPanel: import("react").ForwardRefExoticComponent<{
4
4
  state: SectionBoxRef;
5
- } & import("react").RefAttributes<GenericPanelRef>>;
5
+ } & import("react").RefAttributes<GenericPanelHandle>>;
@@ -6,7 +6,7 @@ import { SideState } from './sideState';
6
6
  import * as Icons from '../icons';
7
7
  import { SectionBoxRef } from './sectionBoxState';
8
8
  import { getMeasureState } from './measureState';
9
- import { ModalRef } from '../panels/modal';
9
+ import { ModalHandle } from '../panels/modal';
10
10
  import { IsolationRef } from './sharedIsolation';
11
11
  import * as ControlBar from '../controlbar';
12
12
  /**
@@ -32,7 +32,7 @@ export declare function controlBarSelection(isolation: IsolationRef): ControlBar
32
32
  /**
33
33
  * Combines all control bar sections into one control bar.
34
34
  */
35
- export declare function useControlBar(viewer: Core.Webgl.Viewer, camera: CameraRef, modal: ModalRef, side: SideState, cursor: CursorManager, settings: Settings, section: SectionBoxRef, isolationRef: IsolationRef, customization: ControlBar.ControlBarCustomization | undefined): (ControlBar.IControlBarSection | {
35
+ export declare function useControlBar(viewer: Core.Webgl.Viewer, camera: CameraRef, modal: ModalHandle, side: SideState, cursor: CursorManager, settings: Settings, section: SectionBoxRef, isolationRef: IsolationRef, customization: ControlBar.ControlBarCustomization | undefined): (ControlBar.IControlBarSection | {
36
36
  id: string;
37
37
  enable: () => boolean;
38
38
  style: string;
@@ -1,5 +1,5 @@
1
- import { ModalRef } from "../panels/modal";
1
+ import { ModalHandle } from "../panels/modal";
2
2
  import * as Core from '../../core-viewers';
3
3
  import { RefObject } from "react";
4
- export declare function updateModal(modal: RefObject<ModalRef>, state: Core.Ultra.ClientState): void;
5
- export declare function updateProgress(request: Core.Ultra.ILoadRequest, modal: ModalRef): Promise<void>;
4
+ export declare function updateModal(modal: RefObject<ModalHandle>, state: Core.Ultra.ClientState): void;
5
+ export declare function updateProgress(request: Core.Ultra.ILoadRequest, modal: ModalHandle): Promise<void>;
@@ -1,9 +1,10 @@
1
1
  import * as Core from '../../core-viewers/ultra';
2
- import { ModalRef } from '../panels/modal';
2
+ import { ModalHandle } from '../panels/modal';
3
3
  import { CameraRef } from '../state/cameraState';
4
4
  import { SectionBoxRef } from '../state/sectionBoxState';
5
5
  import { IsolationRef } from '../state/sharedIsolation';
6
6
  import { ControlBarRef } from '../controlbar';
7
+ import { GenericPanelHandle } from '../generic/';
7
8
  export type ViewerRef = {
8
9
  /**
9
10
  * The Vim viewer instance associated with the viewer.
@@ -12,7 +13,7 @@ export type ViewerRef = {
12
13
  /**
13
14
  * API to manage the modal dialog.
14
15
  */
15
- modal: ModalRef;
16
+ modal: ModalHandle;
16
17
  /**
17
18
  * API to manage the section box.
18
19
  */
@@ -26,6 +27,14 @@ export type ViewerRef = {
26
27
  */
27
28
  camera: CameraRef;
28
29
  isolation: IsolationRef;
30
+ /**
31
+ * API to interact with the isolation panel.
32
+ */
33
+ isolationPanel: GenericPanelHandle;
34
+ /**
35
+ * API to interact with the isolation panel.
36
+ */
37
+ sectionBoxPanel: GenericPanelHandle;
29
38
  /**
30
39
  * Disposes of the viewer and its resources.
31
40
  */
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import * as Core from '../../core-viewers';
5
5
  import { LoadRequest } from '../helpers/loadRequest';
6
- import { ModalRef } from '../panels/modal';
6
+ import { ModalHandle } from '../panels/modal';
7
7
  type AddSettings = {
8
8
  /**
9
9
  * Controls whether to frame the camera on a vim everytime it is updated.
@@ -28,7 +28,7 @@ export type LoadingError = {
28
28
  export declare class ComponentLoader {
29
29
  private _viewer;
30
30
  private _modal;
31
- constructor(viewer: Core.Webgl.Viewer, modal: React.RefObject<ModalRef>);
31
+ constructor(viewer: Core.Webgl.Viewer, modal: React.RefObject<ModalHandle>);
32
32
  /**
33
33
  * Event emitter for progress updates.
34
34
  */
@@ -9,10 +9,10 @@ import { Container } from '../container';
9
9
  import { BimInfoPanelRef } from '../bim/bimInfoData';
10
10
  import { ControlBarRef } from '../controlbar';
11
11
  import { ComponentLoader } from './loading';
12
- import { ModalRef } from '../panels/modal';
12
+ import { ModalHandle } from '../panels/modal';
13
13
  import { SectionBoxRef } from '../state/sectionBoxState';
14
14
  import { IsolationRef } from '../state/sharedIsolation';
15
- import { GenericPanelRef } from '../panels';
15
+ import { GenericPanelHandle } from '../generic';
16
16
  /**
17
17
  * Settings API managing settings applied to the viewer.
18
18
  */
@@ -83,7 +83,7 @@ export type ViewerRef = {
83
83
  /**
84
84
  * Message API to interact with the loading box.
85
85
  */
86
- modal: ModalRef;
86
+ modal: ModalHandle;
87
87
  /**
88
88
  * Camera API to interact with the viewer camera at a higher level.
89
89
  */
@@ -92,8 +92,14 @@ export type ViewerRef = {
92
92
  * API To interact with the BIM info panel.
93
93
  */
94
94
  bimInfo: BimInfoPanelRef;
95
- isolationPanel: GenericPanelRef;
96
- sectionBoxPanel: GenericPanelRef;
95
+ /**
96
+ * API to interact with the isolation panel.
97
+ */
98
+ isolationPanel: GenericPanelHandle;
99
+ /**
100
+ * API to interact with the isolation panel.
101
+ */
102
+ sectionBoxPanel: GenericPanelHandle;
97
103
  /**
98
104
  * Cleans up and releases resources used by the viewer.
99
105
  */
@@ -75720,6 +75720,24 @@ Averrage Date/Second ${avgDataRatePS} kb
75720
75720
  }
75721
75721
  );
75722
75722
  }
75723
+ function useCustomizer(baseEntries, ref) {
75724
+ const customization = React2.useRef();
75725
+ const [entries, setEntries] = React2.useState(baseEntries);
75726
+ const applyCustomization = () => {
75727
+ setEntries(customization.current ? customization.current(baseEntries) : baseEntries);
75728
+ };
75729
+ const setCustomization = (fn) => {
75730
+ customization.current = fn;
75731
+ applyCustomization();
75732
+ };
75733
+ React2.useEffect(() => {
75734
+ applyCustomization();
75735
+ }, [baseEntries]);
75736
+ React2.useImperativeHandle(ref, () => ({
75737
+ customize: setCustomization
75738
+ }));
75739
+ return entries;
75740
+ }
75723
75741
  const GenericPanel = React2.forwardRef((props, ref) => {
75724
75742
  const panelRef = React2.useRef(null);
75725
75743
  const panelPosition = useFloatingPanelPosition(
@@ -75758,24 +75776,6 @@ Averrage Date/Second ${avgDataRatePS} kb
75758
75776
  }
75759
75777
  ) });
75760
75778
  });
75761
- function useCustomizer(baseEntries, ref) {
75762
- const customization = React2.useRef();
75763
- const [entries, setEntries] = React2.useState(baseEntries);
75764
- const applyCustomization = () => {
75765
- setEntries(customization.current ? customization.current(baseEntries) : baseEntries);
75766
- };
75767
- const setCustomization = (fn) => {
75768
- customization.current = fn;
75769
- applyCustomization();
75770
- };
75771
- React2.useEffect(() => {
75772
- applyCustomization();
75773
- }, [baseEntries]);
75774
- React2.useImperativeHandle(ref, () => ({
75775
- customize: setCustomization
75776
- }));
75777
- return entries;
75778
- }
75779
75779
  const SectionBoxPanel = React2.forwardRef(
75780
75780
  (props, ref) => {
75781
75781
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -76136,8 +76136,8 @@ Averrage Date/Second ${avgDataRatePS} kb
76136
76136
  const settings2 = useSettings(props.viewer, props.settings ?? {});
76137
76137
  const modal = React2.useRef(null);
76138
76138
  const sectionBoxRef = useWebglSectionBox(props.viewer);
76139
- const isolationPanelRef = React2.useRef(null);
76140
- const sectionBoxPanelRef = React2.useRef(null);
76139
+ const isolationPanelHandle = React2.useRef(null);
76140
+ const sectionBoxPanelHandle = React2.useRef(null);
76141
76141
  const camera2 = useWebglCamera(props.viewer, sectionBoxRef);
76142
76142
  const cursor = React2.useMemo(() => new CursorManager(props.viewer), []);
76143
76143
  const loader = React2.useRef(new ComponentLoader(props.viewer, modal));
@@ -76174,10 +76174,10 @@ Averrage Date/Second ${avgDataRatePS} kb
76174
76174
  camera: camera2,
76175
76175
  settings: settings2,
76176
76176
  get isolationPanel() {
76177
- return isolationPanelRef.current;
76177
+ return isolationPanelHandle.current;
76178
76178
  },
76179
76179
  get sectionBoxPanel() {
76180
- return sectionBoxPanelRef.current;
76180
+ return sectionBoxPanelHandle.current;
76181
76181
  },
76182
76182
  get sectionBox() {
76183
76183
  return sectionBoxRef;
@@ -76246,8 +76246,8 @@ Averrage Date/Second ${avgDataRatePS} kb
76246
76246
  show: isTrue(settings2.value.ui.controlBar)
76247
76247
  }
76248
76248
  ),
76249
- /* @__PURE__ */ jsxRuntimeExports.jsx(SectionBoxPanel, { ref: sectionBoxPanelRef, state: sectionBoxRef }),
76250
- /* @__PURE__ */ jsxRuntimeExports.jsx(IsolationPanel, { ref: isolationPanelRef, state: isolationRef }),
76249
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SectionBoxPanel, { ref: sectionBoxPanelHandle, state: sectionBoxRef }),
76250
+ /* @__PURE__ */ jsxRuntimeExports.jsx(IsolationPanel, { ref: isolationPanelHandle, state: isolationRef }),
76251
76251
  /* @__PURE__ */ jsxRuntimeExports.jsx(
76252
76252
  AxesPanelMemo,
76253
76253
  {
@@ -76525,9 +76525,11 @@ Averrage Date/Second ${avgDataRatePS} kb
76525
76525
  return promise;
76526
76526
  }
76527
76527
  function Viewer(props) {
76528
- const modal = React2.useRef(null);
76529
76528
  const sectionBox2 = useUltraSectionBox(props.core);
76530
76529
  const camera2 = useUltraCamera(props.core, sectionBox2);
76530
+ const isolationPanelHandle = React2.useRef(null);
76531
+ const sectionBoxPanelHandle = React2.useRef(null);
76532
+ const modalHandle = React2.useRef(null);
76531
76533
  const side = useSideState(true, 400);
76532
76534
  const [_, setSelectState] = React2.useState(0);
76533
76535
  const [controlBarCustom, setControlBarCustom] = React2.useState(() => (c) => c);
@@ -76535,24 +76537,30 @@ Averrage Date/Second ${avgDataRatePS} kb
76535
76537
  const controlBar = useUltraControlBar(props.core, sectionBox2, isolation, camera2, (_2) => _2);
76536
76538
  useViewerInput(props.core.inputs, camera2);
76537
76539
  React2.useEffect(() => {
76538
- props.core.onStateChanged.subscribe((state) => updateModal(modal, state));
76540
+ props.core.onStateChanged.subscribe((state) => updateModal(modalHandle, state));
76539
76541
  props.core.selection.onSelectionChanged.subscribe(() => {
76540
76542
  setSelectState((i2) => (i2 + 1) % 2);
76541
76543
  });
76542
76544
  props.onMount({
76543
76545
  core: props.core,
76544
76546
  get modal() {
76545
- return modal.current;
76547
+ return modalHandle.current;
76546
76548
  },
76547
76549
  isolation,
76548
76550
  sectionBox: sectionBox2,
76549
76551
  camera: camera2,
76552
+ get isolationPanel() {
76553
+ return isolationPanelHandle.current;
76554
+ },
76555
+ get sectionBoxPanel() {
76556
+ return sectionBoxPanelHandle.current;
76557
+ },
76550
76558
  dispose: () => {
76551
76559
  },
76552
76560
  controlBar: {
76553
76561
  customize: (v) => setControlBarCustom(() => v)
76554
76562
  },
76555
- load: patchLoad(props.core, modal)
76563
+ load: patchLoad(props.core, modalHandle)
76556
76564
  });
76557
76565
  }, []);
76558
76566
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
@@ -76567,11 +76575,11 @@ Averrage Date/Second ${avgDataRatePS} kb
76567
76575
  show: true
76568
76576
  }
76569
76577
  ),
76570
- /* @__PURE__ */ jsxRuntimeExports.jsx(SectionBoxPanel, { state: sectionBox2 }),
76571
- /* @__PURE__ */ jsxRuntimeExports.jsx(IsolationPanel, { state: isolation })
76578
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SectionBoxPanel, { ref: sectionBoxPanelHandle, state: sectionBox2 }),
76579
+ /* @__PURE__ */ jsxRuntimeExports.jsx(IsolationPanel, { ref: isolationPanelHandle, state: isolation })
76572
76580
  ] });
76573
76581
  } }),
76574
- /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { ref: modal, canFollowLinks: true }),
76582
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { ref: modalHandle, canFollowLinks: true }),
76575
76583
  /* @__PURE__ */ jsxRuntimeExports.jsx(
76576
76584
  ReactTooltip,
76577
76585
  {