bimatter-viewer-react 0.0.1
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/README.md +73 -0
- package/lib/Camera/useCameraFit.d.ts +2 -0
- package/lib/GeometryUtils/useGeometryIndex.d.ts +35 -0
- package/lib/GeometryUtils/useGeometryUtils.d.ts +13 -0
- package/lib/Hotkeys/useHotkeysUtils.d.ts +2 -0
- package/lib/Loaders/BmtLoader.d.ts +51 -0
- package/lib/Model.d.ts +7 -0
- package/lib/SelectableMesh.d.ts +10 -0
- package/lib/Selector/SelectionBox.d.ts +50 -0
- package/lib/Selector/useSelector.d.ts +3 -0
- package/lib/Viewer.d.ts +21 -0
- package/lib/api/ViewerApi.d.ts +40 -0
- package/lib/api/loader.d.ts +8 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +1165 -0
- package/lib/store/ViewerStore.d.ts +19 -0
- package/lib/store/ViewerStoreContext.d.ts +2 -0
- package/lib/store/ViewerStoreProvider.d.ts +7 -0
- package/lib/store/useViewerStore.d.ts +3 -0
- package/lib/types.d.ts +9 -0
- package/package.json +58 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type StoreApi } from "zustand/vanilla";
|
|
2
|
+
export type UserDevice = "pc" | "mobile";
|
|
3
|
+
export interface SelectedStore {
|
|
4
|
+
[modelID: number]: Set<number>;
|
|
5
|
+
}
|
|
6
|
+
export type ViewerStore = {
|
|
7
|
+
selected: SelectedStore;
|
|
8
|
+
showStats: boolean;
|
|
9
|
+
userDevice: UserDevice;
|
|
10
|
+
setShowStats: (showStats: boolean) => void;
|
|
11
|
+
setSelection: (selected: SelectedStore) => void;
|
|
12
|
+
setSelected: (modelID: number, ids: number[], reset?: boolean) => void;
|
|
13
|
+
addSelected: (modelID: number, ids: number[]) => void;
|
|
14
|
+
removeSelected: (modelID: number, ids: number[]) => void;
|
|
15
|
+
resetSelected: (modelID?: number) => void;
|
|
16
|
+
setUserDevice: (userDevice: UserDevice) => void;
|
|
17
|
+
};
|
|
18
|
+
export type ViewerStoreApi = StoreApi<ViewerStore>;
|
|
19
|
+
export declare function createViewerStore(): StoreApi<ViewerStore>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type PropsWithChildren } from "react";
|
|
2
|
+
import { type ViewerStoreApi } from "./ViewerStore";
|
|
3
|
+
type ViewerStoreProviderProps = PropsWithChildren<{
|
|
4
|
+
store?: ViewerStoreApi;
|
|
5
|
+
}>;
|
|
6
|
+
export declare function ViewerStoreProvider({ children, store, }: ViewerStoreProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RefObject } from "react";
|
|
2
|
+
import type { DirectionalLight, Group } from "three";
|
|
3
|
+
import type { OrbitControls as OrbitControlsImpl } from "three-stdlib";
|
|
4
|
+
export type ViewerModelGroup = Group & {
|
|
5
|
+
modelID?: number;
|
|
6
|
+
};
|
|
7
|
+
export type ViewerModelRef = RefObject<ViewerModelGroup | null>;
|
|
8
|
+
export type ViewerControlsRef = RefObject<OrbitControlsImpl | null>;
|
|
9
|
+
export type ViewerLightRef = RefObject<DirectionalLight | null>;
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bimatter-viewer-react",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./lib/index.js",
|
|
6
|
+
"module": "./lib/index.js",
|
|
7
|
+
"types": "./lib/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/index.d.ts",
|
|
11
|
+
"import": "./lib/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"lib"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"dev": "vite",
|
|
19
|
+
"build": "tsc -b && vite build",
|
|
20
|
+
"build:lib": "vite build -c vite.lib.config.ts && tsc -p tsconfig.lib.json",
|
|
21
|
+
"lint": "eslint .",
|
|
22
|
+
"prepublishOnly": "npm run build:lib",
|
|
23
|
+
"preview": "vite preview"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"pako": "^2.1.0",
|
|
27
|
+
"zustand": "^5.0.13"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@react-three/drei": "^10.7.7",
|
|
31
|
+
"@react-three/fiber": "^9.6.1",
|
|
32
|
+
"react": "^19.2.5",
|
|
33
|
+
"react-dom": "^19.2.5",
|
|
34
|
+
"three": "^0.184.0",
|
|
35
|
+
"three-mesh-bvh": "^0.9.9"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@react-three/drei": "^10.7.7",
|
|
39
|
+
"@react-three/fiber": "^9.6.1",
|
|
40
|
+
"@eslint/js": "^10.0.1",
|
|
41
|
+
"@types/node": "^24.12.2",
|
|
42
|
+
"@types/pako": "^2.0.4",
|
|
43
|
+
"@types/react": "^19.2.14",
|
|
44
|
+
"@types/react-dom": "^19.2.3",
|
|
45
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
46
|
+
"eslint": "^10.2.1",
|
|
47
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
48
|
+
"eslint-plugin-react-refresh": "^0.5.2",
|
|
49
|
+
"globals": "^17.5.0",
|
|
50
|
+
"react": "^19.2.5",
|
|
51
|
+
"react-dom": "^19.2.5",
|
|
52
|
+
"three": "^0.184.0",
|
|
53
|
+
"three-mesh-bvh": "^0.9.9",
|
|
54
|
+
"typescript": "~6.0.2",
|
|
55
|
+
"typescript-eslint": "^8.58.2",
|
|
56
|
+
"vite": "^8.0.10"
|
|
57
|
+
}
|
|
58
|
+
}
|