brepjs-viewer 0.1.0 → 0.2.0

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/CHANGELOG.md CHANGED
@@ -1 +1,19 @@
1
1
  # Changelog
2
+
3
+ ## [0.2.0](https://github.com/andymai/brepjs/compare/brepjs-viewer-v0.1.0...brepjs-viewer-v0.2.0) (2026-06-13)
4
+
5
+
6
+ ### Features
7
+
8
+ * **viewer:** click-to-inspect face picking in verify --serve ([#1278](https://github.com/andymai/brepjs/issues/1278)) ([735dc04](https://github.com/andymai/brepjs/commit/735dc0401143ff47046a79e6fb7bac53cf00a91e))
9
+ * **viewer:** measurements info panel in verify --serve ([#1277](https://github.com/andymai/brepjs/issues/1277)) ([c1ccf1d](https://github.com/andymai/brepjs/commit/c1ccf1d7c50ab43dc0444468f92fcf9365fda9da))
10
+ * **viewer:** orthographic/perspective projection toggle ([#1281](https://github.com/andymai/brepjs/issues/1281)) ([96673e4](https://github.com/andymai/brepjs/commit/96673e45e1ee316f9d26e52c995b4daba691e8b0))
11
+ * **viewer:** section/clipping plane in verify --serve ([#1279](https://github.com/andymai/brepjs/issues/1279)) ([cc0d00b](https://github.com/andymai/brepjs/commit/cc0d00b7a6296cc698fce1ae42b7503e6d47c032))
12
+ * **viewer:** shared ViewerControls toolbar; interactive verify --serve ([#1275](https://github.com/andymai/brepjs/issues/1275)) ([139ae15](https://github.com/andymai/brepjs/commit/139ae15a29d8a7ad5e520ba21d6dc9788242c089))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * **security:** clear open Dependabot + CodeQL alerts ([#1144](https://github.com/andymai/brepjs/issues/1144)) ([0ac6411](https://github.com/andymai/brepjs/commit/0ac6411e866df0b88e048db52cae550734a20765))
18
+
19
+ ## Changelog
package/README.md CHANGED
@@ -2,23 +2,23 @@
2
2
 
3
3
  Shared React + [@react-three/fiber](https://github.com/pmndrs/react-three-fiber) renderer for brepjs meshes. Extracted from the playground so both `apps/playground` and the `brepjs-agent` standalone viewer render through one source of truth (no drift).
4
4
 
5
- It is a thin, store-agnostic rendering layer: it takes a `MeshData` and optional selection callbacks it owns no application state and never imports a consumer.
5
+ It is a thin, store-agnostic rendering layer: it takes a `MeshData` and optional selection callbacks; it owns no application state and never imports a consumer.
6
6
 
7
7
  ## Exports
8
8
 
9
- - `Renderer` draws a `MeshData` mesh; optional `onFacePick`/`onFaceHover`/`onFaceContextMenu` callbacks for selection.
10
- - `ViewerCanvas` R3F `<Canvas>` wrapper that frames the model bbox, re-points the camera from a `view` prop (`iso`/`front`/`top`/`right`), re-frames on a `fitSignal` bump, toggles `autoRotate`/`gridVisible`, and switches `projection` between `perspective` and `orthographic` (zoom-fit ortho camera). Flips to `frameloop="always"` while spinning, `demand` otherwise. Fires `onFirstFrame` after first paint. Screenshot-agnostic.
11
- - `ViewerControls` store-agnostic, fully-controlled toolbar (view-mode, edges, grid, turntable, projection, view presets, fit, screenshot). Each group renders only when its handler is supplied; self-contained inline styles, `className` to restyle.
12
- - `ViewerInfoPanel` controlled, store-agnostic measurements readout (bbox size, volume, area, triangles, validity); renders only the rows whose values are supplied.
13
- - `ViewerSelectionPanel` controlled readout for a picked `FaceInfo` (surface type, area, normal) with an optional clear button; renders nothing when no face is selected.
14
- - `ViewerSectionControls` controlled section-plane bar (enable, axis, position slider, flip). Pair with `sectionPlane(...)` and pass the result to `Renderer`/`EdgeRenderer` via their `clippingPlanes` prop. `ViewerCanvas` enables local clipping, so only the model is cut (not the grid).
15
- - `EdgeRenderer`, `SelectionHighlight`, `SceneSetup` companion components.
16
- - `buildGeometry`, `findFaceGroupAt`, `meshSize`, `meshBounds`, `sectionPlane` pure helpers (`meshBounds` returns the bbox; `sectionPlane` builds a model-space clipping plane).
9
+ - `Renderer`: draws a `MeshData` mesh; optional `onFacePick`/`onFaceHover`/`onFaceContextMenu` callbacks for selection.
10
+ - `ViewerCanvas`: R3F `<Canvas>` wrapper that frames the model bbox, re-points the camera from a `view` prop (`iso`/`front`/`top`/`right`), re-frames on a `fitSignal` bump, toggles `autoRotate`/`gridVisible`, and switches `projection` between `perspective` and `orthographic` (zoom-fit ortho camera). Flips to `frameloop="always"` while spinning, `demand` otherwise. Fires `onFirstFrame` after first paint. Screenshot-agnostic.
11
+ - `ViewerControls`: store-agnostic, fully-controlled toolbar (view-mode, edges, grid, turntable, projection, view presets, fit, screenshot). Each group renders only when its handler is supplied; self-contained inline styles, `className` to restyle.
12
+ - `ViewerInfoPanel`: controlled, store-agnostic measurements readout (bbox size, volume, area, triangles, validity); renders only the rows whose values are supplied.
13
+ - `ViewerSelectionPanel`: controlled readout for a picked `FaceInfo` (surface type, area, normal) with an optional clear button; renders nothing when no face is selected.
14
+ - `ViewerSectionControls`: controlled section-plane bar (enable, axis, position slider, flip). Pair with `sectionPlane(...)` and pass the result to `Renderer`/`EdgeRenderer` via their `clippingPlanes` prop. `ViewerCanvas` enables local clipping, so only the model is cut (not the grid).
15
+ - `EdgeRenderer`, `SelectionHighlight`, `SceneSetup`: companion components.
16
+ - `buildGeometry`, `findFaceGroupAt`, `meshSize`, `meshBounds`, `sectionPlane`: pure helpers (`meshBounds` returns the bbox; `sectionPlane` builds a model-space clipping plane).
17
17
  - Types: `MeshData`, `FaceGroup`, `FaceInfo`, `EdgeGroup`, `EdgeInfo`, `ViewMode`, `ViewName`, `VIEW_NAMES`.
18
18
 
19
19
  ## Peer dependencies
20
20
 
21
- `react`, `react-dom`, `three`, `@react-three/fiber`, `@react-three/drei` pinned to the versions `apps/playground` uses so a single copy resolves across the monorepo.
21
+ `react`, `react-dom`, `three`, `@react-three/fiber`, `@react-three/drei`: pinned to the versions `apps/playground` uses so a single copy resolves across the monorepo.
22
22
 
23
23
  ## Usage
24
24
 
@@ -9,4 +9,4 @@ export interface EdgeRendererProps {
9
9
  onEdgeHover?: (info: EdgeInfo | null, pos?: ScreenPos) => void;
10
10
  onEdgeContextMenu?: (info: EdgeInfo, pos: ScreenPos) => void;
11
11
  }
12
- export default function EdgeRenderer({ edges, edgeGroups, edgeInfos, clippingPlanes, onEdgePick, onEdgeHover, onEdgeContextMenu, }: EdgeRendererProps): import("react/jsx-runtime").JSX.Element;
12
+ export default function EdgeRenderer({ edges, edgeGroups, edgeInfos, clippingPlanes, onEdgePick, onEdgeHover, onEdgeContextMenu, }: EdgeRendererProps): import("react").JSX.Element;
@@ -2,5 +2,5 @@ interface GradientBackgroundProps {
2
2
  colorTop?: string;
3
3
  colorBottom?: string;
4
4
  }
5
- export default function GradientBackground({ colorTop, colorBottom, }: GradientBackgroundProps): import("react/jsx-runtime").JSX.Element;
5
+ export default function GradientBackground({ colorTop, colorBottom, }: GradientBackgroundProps): import("react").JSX.Element;
6
6
  export {};
@@ -5,5 +5,5 @@ interface InfiniteGridProps {
5
5
  fadeStart?: number;
6
6
  fadeEnd?: number;
7
7
  }
8
- export default function InfiniteGrid({ cellSize, lineColor, lineOpacity, fadeStart, fadeEnd, }: InfiniteGridProps): import("react/jsx-runtime").JSX.Element;
8
+ export default function InfiniteGrid({ cellSize, lineColor, lineOpacity, fadeStart, fadeEnd, }: InfiniteGridProps): import("react").JSX.Element;
9
9
  export {};
@@ -8,4 +8,4 @@ export interface RendererProps {
8
8
  onFaceHover?: (info: FaceInfo | null, pos?: ScreenPos) => void;
9
9
  onFaceContextMenu?: (info: FaceInfo, pos: ScreenPos) => void;
10
10
  }
11
- export declare function Renderer({ data, viewMode, clippingPlanes, onFacePick, onFaceHover, onFaceContextMenu, }: RendererProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare function Renderer({ data, viewMode, clippingPlanes, onFacePick, onFaceHover, onFaceContextMenu, }: RendererProps): import("react").JSX.Element;
@@ -1 +1 @@
1
- export default function SceneLighting(): import("react/jsx-runtime").JSX.Element;
1
+ export default function SceneLighting(): import("react").JSX.Element;
@@ -27,5 +27,5 @@ interface SceneSetupProps {
27
27
  controlsRef?: RefObject<any>;
28
28
  onControlsStart?: () => void;
29
29
  }
30
- export default function SceneSetup({ autoRotate, target, gridVisible, gridProps, controlsProps, controlsRef, onControlsStart, }: SceneSetupProps): import("react/jsx-runtime").JSX.Element;
30
+ export default function SceneSetup({ autoRotate, target, gridVisible, gridProps, controlsProps, controlsRef, onControlsStart, }: SceneSetupProps): import("react").JSX.Element;
31
31
  export {};
@@ -6,4 +6,4 @@ export interface SelectionHighlightProps {
6
6
  hoverFaceId?: number | null;
7
7
  hoverEdgeId?: number | null;
8
8
  }
9
- export default function SelectionHighlight({ data, selectedFaceIds, selectedEdgeIds, hoverFaceId, hoverEdgeId, }: SelectionHighlightProps): import("react/jsx-runtime").JSX.Element;
9
+ export default function SelectionHighlight({ data, selectedFaceIds, selectedEdgeIds, hoverFaceId, hoverEdgeId, }: SelectionHighlightProps): import("react").JSX.Element;
@@ -11,4 +11,4 @@ export interface ViewerCanvasProps {
11
11
  onFirstFrame?: () => void;
12
12
  children?: ReactNode;
13
13
  }
14
- export declare function ViewerCanvas({ data, view, fitSignal, autoRotate, gridVisible, projection, onFirstFrame, children, }: ViewerCanvasProps): import("react/jsx-runtime").JSX.Element;
14
+ export declare function ViewerCanvas({ data, view, fitSignal, autoRotate, gridVisible, projection, onFirstFrame, children, }: ViewerCanvasProps): import("react").JSX.Element;
@@ -17,4 +17,4 @@ export interface ViewerControlsProps {
17
17
  onScreenshot?: () => void;
18
18
  className?: string;
19
19
  }
20
- export declare function ViewerControls({ viewMode, onViewModeChange, showEdges, onToggleEdges, showGrid, onToggleGrid, autoRotate, onToggleAutoRotate, projection, onToggleProjection, activeView, onView, onFit, onScreenshot, className, }: ViewerControlsProps): import("react/jsx-runtime").JSX.Element;
20
+ export declare function ViewerControls({ viewMode, onViewModeChange, showEdges, onToggleEdges, showGrid, onToggleGrid, autoRotate, onToggleAutoRotate, projection, onToggleProjection, activeView, onView, onFit, onScreenshot, className, }: ViewerControlsProps): import("react").JSX.Element;
@@ -9,4 +9,4 @@ export interface ViewerInfoPanelProps {
9
9
  unit?: string | undefined;
10
10
  className?: string;
11
11
  }
12
- export declare function ViewerInfoPanel({ dims, volume, area, triangles, valid, unit, className, }: ViewerInfoPanelProps): import("react/jsx-runtime").JSX.Element | null;
12
+ export declare function ViewerInfoPanel({ dims, volume, area, triangles, valid, unit, className, }: ViewerInfoPanelProps): import("react").JSX.Element | null;
@@ -12,4 +12,4 @@ export interface ViewerSectionControlsProps {
12
12
  onToggleFlip: () => void;
13
13
  className?: string;
14
14
  }
15
- export declare function ViewerSectionControls({ enabled, onToggle, axis, onAxisChange, position, min, max, onPositionChange, flip, onToggleFlip, className, }: ViewerSectionControlsProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function ViewerSectionControls({ enabled, onToggle, axis, onAxisChange, position, min, max, onPositionChange, flip, onToggleFlip, className, }: ViewerSectionControlsProps): import("react").JSX.Element;
@@ -5,4 +5,4 @@ export interface ViewerSelectionPanelProps {
5
5
  unit?: string | undefined;
6
6
  className?: string;
7
7
  }
8
- export declare function ViewerSelectionPanel({ face, onClear, unit, className, }: ViewerSelectionPanelProps): import("react/jsx-runtime").JSX.Element | null;
8
+ export declare function ViewerSelectionPanel({ face, onClear, unit, className, }: ViewerSelectionPanelProps): import("react").JSX.Element | null;
package/package.json CHANGED
@@ -1,21 +1,39 @@
1
1
  {
2
2
  "name": "brepjs-viewer",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Shared React/R3F renderer for brepjs meshes (used by the playground and the brepjs-agent viewer)",
5
5
  "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/andymai/brepjs",
9
+ "directory": "packages/brepjs-viewer"
10
+ },
6
11
  "type": "module",
7
12
  "sideEffects": false,
8
- "engines": { "node": ">=24" },
13
+ "engines": {
14
+ "node": ">=24"
15
+ },
9
16
  "main": "./dist/brepjs-viewer.cjs",
10
17
  "module": "./dist/brepjs-viewer.js",
11
18
  "types": "./dist/index.d.ts",
12
19
  "exports": {
13
20
  ".": {
14
- "import": { "types": "./dist/index.d.ts", "default": "./dist/brepjs-viewer.js" },
15
- "require": { "types": "./dist/index.d.ts", "default": "./dist/brepjs-viewer.cjs" }
21
+ "import": {
22
+ "types": "./dist/index.d.ts",
23
+ "default": "./dist/brepjs-viewer.js"
24
+ },
25
+ "require": {
26
+ "types": "./dist/index.d.ts",
27
+ "default": "./dist/brepjs-viewer.cjs"
28
+ }
16
29
  }
17
30
  },
18
- "files": ["dist", "CHANGELOG.md", "LICENSE", "README.md"],
31
+ "files": [
32
+ "dist",
33
+ "CHANGELOG.md",
34
+ "LICENSE",
35
+ "README.md"
36
+ ],
19
37
  "scripts": {
20
38
  "build": "vite build",
21
39
  "typecheck": "tsc --noEmit",
@@ -32,12 +50,12 @@
32
50
  "devDependencies": {
33
51
  "@eslint/js": "*",
34
52
  "@react-three/test-renderer": "*",
35
- "@types/react": "19.2.15",
53
+ "@types/react": "19.2.17",
36
54
  "@types/three": "0.184.1",
37
55
  "eslint": "*",
38
56
  "jsdom": "*",
39
- "react": "19.2.6",
40
- "react-dom": "19.2.6",
57
+ "react": "19.2.7",
58
+ "react-dom": "19.2.7",
41
59
  "@react-three/fiber": "9.6.1",
42
60
  "@react-three/drei": "10.7.7",
43
61
  "three": "0.184.0",