@classcad/react-cad 0.0.0-stage → 3.0.0-beta.20261119100608
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 +57 -0
- package/README.md +98 -2
- package/build/components/UI/CAD/Constraints.d.ts +30 -0
- package/build/components/UI/CAD/Drawing.d.ts +83 -0
- package/build/components/UI/CAD/ListPlaceholder.d.ts +3 -0
- package/build/components/UI/CAD/Messages/Message.d.ts +8 -0
- package/build/components/UI/CAD/Messages/Messages.d.ts +43 -0
- package/build/components/UI/CAD/Messages/index.d.ts +1 -0
- package/build/components/UI/CAD/Messages/msgStore.d.ts +18 -0
- package/build/components/UI/CAD/ModelTree/AssemblyNode.d.ts +5 -0
- package/build/components/UI/CAD/ModelTree/FeatureList/Feature.d.ts +8 -0
- package/build/components/UI/CAD/ModelTree/FeatureList/FeatureList.d.ts +6 -0
- package/build/components/UI/CAD/ModelTree/FeatureList/index.d.ts +1 -0
- package/build/components/UI/CAD/ModelTree/FeatureList/utils.d.ts +26 -0
- package/build/components/UI/CAD/ModelTree/ModelTree.d.ts +56 -0
- package/build/components/UI/CAD/ModelTree/ModelTreeHeader.d.ts +15 -0
- package/build/components/UI/CAD/ModelTree/index.d.ts +1 -0
- package/build/components/UI/CAD/ModelTree/primitives.d.ts +6 -0
- package/build/components/UI/CAD/ModelTree/useContextMenuItems.d.ts +4 -0
- package/build/components/UI/CAD/PluginBounds.d.ts +8 -0
- package/build/components/UI/CAD/PluginTooltip.d.ts +5 -0
- package/build/components/UI/CAD/PluginsWindows.d.ts +99 -0
- package/build/components/UI/CAD/ReadOnlyContext.d.ts +10 -0
- package/build/components/UI/CAD/SideBar.d.ts +40 -0
- package/build/components/UI/CAD/Solids/Solids.d.ts +23 -0
- package/build/components/UI/CAD/Solids/index.d.ts +1 -0
- package/build/components/UI/CAD/Solids/useContextMenuItems.d.ts +4 -0
- package/build/components/UI/CAD/Solids/useVisibleSolids.d.ts +30 -0
- package/build/components/UI/CAD/StageHud.d.ts +9 -0
- package/build/components/UI/CAD/StatusBar.d.ts +11 -0
- package/build/components/UI/CAD/ThemeToggle.d.ts +25 -0
- package/build/components/UI/CAD/ToolBar/AssemblyModeCmds.d.ts +3 -0
- package/build/components/UI/CAD/ToolBar/PartModeCmds.d.ts +3 -0
- package/build/components/UI/CAD/ToolBar/ToolBar.d.ts +24 -0
- package/build/components/UI/CAD/ToolBar/index.d.ts +1 -0
- package/build/components/UI/CAD/ToolBar/useCommands.d.ts +12 -0
- package/build/components/UI/CAD/ViewOptionsBar/ViewOptionButtons.d.ts +30 -0
- package/build/components/UI/CAD/ViewOptionsBar/useOptionCommands.d.ts +65 -0
- package/build/components/UI/CAD/ViewPlugButtons.d.ts +43 -0
- package/build/components/UI/CAD/ant-design-draggable-modal/DraggableModal.d.ts +18 -0
- package/build/components/UI/CAD/ant-design-draggable-modal/DraggableModalContext.d.ts +9 -0
- package/build/components/UI/CAD/ant-design-draggable-modal/DraggableModalInner.d.ts +27 -0
- package/build/components/UI/CAD/ant-design-draggable-modal/DraggableModalProvider.d.ts +4 -0
- package/build/components/UI/CAD/ant-design-draggable-modal/OverlayScrollbar.d.ts +6 -0
- package/build/components/UI/CAD/ant-design-draggable-modal/ResizeHandle.d.ts +2 -0
- package/build/components/UI/CAD/ant-design-draggable-modal/clamp.d.ts +1 -0
- package/build/components/UI/CAD/ant-design-draggable-modal/draggableModalReducer.d.ts +123 -0
- package/build/components/UI/CAD/ant-design-draggable-modal/getWindowSize.d.ts +4 -0
- package/build/components/UI/CAD/ant-design-draggable-modal/index.d.ts +3 -0
- package/build/components/UI/CAD/ant-design-draggable-modal/useDrag.d.ts +5 -0
- package/build/components/UI/CAD/ant-design-draggable-modal/usePrevious.d.ts +1 -0
- package/build/components/UI/CAD/ant-design-draggable-modal/useResize.d.ts +7 -0
- package/build/components/UI/CAD/common/BlankDiv.d.ts +3 -0
- package/build/components/UI/CAD/common/Collapse.d.ts +13 -0
- package/build/components/UI/CAD/common/ContextMenu.d.ts +115 -0
- package/build/components/UI/CAD/common/Divider.d.ts +4 -0
- package/build/components/UI/CAD/common/EntityName.d.ts +14 -0
- package/build/components/UI/CAD/common/Img.d.ts +6 -0
- package/build/components/UI/CAD/common/LoadingScreen/LoadingScreen.d.ts +8 -0
- package/build/components/UI/CAD/common/LoadingScreen/Spinner.d.ts +3 -0
- package/build/components/UI/CAD/common/LoadingScreen/index.d.ts +1 -0
- package/build/components/UI/CAD/common/Menu.d.ts +81 -0
- package/build/components/UI/CAD/common/MultiSelect.d.ts +12 -0
- package/build/components/UI/CAD/common/NameEdit.d.ts +7 -0
- package/build/components/UI/CAD/common/SectionHeader.d.ts +9 -0
- package/build/components/UI/CAD/common/primitives.d.ts +36 -0
- package/build/components/UI/CAD/common/reveal.d.ts +12 -0
- package/build/components/UI/CAD/hooks/index.d.ts +13 -0
- package/build/components/UI/CAD/hooks/useContextMenuInteraction.d.ts +7 -0
- package/build/components/UI/CAD/hooks/useContextMenuItems.d.ts +4 -0
- package/build/components/UI/CAD/hooks/useCurrentInstance.d.ts +2 -0
- package/build/components/UI/CAD/hooks/useCurrentProduct.d.ts +2 -0
- package/build/components/UI/CAD/hooks/useEditMode.d.ts +40 -0
- package/build/components/UI/CAD/hooks/useFeatureCount.d.ts +6 -0
- package/build/components/UI/CAD/hooks/useGlobalMateInfo.d.ts +6 -0
- package/build/components/UI/CAD/hooks/useHasPending.d.ts +27 -0
- package/build/components/UI/CAD/hooks/useIsDisabled.d.ts +2 -0
- package/build/components/UI/CAD/hooks/useIsLoading.d.ts +25 -0
- package/build/components/UI/CAD/hooks/useIsSketchActive.d.ts +26 -0
- package/build/components/UI/CAD/hooks/useObjectDetails.d.ts +12 -0
- package/build/components/UI/CAD/hooks/useOperationSequence.d.ts +29 -0
- package/build/components/UI/CAD/hooks/useRollbackBar.d.ts +8 -0
- package/build/components/UI/CAD/hooks/useRoot.d.ts +2 -0
- package/build/components/UI/CAD/index.d.ts +27 -0
- package/build/components/UI/CAD/plugins/ProductManagement/ProdTable.d.ts +10 -0
- package/build/components/UI/CAD/plugins/ProductManagement/Root.d.ts +11 -0
- package/build/components/UI/CAD/plugins/ProductManagement/View.d.ts +11 -0
- package/build/components/UI/CAD/plugins/ProductManagement/index.d.ts +34 -0
- package/build/components/UI/CAD/plugins/ProductManagement/types.d.ts +4 -0
- package/build/components/UI/CAD/plugins/ProductManagement/useContextMenuItems.d.ts +4 -0
- package/build/components/UI/CAD/plugins/SessionManagement/Root.d.ts +11 -0
- package/build/components/UI/CAD/plugins/SessionManagement/index.d.ts +36 -0
- package/build/components/UI/CAD/plugins/SessionManagement/types.d.ts +3 -0
- package/build/components/UI/CAD/store/CADActions.d.ts +29 -0
- package/build/components/UI/CAD/store/CADStore.d.ts +68 -0
- package/build/components/UI/CAD/store/instances.d.ts +7 -0
- package/build/components/UI/Readfile.d.ts +39 -0
- package/build/components/UI/ThemeVars.d.ts +6 -0
- package/build/components/UI/editors/BooleanEditor/BooleanEditor.d.ts +8 -0
- package/build/components/UI/editors/BooleanEditor/index.d.ts +2 -0
- package/build/components/UI/editors/BooleanEditor/useBoolParam.d.ts +3 -0
- package/build/components/UI/editors/CSysEditor/CSysEditor.d.ts +11 -0
- package/build/components/UI/editors/CSysEditor/index.d.ts +2 -0
- package/build/components/UI/editors/CSysEditor/useCSysParam.d.ts +9 -0
- package/build/components/UI/editors/ColorEditor/ColorEditor.d.ts +12 -0
- package/build/components/UI/editors/ColorEditor/index.d.ts +2 -0
- package/build/components/UI/editors/ColorEditor/useColorParam.d.ts +9 -0
- package/build/components/UI/editors/ExpressionEditor/ExpressionEditor.d.ts +20 -0
- package/build/components/UI/editors/ExpressionEditor/index.d.ts +2 -0
- package/build/components/UI/editors/ExpressionEditor/useExpressionsParam.d.ts +5 -0
- package/build/components/UI/editors/NumberEditor/Inputs.d.ts +18 -0
- package/build/components/UI/editors/NumberEditor/Mentions.d.ts +10 -0
- package/build/components/UI/editors/NumberEditor/NumOrExpr.d.ts +12 -0
- package/build/components/UI/editors/NumberEditor/NumberEditor.d.ts +12 -0
- package/build/components/UI/editors/NumberEditor/index.d.ts +2 -0
- package/build/components/UI/editors/NumberEditor/useNumParam.d.ts +5 -0
- package/build/components/UI/editors/PointEditor/PointEditor.d.ts +10 -0
- package/build/components/UI/editors/PointEditor/index.d.ts +2 -0
- package/build/components/UI/editors/PointEditor/usePointParam.d.ts +5 -0
- package/build/components/UI/editors/RefsEditors/ChainFinder.d.ts +12 -0
- package/build/components/UI/editors/RefsEditors/MateEditor.d.ts +13 -0
- package/build/components/UI/editors/RefsEditors/MateOrientationEditor.d.ts +9 -0
- package/build/components/UI/editors/RefsEditors/RefEditor.d.ts +24 -0
- package/build/components/UI/editors/RefsEditors/RefsEditor.d.ts +16 -0
- package/build/components/UI/editors/RefsEditors/index.d.ts +8 -0
- package/build/components/UI/editors/RefsEditors/pickers.d.ts +4 -0
- package/build/components/UI/editors/RefsEditors/useIdParam.d.ts +3 -0
- package/build/components/UI/editors/RefsEditors/useMateParam.d.ts +19 -0
- package/build/components/UI/editors/RefsEditors/useModes.d.ts +11 -0
- package/build/components/UI/editors/RefsEditors/useRefsParam.d.ts +3 -0
- package/build/components/UI/editors/RefsEditors/useSelectedItems.d.ts +18 -0
- package/build/components/UI/editors/ToleranceEditor/ToleranceEditor.d.ts +7 -0
- package/build/components/UI/editors/ToleranceEditor/index.d.ts +2 -0
- package/build/components/UI/editors/ToleranceEditor/useToleranceParam.d.ts +3 -0
- package/build/components/UI/editors/TypeEditor/TypeEditor.d.ts +10 -0
- package/build/components/UI/editors/TypeEditor/index.d.ts +2 -0
- package/build/components/UI/editors/TypeEditor/useTypeParam.d.ts +3 -0
- package/build/components/UI/editors/TypeWrapper.d.ts +6 -0
- package/build/components/UI/editors/Wrapper.d.ts +16 -0
- package/build/components/UI/editors/useParam.d.ts +20 -0
- package/build/components/UI/editors/useValidation.d.ts +4 -0
- package/build/components/graphics/Badge.d.ts +70 -0
- package/build/components/graphics/CSysDisplay.d.ts +108 -0
- package/build/components/graphics/CompositeCurveObj.d.ts +33 -0
- package/build/components/graphics/GeometryOverrides/GeometryOverridesManager.d.ts +41 -0
- package/build/components/graphics/GeometryOverrides/GeometryOverridesStore.d.ts +28 -0
- package/build/components/graphics/GeometryOverrides/index.d.ts +2 -0
- package/build/components/graphics/GeometryOverrides/useOverrideGeometryColor.d.ts +36 -0
- package/build/components/graphics/HUD.d.ts +44 -0
- package/build/components/graphics/HoveredConstraintDisplay.d.ts +24 -0
- package/build/components/graphics/InfinityPlane.d.ts +4 -0
- package/build/components/graphics/Outlines/AAPass.d.ts +8 -0
- package/build/components/graphics/Outlines/IDPass.d.ts +12 -0
- package/build/components/graphics/Outlines/Outline.d.ts +62 -0
- package/build/components/graphics/Outlines/OutlineEffect.d.ts +48 -0
- package/build/components/graphics/Outlines/OutlineMaterial.d.ts +9 -0
- package/build/components/graphics/Outlines/WidenPass.d.ts +17 -0
- package/build/components/graphics/PluginGeometryBounds.d.ts +40 -0
- package/build/components/graphics/SelectableMate.d.ts +3 -0
- package/build/components/graphics/SelectedMateObj.d.ts +54 -0
- package/build/components/graphics/StageLook.d.ts +51 -0
- package/build/components/graphics/WorkAxisObj.d.ts +33 -0
- package/build/components/graphics/WorkCSysObj.d.ts +33 -0
- package/build/components/graphics/WorkCoordSystemObj.d.ts +32 -0
- package/build/components/graphics/WorkPlaneObj.d.ts +33 -0
- package/build/components/graphics/WorkPointObj.d.ts +57 -0
- package/build/components/graphics/graphics.d.ts +61 -0
- package/build/components/graphics/utils/MatePathTransform.d.ts +10 -0
- package/build/components/graphics/utils/useCsysMatrix.d.ts +4 -0
- package/build/components/utils/CompValidation/ErrorBoundary.d.ts +28 -0
- package/build/components/utils/CompValidation/validators/CSysDisplayValidator.d.ts +12 -0
- package/build/components/utils/CompValidation/validators/DrawingValidator.d.ts +12 -0
- package/build/components/utils/CompValidation/validators/ExpressionsValidator.d.ts +12 -0
- package/build/components/utils/CompValidation/validators/FPluginValidator.d.ts +16 -0
- package/build/components/utils/CompValidation/validators/FeatureListValidator.d.ts +12 -0
- package/build/components/utils/CompValidation/validators/ProductManagementValidator.d.ts +14 -0
- package/build/components/utils/CompValidation/verifiers.d.ts +32 -0
- package/build/components/utils/FtVisibilityController.d.ts +26 -0
- package/build/elements/index.d.ts +162 -0
- package/build/icons/axes.d.ts +73 -0
- package/build/icons/draw.d.ts +75 -0
- package/build/icons/features.d.ts +71 -0
- package/build/icons/glyphs.d.ts +10 -0
- package/build/icons/index.d.ts +152 -0
- package/build/icons/legacy.d.ts +159 -0
- package/build/icons/mates.d.ts +26 -0
- package/build/icons/params.d.ts +77 -0
- package/build/icons/refs.d.ts +61 -0
- package/build/icons/sheets.d.ts +302 -0
- package/build/icons/sketch.d.ts +102 -0
- package/build/icons/types.d.ts +74 -0
- package/build/icons/ui.d.ts +114 -0
- package/build/icons.cjs.js +1751 -0
- package/build/icons.js +1742 -0
- package/build/index.cjs.js +44948 -0
- package/build/index.d.ts +115 -0
- package/build/index.js +44800 -0
- package/build/plugins/AppearanceEditor/Root.d.ts +12 -0
- package/build/plugins/AppearanceEditor/index.d.ts +42 -0
- package/build/plugins/Boolean/Root.d.ts +11 -0
- package/build/plugins/Boolean/index.d.ts +39 -0
- package/build/plugins/BoundingBoxInfo/Root.d.ts +12 -0
- package/build/plugins/BoundingBoxInfo/View.d.ts +11 -0
- package/build/plugins/BoundingBoxInfo/index.d.ts +35 -0
- package/build/plugins/Box/Root.d.ts +11 -0
- package/build/plugins/Box/index.d.ts +34 -0
- package/build/plugins/Chamfer/Root.d.ts +11 -0
- package/build/plugins/Chamfer/index.d.ts +35 -0
- package/build/plugins/CircularPattern/Root.d.ts +11 -0
- package/build/plugins/CircularPattern/index.d.ts +35 -0
- package/build/plugins/CompositeCurve/Root.d.ts +11 -0
- package/build/plugins/CompositeCurve/View.d.ts +11 -0
- package/build/plugins/CompositeCurve/index.d.ts +36 -0
- package/build/plugins/Cone/Root.d.ts +11 -0
- package/build/plugins/Cone/index.d.ts +36 -0
- package/build/plugins/Cylinder/Root.d.ts +11 -0
- package/build/plugins/Cylinder/index.d.ts +35 -0
- package/build/plugins/Dimensions/DimContext.d.ts +10 -0
- package/build/plugins/Dimensions/Root.d.ts +11 -0
- package/build/plugins/Dimensions/View.d.ts +11 -0
- package/build/plugins/Dimensions/graphics/DimGraphics.d.ts +7 -0
- package/build/plugins/Dimensions/graphics/DimensionSet.d.ts +8 -0
- package/build/plugins/Dimensions/graphics/primitives.d.ts +34 -0
- package/build/plugins/Dimensions/index.d.ts +34 -0
- package/build/plugins/Dimensions/utils.d.ts +5 -0
- package/build/plugins/EntityDeletion/Root.d.ts +11 -0
- package/build/plugins/EntityDeletion/index.d.ts +34 -0
- package/build/plugins/Expressions/Root.d.ts +11 -0
- package/build/plugins/Expressions/index.d.ts +34 -0
- package/build/plugins/Expressions/useContextMenuItems.d.ts +4 -0
- package/build/plugins/Extrusion/Root.d.ts +11 -0
- package/build/plugins/Extrusion/View.d.ts +11 -0
- package/build/plugins/Extrusion/index.d.ts +50 -0
- package/build/plugins/Fillet/Root.d.ts +11 -0
- package/build/plugins/Fillet/index.d.ts +35 -0
- package/build/plugins/HLConstraints/CircularPattern/Root.d.ts +11 -0
- package/build/plugins/HLConstraints/CircularPattern/View.d.ts +11 -0
- package/build/plugins/HLConstraints/CircularPattern/index.d.ts +38 -0
- package/build/plugins/HLConstraints/Cylindrical/Root.d.ts +11 -0
- package/build/plugins/HLConstraints/Cylindrical/View.d.ts +11 -0
- package/build/plugins/HLConstraints/Cylindrical/index.d.ts +37 -0
- package/build/plugins/HLConstraints/Fastened/Root.d.ts +11 -0
- package/build/plugins/HLConstraints/Fastened/View.d.ts +11 -0
- package/build/plugins/HLConstraints/Fastened/index.d.ts +37 -0
- package/build/plugins/HLConstraints/FastenedOrigin/Root.d.ts +11 -0
- package/build/plugins/HLConstraints/FastenedOrigin/View.d.ts +11 -0
- package/build/plugins/HLConstraints/FastenedOrigin/index.d.ts +37 -0
- package/build/plugins/HLConstraints/Gear/Root.d.ts +11 -0
- package/build/plugins/HLConstraints/Gear/View.d.ts +11 -0
- package/build/plugins/HLConstraints/Gear/index.d.ts +36 -0
- package/build/plugins/HLConstraints/Group/Root.d.ts +11 -0
- package/build/plugins/HLConstraints/Group/index.d.ts +34 -0
- package/build/plugins/HLConstraints/LinearPattern/Root.d.ts +11 -0
- package/build/plugins/HLConstraints/LinearPattern/View.d.ts +11 -0
- package/build/plugins/HLConstraints/LinearPattern/index.d.ts +38 -0
- package/build/plugins/HLConstraints/Parallel/Root.d.ts +11 -0
- package/build/plugins/HLConstraints/Parallel/View.d.ts +11 -0
- package/build/plugins/HLConstraints/Parallel/index.d.ts +37 -0
- package/build/plugins/HLConstraints/Planar/Root.d.ts +11 -0
- package/build/plugins/HLConstraints/Planar/View.d.ts +11 -0
- package/build/plugins/HLConstraints/Planar/index.d.ts +37 -0
- package/build/plugins/HLConstraints/Revolute/Root.d.ts +11 -0
- package/build/plugins/HLConstraints/Revolute/View.d.ts +11 -0
- package/build/plugins/HLConstraints/Revolute/index.d.ts +37 -0
- package/build/plugins/HLConstraints/Slider/Root.d.ts +11 -0
- package/build/plugins/HLConstraints/Slider/View.d.ts +11 -0
- package/build/plugins/HLConstraints/Slider/index.d.ts +37 -0
- package/build/plugins/HLConstraints/Spherical/Root.d.ts +11 -0
- package/build/plugins/HLConstraints/Spherical/View.d.ts +11 -0
- package/build/plugins/HLConstraints/Spherical/index.d.ts +36 -0
- package/build/plugins/HLConstraints/components/CSysDisplayWrapper.d.ts +7 -0
- package/build/plugins/HLConstraints/components/HLConstrIcon.d.ts +7 -0
- package/build/plugins/HLConstraints/components/LimitedValue.d.ts +12 -0
- package/build/plugins/HLConstraints/components/Limits.d.ts +25 -0
- package/build/plugins/HLConstraints/components/LimitsCollapse.d.ts +12 -0
- package/build/plugins/HLConstraints/validators.d.ts +2 -0
- package/build/plugins/Import/Root.d.ts +11 -0
- package/build/plugins/Import/index.d.ts +35 -0
- package/build/plugins/LinearPattern/Root.d.ts +11 -0
- package/build/plugins/LinearPattern/index.d.ts +36 -0
- package/build/plugins/Measure/Digits.d.ts +7 -0
- package/build/plugins/Measure/Root.d.ts +11 -0
- package/build/plugins/Measure/View.d.ts +15 -0
- package/build/plugins/Measure/config.d.ts +1 -0
- package/build/plugins/Measure/graphics/MeasureGraphics.d.ts +24 -0
- package/build/plugins/Measure/index.d.ts +39 -0
- package/build/plugins/Measure/utils.d.ts +2 -0
- package/build/plugins/Mirror/Root.d.ts +11 -0
- package/build/plugins/Mirror/index.d.ts +34 -0
- package/build/plugins/Revolve/Root.d.ts +11 -0
- package/build/plugins/Revolve/index.d.ts +37 -0
- package/build/plugins/Rotate/Root.d.ts +11 -0
- package/build/plugins/Rotate/index.d.ts +35 -0
- package/build/plugins/Sketch/Root/Constraints/Constraints.d.ts +2 -0
- package/build/plugins/Sketch/Root/Constraints/constraintsHelpers.d.ts +22 -0
- package/build/plugins/Sketch/Root/Constraints/index.d.ts +2 -0
- package/build/plugins/Sketch/Root/Constraints/utils.d.ts +6 -0
- package/build/plugins/Sketch/Root/CopyPatterns.d.ts +2 -0
- package/build/plugins/Sketch/Root/Details.d.ts +2 -0
- package/build/plugins/Sketch/Root/Handlers.d.ts +2 -0
- package/build/plugins/Sketch/Root/PlaneSelection.d.ts +7 -0
- package/build/plugins/Sketch/Root/Position.d.ts +2 -0
- package/build/plugins/Sketch/Root/Regions.d.ts +2 -0
- package/build/plugins/Sketch/Root/Root.d.ts +11 -0
- package/build/plugins/Sketch/Root/RootContext.d.ts +7 -0
- package/build/plugins/Sketch/Root/SketchGroup.d.ts +15 -0
- package/build/plugins/Sketch/Root/index.d.ts +1 -0
- package/build/plugins/Sketch/Root/useContextMenuItems.d.ts +4 -0
- package/build/plugins/Sketch/Root/useLayoutSize.d.ts +11 -0
- package/build/plugins/Sketch/View/View.d.ts +11 -0
- package/build/plugins/Sketch/View/ViewContext.d.ts +8 -0
- package/build/plugins/Sketch/View/graphics/Constraints.d.ts +5 -0
- package/build/plugins/Sketch/View/graphics/IconGroups.d.ts +7 -0
- package/build/plugins/Sketch/View/graphics/Merged/Arc.d.ts +20 -0
- package/build/plugins/Sketch/View/graphics/Merged/ArcGeometry.d.ts +2 -0
- package/build/plugins/Sketch/View/graphics/Merged/ArcMaterial.d.ts +2 -0
- package/build/plugins/Sketch/View/graphics/Merged/Bezier.d.ts +19 -0
- package/build/plugins/Sketch/View/graphics/Merged/BezierGeometry.d.ts +12 -0
- package/build/plugins/Sketch/View/graphics/Merged/BezierMaterial.d.ts +2 -0
- package/build/plugins/Sketch/View/graphics/Merged/Circle.d.ts +9 -0
- package/build/plugins/Sketch/View/graphics/Merged/Line.d.ts +15 -0
- package/build/plugins/Sketch/View/graphics/Merged/LineGeometry.d.ts +2 -0
- package/build/plugins/Sketch/View/graphics/Merged/LineMaterial.d.ts +2 -0
- package/build/plugins/Sketch/View/graphics/Merged/MergedWrapper.d.ts +16 -0
- package/build/plugins/Sketch/View/graphics/Merged/Point.d.ts +8 -0
- package/build/plugins/Sketch/View/graphics/Merged/Spline.d.ts +17 -0
- package/build/plugins/Sketch/View/graphics/Merged/SplineGeometry.d.ts +11 -0
- package/build/plugins/Sketch/View/graphics/Merged/SplineMaterial.d.ts +2 -0
- package/build/plugins/Sketch/View/graphics/MousePosition.d.ts +2 -0
- package/build/plugins/Sketch/View/graphics/Regions.d.ts +5 -0
- package/build/plugins/Sketch/View/graphics/TmpAngularDimension.d.ts +8 -0
- package/build/plugins/Sketch/View/graphics/graphics.d.ts +5 -0
- package/build/plugins/Sketch/View/graphics/hooks.d.ts +49 -0
- package/build/plugins/Sketch/View/graphics/primitives.d.ts +34 -0
- package/build/plugins/Sketch/View/graphics/scale.d.ts +6 -0
- package/build/plugins/Sketch/View/graphics/tmpGraphics.d.ts +3 -0
- package/build/plugins/Sketch/View/graphics/transform.d.ts +4 -0
- package/build/plugins/Sketch/View/handlers/CreateAngle.d.ts +3 -0
- package/build/plugins/Sketch/View/handlers/CreateConstraint.d.ts +10 -0
- package/build/plugins/Sketch/View/handlers/Drag.d.ts +3 -0
- package/build/plugins/Sketch/View/handlers/DrawArc.d.ts +3 -0
- package/build/plugins/Sketch/View/handlers/DrawCircle.d.ts +3 -0
- package/build/plugins/Sketch/View/handlers/DrawLine.d.ts +3 -0
- package/build/plugins/Sketch/View/handlers/DrawNurbs.d.ts +3 -0
- package/build/plugins/Sketch/View/handlers/DrawPoint.d.ts +3 -0
- package/build/plugins/Sketch/View/handlers/DrawRectangle.d.ts +3 -0
- package/build/plugins/Sketch/View/handlers/Fillet.d.ts +3 -0
- package/build/plugins/Sketch/View/handlers/HandlersConstructors.d.ts +33 -0
- package/build/plugins/Sketch/View/handlers/Hover.d.ts +3 -0
- package/build/plugins/Sketch/View/handlers/SSelect.d.ts +3 -0
- package/build/plugins/Sketch/View/handlers/Split.d.ts +3 -0
- package/build/plugins/Sketch/View/handlers/Trim.d.ts +3 -0
- package/build/plugins/Sketch/View/handlers/Use.d.ts +3 -0
- package/build/plugins/Sketch/View/handlers/constraintCreation.d.ts +10 -0
- package/build/plugins/Sketch/View/handlers/filletHelpers.d.ts +24 -0
- package/build/plugins/Sketch/View/handlers/hoverHelpers.d.ts +3 -0
- package/build/plugins/Sketch/View/handlers/snapper.d.ts +11 -0
- package/build/plugins/Sketch/View/handlers/splitHelpers.d.ts +20 -0
- package/build/plugins/Sketch/View/index.d.ts +1 -0
- package/build/plugins/Sketch/constants.d.ts +5 -0
- package/build/plugins/Sketch/description.d.ts +7 -0
- package/build/plugins/Sketch/index.d.ts +35 -0
- package/build/plugins/Sketch/resources.d.ts +5 -0
- package/build/plugins/Sketch/types.d.ts +148 -0
- package/build/plugins/Sketch/utils/Interaction.d.ts +7 -0
- package/build/plugins/Sketch/utils/OverdefinedStateManager.d.ts +6 -0
- package/build/plugins/Sketch/utils/getSketchState.d.ts +3 -0
- package/build/plugins/Sketch/utils/useSketchRegions.d.ts +2 -0
- package/build/plugins/Sketch/utils/useSketchState.d.ts +3 -0
- package/build/plugins/Slice/Root.d.ts +11 -0
- package/build/plugins/Slice/index.d.ts +34 -0
- package/build/plugins/SliceBySheet/Root.d.ts +11 -0
- package/build/plugins/SliceBySheet/index.d.ts +35 -0
- package/build/plugins/Sphere/Root.d.ts +11 -0
- package/build/plugins/Sphere/index.d.ts +35 -0
- package/build/plugins/TransformByCsys/Root.d.ts +11 -0
- package/build/plugins/TransformByCsys/index.d.ts +35 -0
- package/build/plugins/Translate/Root.d.ts +11 -0
- package/build/plugins/Translate/index.d.ts +35 -0
- package/build/plugins/Twist/Root.d.ts +11 -0
- package/build/plugins/Twist/View.d.ts +11 -0
- package/build/plugins/Twist/index.d.ts +48 -0
- package/build/plugins/WorkAxis/Root.d.ts +11 -0
- package/build/plugins/WorkAxis/View.d.ts +11 -0
- package/build/plugins/WorkAxis/index.d.ts +37 -0
- package/build/plugins/WorkCSys/Root.d.ts +11 -0
- package/build/plugins/WorkCSys/View.d.ts +11 -0
- package/build/plugins/WorkCSys/index.d.ts +53 -0
- package/build/plugins/WorkCoordSystem/Root.d.ts +11 -0
- package/build/plugins/WorkCoordSystem/View.d.ts +11 -0
- package/build/plugins/WorkCoordSystem/index.d.ts +55 -0
- package/build/plugins/WorkPlane/Root.d.ts +11 -0
- package/build/plugins/WorkPlane/View.d.ts +11 -0
- package/build/plugins/WorkPlane/index.d.ts +38 -0
- package/build/plugins/WorkPlane/validators.d.ts +1 -0
- package/build/plugins/WorkPoint/Root.d.ts +11 -0
- package/build/plugins/WorkPoint/View.d.ts +11 -0
- package/build/plugins/WorkPoint/index.d.ts +38 -0
- package/build/plugins/components/PluginForm.d.ts +24 -0
- package/build/plugins/utils/useRefsReset.d.ts +2 -0
- package/build/session/identity.d.ts +46 -0
- package/build/session/sessionClient.d.ts +140 -0
- package/build/session/types.d.ts +52 -0
- package/build/session/viewpoints.d.ts +90 -0
- package/build/theme/AppStyle.d.ts +33 -0
- package/build/theme/fonts/mono.d.ts +29 -0
- package/build/theme/stage.d.ts +148 -0
- package/build/theme/styles/antdChoices.d.ts +1 -0
- package/build/theme/styles/antdControls.d.ts +1 -0
- package/build/theme/styles/antdSurfaces.d.ts +1 -0
- package/build/theme/styles/editors.d.ts +1 -0
- package/build/theme/styles/fields.d.ts +1 -0
- package/build/theme/styles/frame.d.ts +1 -0
- package/build/theme/styles/panes.d.ts +1 -0
- package/build/theme/styles/parts.d.ts +2 -0
- package/build/theme/styles/rest.d.ts +1 -0
- package/build/theme/styles/sketch.d.ts +1 -0
- package/build/theme/styles/toolbar.d.ts +1 -0
- package/build/theme/styles/tools.d.ts +1 -0
- package/build/theme/styles/windows.d.ts +1 -0
- package/build/theme/themeStore.d.ts +305 -0
- package/build/types/jsx-compat.d.ts +8 -0
- package/build/types.d.ts +16 -0
- package/build/utils/FileUtils.d.ts +20 -0
- package/build/utils/bezierMatrices.d.ts +3 -0
- package/build/utils/conversionUtils.d.ts +78 -0
- package/build/utils/cubicSplineInterpolation.d.ts +5 -0
- package/build/utils/defaultValues.d.ts +3 -0
- package/build/utils/drawing/index.d.ts +3 -0
- package/build/utils/drawing/useDrawingArr.d.ts +10 -0
- package/build/utils/drawing/useDrawingCCId.d.ts +10 -0
- package/build/utils/drawing/useDrawingStr.d.ts +10 -0
- package/build/utils/getHighlightedColor.d.ts +6 -0
- package/build/utils/getMatePath.d.ts +2 -0
- package/build/utils/getMateRefIds.d.ts +30 -0
- package/build/utils/helpers.d.ts +19 -0
- package/build/utils/mateUtils.d.ts +35 -0
- package/build/utils/nurbsUtils.d.ts +35 -0
- package/build/utils/selection/filters.d.ts +12 -0
- package/build/utils/selection/scopes/mateSelection.d.ts +49 -0
- package/build/utils/selection/scopes/treeObjInteraction.d.ts +74 -0
- package/build/utils/selection/useSelectorsOrder.d.ts +12 -0
- package/build/utils/sketchIntersectionUtils.d.ts +139 -0
- package/build/utils/sketchUtils.d.ts +235 -0
- package/build/utils/useAllObjects.d.ts +31 -0
- package/build/utils/useIsUncommited.d.ts +2 -0
- package/build/utils/useRetainVisibility.d.ts +2 -0
- package/build/utils/useScale.d.ts +5 -0
- package/build/utils/validation.d.ts +11 -0
- package/doc/api/advanced/session.md +646 -0
- package/doc/api/advanced/utilities.md +1306 -0
- package/doc/api/assembly-constraints.md +340 -0
- package/doc/api/feature-plugins.md +613 -0
- package/doc/api/graphics.md +848 -0
- package/doc/api/hooks.md +300 -0
- package/doc/api/icons.md +812 -0
- package/doc/api/index.md +87 -0
- package/doc/api/other.md +369 -0
- package/doc/api/panels.md +754 -0
- package/doc/api/theme.md +551 -0
- package/doc/api/tool-plugins.md +191 -0
- package/doc/api/ui-elements.md +310 -0
- package/doc/api/work-geometry.md +154 -0
- package/icons/package.json +8 -0
- package/package.json +109 -4
- package/tools/fonts/brotli.py +29 -0
- package/tools/fonts/build.py +76 -0
- package/tools/icons/preview.mjs +74 -0
- package/tsconfig.build.json +16 -0
- package/typedoc.json +18 -0
- package/vitest.config.mts +25 -0
|
@@ -0,0 +1,646 @@
|
|
|
1
|
+
# Session
|
|
2
|
+
|
|
3
|
+
A shared session: the client whose session the page shares, its role in it, and the peers' cameras and pointers.
|
|
4
|
+
|
|
5
|
+
## Types
|
|
6
|
+
|
|
7
|
+
### CursorData {#cursordata}
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
type CursorData = {
|
|
11
|
+
active?: boolean;
|
|
12
|
+
buttons?: number;
|
|
13
|
+
point?: [number, number, number];
|
|
14
|
+
};
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
A peer's pointer, broadcast on the 'cursor' presence channel. `point` is
|
|
18
|
+
world-space, projected onto the sender's view plane (the plane through the
|
|
19
|
+
orbit target perpendicular to the view direction) — meaningful for any
|
|
20
|
+
receiver, and exact when the receiver follows the sender's camera.
|
|
21
|
+
|
|
22
|
+
#### Properties
|
|
23
|
+
|
|
24
|
+
| Property | Type | Description |
|
|
25
|
+
| :------ | :------ | :------ |
|
|
26
|
+
| <a id="property-active"></a> `active?` | `boolean` | Whether the pointer is over the sender's stage. |
|
|
27
|
+
| <a id="property-buttons"></a> `buttons?` | `number` | Pressed mouse buttons, PointerEvent.buttons bitmask (1=left, 2=right). Lets receivers animate the cursor while the peer clicks or drags. |
|
|
28
|
+
| <a id="property-point"></a> `point?` | \[`number`, `number`, `number`\] | Where the pointer is, in world coordinates on the sender's view plane. |
|
|
29
|
+
|
|
30
|
+
***
|
|
31
|
+
|
|
32
|
+
### FollowState {#followstate}
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
type FollowState =
|
|
36
|
+
| {
|
|
37
|
+
name: string;
|
|
38
|
+
peerId: string;
|
|
39
|
+
}
|
|
40
|
+
| null;
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Whose camera this page looks through, if anyone's: the peer that is followed (`viewpoints.useFollow()`).
|
|
44
|
+
|
|
45
|
+
#### Union Members
|
|
46
|
+
|
|
47
|
+
##### Type Literal
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
{
|
|
51
|
+
name: string;
|
|
52
|
+
peerId: string;
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
| Name | Type | Description |
|
|
57
|
+
| :------ | :------ | :------ |
|
|
58
|
+
| `name` | `string` | Its name. |
|
|
59
|
+
| `peerId` | `string` | The followed peer's connection id. |
|
|
60
|
+
|
|
61
|
+
***
|
|
62
|
+
|
|
63
|
+
`null`
|
|
64
|
+
|
|
65
|
+
***
|
|
66
|
+
|
|
67
|
+
### IdentityColors {#identitycolors}
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
type IdentityColors = {
|
|
71
|
+
accent: string;
|
|
72
|
+
bg: string;
|
|
73
|
+
solid: string;
|
|
74
|
+
text: string;
|
|
75
|
+
};
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The colours of one participant of a shared session, in tones that go together: one hue, picked from its name.
|
|
79
|
+
|
|
80
|
+
They are CSS colours (`hsl(…)`), and do not change with the app's theme: `bg` and `text` are a pair that reads on
|
|
81
|
+
its own. `viewpoints.identityColors(name)` gives them.
|
|
82
|
+
|
|
83
|
+
#### Properties
|
|
84
|
+
|
|
85
|
+
| Property | Type | Description |
|
|
86
|
+
| :------ | :------ | :------ |
|
|
87
|
+
| <a id="property-accent"></a> `accent` | `string` | A medium tone, for borders and frames. |
|
|
88
|
+
| <a id="property-bg"></a> `bg` | `string` | A light pastel ground: a comment's chip, a thread's panel. |
|
|
89
|
+
| <a id="property-solid"></a> `solid` | `string` | A saturated tone, for what is drawn over the canvas: a camera's frustum, a name tag, a pointer, a swatch. |
|
|
90
|
+
| <a id="property-text"></a> `text` | `string` | A dark tone of the same hue, which always reads on `bg`. |
|
|
91
|
+
|
|
92
|
+
***
|
|
93
|
+
|
|
94
|
+
### ViewData {#viewdata}
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
type ViewData = {
|
|
98
|
+
height?: number;
|
|
99
|
+
name?: string;
|
|
100
|
+
position?: [number, number, number];
|
|
101
|
+
target?: [number, number, number];
|
|
102
|
+
up?: [number, number, number];
|
|
103
|
+
zoom?: number;
|
|
104
|
+
};
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
A peer's camera, broadcast on the 'view' presence channel: where it is, what it looks at, and its name.
|
|
108
|
+
|
|
109
|
+
viewpoints keeps the last of every peer's (`viewpoints.useViewpoints()`).
|
|
110
|
+
|
|
111
|
+
#### Properties
|
|
112
|
+
|
|
113
|
+
| Property | Type | Description |
|
|
114
|
+
| :------ | :------ | :------ |
|
|
115
|
+
| <a id="property-height"></a> `height?` | `number` | Visible world height of the sender's viewport (viewportPx / zoom). |
|
|
116
|
+
| <a id="property-name"></a> `name?` | `string` | The peer's name, for its name tag. |
|
|
117
|
+
| <a id="property-position"></a> `position?` | \[`number`, `number`, `number`\] | Where the camera is (world coordinates). |
|
|
118
|
+
| <a id="property-target"></a> `target?` | \[`number`, `number`, `number`\] | What it looks at: the orbit's target. |
|
|
119
|
+
| <a id="property-up"></a> `up?` | \[`number`, `number`, `number`\] | Its up. |
|
|
120
|
+
| <a id="property-zoom"></a> `zoom?` | `number` | Its zoom (an orthographic camera's). |
|
|
121
|
+
|
|
122
|
+
## sessionClient
|
|
123
|
+
|
|
124
|
+
The session this page shares, for react-cad's components: which client it is, this page's role in it, and what its
|
|
125
|
+
host offers.
|
|
126
|
+
|
|
127
|
+
A thin React layer over the sharing API of `@classcad/client` (`session/share.ts`); any sdkjs app can build its
|
|
128
|
+
own UI on that API without react-cad. Which client is "the session client" is decided by the app, with
|
|
129
|
+
{@link setSessionClient}: a `WSClient` (the session is a ClassCAD server's, or a ClassCAD MCP's) or a `WASMClient`
|
|
130
|
+
(the page hosts it itself). Both have the same surface (role, peers, invites, `createInvite`/`revokeInvite`,
|
|
131
|
+
presence). The Session Management panel, read-only views for a viewer and the export menu's formats follow it.
|
|
132
|
+
|
|
133
|
+
**Example**
|
|
134
|
+
|
|
135
|
+
```tsx
|
|
136
|
+
import { init, onClient, syncSelection, WSClient } from '@classcad/client'
|
|
137
|
+
import { elements, sessionClient, SessionManagement, viewpoints } from '@classcad/react-cad'
|
|
138
|
+
|
|
139
|
+
init((drawingId) => new WSClient('wss://classcad.example.com', drawingId), {
|
|
140
|
+
elements,
|
|
141
|
+
globalPlugins: [SessionManagement],
|
|
142
|
+
})
|
|
143
|
+
// every client, before it connects: its session is the page's; the peers' cameras and selections are heard
|
|
144
|
+
onClient((client) => {
|
|
145
|
+
sessionClient.setSessionClient(client)
|
|
146
|
+
viewpoints.syncViewpoints(client)
|
|
147
|
+
syncSelection(client)
|
|
148
|
+
})
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### sessionClient.buildInviteUrl() {#sessionclientbuildinviteurl}
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
function buildInviteUrl(token): string;
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Builds a shareable URL for a token (`?invite=<token>`), preserving the current origin and path.
|
|
158
|
+
|
|
159
|
+
#### Parameters
|
|
160
|
+
|
|
161
|
+
| Parameter | Type | Description |
|
|
162
|
+
| :------ | :------ | :------ |
|
|
163
|
+
| `token` | `string` | An invite's token: its `invite`, as `createInvite` returns it and the client's `invites` list it. |
|
|
164
|
+
|
|
165
|
+
#### Returns
|
|
166
|
+
|
|
167
|
+
`string`
|
|
168
|
+
|
|
169
|
+
#### Example
|
|
170
|
+
|
|
171
|
+
```tsx
|
|
172
|
+
import { sessionClient } from '@classcad/react-cad'
|
|
173
|
+
|
|
174
|
+
// a button of the host's: an invite to view the session, its link copied
|
|
175
|
+
function ShareButton() {
|
|
176
|
+
const client = sessionClient.useSessionClient()
|
|
177
|
+
if (!client?.shareKind || sessionClient.getInviteFromUrl()) return null
|
|
178
|
+
const share = async () => {
|
|
179
|
+
const { invite } = await client.createInvite('view', 'Review')
|
|
180
|
+
await navigator.clipboard.writeText(sessionClient.buildInviteUrl(invite))
|
|
181
|
+
}
|
|
182
|
+
return <button onClick={share}>Share for review</button>
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
***
|
|
187
|
+
|
|
188
|
+
### sessionClient.getInviteFromUrl() {#sessionclientgetinvitefromurl}
|
|
189
|
+
|
|
190
|
+
```ts
|
|
191
|
+
function getInviteFromUrl(): string | undefined;
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
The share token this page was opened with, if any: then it is a guest in somebody else's session.
|
|
195
|
+
|
|
196
|
+
#### Returns
|
|
197
|
+
|
|
198
|
+
`string` \| `undefined`
|
|
199
|
+
|
|
200
|
+
***
|
|
201
|
+
|
|
202
|
+
### sessionClient.offeredTypes() {#sessionclientofferedtypes}
|
|
203
|
+
|
|
204
|
+
```ts
|
|
205
|
+
function offeredTypes(own, saveFormats?): string[];
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
The file types (lower case: 'stp') a menu offers for saving: the app's own, less what the
|
|
209
|
+
session's host keeps back, then what the host offers beyond them.
|
|
210
|
+
|
|
211
|
+
#### Parameters
|
|
212
|
+
|
|
213
|
+
| Parameter | Type | Description |
|
|
214
|
+
| :------ | :------ | :------ |
|
|
215
|
+
| `own` | readonly `string`[] | The types the app saves itself, such as `['ofb', 'stp', 'stl']`. |
|
|
216
|
+
| `saveFormats?` | `string`[] | What the host offers ([SessionConfig](#sessionclientsessionconfig).saveFormats); without it, the app's own. |
|
|
217
|
+
|
|
218
|
+
#### Returns
|
|
219
|
+
|
|
220
|
+
`string`[]
|
|
221
|
+
|
|
222
|
+
#### Example
|
|
223
|
+
|
|
224
|
+
```tsx
|
|
225
|
+
import { createApi } from '@classcad/client'
|
|
226
|
+
import type { DrawingID } from '@classcad/sdkjs'
|
|
227
|
+
import { Menu, sessionClient } from '@classcad/react-cad'
|
|
228
|
+
import type { MenuItems } from '@classcad/react-cad'
|
|
229
|
+
|
|
230
|
+
// an export menu with what the app saves, as far as the session's host allows, and what the host adds
|
|
231
|
+
function ExportMenu({ drawingId }: { drawingId: DrawingID }) {
|
|
232
|
+
const { saveFormats } = sessionClient.useSessionConfig()
|
|
233
|
+
const types = sessionClient.offeredTypes(['ofb', 'stp', 'stl'], saveFormats)
|
|
234
|
+
const items: MenuItems = Object.fromEntries(
|
|
235
|
+
types.map((type) => [type, { caption: type.toUpperCase(), callback: () => createApi(drawingId).v1.common.save({ format: type.toUpperCase() as 'STP', encoding: 'base64' }) }]),
|
|
236
|
+
)
|
|
237
|
+
return <Menu items={items} />
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
***
|
|
242
|
+
|
|
243
|
+
### sessionClient.SessionConfig {#sessionclientsessionconfig}
|
|
244
|
+
|
|
245
|
+
```ts
|
|
246
|
+
type sessionClient.SessionConfig = {
|
|
247
|
+
saveFormats?: string[];
|
|
248
|
+
};
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
What a session's host says its guests are offered. It travels on the
|
|
252
|
+
'config' presence channel: only a host may publish there, and the server
|
|
253
|
+
keeps the frame for those who join later. A session whose host says nothing
|
|
254
|
+
offers everything the app can do.
|
|
255
|
+
|
|
256
|
+
#### See
|
|
257
|
+
|
|
258
|
+
[useSessionConfig](#sessionclientusesessionconfig)
|
|
259
|
+
|
|
260
|
+
#### Properties
|
|
261
|
+
|
|
262
|
+
| Property | Type | Description |
|
|
263
|
+
| :------ | :------ | :------ |
|
|
264
|
+
| <a id="property-saveformats"></a> `saveFormats?` | `string`[] | The formats a model may be saved in from this session (upper case: 'STP', 'STL', 'OFB'). A host whose engine saves formats beyond ClassCAD's names them too ('GLB', 'OBJ'): the apps offer them after their own and ask for them with v1.common.save. |
|
|
265
|
+
|
|
266
|
+
***
|
|
267
|
+
|
|
268
|
+
### sessionClient.setSessionClient() {#sessionclientsetsessionclient}
|
|
269
|
+
|
|
270
|
+
```ts
|
|
271
|
+
function setSessionClient(client): void;
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Registers the client whose session this page shares (null: none). The app
|
|
275
|
+
calls it when it creates the client, before connecting; from then on the
|
|
276
|
+
hooks below follow that client, and what its session's host offers is heard.
|
|
277
|
+
|
|
278
|
+
#### Parameters
|
|
279
|
+
|
|
280
|
+
| Parameter | Type | Description |
|
|
281
|
+
| :------ | :------ | :------ |
|
|
282
|
+
| `client` | `AwvNodeClient` \| `null` | The drawing's client, such as the one `onClient` (`@classcad/client`) hands over. |
|
|
283
|
+
|
|
284
|
+
#### Returns
|
|
285
|
+
|
|
286
|
+
`void`
|
|
287
|
+
|
|
288
|
+
***
|
|
289
|
+
|
|
290
|
+
### sessionClient.useSessionClient() {#sessionclientusesessionclient}
|
|
291
|
+
|
|
292
|
+
```ts
|
|
293
|
+
function useSessionClient(): AwvNodeClient | null;
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
Returns the session client the app registered ([setSessionClient](#sessionclientsetsessionclient)), or null when it registered none; and
|
|
297
|
+
renders again when another is registered.
|
|
298
|
+
|
|
299
|
+
#### Returns
|
|
300
|
+
|
|
301
|
+
`AwvNodeClient` \| `null`
|
|
302
|
+
|
|
303
|
+
***
|
|
304
|
+
|
|
305
|
+
### sessionClient.useSessionConfig() {#sessionclientusesessionconfig}
|
|
306
|
+
|
|
307
|
+
```ts
|
|
308
|
+
function useSessionConfig(): sessionClient.SessionConfig;
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
Returns what the host of the session this page is in offers its guests ([SessionConfig](#sessionclientsessionconfig)), and renders again
|
|
312
|
+
when the host says otherwise.
|
|
313
|
+
|
|
314
|
+
#### Returns
|
|
315
|
+
|
|
316
|
+
[`sessionClient.SessionConfig`](#sessionclientsessionconfig)
|
|
317
|
+
|
|
318
|
+
***
|
|
319
|
+
|
|
320
|
+
### sessionClient.useSessionRole() {#sessionclientusesessionrole}
|
|
321
|
+
|
|
322
|
+
```ts
|
|
323
|
+
function useSessionRole(): SessionRole;
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
This connection's role within a shared session, kept reactive. Guests get
|
|
327
|
+
their role from the server's `SessionJoined` frame; hosts and non-sharing
|
|
328
|
+
clients are always `'edit'`.
|
|
329
|
+
|
|
330
|
+
#### Returns
|
|
331
|
+
|
|
332
|
+
`SessionRole`
|
|
333
|
+
|
|
334
|
+
#### Example
|
|
335
|
+
|
|
336
|
+
```tsx
|
|
337
|
+
import type { DrawingID } from '@classcad/sdkjs'
|
|
338
|
+
import { Drawing, sessionClient } from '@classcad/react-cad'
|
|
339
|
+
|
|
340
|
+
// a viewer of a shared session browses the model, but has no tools to change it
|
|
341
|
+
function Editor({ drawingId, children }: { drawingId: DrawingID; children: React.ReactNode }) {
|
|
342
|
+
const readOnly = sessionClient.useSessionRole() === 'view'
|
|
343
|
+
return (
|
|
344
|
+
<Drawing drawingId={drawingId} readOnly={readOnly}>
|
|
345
|
+
{children}
|
|
346
|
+
</Drawing>
|
|
347
|
+
)
|
|
348
|
+
}
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
## viewpoints
|
|
352
|
+
|
|
353
|
+
What the peers of a shared session show of themselves besides the model: their cameras and pointers, and whose
|
|
354
|
+
camera this page follows.
|
|
355
|
+
|
|
356
|
+
A small store for the whole page, fed by the session's presence frames once {@link syncViewpoints} is attached to
|
|
357
|
+
the client: 'view' (a peer's camera, {@link ViewData}), 'cursor' (its pointer, {@link CursorData}) and 'leave'.
|
|
358
|
+
The canvas components (a peer's camera as a marker, a camera that follows one) and the page around the canvas (a
|
|
359
|
+
banner that says whom it follows) read the same store with its hooks, across the canvas' boundary. The colours a
|
|
360
|
+
peer is drawn in are {@link identityColors} of its name.
|
|
361
|
+
|
|
362
|
+
**Example**
|
|
363
|
+
|
|
364
|
+
```tsx
|
|
365
|
+
import { viewpoints } from '@classcad/react-cad'
|
|
366
|
+
|
|
367
|
+
// the peers of the session, each in its colour; a click looks through that peer's camera
|
|
368
|
+
function Peers() {
|
|
369
|
+
const views = viewpoints.useViewpoints()
|
|
370
|
+
const follow = viewpoints.useFollow()
|
|
371
|
+
return (
|
|
372
|
+
<ul>
|
|
373
|
+
{Object.entries(views).map(([peerId, view]) => (
|
|
374
|
+
<li key={peerId} style={{ color: viewpoints.colorFor(view.name ?? '') }}
|
|
375
|
+
onClick={() => (follow?.peerId === peerId ? viewpoints.clearFollow() : viewpoints.setFollow(peerId, view.name ?? 'unnamed'))}>
|
|
376
|
+
{view.name ?? 'unnamed'} {follow?.peerId === peerId && '(following)'}
|
|
377
|
+
</li>
|
|
378
|
+
))}
|
|
379
|
+
</ul>
|
|
380
|
+
)
|
|
381
|
+
}
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### viewpoints.clearFollow() {#viewpointsclearfollow}
|
|
385
|
+
|
|
386
|
+
```ts
|
|
387
|
+
function clearFollow(): void;
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
Stops following a peer's camera.
|
|
391
|
+
|
|
392
|
+
#### Returns
|
|
393
|
+
|
|
394
|
+
`void`
|
|
395
|
+
|
|
396
|
+
***
|
|
397
|
+
|
|
398
|
+
### viewpoints.colorFor() {#viewpointscolorfor}
|
|
399
|
+
|
|
400
|
+
```ts
|
|
401
|
+
function colorFor(name): string;
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
The solid colour of a participant ([identityColors](#viewpointsidentitycolors)`(name).solid`): for frustums, name tags, cursors, swatches.
|
|
405
|
+
|
|
406
|
+
#### Parameters
|
|
407
|
+
|
|
408
|
+
| Parameter | Type | Description |
|
|
409
|
+
| :------ | :------ | :------ |
|
|
410
|
+
| `name` | `string` | The display name. |
|
|
411
|
+
|
|
412
|
+
#### Returns
|
|
413
|
+
|
|
414
|
+
`string`
|
|
415
|
+
|
|
416
|
+
***
|
|
417
|
+
|
|
418
|
+
### viewpoints.getCursors() {#viewpointsgetcursors}
|
|
419
|
+
|
|
420
|
+
```ts
|
|
421
|
+
function getCursors(): Record<string, CursorData>;
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
The last pointer of every peer, by peer id, outside of a component ([useCursors](#viewpointsusecursors) in one).
|
|
425
|
+
|
|
426
|
+
#### Returns
|
|
427
|
+
|
|
428
|
+
`Record`<`string`, [`CursorData`](#cursordata)>
|
|
429
|
+
|
|
430
|
+
***
|
|
431
|
+
|
|
432
|
+
### viewpoints.getFollow() {#viewpointsgetfollow}
|
|
433
|
+
|
|
434
|
+
```ts
|
|
435
|
+
function getFollow(): FollowState;
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
Whose camera this page follows, outside of a component ([useFollow](#viewpointsusefollow) in one).
|
|
439
|
+
|
|
440
|
+
#### Returns
|
|
441
|
+
|
|
442
|
+
[`FollowState`](#followstate)
|
|
443
|
+
|
|
444
|
+
***
|
|
445
|
+
|
|
446
|
+
### viewpoints.getModelRadius() {#viewpointsgetmodelradius}
|
|
447
|
+
|
|
448
|
+
```ts
|
|
449
|
+
function getModelRadius(): number | null;
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
The radius of the sphere around the model, as [setModelRadius](#viewpointssetmodelradius) gave it, outside of a component.
|
|
453
|
+
|
|
454
|
+
#### Returns
|
|
455
|
+
|
|
456
|
+
`number` \| `null`
|
|
457
|
+
|
|
458
|
+
***
|
|
459
|
+
|
|
460
|
+
### viewpoints.getViewpoints() {#viewpointsgetviewpoints}
|
|
461
|
+
|
|
462
|
+
```ts
|
|
463
|
+
function getViewpoints(): Record<string, ViewData>;
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
The last camera of every peer, by peer id, outside of a component ([useViewpoints](#viewpointsuseviewpoints) in one).
|
|
467
|
+
|
|
468
|
+
#### Returns
|
|
469
|
+
|
|
470
|
+
`Record`<`string`, [`ViewData`](#viewdata)>
|
|
471
|
+
|
|
472
|
+
***
|
|
473
|
+
|
|
474
|
+
### viewpoints.identityColors() {#viewpointsidentitycolors}
|
|
475
|
+
|
|
476
|
+
```ts
|
|
477
|
+
function identityColors(name): IdentityColors;
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
The colours a participant of a shared session is shown in, picked from its display name.
|
|
481
|
+
|
|
482
|
+
The name, not the connection's peer id: the same person gets the same colours on every client, in every session,
|
|
483
|
+
and in everything that shows them. The pick is a hash of the name (case and outer spaces aside) into a palette of
|
|
484
|
+
twelve hues, so every client agrees on it. An empty name is grey.
|
|
485
|
+
|
|
486
|
+
#### Parameters
|
|
487
|
+
|
|
488
|
+
| Parameter | Type | Description |
|
|
489
|
+
| :------ | :------ | :------ |
|
|
490
|
+
| `name` | `string` | The display name: an invite's name, `Host`, `unnamed`, or a name the user set. |
|
|
491
|
+
|
|
492
|
+
#### Returns
|
|
493
|
+
|
|
494
|
+
[`IdentityColors`](#identitycolors)
|
|
495
|
+
|
|
496
|
+
#### Example
|
|
497
|
+
|
|
498
|
+
```tsx
|
|
499
|
+
import { viewpoints } from '@classcad/react-cad'
|
|
500
|
+
|
|
501
|
+
// a name tag in a participant's colours: the same on every client
|
|
502
|
+
function NameTag({ name }: { name: string }) {
|
|
503
|
+
const { bg, text, accent } = viewpoints.identityColors(name)
|
|
504
|
+
return <span style={{ background: bg, color: text, border: `1px solid ${accent}`, borderRadius: 4 }}>{name}</span>
|
|
505
|
+
}
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
***
|
|
509
|
+
|
|
510
|
+
### viewpoints.IdentityColors {#viewpointsidentitycolors-1}
|
|
511
|
+
|
|
512
|
+
Renames and re-exports [IdentityColors](#identitycolors)
|
|
513
|
+
|
|
514
|
+
***
|
|
515
|
+
|
|
516
|
+
### viewpoints.setFollow() {#viewpointssetfollow}
|
|
517
|
+
|
|
518
|
+
```ts
|
|
519
|
+
function setFollow(peerId, name): void;
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
Follows a peer's camera: this page's camera is to look through it, until [clearFollow](#viewpointsclearfollow), or until the peer
|
|
523
|
+
leaves.
|
|
524
|
+
|
|
525
|
+
The store only says whom to follow; the canvas component that moves the camera reads it with [useFollow](#viewpointsusefollow).
|
|
526
|
+
|
|
527
|
+
#### Parameters
|
|
528
|
+
|
|
529
|
+
| Parameter | Type | Description |
|
|
530
|
+
| :------ | :------ | :------ |
|
|
531
|
+
| `peerId` | `string` | The peer's connection id, as [useViewpoints](#viewpointsuseviewpoints) keys it. |
|
|
532
|
+
| `name` | `string` | Its name, for whatever says whom the page follows. |
|
|
533
|
+
|
|
534
|
+
#### Returns
|
|
535
|
+
|
|
536
|
+
`void`
|
|
537
|
+
|
|
538
|
+
***
|
|
539
|
+
|
|
540
|
+
### viewpoints.setModelRadius() {#viewpointssetmodelradius}
|
|
541
|
+
|
|
542
|
+
```ts
|
|
543
|
+
function setModelRadius(radius): void;
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
Says how large the model is: the radius of the sphere around it (world units), or null while there is none.
|
|
547
|
+
|
|
548
|
+
The peers' camera markers are placed on a ring of that size around the model, not where their zoom would put them.
|
|
549
|
+
The app feeds it from the drawing's structure (`api.structure.calculateProductBounds`).
|
|
550
|
+
|
|
551
|
+
#### Parameters
|
|
552
|
+
|
|
553
|
+
| Parameter | Type |
|
|
554
|
+
| :------ | :------ |
|
|
555
|
+
| `radius` | `number` \| `null` |
|
|
556
|
+
|
|
557
|
+
#### Returns
|
|
558
|
+
|
|
559
|
+
`void`
|
|
560
|
+
|
|
561
|
+
***
|
|
562
|
+
|
|
563
|
+
### viewpoints.syncViewpoints() {#viewpointssyncviewpoints}
|
|
564
|
+
|
|
565
|
+
```ts
|
|
566
|
+
function syncViewpoints(client): () => void;
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
Attaches the store to a WSClient: 'view' presence updates the peer's
|
|
570
|
+
viewpoint, 'cursor' its pointer, 'leave' removes both (and exits follow
|
|
571
|
+
mode if that peer was being followed). Returns a detach function.
|
|
572
|
+
|
|
573
|
+
Only one client is attached at a time: attaching a new one detaches the
|
|
574
|
+
previous client and clears the store first, so peers of a replaced session
|
|
575
|
+
(new file / new drawing) never linger as stale markers.
|
|
576
|
+
|
|
577
|
+
Attach it before the client connects: the peers' cameras arrive right after it has joined, before any component
|
|
578
|
+
has mounted. (See the example of sessionClient.)
|
|
579
|
+
|
|
580
|
+
#### Parameters
|
|
581
|
+
|
|
582
|
+
| Parameter | Type | Description |
|
|
583
|
+
| :------ | :------ | :------ |
|
|
584
|
+
| `client` | `AwvNodeClient` | The session's client: a `WSClient` or a `WASMClient` of `@classcad/client`. |
|
|
585
|
+
|
|
586
|
+
#### Returns
|
|
587
|
+
|
|
588
|
+
A function that detaches it again, and clears the store.
|
|
589
|
+
|
|
590
|
+
() => `void`
|
|
591
|
+
|
|
592
|
+
***
|
|
593
|
+
|
|
594
|
+
### viewpoints.useCursors() {#viewpointsusecursors}
|
|
595
|
+
|
|
596
|
+
```ts
|
|
597
|
+
function useCursors(): Record<string, CursorData>;
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
Returns the last pointer of every peer, by peer id, and renders again when one moves, comes or goes.
|
|
601
|
+
|
|
602
|
+
#### Returns
|
|
603
|
+
|
|
604
|
+
`Record`<`string`, [`CursorData`](#cursordata)>
|
|
605
|
+
|
|
606
|
+
***
|
|
607
|
+
|
|
608
|
+
### viewpoints.useFollow() {#viewpointsusefollow}
|
|
609
|
+
|
|
610
|
+
```ts
|
|
611
|
+
function useFollow(): FollowState;
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
Returns whose camera this page follows (null: no one's), and renders again when that changes.
|
|
615
|
+
|
|
616
|
+
#### Returns
|
|
617
|
+
|
|
618
|
+
[`FollowState`](#followstate)
|
|
619
|
+
|
|
620
|
+
***
|
|
621
|
+
|
|
622
|
+
### viewpoints.useModelRadius() {#viewpointsusemodelradius}
|
|
623
|
+
|
|
624
|
+
```ts
|
|
625
|
+
function useModelRadius(): number | null;
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
Returns the model's radius ([setModelRadius](#viewpointssetmodelradius)), and renders again when it changes.
|
|
629
|
+
|
|
630
|
+
#### Returns
|
|
631
|
+
|
|
632
|
+
`number` \| `null`
|
|
633
|
+
|
|
634
|
+
***
|
|
635
|
+
|
|
636
|
+
### viewpoints.useViewpoints() {#viewpointsuseviewpoints}
|
|
637
|
+
|
|
638
|
+
```ts
|
|
639
|
+
function useViewpoints(): Record<string, ViewData>;
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
Returns the last camera of every peer, by peer id, and renders again when one moves, comes or goes.
|
|
643
|
+
|
|
644
|
+
#### Returns
|
|
645
|
+
|
|
646
|
+
`Record`<`string`, [`ViewData`](#viewdata)>
|