@classcad/react-cad 0.0.0-stage → 3.0.0-beta.20261119090857

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.
Files changed (471) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +98 -2
  3. package/build/components/UI/CAD/Constraints.d.ts +30 -0
  4. package/build/components/UI/CAD/Drawing.d.ts +83 -0
  5. package/build/components/UI/CAD/ListPlaceholder.d.ts +3 -0
  6. package/build/components/UI/CAD/Messages/Message.d.ts +8 -0
  7. package/build/components/UI/CAD/Messages/Messages.d.ts +43 -0
  8. package/build/components/UI/CAD/Messages/index.d.ts +1 -0
  9. package/build/components/UI/CAD/Messages/msgStore.d.ts +18 -0
  10. package/build/components/UI/CAD/ModelTree/AssemblyNode.d.ts +5 -0
  11. package/build/components/UI/CAD/ModelTree/FeatureList/Feature.d.ts +8 -0
  12. package/build/components/UI/CAD/ModelTree/FeatureList/FeatureList.d.ts +6 -0
  13. package/build/components/UI/CAD/ModelTree/FeatureList/index.d.ts +1 -0
  14. package/build/components/UI/CAD/ModelTree/FeatureList/utils.d.ts +26 -0
  15. package/build/components/UI/CAD/ModelTree/ModelTree.d.ts +56 -0
  16. package/build/components/UI/CAD/ModelTree/ModelTreeHeader.d.ts +15 -0
  17. package/build/components/UI/CAD/ModelTree/index.d.ts +1 -0
  18. package/build/components/UI/CAD/ModelTree/primitives.d.ts +6 -0
  19. package/build/components/UI/CAD/ModelTree/useContextMenuItems.d.ts +4 -0
  20. package/build/components/UI/CAD/PluginBounds.d.ts +8 -0
  21. package/build/components/UI/CAD/PluginTooltip.d.ts +5 -0
  22. package/build/components/UI/CAD/PluginsWindows.d.ts +99 -0
  23. package/build/components/UI/CAD/ReadOnlyContext.d.ts +10 -0
  24. package/build/components/UI/CAD/SideBar.d.ts +40 -0
  25. package/build/components/UI/CAD/Solids/Solids.d.ts +23 -0
  26. package/build/components/UI/CAD/Solids/index.d.ts +1 -0
  27. package/build/components/UI/CAD/Solids/useContextMenuItems.d.ts +4 -0
  28. package/build/components/UI/CAD/Solids/useVisibleSolids.d.ts +30 -0
  29. package/build/components/UI/CAD/StageHud.d.ts +9 -0
  30. package/build/components/UI/CAD/StatusBar.d.ts +11 -0
  31. package/build/components/UI/CAD/ThemeToggle.d.ts +25 -0
  32. package/build/components/UI/CAD/ToolBar/AssemblyModeCmds.d.ts +3 -0
  33. package/build/components/UI/CAD/ToolBar/PartModeCmds.d.ts +3 -0
  34. package/build/components/UI/CAD/ToolBar/ToolBar.d.ts +24 -0
  35. package/build/components/UI/CAD/ToolBar/index.d.ts +1 -0
  36. package/build/components/UI/CAD/ToolBar/useCommands.d.ts +12 -0
  37. package/build/components/UI/CAD/ViewOptionsBar/ViewOptionButtons.d.ts +30 -0
  38. package/build/components/UI/CAD/ViewOptionsBar/useOptionCommands.d.ts +65 -0
  39. package/build/components/UI/CAD/ViewPlugButtons.d.ts +43 -0
  40. package/build/components/UI/CAD/ant-design-draggable-modal/DraggableModal.d.ts +18 -0
  41. package/build/components/UI/CAD/ant-design-draggable-modal/DraggableModalContext.d.ts +9 -0
  42. package/build/components/UI/CAD/ant-design-draggable-modal/DraggableModalInner.d.ts +27 -0
  43. package/build/components/UI/CAD/ant-design-draggable-modal/DraggableModalProvider.d.ts +4 -0
  44. package/build/components/UI/CAD/ant-design-draggable-modal/OverlayScrollbar.d.ts +6 -0
  45. package/build/components/UI/CAD/ant-design-draggable-modal/ResizeHandle.d.ts +2 -0
  46. package/build/components/UI/CAD/ant-design-draggable-modal/clamp.d.ts +1 -0
  47. package/build/components/UI/CAD/ant-design-draggable-modal/draggableModalReducer.d.ts +123 -0
  48. package/build/components/UI/CAD/ant-design-draggable-modal/getWindowSize.d.ts +4 -0
  49. package/build/components/UI/CAD/ant-design-draggable-modal/index.d.ts +3 -0
  50. package/build/components/UI/CAD/ant-design-draggable-modal/useDrag.d.ts +5 -0
  51. package/build/components/UI/CAD/ant-design-draggable-modal/usePrevious.d.ts +1 -0
  52. package/build/components/UI/CAD/ant-design-draggable-modal/useResize.d.ts +7 -0
  53. package/build/components/UI/CAD/common/BlankDiv.d.ts +3 -0
  54. package/build/components/UI/CAD/common/Collapse.d.ts +13 -0
  55. package/build/components/UI/CAD/common/ContextMenu.d.ts +115 -0
  56. package/build/components/UI/CAD/common/Divider.d.ts +4 -0
  57. package/build/components/UI/CAD/common/EntityName.d.ts +14 -0
  58. package/build/components/UI/CAD/common/Img.d.ts +6 -0
  59. package/build/components/UI/CAD/common/LoadingScreen/LoadingScreen.d.ts +8 -0
  60. package/build/components/UI/CAD/common/LoadingScreen/Spinner.d.ts +3 -0
  61. package/build/components/UI/CAD/common/LoadingScreen/index.d.ts +1 -0
  62. package/build/components/UI/CAD/common/Menu.d.ts +81 -0
  63. package/build/components/UI/CAD/common/MultiSelect.d.ts +12 -0
  64. package/build/components/UI/CAD/common/NameEdit.d.ts +7 -0
  65. package/build/components/UI/CAD/common/SectionHeader.d.ts +9 -0
  66. package/build/components/UI/CAD/common/primitives.d.ts +36 -0
  67. package/build/components/UI/CAD/common/reveal.d.ts +12 -0
  68. package/build/components/UI/CAD/hooks/index.d.ts +13 -0
  69. package/build/components/UI/CAD/hooks/useContextMenuInteraction.d.ts +7 -0
  70. package/build/components/UI/CAD/hooks/useContextMenuItems.d.ts +4 -0
  71. package/build/components/UI/CAD/hooks/useCurrentInstance.d.ts +2 -0
  72. package/build/components/UI/CAD/hooks/useCurrentProduct.d.ts +2 -0
  73. package/build/components/UI/CAD/hooks/useEditMode.d.ts +40 -0
  74. package/build/components/UI/CAD/hooks/useFeatureCount.d.ts +6 -0
  75. package/build/components/UI/CAD/hooks/useGlobalMateInfo.d.ts +6 -0
  76. package/build/components/UI/CAD/hooks/useHasPending.d.ts +27 -0
  77. package/build/components/UI/CAD/hooks/useIsDisabled.d.ts +2 -0
  78. package/build/components/UI/CAD/hooks/useIsLoading.d.ts +25 -0
  79. package/build/components/UI/CAD/hooks/useIsSketchActive.d.ts +26 -0
  80. package/build/components/UI/CAD/hooks/useObjectDetails.d.ts +12 -0
  81. package/build/components/UI/CAD/hooks/useOperationSequence.d.ts +29 -0
  82. package/build/components/UI/CAD/hooks/useRollbackBar.d.ts +8 -0
  83. package/build/components/UI/CAD/hooks/useRoot.d.ts +2 -0
  84. package/build/components/UI/CAD/index.d.ts +27 -0
  85. package/build/components/UI/CAD/plugins/ProductManagement/ProdTable.d.ts +10 -0
  86. package/build/components/UI/CAD/plugins/ProductManagement/Root.d.ts +11 -0
  87. package/build/components/UI/CAD/plugins/ProductManagement/View.d.ts +11 -0
  88. package/build/components/UI/CAD/plugins/ProductManagement/index.d.ts +34 -0
  89. package/build/components/UI/CAD/plugins/ProductManagement/types.d.ts +4 -0
  90. package/build/components/UI/CAD/plugins/ProductManagement/useContextMenuItems.d.ts +4 -0
  91. package/build/components/UI/CAD/plugins/SessionManagement/Root.d.ts +11 -0
  92. package/build/components/UI/CAD/plugins/SessionManagement/index.d.ts +36 -0
  93. package/build/components/UI/CAD/plugins/SessionManagement/types.d.ts +3 -0
  94. package/build/components/UI/CAD/store/CADActions.d.ts +29 -0
  95. package/build/components/UI/CAD/store/CADStore.d.ts +68 -0
  96. package/build/components/UI/CAD/store/instances.d.ts +7 -0
  97. package/build/components/UI/Readfile.d.ts +39 -0
  98. package/build/components/UI/ThemeVars.d.ts +6 -0
  99. package/build/components/UI/editors/BooleanEditor/BooleanEditor.d.ts +8 -0
  100. package/build/components/UI/editors/BooleanEditor/index.d.ts +2 -0
  101. package/build/components/UI/editors/BooleanEditor/useBoolParam.d.ts +3 -0
  102. package/build/components/UI/editors/CSysEditor/CSysEditor.d.ts +11 -0
  103. package/build/components/UI/editors/CSysEditor/index.d.ts +2 -0
  104. package/build/components/UI/editors/CSysEditor/useCSysParam.d.ts +9 -0
  105. package/build/components/UI/editors/ColorEditor/ColorEditor.d.ts +12 -0
  106. package/build/components/UI/editors/ColorEditor/index.d.ts +2 -0
  107. package/build/components/UI/editors/ColorEditor/useColorParam.d.ts +9 -0
  108. package/build/components/UI/editors/ExpressionEditor/ExpressionEditor.d.ts +20 -0
  109. package/build/components/UI/editors/ExpressionEditor/index.d.ts +2 -0
  110. package/build/components/UI/editors/ExpressionEditor/useExpressionsParam.d.ts +5 -0
  111. package/build/components/UI/editors/NumberEditor/Inputs.d.ts +18 -0
  112. package/build/components/UI/editors/NumberEditor/Mentions.d.ts +10 -0
  113. package/build/components/UI/editors/NumberEditor/NumOrExpr.d.ts +12 -0
  114. package/build/components/UI/editors/NumberEditor/NumberEditor.d.ts +12 -0
  115. package/build/components/UI/editors/NumberEditor/index.d.ts +2 -0
  116. package/build/components/UI/editors/NumberEditor/useNumParam.d.ts +5 -0
  117. package/build/components/UI/editors/PointEditor/PointEditor.d.ts +10 -0
  118. package/build/components/UI/editors/PointEditor/index.d.ts +2 -0
  119. package/build/components/UI/editors/PointEditor/usePointParam.d.ts +5 -0
  120. package/build/components/UI/editors/RefsEditors/ChainFinder.d.ts +12 -0
  121. package/build/components/UI/editors/RefsEditors/MateEditor.d.ts +13 -0
  122. package/build/components/UI/editors/RefsEditors/MateOrientationEditor.d.ts +9 -0
  123. package/build/components/UI/editors/RefsEditors/RefEditor.d.ts +24 -0
  124. package/build/components/UI/editors/RefsEditors/RefsEditor.d.ts +16 -0
  125. package/build/components/UI/editors/RefsEditors/index.d.ts +8 -0
  126. package/build/components/UI/editors/RefsEditors/pickers.d.ts +4 -0
  127. package/build/components/UI/editors/RefsEditors/useIdParam.d.ts +3 -0
  128. package/build/components/UI/editors/RefsEditors/useMateParam.d.ts +19 -0
  129. package/build/components/UI/editors/RefsEditors/useModes.d.ts +11 -0
  130. package/build/components/UI/editors/RefsEditors/useRefsParam.d.ts +3 -0
  131. package/build/components/UI/editors/RefsEditors/useSelectedItems.d.ts +18 -0
  132. package/build/components/UI/editors/ToleranceEditor/ToleranceEditor.d.ts +7 -0
  133. package/build/components/UI/editors/ToleranceEditor/index.d.ts +2 -0
  134. package/build/components/UI/editors/ToleranceEditor/useToleranceParam.d.ts +3 -0
  135. package/build/components/UI/editors/TypeEditor/TypeEditor.d.ts +10 -0
  136. package/build/components/UI/editors/TypeEditor/index.d.ts +2 -0
  137. package/build/components/UI/editors/TypeEditor/useTypeParam.d.ts +3 -0
  138. package/build/components/UI/editors/TypeWrapper.d.ts +6 -0
  139. package/build/components/UI/editors/Wrapper.d.ts +16 -0
  140. package/build/components/UI/editors/useParam.d.ts +20 -0
  141. package/build/components/UI/editors/useValidation.d.ts +4 -0
  142. package/build/components/graphics/Badge.d.ts +70 -0
  143. package/build/components/graphics/CSysDisplay.d.ts +108 -0
  144. package/build/components/graphics/CompositeCurveObj.d.ts +33 -0
  145. package/build/components/graphics/GeometryOverrides/GeometryOverridesManager.d.ts +41 -0
  146. package/build/components/graphics/GeometryOverrides/GeometryOverridesStore.d.ts +28 -0
  147. package/build/components/graphics/GeometryOverrides/index.d.ts +2 -0
  148. package/build/components/graphics/GeometryOverrides/useOverrideGeometryColor.d.ts +36 -0
  149. package/build/components/graphics/HUD.d.ts +44 -0
  150. package/build/components/graphics/HoveredConstraintDisplay.d.ts +24 -0
  151. package/build/components/graphics/InfinityPlane.d.ts +4 -0
  152. package/build/components/graphics/Outlines/AAPass.d.ts +8 -0
  153. package/build/components/graphics/Outlines/IDPass.d.ts +12 -0
  154. package/build/components/graphics/Outlines/Outline.d.ts +62 -0
  155. package/build/components/graphics/Outlines/OutlineEffect.d.ts +48 -0
  156. package/build/components/graphics/Outlines/OutlineMaterial.d.ts +9 -0
  157. package/build/components/graphics/Outlines/WidenPass.d.ts +17 -0
  158. package/build/components/graphics/PluginGeometryBounds.d.ts +40 -0
  159. package/build/components/graphics/SelectableMate.d.ts +3 -0
  160. package/build/components/graphics/SelectedMateObj.d.ts +54 -0
  161. package/build/components/graphics/StageLook.d.ts +51 -0
  162. package/build/components/graphics/WorkAxisObj.d.ts +33 -0
  163. package/build/components/graphics/WorkCSysObj.d.ts +33 -0
  164. package/build/components/graphics/WorkCoordSystemObj.d.ts +32 -0
  165. package/build/components/graphics/WorkPlaneObj.d.ts +33 -0
  166. package/build/components/graphics/WorkPointObj.d.ts +57 -0
  167. package/build/components/graphics/graphics.d.ts +61 -0
  168. package/build/components/graphics/utils/MatePathTransform.d.ts +10 -0
  169. package/build/components/graphics/utils/useCsysMatrix.d.ts +4 -0
  170. package/build/components/utils/CompValidation/ErrorBoundary.d.ts +28 -0
  171. package/build/components/utils/CompValidation/validators/CSysDisplayValidator.d.ts +12 -0
  172. package/build/components/utils/CompValidation/validators/DrawingValidator.d.ts +12 -0
  173. package/build/components/utils/CompValidation/validators/ExpressionsValidator.d.ts +12 -0
  174. package/build/components/utils/CompValidation/validators/FPluginValidator.d.ts +16 -0
  175. package/build/components/utils/CompValidation/validators/FeatureListValidator.d.ts +12 -0
  176. package/build/components/utils/CompValidation/validators/ProductManagementValidator.d.ts +14 -0
  177. package/build/components/utils/CompValidation/verifiers.d.ts +32 -0
  178. package/build/components/utils/FtVisibilityController.d.ts +26 -0
  179. package/build/elements/index.d.ts +162 -0
  180. package/build/icons/axes.d.ts +73 -0
  181. package/build/icons/draw.d.ts +75 -0
  182. package/build/icons/features.d.ts +71 -0
  183. package/build/icons/glyphs.d.ts +10 -0
  184. package/build/icons/index.d.ts +152 -0
  185. package/build/icons/legacy.d.ts +159 -0
  186. package/build/icons/mates.d.ts +26 -0
  187. package/build/icons/params.d.ts +77 -0
  188. package/build/icons/refs.d.ts +61 -0
  189. package/build/icons/sheets.d.ts +302 -0
  190. package/build/icons/sketch.d.ts +102 -0
  191. package/build/icons/types.d.ts +74 -0
  192. package/build/icons/ui.d.ts +114 -0
  193. package/build/icons.cjs.js +1751 -0
  194. package/build/icons.js +1742 -0
  195. package/build/index.cjs.js +44948 -0
  196. package/build/index.d.ts +115 -0
  197. package/build/index.js +44800 -0
  198. package/build/plugins/AppearanceEditor/Root.d.ts +12 -0
  199. package/build/plugins/AppearanceEditor/index.d.ts +42 -0
  200. package/build/plugins/Boolean/Root.d.ts +11 -0
  201. package/build/plugins/Boolean/index.d.ts +39 -0
  202. package/build/plugins/BoundingBoxInfo/Root.d.ts +12 -0
  203. package/build/plugins/BoundingBoxInfo/View.d.ts +11 -0
  204. package/build/plugins/BoundingBoxInfo/index.d.ts +35 -0
  205. package/build/plugins/Box/Root.d.ts +11 -0
  206. package/build/plugins/Box/index.d.ts +34 -0
  207. package/build/plugins/Chamfer/Root.d.ts +11 -0
  208. package/build/plugins/Chamfer/index.d.ts +35 -0
  209. package/build/plugins/CircularPattern/Root.d.ts +11 -0
  210. package/build/plugins/CircularPattern/index.d.ts +35 -0
  211. package/build/plugins/CompositeCurve/Root.d.ts +11 -0
  212. package/build/plugins/CompositeCurve/View.d.ts +11 -0
  213. package/build/plugins/CompositeCurve/index.d.ts +36 -0
  214. package/build/plugins/Cone/Root.d.ts +11 -0
  215. package/build/plugins/Cone/index.d.ts +36 -0
  216. package/build/plugins/Cylinder/Root.d.ts +11 -0
  217. package/build/plugins/Cylinder/index.d.ts +35 -0
  218. package/build/plugins/Dimensions/DimContext.d.ts +10 -0
  219. package/build/plugins/Dimensions/Root.d.ts +11 -0
  220. package/build/plugins/Dimensions/View.d.ts +11 -0
  221. package/build/plugins/Dimensions/graphics/DimGraphics.d.ts +7 -0
  222. package/build/plugins/Dimensions/graphics/DimensionSet.d.ts +8 -0
  223. package/build/plugins/Dimensions/graphics/primitives.d.ts +34 -0
  224. package/build/plugins/Dimensions/index.d.ts +34 -0
  225. package/build/plugins/Dimensions/utils.d.ts +5 -0
  226. package/build/plugins/EntityDeletion/Root.d.ts +11 -0
  227. package/build/plugins/EntityDeletion/index.d.ts +34 -0
  228. package/build/plugins/Expressions/Root.d.ts +11 -0
  229. package/build/plugins/Expressions/index.d.ts +34 -0
  230. package/build/plugins/Expressions/useContextMenuItems.d.ts +4 -0
  231. package/build/plugins/Extrusion/Root.d.ts +11 -0
  232. package/build/plugins/Extrusion/View.d.ts +11 -0
  233. package/build/plugins/Extrusion/index.d.ts +50 -0
  234. package/build/plugins/Fillet/Root.d.ts +11 -0
  235. package/build/plugins/Fillet/index.d.ts +35 -0
  236. package/build/plugins/HLConstraints/CircularPattern/Root.d.ts +11 -0
  237. package/build/plugins/HLConstraints/CircularPattern/View.d.ts +11 -0
  238. package/build/plugins/HLConstraints/CircularPattern/index.d.ts +38 -0
  239. package/build/plugins/HLConstraints/Cylindrical/Root.d.ts +11 -0
  240. package/build/plugins/HLConstraints/Cylindrical/View.d.ts +11 -0
  241. package/build/plugins/HLConstraints/Cylindrical/index.d.ts +37 -0
  242. package/build/plugins/HLConstraints/Fastened/Root.d.ts +11 -0
  243. package/build/plugins/HLConstraints/Fastened/View.d.ts +11 -0
  244. package/build/plugins/HLConstraints/Fastened/index.d.ts +37 -0
  245. package/build/plugins/HLConstraints/FastenedOrigin/Root.d.ts +11 -0
  246. package/build/plugins/HLConstraints/FastenedOrigin/View.d.ts +11 -0
  247. package/build/plugins/HLConstraints/FastenedOrigin/index.d.ts +37 -0
  248. package/build/plugins/HLConstraints/Gear/Root.d.ts +11 -0
  249. package/build/plugins/HLConstraints/Gear/View.d.ts +11 -0
  250. package/build/plugins/HLConstraints/Gear/index.d.ts +36 -0
  251. package/build/plugins/HLConstraints/Group/Root.d.ts +11 -0
  252. package/build/plugins/HLConstraints/Group/index.d.ts +34 -0
  253. package/build/plugins/HLConstraints/LinearPattern/Root.d.ts +11 -0
  254. package/build/plugins/HLConstraints/LinearPattern/View.d.ts +11 -0
  255. package/build/plugins/HLConstraints/LinearPattern/index.d.ts +38 -0
  256. package/build/plugins/HLConstraints/Parallel/Root.d.ts +11 -0
  257. package/build/plugins/HLConstraints/Parallel/View.d.ts +11 -0
  258. package/build/plugins/HLConstraints/Parallel/index.d.ts +37 -0
  259. package/build/plugins/HLConstraints/Planar/Root.d.ts +11 -0
  260. package/build/plugins/HLConstraints/Planar/View.d.ts +11 -0
  261. package/build/plugins/HLConstraints/Planar/index.d.ts +37 -0
  262. package/build/plugins/HLConstraints/Revolute/Root.d.ts +11 -0
  263. package/build/plugins/HLConstraints/Revolute/View.d.ts +11 -0
  264. package/build/plugins/HLConstraints/Revolute/index.d.ts +37 -0
  265. package/build/plugins/HLConstraints/Slider/Root.d.ts +11 -0
  266. package/build/plugins/HLConstraints/Slider/View.d.ts +11 -0
  267. package/build/plugins/HLConstraints/Slider/index.d.ts +37 -0
  268. package/build/plugins/HLConstraints/Spherical/Root.d.ts +11 -0
  269. package/build/plugins/HLConstraints/Spherical/View.d.ts +11 -0
  270. package/build/plugins/HLConstraints/Spherical/index.d.ts +36 -0
  271. package/build/plugins/HLConstraints/components/CSysDisplayWrapper.d.ts +7 -0
  272. package/build/plugins/HLConstraints/components/HLConstrIcon.d.ts +7 -0
  273. package/build/plugins/HLConstraints/components/LimitedValue.d.ts +12 -0
  274. package/build/plugins/HLConstraints/components/Limits.d.ts +25 -0
  275. package/build/plugins/HLConstraints/components/LimitsCollapse.d.ts +12 -0
  276. package/build/plugins/HLConstraints/validators.d.ts +2 -0
  277. package/build/plugins/Import/Root.d.ts +11 -0
  278. package/build/plugins/Import/index.d.ts +35 -0
  279. package/build/plugins/LinearPattern/Root.d.ts +11 -0
  280. package/build/plugins/LinearPattern/index.d.ts +36 -0
  281. package/build/plugins/Measure/Digits.d.ts +7 -0
  282. package/build/plugins/Measure/Root.d.ts +11 -0
  283. package/build/plugins/Measure/View.d.ts +15 -0
  284. package/build/plugins/Measure/config.d.ts +1 -0
  285. package/build/plugins/Measure/graphics/MeasureGraphics.d.ts +24 -0
  286. package/build/plugins/Measure/index.d.ts +39 -0
  287. package/build/plugins/Measure/utils.d.ts +2 -0
  288. package/build/plugins/Mirror/Root.d.ts +11 -0
  289. package/build/plugins/Mirror/index.d.ts +34 -0
  290. package/build/plugins/Revolve/Root.d.ts +11 -0
  291. package/build/plugins/Revolve/index.d.ts +37 -0
  292. package/build/plugins/Rotate/Root.d.ts +11 -0
  293. package/build/plugins/Rotate/index.d.ts +35 -0
  294. package/build/plugins/Sketch/Root/Constraints/Constraints.d.ts +2 -0
  295. package/build/plugins/Sketch/Root/Constraints/constraintsHelpers.d.ts +22 -0
  296. package/build/plugins/Sketch/Root/Constraints/index.d.ts +2 -0
  297. package/build/plugins/Sketch/Root/Constraints/utils.d.ts +6 -0
  298. package/build/plugins/Sketch/Root/CopyPatterns.d.ts +2 -0
  299. package/build/plugins/Sketch/Root/Details.d.ts +2 -0
  300. package/build/plugins/Sketch/Root/Handlers.d.ts +2 -0
  301. package/build/plugins/Sketch/Root/PlaneSelection.d.ts +7 -0
  302. package/build/plugins/Sketch/Root/Position.d.ts +2 -0
  303. package/build/plugins/Sketch/Root/Regions.d.ts +2 -0
  304. package/build/plugins/Sketch/Root/Root.d.ts +11 -0
  305. package/build/plugins/Sketch/Root/RootContext.d.ts +7 -0
  306. package/build/plugins/Sketch/Root/SketchGroup.d.ts +15 -0
  307. package/build/plugins/Sketch/Root/index.d.ts +1 -0
  308. package/build/plugins/Sketch/Root/useContextMenuItems.d.ts +4 -0
  309. package/build/plugins/Sketch/Root/useLayoutSize.d.ts +11 -0
  310. package/build/plugins/Sketch/View/View.d.ts +11 -0
  311. package/build/plugins/Sketch/View/ViewContext.d.ts +8 -0
  312. package/build/plugins/Sketch/View/graphics/Constraints.d.ts +5 -0
  313. package/build/plugins/Sketch/View/graphics/IconGroups.d.ts +7 -0
  314. package/build/plugins/Sketch/View/graphics/Merged/Arc.d.ts +20 -0
  315. package/build/plugins/Sketch/View/graphics/Merged/ArcGeometry.d.ts +2 -0
  316. package/build/plugins/Sketch/View/graphics/Merged/ArcMaterial.d.ts +2 -0
  317. package/build/plugins/Sketch/View/graphics/Merged/Bezier.d.ts +19 -0
  318. package/build/plugins/Sketch/View/graphics/Merged/BezierGeometry.d.ts +12 -0
  319. package/build/plugins/Sketch/View/graphics/Merged/BezierMaterial.d.ts +2 -0
  320. package/build/plugins/Sketch/View/graphics/Merged/Circle.d.ts +9 -0
  321. package/build/plugins/Sketch/View/graphics/Merged/Line.d.ts +15 -0
  322. package/build/plugins/Sketch/View/graphics/Merged/LineGeometry.d.ts +2 -0
  323. package/build/plugins/Sketch/View/graphics/Merged/LineMaterial.d.ts +2 -0
  324. package/build/plugins/Sketch/View/graphics/Merged/MergedWrapper.d.ts +16 -0
  325. package/build/plugins/Sketch/View/graphics/Merged/Point.d.ts +8 -0
  326. package/build/plugins/Sketch/View/graphics/Merged/Spline.d.ts +17 -0
  327. package/build/plugins/Sketch/View/graphics/Merged/SplineGeometry.d.ts +11 -0
  328. package/build/plugins/Sketch/View/graphics/Merged/SplineMaterial.d.ts +2 -0
  329. package/build/plugins/Sketch/View/graphics/MousePosition.d.ts +2 -0
  330. package/build/plugins/Sketch/View/graphics/Regions.d.ts +5 -0
  331. package/build/plugins/Sketch/View/graphics/TmpAngularDimension.d.ts +8 -0
  332. package/build/plugins/Sketch/View/graphics/graphics.d.ts +5 -0
  333. package/build/plugins/Sketch/View/graphics/hooks.d.ts +49 -0
  334. package/build/plugins/Sketch/View/graphics/primitives.d.ts +34 -0
  335. package/build/plugins/Sketch/View/graphics/scale.d.ts +6 -0
  336. package/build/plugins/Sketch/View/graphics/tmpGraphics.d.ts +3 -0
  337. package/build/plugins/Sketch/View/graphics/transform.d.ts +4 -0
  338. package/build/plugins/Sketch/View/handlers/CreateAngle.d.ts +3 -0
  339. package/build/plugins/Sketch/View/handlers/CreateConstraint.d.ts +10 -0
  340. package/build/plugins/Sketch/View/handlers/Drag.d.ts +3 -0
  341. package/build/plugins/Sketch/View/handlers/DrawArc.d.ts +3 -0
  342. package/build/plugins/Sketch/View/handlers/DrawCircle.d.ts +3 -0
  343. package/build/plugins/Sketch/View/handlers/DrawLine.d.ts +3 -0
  344. package/build/plugins/Sketch/View/handlers/DrawNurbs.d.ts +3 -0
  345. package/build/plugins/Sketch/View/handlers/DrawPoint.d.ts +3 -0
  346. package/build/plugins/Sketch/View/handlers/DrawRectangle.d.ts +3 -0
  347. package/build/plugins/Sketch/View/handlers/Fillet.d.ts +3 -0
  348. package/build/plugins/Sketch/View/handlers/HandlersConstructors.d.ts +33 -0
  349. package/build/plugins/Sketch/View/handlers/Hover.d.ts +3 -0
  350. package/build/plugins/Sketch/View/handlers/SSelect.d.ts +3 -0
  351. package/build/plugins/Sketch/View/handlers/Split.d.ts +3 -0
  352. package/build/plugins/Sketch/View/handlers/Trim.d.ts +3 -0
  353. package/build/plugins/Sketch/View/handlers/Use.d.ts +3 -0
  354. package/build/plugins/Sketch/View/handlers/constraintCreation.d.ts +10 -0
  355. package/build/plugins/Sketch/View/handlers/filletHelpers.d.ts +24 -0
  356. package/build/plugins/Sketch/View/handlers/hoverHelpers.d.ts +3 -0
  357. package/build/plugins/Sketch/View/handlers/snapper.d.ts +11 -0
  358. package/build/plugins/Sketch/View/handlers/splitHelpers.d.ts +20 -0
  359. package/build/plugins/Sketch/View/index.d.ts +1 -0
  360. package/build/plugins/Sketch/constants.d.ts +5 -0
  361. package/build/plugins/Sketch/description.d.ts +7 -0
  362. package/build/plugins/Sketch/index.d.ts +35 -0
  363. package/build/plugins/Sketch/resources.d.ts +5 -0
  364. package/build/plugins/Sketch/types.d.ts +148 -0
  365. package/build/plugins/Sketch/utils/Interaction.d.ts +7 -0
  366. package/build/plugins/Sketch/utils/OverdefinedStateManager.d.ts +6 -0
  367. package/build/plugins/Sketch/utils/getSketchState.d.ts +3 -0
  368. package/build/plugins/Sketch/utils/useSketchRegions.d.ts +2 -0
  369. package/build/plugins/Sketch/utils/useSketchState.d.ts +3 -0
  370. package/build/plugins/Slice/Root.d.ts +11 -0
  371. package/build/plugins/Slice/index.d.ts +34 -0
  372. package/build/plugins/SliceBySheet/Root.d.ts +11 -0
  373. package/build/plugins/SliceBySheet/index.d.ts +35 -0
  374. package/build/plugins/Sphere/Root.d.ts +11 -0
  375. package/build/plugins/Sphere/index.d.ts +35 -0
  376. package/build/plugins/TransformByCsys/Root.d.ts +11 -0
  377. package/build/plugins/TransformByCsys/index.d.ts +35 -0
  378. package/build/plugins/Translate/Root.d.ts +11 -0
  379. package/build/plugins/Translate/index.d.ts +35 -0
  380. package/build/plugins/Twist/Root.d.ts +11 -0
  381. package/build/plugins/Twist/View.d.ts +11 -0
  382. package/build/plugins/Twist/index.d.ts +48 -0
  383. package/build/plugins/WorkAxis/Root.d.ts +11 -0
  384. package/build/plugins/WorkAxis/View.d.ts +11 -0
  385. package/build/plugins/WorkAxis/index.d.ts +37 -0
  386. package/build/plugins/WorkCSys/Root.d.ts +11 -0
  387. package/build/plugins/WorkCSys/View.d.ts +11 -0
  388. package/build/plugins/WorkCSys/index.d.ts +53 -0
  389. package/build/plugins/WorkCoordSystem/Root.d.ts +11 -0
  390. package/build/plugins/WorkCoordSystem/View.d.ts +11 -0
  391. package/build/plugins/WorkCoordSystem/index.d.ts +55 -0
  392. package/build/plugins/WorkPlane/Root.d.ts +11 -0
  393. package/build/plugins/WorkPlane/View.d.ts +11 -0
  394. package/build/plugins/WorkPlane/index.d.ts +38 -0
  395. package/build/plugins/WorkPlane/validators.d.ts +1 -0
  396. package/build/plugins/WorkPoint/Root.d.ts +11 -0
  397. package/build/plugins/WorkPoint/View.d.ts +11 -0
  398. package/build/plugins/WorkPoint/index.d.ts +38 -0
  399. package/build/plugins/components/PluginForm.d.ts +24 -0
  400. package/build/plugins/utils/useRefsReset.d.ts +2 -0
  401. package/build/session/identity.d.ts +46 -0
  402. package/build/session/sessionClient.d.ts +140 -0
  403. package/build/session/types.d.ts +52 -0
  404. package/build/session/viewpoints.d.ts +90 -0
  405. package/build/theme/AppStyle.d.ts +33 -0
  406. package/build/theme/fonts/mono.d.ts +29 -0
  407. package/build/theme/stage.d.ts +148 -0
  408. package/build/theme/styles/antdChoices.d.ts +1 -0
  409. package/build/theme/styles/antdControls.d.ts +1 -0
  410. package/build/theme/styles/antdSurfaces.d.ts +1 -0
  411. package/build/theme/styles/editors.d.ts +1 -0
  412. package/build/theme/styles/fields.d.ts +1 -0
  413. package/build/theme/styles/frame.d.ts +1 -0
  414. package/build/theme/styles/panes.d.ts +1 -0
  415. package/build/theme/styles/parts.d.ts +2 -0
  416. package/build/theme/styles/rest.d.ts +1 -0
  417. package/build/theme/styles/sketch.d.ts +1 -0
  418. package/build/theme/styles/toolbar.d.ts +1 -0
  419. package/build/theme/styles/tools.d.ts +1 -0
  420. package/build/theme/styles/windows.d.ts +1 -0
  421. package/build/theme/themeStore.d.ts +305 -0
  422. package/build/types/jsx-compat.d.ts +8 -0
  423. package/build/types.d.ts +16 -0
  424. package/build/utils/FileUtils.d.ts +20 -0
  425. package/build/utils/bezierMatrices.d.ts +3 -0
  426. package/build/utils/conversionUtils.d.ts +78 -0
  427. package/build/utils/cubicSplineInterpolation.d.ts +5 -0
  428. package/build/utils/defaultValues.d.ts +3 -0
  429. package/build/utils/drawing/index.d.ts +3 -0
  430. package/build/utils/drawing/useDrawingArr.d.ts +10 -0
  431. package/build/utils/drawing/useDrawingCCId.d.ts +10 -0
  432. package/build/utils/drawing/useDrawingStr.d.ts +10 -0
  433. package/build/utils/getHighlightedColor.d.ts +6 -0
  434. package/build/utils/getMatePath.d.ts +2 -0
  435. package/build/utils/getMateRefIds.d.ts +30 -0
  436. package/build/utils/helpers.d.ts +19 -0
  437. package/build/utils/mateUtils.d.ts +35 -0
  438. package/build/utils/nurbsUtils.d.ts +35 -0
  439. package/build/utils/selection/filters.d.ts +12 -0
  440. package/build/utils/selection/scopes/mateSelection.d.ts +49 -0
  441. package/build/utils/selection/scopes/treeObjInteraction.d.ts +74 -0
  442. package/build/utils/selection/useSelectorsOrder.d.ts +12 -0
  443. package/build/utils/sketchIntersectionUtils.d.ts +139 -0
  444. package/build/utils/sketchUtils.d.ts +235 -0
  445. package/build/utils/useAllObjects.d.ts +31 -0
  446. package/build/utils/useIsUncommited.d.ts +2 -0
  447. package/build/utils/useRetainVisibility.d.ts +2 -0
  448. package/build/utils/useScale.d.ts +5 -0
  449. package/build/utils/validation.d.ts +11 -0
  450. package/doc/api/advanced/session.md +646 -0
  451. package/doc/api/advanced/utilities.md +1306 -0
  452. package/doc/api/assembly-constraints.md +340 -0
  453. package/doc/api/feature-plugins.md +613 -0
  454. package/doc/api/graphics.md +848 -0
  455. package/doc/api/hooks.md +300 -0
  456. package/doc/api/icons.md +812 -0
  457. package/doc/api/index.md +87 -0
  458. package/doc/api/other.md +369 -0
  459. package/doc/api/panels.md +754 -0
  460. package/doc/api/theme.md +551 -0
  461. package/doc/api/tool-plugins.md +191 -0
  462. package/doc/api/ui-elements.md +310 -0
  463. package/doc/api/work-geometry.md +154 -0
  464. package/icons/package.json +8 -0
  465. package/package.json +108 -4
  466. package/tools/fonts/brotli.py +29 -0
  467. package/tools/fonts/build.py +76 -0
  468. package/tools/icons/preview.mjs +74 -0
  469. package/tsconfig.build.json +16 -0
  470. package/typedoc.json +18 -0
  471. package/vitest.config.mts +25 -0
@@ -0,0 +1,1751 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
6
+ var React = require('react');
7
+
8
+ /**
9
+ * An icon is a small sign on a 20 × 20 sheet, in layers, back to front. A layer is a path and the
10
+ * pen it is drawn with. A sign has two tones: ink for what it is about, grey for what that is done
11
+ * to or was there before. No colour, but an axis' own where the sign is about that axis.
12
+ *
13
+ * '' ink: what the sign is about
14
+ * 'sub' grey: what it is done to, what was there before
15
+ * 'dash' ink, dashed
16
+ * 'sub-dash' grey, dashed: what is hidden, what was taken away
17
+ * 'axis' grey, chain-dashed: an axis, a line to mirror in
18
+ * 'fill' filled, ink: a point
19
+ * 'sub-fill' filled, grey
20
+ * 'point' a point of a sketch: a ring in ink, its centre light. What lies under it is cut away
21
+ * 'sub-point' the same, grey
22
+ * 'tone' a wash of ink: the face of what the sign is about
23
+ * 'x' 'y' 'z' a line in an axis' own colour (red, green, blue)
24
+ *
25
+ * Every line has the same weight. A sign that is one path in ink can be written as just that path.
26
+ *
27
+ * In a line's path, a part in square brackets is solid: filled in the line's own tone as well as
28
+ * drawn. That is an arrow's head: `M3 10H13[M17 10L13 8V12Z]`.
29
+ *
30
+ * @category Icons
31
+ */
32
+
33
+ /** Whether a layer's pen draws points, which cut away what lies under their centres. @internal */
34
+ const isPointPen = pen => pen === 'point' || pen === 'sub-point';
35
+
36
+ /**
37
+ * A layer of an icon: the pen it is drawn with ({@link IconPen}), and its SVG path on the 20 × 20 sheet.
38
+ *
39
+ * @category Icons
40
+ */
41
+
42
+ /**
43
+ * An icon's drawing: its layers, back to front, each a pen and an SVG path on the 20 × 20 sheet (`[pen, d]`); or, for
44
+ * a sign that is one path in ink, just that path.
45
+ *
46
+ * The pens are `''` (ink: what the sign is about), `'sub'` (grey: what it is done to), `'dash'` and `'sub-dash'`,
47
+ * `'axis'` (grey, chain-dashed), `'fill'` and `'sub-fill'` (filled), `'point'` and `'sub-point'` (a sketch's point: a
48
+ * ring with a light centre, given as its circle), `'tone'` (a wash of ink: the face of what the
49
+ * sign is about), and `'x'`, `'y'`, `'z'` (a line in an axis' own colour). In a path, a part in square brackets is
50
+ * filled as well as drawn: an arrow's head, `M3 10H13[M17 10L13 8V12Z]`.
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * import type { IconDrawing } from '@classcad/react-cad'
55
+ *
56
+ * // a sign that is one path in ink, and one in layers: what is done to in grey, what it is about in ink
57
+ * const plus: IconDrawing = 'M10 4v12M4 10h12'
58
+ * const eyeOff: IconDrawing = [
59
+ * ['sub', 'M2 10C4 6.7 6.8 5 10 5s6 1.7 8 5c-2 3.3-4.8 5-8 5s-6-1.7-8-5Z'],
60
+ * ['', 'M4 16 16 4'],
61
+ * ]
62
+ * ```
63
+ *
64
+ * @advanced
65
+ * @category Icons
66
+ */
67
+
68
+ /**
69
+ * A layer's path, taken apart: what is drawn as lines, and what is solid (the parts in brackets).
70
+ *
71
+ * @internal
72
+ */
73
+ const partsOf = d => {
74
+ if (!d.includes('[')) return {
75
+ lines: d,
76
+ solid: ''
77
+ };
78
+ let solid = '';
79
+ const lines = d.replace(/\[([^\]]*)\]/g, (_, part) => {
80
+ solid += part;
81
+ return '';
82
+ });
83
+ return {
84
+ lines,
85
+ solid
86
+ };
87
+ };
88
+
89
+ /**
90
+ * A sheet of signs, typed by the names on it.
91
+ *
92
+ * @internal
93
+ */
94
+ const sheet = drawings => drawings;
95
+
96
+ // The pen the hand-drawn icons share: a few shapes on the 20 × 20 sheet, and the one camera every
97
+ // drawing of a body is seen through. It is the camera of the family's feature drawings: iso, from
98
+ // the front-right-top corner (+X, −Y, +Z), so X runs down to the right, Y up to the right, Z up.
99
+
100
+ const n = v => {
101
+ const s = (Math.round(v * 100) / 100).toString();
102
+ return s === '-0' ? '0' : s;
103
+ };
104
+ const COS$1 = Math.sqrt(3) / 2;
105
+
106
+ /** The camera: a point in space, to the sheet. `s` is how long a unit is, `o` where the origin lies. */
107
+ const iso = (s = 1, o = [10, 10]) => ([x, y, z]) => [o[0] + (x + y) * COS$1 * s, o[1] + (x - y) * 0.5 * s - z * s];
108
+
109
+ /** A line through points; closed when asked. */
110
+ const line = (pts, close = false) => 'M' + pts.map(p => `${n(p[0])} ${n(p[1])}`).join('L') + (close ? 'Z' : '');
111
+
112
+ /** A circle (as two arcs, so it can be stroked from its start). */
113
+ const circle = (cx, cy, r) => `M${n(cx - r)} ${n(cy)}a${n(r)} ${n(r)} 0 1 0 ${n(2 * r)} 0a${n(r)} ${n(r)} 0 1 0 ${n(-2 * r)} 0Z`;
114
+
115
+ /** An ellipse, its axes along the sheet's. */
116
+ const ellipse = (cx, cy, rx, ry) => `M${n(cx - rx)} ${n(cy)}a${n(rx)} ${n(ry)} 0 1 0 ${n(2 * rx)} 0a${n(rx)} ${n(ry)} 0 1 0 ${n(-2 * rx)} 0Z`;
117
+
118
+ /** Part of an ellipse, from angle a0 to a1 (degrees, clockwise on the sheet from its right). */
119
+ const arc = (cx, cy, rx, ry, a0, a1) => {
120
+ const at = a => [cx + rx * Math.cos(a * Math.PI / 180), cy + ry * Math.sin(a * Math.PI / 180)];
121
+ const [p, q] = [at(a0), at(a1)];
122
+ const large = Math.abs(a1 - a0) > 180 ? 1 : 0;
123
+ const sweep = a1 > a0 ? 1 : 0;
124
+ return `M${n(p[0])} ${n(p[1])}A${n(rx)} ${n(ry)} 0 ${large} ${sweep} ${n(q[0])} ${n(q[1])}`;
125
+ };
126
+
127
+ /** A rectangle with round corners. */
128
+ const rect = (x, y, w, h, r = 0) => r ? `M${n(x + r)} ${n(y)}h${n(w - 2 * r)}a${n(r)} ${n(r)} 0 0 1 ${n(r)} ${n(r)}v${n(h - 2 * r)}a${n(r)} ${n(r)} 0 0 1 ${n(-r)} ${n(r)}h${n(-(w - 2 * r))}a${n(r)} ${n(r)} 0 0 1 ${n(-r)} ${n(-r)}v${n(-(h - 2 * r))}a${n(r)} ${n(r)} 0 0 1 ${n(r)} ${n(-r)}Z` : `M${n(x)} ${n(y)}h${n(w)}v${n(h)}h${n(-w)}Z`;
129
+
130
+ // An arrow's head is a solid triangle: an open one is two hairs at the size a sign is shown at.
131
+ // It is this much wider than half its length.
132
+ const HEAD = 0.62;
133
+
134
+ /** An arrow's head at `to`, coming from `from`: a solid triangle, `size` long. */
135
+ const head = (from, to, size = 3) => {
136
+ const a = Math.atan2(to[1] - from[1], to[0] - from[0]);
137
+ const [c, s] = [Math.cos(a), Math.sin(a)];
138
+ const [bx, by] = [to[0] - size * c, to[1] - size * s];
139
+ const half = size * HEAD;
140
+ return `[${line([to, [bx - half * s, by + half * c], [bx + half * s, by - half * c]], true)}]`;
141
+ };
142
+
143
+ // where a shaft ends under a head at `to`: at the head's back
144
+ const under = (from, to, size) => {
145
+ const d = Math.hypot(to[0] - from[0], to[1] - from[1]) || 1;
146
+ const t = Math.min(size, d) / d;
147
+ return [to[0] + (from[0] - to[0]) * t, to[1] + (from[1] - to[1]) * t];
148
+ };
149
+
150
+ /** The box from `lo` to `hi`, as the camera sees it: its outline and the three edges of its near corner. */
151
+ const box = (cam, lo, hi) => {
152
+ const [x0, y0, z0] = lo;
153
+ const [x1, y1, z1] = hi;
154
+ const outline = line([[x0, y0, z1], [x0, y1, z1], [x1, y1, z1], [x1, y1, z0], [x1, y0, z0], [x0, y0, z0]].map(p => cam(p)), true);
155
+ const near = cam([x1, y0, z1]);
156
+ const corner = line([cam([x0, y0, z1]), near, cam([x1, y1, z1])]) + line([near, cam([x1, y0, z0])]);
157
+ return {
158
+ outline,
159
+ corner,
160
+ all: outline + corner
161
+ };
162
+ };
163
+
164
+ /** A flat face in space, as the camera sees it. */
165
+ const face = (cam, pts) => line(pts.map(cam), true);
166
+
167
+ // ---- what the signs share: the same points, the same arrows, the same cube
168
+
169
+ const rad$1 = a => a * Math.PI / 180;
170
+
171
+ /** A point on an ellipse about `c`, by its angle (degrees, clockwise on the sheet from its right). */
172
+ const on$1 = (c, rx, ry, a) => [c[0] + rx * Math.cos(rad$1(a)), c[1] + ry * Math.sin(rad$1(a))];
173
+
174
+ /** A point of a sign: a small filled dot. */
175
+ const dot$1 = (p, r = 1.35) => circle(p[0], p[1], r);
176
+
177
+ /** An arrow: its shaft, and a solid head. */
178
+ const arrowTo = (from, to, size = 3) => line([from, under(from, to, size)]) + head(from, to, size);
179
+
180
+ /** A length, as a dimension is drawn: a shaft with a head at either end. */
181
+ const spanTo = (a, b, size = 3) => line([under(b, a, size), under(a, b, size)]) + head(a, b, size) + head(b, a, size);
182
+
183
+ /** A turn: part of an ellipse, with an arrow's head where it ends. */
184
+ const turn = (c, rx, ry, a0, a1, size = 3) => {
185
+ // the head lies along the last of the arc: as much of it as the head is long
186
+ const back = (a1 > a0 ? -1 : 1) * size * 360 / (Math.PI * (rx + ry));
187
+ return arc(c[0], c[1], rx, ry, a0, a1) + head(on$1(c, rx, ry, a1 + back), on$1(c, rx, ry, a1), size);
188
+ };
189
+
190
+ /** A block from `lo` to `hi` in the one camera: its lines, its outline alone, and its top face. */
191
+ const block = (s, o, lo = [-0.5, -0.5, -0.5], hi = [0.5, 0.5, 0.5]) => {
192
+ const cam = iso(s, o);
193
+ const b = box(cam, lo, hi);
194
+ return {
195
+ cam,
196
+ lines: b.all,
197
+ outline: b.outline,
198
+ top: face(cam, [[lo[0], lo[1], hi[2]], [lo[0], hi[1], hi[2]], [hi[0], hi[1], hi[2]], [hi[0], lo[1], hi[2]]]),
199
+ /** The face that looks along +X (to the right), and the one that looks along −Y (to the left). */
200
+ right: face(cam, [[hi[0], lo[1], hi[2]], [hi[0], hi[1], hi[2]], [hi[0], hi[1], lo[2]], [hi[0], lo[1], lo[2]]]),
201
+ left: face(cam, [[lo[0], lo[1], hi[2]], [hi[0], lo[1], hi[2]], [hi[0], lo[1], lo[2]], [lo[0], lo[1], lo[2]]])
202
+ };
203
+ };
204
+
205
+ /** The cube every sign of a body starts from: it fills the sheet. */
206
+ const cube = block(7, [10, 10]);
207
+
208
+ /** A plate lying flat, as the camera sees it: its middle at `m`, `w` half its width on the sheet. */
209
+ const plate = (m, w) => line([180, 270, 0, 90].map(a => on$1(m, w, w / Math.sqrt(3), a)), true);
210
+
211
+ // ---- several things in one sign. They stand apart: what is closer than a couple of pixels at the
212
+ // size a sign is shown at runs together and reads as one thing. So what a sign has several of is
213
+ // small and solid (an outline would close the gap from both sides), with clear room between.
214
+
215
+ /** One of several: a small solid tile about `m`. For a pen that fills. */
216
+ const tile$1 = (m, side = 4) => rect(m[0] - side / 2, m[1] - side / 2, side, side, 0.9);
217
+
218
+ /** Where three tiles in a row lie, the sheet wide. */
219
+ const ROW = [3.2, 10, 16.8];
220
+
221
+ /** Three about a middle: the one that was there at the top, its copies to either side below. */
222
+ const AROUND = {
223
+ m: [10, 10.8],
224
+ r: 6.8,
225
+ at: [-90, 30, 150]
226
+ };
227
+
228
+ /** A pattern along a line: the one that was there in grey, its copies in ink, in a row at `y`. */
229
+ const copiesInRow = (y, way = p => p) => [['sub-fill', tile$1(way([ROW[0], y]))], ['fill', tile$1(way([ROW[1], y])) + tile$1(way([ROW[2], y]))]];
230
+
231
+ /** A pattern about a middle: the circle the copies lie on (in grey, between them), and the three on it. */
232
+ const copiesAround = (m = AROUND.m, r = AROUND.r) => {
233
+ const [a, b, c] = AROUND.at;
234
+ // (the circle stops short of every tile)
235
+ const open = Math.atan(2 / r) * 180 / Math.PI + 14;
236
+ const between = [[a + open, b - open], [b + open, c - open], [c + open, a + 360 - open]];
237
+ return [['sub', between.map(([a0, a1]) => arc(m[0], m[1], r, r, a0, a1)).join('')], ['sub-fill', tile$1(on$1(m, r, r, a))], ['fill', tile$1(on$1(m, r, r, b)) + tile$1(on$1(m, r, r, c))]];
238
+ };
239
+
240
+ /** The closed shape a sign is about, as a body: its wash, then its outline. */
241
+ const toned = d => [['tone', d], ['', d]];
242
+
243
+ // The app's own signs: what its bars, rows and menus are worked with. One weight, round ends; ink,
244
+ const tray = 'M3.5 12v3c0 .8.7 1.5 1.5 1.5h10c.8 0 1.5-.7 1.5-1.5v-3';
245
+ // (four tiles with clear room between them: closer, they run into one square at the size of a row)
246
+ const tile = (x, y) => rect(x, y, 5, 5, 1.2);
247
+ const tiles = tile(3, 3) + tile(12, 3) + tile(3, 12);
248
+ const eye = 'M2 10C4 6.7 6.8 5 10 5s6 1.7 8 5c-2 3.3-4.8 5-8 5s-6-1.7-8-5Z';
249
+ const drop = 'M10 3c3 3.4 4.8 6 4.8 8.2a4.8 4.8 0 0 1-9.6 0C5.2 9 7 6.4 10 3Z';
250
+ const disc = circle(10, 10, 7.2);
251
+ // the cube's corners that are seen, and the three edges that are not
252
+ const c$2 = cube.cam;
253
+ const corners = [c$2([-0.5, -0.5, 0.5]), c$2([-0.5, 0.5, 0.5]), c$2([0.5, 0.5, 0.5]), c$2([0.5, 0.5, -0.5]), c$2([0.5, -0.5, -0.5]), c$2([-0.5, -0.5, -0.5]), c$2([0.5, -0.5, 0.5])];
254
+ const far = c$2([-0.5, 0.5, -0.5]);
255
+ const hidden = line([corners[1], far]) + line([corners[5], far, corners[3]]);
256
+ const inner = block(3.6, [10, 10.6]);
257
+ const ui = sheet({
258
+ // ---- ways through the app
259
+ /** Three bars: a menu. */
260
+ menu: 'M3.5 5.5h13M3.5 10h13M3.5 14.5h13',
261
+ /** An arrow that turns back: undo. */
262
+ undo: 'M7 8.5h5.2a4.3 4.3 0 0 1 0 8.6H9' + head([8, 8.5], [3.4, 8.5], 3.6),
263
+ /** An arrow that turns on: redo. */
264
+ redo: 'M13 8.5H7.8a4.3 4.3 0 0 0 0 8.6H11' + head([12, 8.5], [16.6, 8.5], 3.6),
265
+ /** An arrow to the left: back. */
266
+ back: arrowTo([16.5, 10], [3.5, 10], 4),
267
+ // (a chevron fills its sheet: it is shown small, beside a row or a tool, and has to be made out there)
268
+ /** A chevron to the left. */
269
+ chevronLeft: 'M13 3.6 6.6 10l6.4 6.4',
270
+ /** A chevron to the right: a row or a section that opens. */
271
+ chevronRight: 'M7 3.6l6.4 6.4L7 16.4',
272
+ /** A chevron down. */
273
+ chevronDown: 'M3.6 7l6.4 6.4L16.4 7',
274
+ /** A chevron up. */
275
+ chevronUp: 'M3.6 13 10 6.6l6.4 6.4',
276
+ /** A wide chevron down: opens a set, such as a tool button's. */
277
+ caret: 'M3.2 6.8l6.8 6.8 6.8-6.8',
278
+ /** An arrow to the right. */
279
+ arrowRight: arrowTo([3.5, 10], [16.5, 10], 4),
280
+ /** A cross: close. */
281
+ close: 'M5 5l10 10M15 5 5 15',
282
+ /** A tick: done, on. */
283
+ check: 'M4 10.6 8 14.5 16 5.5',
284
+ /** A plus: add, create. */
285
+ plus: 'M10 4v12M4 10h12',
286
+ /** A minus: remove. */
287
+ minus: 'M4 10h12',
288
+ /** Three dots: more, a row's menu. */
289
+ more: [['fill', dot$1([4.2, 10], 1.4) + dot$1([10, 10], 1.4) + dot$1([15.8, 10], 1.4)]],
290
+ /** Six dots: what is dragged. */
291
+ grip: [['fill', [5, 10, 15].map(y => dot$1([7, y], 1.2) + dot$1([13, y], 1.2)).join('')]],
292
+ /** A lens: search. */
293
+ search: circle(8.6, 8.6, 5.1) + 'M12.4 12.4 17 17',
294
+ // ---- the sidebar: the app's frame with its left pane, there (inked) and put away (empty)
295
+ /** The app's frame with its sidebar there: hide the sidebar. */
296
+ sidebar: [['fill', 'M4.5 4H8V16H4.5C3.7 16 3 15.3 3 14.5V5.5C3 4.7 3.7 4 4.5 4Z'], ['', rect(3, 4, 14, 12, 1.5) + 'M8 4V16']],
297
+ /** The frame with the sidebar put away: show the sidebar. */
298
+ sidebarOff: [['sub', 'M8 4V16'], ['', rect(3, 4, 14, 12, 1.5)]],
299
+ // ---- shown, and not shown: an eye; the same, struck through
300
+ /** An eye: shown. */
301
+ eye: [['tone', eye], ['', eye], ['fill', dot$1([10, 10], 2.2)]],
302
+ /** The eye struck through: hidden. */
303
+ eyeOff: [['sub', eye], ['sub-fill', dot$1([10, 10], 2.2)], ['', 'M4 16 16 4']],
304
+ // ---- what is done to a thing
305
+ /** A bin: delete. */
306
+ trash: 'M3.8 6h12.4M8 6V4.2h4V6M5.4 6l.8 9.6c0 .5.5.9 1 .9h5.6c.5 0 1-.4 1-.9l.8-9.6M8.4 9.2v4.2M11.6 9.2v4.2',
307
+ /** A pen: edit. */
308
+ edit: 'M3.6 16.4l.9-3.7 8.7-8.7a1.5 1.5 0 0 1 2.1 0l.7.7a1.5 1.5 0 0 1 0 2.1l-8.7 8.7-3.7.9ZM11.6 5.6l2.8 2.8',
309
+ // a name being written: its field, and the caret in it
310
+ /** A field with its caret: rename. */
311
+ rename: [['sub', rect(2.4, 5.8, 15.2, 8.4, 2)], ['', 'M10 3.6v12.8M7.8 3.6h4.4M7.8 16.4h4.4']],
312
+ /** Two sheets, one over the other: copy. */
313
+ copy: [['sub', 'M6.4 12.8H5c-.8 0-1.5-.7-1.5-1.5V5c0-.8.7-1.5 1.5-1.5h6.3c.8 0 1.5.7 1.5 1.5v1.4'], ['tone', rect(7.2, 7.2, 9.3, 9.3, 1.5)], ['', rect(7.2, 7.2, 9.3, 9.3, 1.5)]],
314
+ /** Two links of a chain: a link. */
315
+ link: 'M8.6 11.4a3.2 3.2 0 0 0 4.5 0l2.6-2.6a3.2 3.2 0 0 0-4.5-4.5l-.9.9M11.4 8.6a3.2 3.2 0 0 0-4.5 0l-2.6 2.6a3.2 3.2 0 0 0 4.5 4.5l.9-.9',
316
+ /** A pointer: select. */
317
+ select: [['tone', 'M4.6 3.4 15 9.6l-4.6 1 2.7 4.8-2 1.1-2.7-4.8-3.2 3.4Z'], ['', 'M4.6 3.4 15 9.6l-4.6 1 2.7 4.8-2 1.1-2.7-4.8-3.2 3.4Z']],
318
+ /** A pin: pin. */
319
+ pin: 'M12.2 3.4l4.4 4.4-1.7.6-2.7 2.7.2 3.3-1.3 1.3-6.5-6.5 1.3-1.3 3.3.2 2.7-2.7.3-2ZM7.8 12.2 3.8 16.2',
320
+ // into a product, to work on it: through its frame
321
+ /** An arrow into a frame: go into a product to work on it. */
322
+ enter: [['sub', 'M10.5 4h4c.8 0 1.5.7 1.5 1.5v9c0 .8-.7 1.5-1.5 1.5h-4'], ['', arrowTo([3.2, 10], [12, 10], 3.4)]],
323
+ // ---- out of the app, and into it
324
+ /** An arrow up out of a tray: export. */
325
+ export: tray + arrowTo([10, 12.6], [10, 3], 3.6),
326
+ /** An arrow down into a tray: download. */
327
+ download: tray + arrowTo([10, 3], [10, 12.6], 3.6),
328
+ /** An arrow down into a tray: import. */
329
+ import: tray + arrowTo([10, 3], [10, 12.6], 3.6),
330
+ /** A folder: open. */
331
+ open: 'M3 6c0-.8.7-1.5 1.5-1.5h3l1.6 1.8h6.4c.8 0 1.5.7 1.5 1.5v6.7c0 .8-.7 1.5-1.5 1.5h-11C3.7 16 3 15.3 3 14.5V6Z',
332
+ /** A sheet with a folded corner: a file. */
333
+ file: 'M6 3h5l4 4v8.5c0 .8-.7 1.5-1.5 1.5H6c-.8 0-1.5-.7-1.5-1.5v-11C4.5 3.7 5.2 3 6 3ZM11 3v4h4',
334
+ // ---- the theme: a disc, half inked
335
+ /** A disc, half inked: the theme. */
336
+ theme: [['', disc], ['fill', 'M10 2.8a7.2 7.2 0 0 1 0 14.4Z']],
337
+ // ---- what the app has to say
338
+ /** A speech bubble: messages. */
339
+ message: 'M4.5 4h11c.8 0 1.5.7 1.5 1.5V12c0 .8-.7 1.5-1.5 1.5H9.6L6.4 16.5v-3H4.5C3.7 13.5 3 12.8 3 12V5.5C3 4.7 3.7 4 4.5 4Z',
340
+ /** A question mark in a disc: help. */
341
+ question: disc + 'M7.9 8a2.2 2.2 0 1 1 3.3 1.9c-.8.5-1.2 1-1.2 1.9' + 'M10 14.2v.1',
342
+ /** An i in a disc: a note. */
343
+ info: disc + 'M10 9.2v4.6M10 6.2v.1',
344
+ /** An exclamation mark in a triangle: a warning. */
345
+ warning: 'M10 3 17.6 16.2H2.4L10 3ZM10 8v3.8M10 14v.1',
346
+ /** A cross in a disc: an error. */
347
+ error: disc + 'M7.3 7.3l5.4 5.4M12.7 7.3l-5.4 5.4',
348
+ /** A tick in a disc: done. */
349
+ success: disc + 'M6.6 10.2l2.4 2.4 4.4-5',
350
+ // ---- products: the parts a model is put together from; one more of them
351
+ /** Four tiles: the products a model is put together from. */
352
+ products: tiles + tile(12, 12),
353
+ /** Three tiles and a plus: convert to a subassembly. */
354
+ toSubassembly: [['sub', tiles], ['', 'M14.5 11.4v6.2M11.4 14.5h6.2']],
355
+ /** Three people, linked: a shared session. */
356
+ session: [['sub', 'M8.6 7.8 7 11.2M11.4 7.8 13 11.2M8.6 13.8h2.8'], ['', circle(5.8, 13.8, 2.6) + circle(14.2, 13.8, 2.6) + circle(10, 5.4, 2.6)]],
357
+ // ---- how the model is shown: its faces, its mesh, its edges, its points
358
+ /** A cube with its faces: show the faces. */
359
+ viewFaces: [['tone', cube.outline], ['tone', cube.top], ['', cube.outline]],
360
+ /** A cube's wires: show the faces as wires. */
361
+ viewWire: [['sub', line([corners[0], corners[2]]) + line([corners[0], corners[4]]) + line([corners[6], corners[3]])], ['', cube.lines]],
362
+ /** A cube's edges, the hidden ones dashed: show the edges. */
363
+ viewEdges: [['sub-dash', hidden], ['', cube.lines]],
364
+ /** A cube's corners: show the points. */
365
+ viewPoints: [['sub', cube.lines], ['fill', corners.map(p => dot$1(p, 1.5)).join('')]],
366
+ // how a body is drawn: a ball with its own shadow and a gleam, lit (and, unpressed, drawn flat)
367
+ /** A lit ball: how the bodies are drawn. */
368
+ look: [['tone', 'M15.09 4.91A7.2 7.2 0 0 1 4.91 15.09A9.2 9.2 0 0 0 15.09 4.91Z'], ['', disc], ['sub', 'M6.4 8.6a4 4 0 0 1 2.4-2.8']],
369
+ // ---- what is laid over the model: its dimensions, a measure, its box
370
+ /** A span between two rules: the dimensions. */
371
+ dims: [['sub', 'M2.6 4v12M17.4 4v12'], ['', spanTo([5, 10], [15, 10], 2.8)]],
372
+ /** A ruler: measure. */
373
+ measure: [['tone', 'M12.6 3 17 7.4 7.4 17 3 12.6Z'], ['', 'M12.6 3 17 7.4 7.4 17 3 12.6ZM9.9 5.7l2 2M7.2 8.4l2 2']],
374
+ /** A block in a dashed cube: the bounding box. */
375
+ bbox: [['sub-dash', cube.lines], ['tone', inner.top], ['', inner.lines]],
376
+ // ---- the view: all of it in the frame; along a plane's normal; how a body looks
377
+ /** Corners around a square: zoom to fit. */
378
+ zoomFit: [['', 'M3.5 7V3.5H7M13 3.5h3.5V7M16.5 13v3.5H13M7 16.5H3.5V13'], ['tone', rect(7.2, 7.2, 5.6, 5.6, 1)], ['', rect(7.2, 7.2, 5.6, 5.6, 1)]],
379
+ /** An arrow that stands on a plane: look along a plane's normal. */
380
+ viewNormal: [['tone', 'M2.4 13 10 8.6 17.6 13 10 17.4Z'], ['sub', 'M2.4 13 10 8.6 17.6 13 10 17.4Z'], ['', arrowTo([10, 13], [10, 2.4], 3.2)]],
381
+ /** A drop: the appearance, a body's colour. */
382
+ appearance: [['tone', drop], ['', drop]],
383
+ // ---- expressions: a value given by its name
384
+ /** An f and an x: the expressions. */
385
+ expressions: 'M8.6 4.2c-1.8-.3-2.8.5-3 2.4L4.6 15.8M3.4 9h4.2' + 'M10.4 9.6l5.8 6.2M16.2 9.6l-5.8 6.2'
386
+ });
387
+
388
+ // The features' signs: what a part is built from. Each says what its feature does, as a sign that
389
+ const f$2 = v => Math.round(v * 100) / 100;
390
+ const at$2 = p => `${f$2(p[0])} ${f$2(p[1])}`;
391
+
392
+ // ---- what an extrusion makes: a body, tall on the sheet, and the way it was raised out of its top
393
+ const raised = block(6, [10, 12.3], [-0.5, -0.5, -0.45], [0.5, 0.5, 0.45]);
394
+ const raisedTop = [10, 9.6];
395
+
396
+ // ---- a bar raised with a twist: its top is turned against its foot by `by` degrees, and its
397
+ // corners run up between them as screws. Drawn as a body is: its outline (what it covers on the
398
+ // sheet, so the waist the twist gives it is one clean line), its top, and of its corners what
399
+ // lies within the outline and is turned towards the camera.
400
+ const twisted = (by, r, h) => {
401
+ const COS = Math.sqrt(3) / 2;
402
+ const o = [10, 18 - 0.4 - r * Math.SQRT1_2];
403
+ // a corner of the bar: the `k`th, `t` of the way up
404
+ const angle = (k, t) => 45 + 90 * k + by * t;
405
+ const corner = (k, t) => {
406
+ const a = angle(k, t) * Math.PI / 180;
407
+ const [x, y] = [r * Math.cos(a), r * Math.sin(a)];
408
+ return [o[0] + (x + y) * COS, o[1] + (x - y) * 0.5 - t * h];
409
+ };
410
+ const section = t => [0, 1, 2, 3].map(k => corner(k, t));
411
+ // the bar as a stack of its sections, and, row by row down the sheet, how far they reach to either side
412
+ const SECTIONS = 60;
413
+ const stack = Array.from({
414
+ length: SECTIONS + 1
415
+ }, (_, i) => section(i / SECTIONS));
416
+ const heights = stack.reduce((all, q) => all.concat(q.map(point => point[1])), []);
417
+ const [y0, y1] = [Math.min(...heights), Math.max(...heights)];
418
+ const ROWS = 72;
419
+ const rows = [];
420
+ for (let i = 0; i <= ROWS; i++) {
421
+ const y = y0 + (y1 - y0) * i / ROWS;
422
+ let [lo, hi] = [Infinity, -Infinity];
423
+ for (const q of stack) {
424
+ for (let k = 0; k < 4; k++) {
425
+ const [a, b] = [q[k], q[(k + 1) % 4]];
426
+ if ((a[1] - y) * (b[1] - y) > 1e-9) continue;
427
+ const xs = Math.abs(a[1] - b[1]) < 1e-9 ? [a[0], b[0]] : [a[0] + (b[0] - a[0]) * (y - a[1]) / (b[1] - a[1])];
428
+ lo = Math.min(lo, ...xs);
429
+ hi = Math.max(hi, ...xs);
430
+ }
431
+ }
432
+ if (lo <= hi) rows.push({
433
+ y,
434
+ lo,
435
+ hi
436
+ });
437
+ }
438
+ // (a run of points that lie on one line is that line)
439
+ const straight = pts => pts.filter((q, i) => {
440
+ if (i === 0 || i === pts.length - 1) return true;
441
+ const [a, b] = [pts[i - 1], pts[i + 1]];
442
+ const off = Math.abs((b[0] - a[0]) * (q[1] - a[1]) - (b[1] - a[1]) * (q[0] - a[0])) / Math.hypot(b[0] - a[0], b[1] - a[1]);
443
+ return off > 0.004;
444
+ });
445
+ const outline = line([...straight(rows.map(row => [row.lo, row.y])), ...straight(rows.map(row => [row.hi, row.y]).reverse())], true);
446
+ // a corner is seen unless it is turned to the far side (the camera looks from the corner at -45°);
447
+ // it is drawn where it lies within the outline (on the outline, the outline is its line)
448
+ const seen = (k, t) => {
449
+ const a = (angle(k, t) % 360 + 360) % 360;
450
+ return a < 90 || a > 180;
451
+ };
452
+ const within = ([x, y]) => {
453
+ const row = rows[Math.min(rows.length - 1, Math.max(0, Math.round((y - y0) / (y1 - y0) * ROWS)))];
454
+ return x > row.lo + 0.3 && x < row.hi - 0.3;
455
+ };
456
+ const STEPS = 40;
457
+ let screws = '';
458
+ for (let k = 0; k < 4; k++) {
459
+ let run = [];
460
+ for (let i = 0; i <= STEPS; i++) {
461
+ const q = corner(k, i / STEPS);
462
+ const drawn = seen(k, i / STEPS) && within(q);
463
+ // (a run starts and ends on the outline: the point before it and the point after it)
464
+ if (drawn && !run.length && i > 0 && seen(k, (i - 1) / STEPS)) run.push(corner(k, (i - 1) / STEPS));
465
+ if (drawn) run.push(q);
466
+ if (!drawn || i === STEPS) {
467
+ if (run.length && !drawn && seen(k, i / STEPS)) run.push(q);
468
+ // (a corner that only grazes the outline leaves a stub: it is not drawn)
469
+ if (run.length > 1 && Math.hypot(run[0][0] - run[run.length - 1][0], run[0][1] - run[run.length - 1][1]) > 2) screws += line(run);
470
+ run = [];
471
+ }
472
+ }
473
+ }
474
+ return {
475
+ outline,
476
+ screws,
477
+ top: line(section(1), true)
478
+ };
479
+ };
480
+ const TWISTED = twisted(90, 4.6, 9.4);
481
+
482
+ // ---- the three axes from a corner, as the camera sees them: X down to the right, Y up to the right, Z up
483
+ const O$1 = [6.5, 11.5];
484
+ const tip = {
485
+ x: [15.6, 16.75],
486
+ y: [15.6, 6.25],
487
+ z: [6.5, 2.4]
488
+ };
489
+ const axis$1 = a => line([O$1, tip[a]]);
490
+ // a datum axis: the three in grey, the one that is meant in its own colour
491
+ const axisOf = a => [['sub', ['x', 'y', 'z'].filter(b => b !== a).map(axis$1).join('')], [a, arrowTo(O$1, tip[a], 3)]];
492
+
493
+ // ---- a datum plane: one sheet, the way it lies
494
+ const PLANE$2 = {
495
+ top: 'M2.4 10L10 5.6L17.6 10L10 14.4Z',
496
+ front: 'M4.5 3.6L15.5 9.95V16.95L4.5 10.6Z',
497
+ right: 'M15.5 3.6L4.5 9.95V16.95L15.5 10.6Z'
498
+ };
499
+
500
+ // ---- a body seen flat, for what is done to a whole body
501
+ const BODY$1 = rect(2.5, 8.5, 9, 9, 1.2);
502
+ const body$1 = toned(BODY$1);
503
+
504
+ // ---- the two shapes of a boolean: a square, and a circle over its corner
505
+ const SQ = {
506
+ x0: 2.5,
507
+ y0: 8,
508
+ x1: 12,
509
+ y1: 17.5
510
+ };
511
+ const CI = {
512
+ c: [12.5, 7.5],
513
+ r: 5.5
514
+ };
515
+ // where the circle crosses the square's top and its right side
516
+ const P$1 = [CI.c[0] - Math.sqrt(CI.r * CI.r - 0.25), SQ.y0];
517
+ const Q = [SQ.x1, CI.c[1] + Math.sqrt(CI.r * CI.r - 0.25)];
518
+ const A$1 = `A${CI.r} ${CI.r} 0`;
519
+ // the square's sides from P round to Q, and the circle's two ways between them: round the outside, through the square
520
+ const sides = `M${at$2(P$1)}H${SQ.x0}V${SQ.y1}H${SQ.x1}V${f$2(Q[1])}`;
521
+ const outside = `${A$1} 1 0 ${at$2(P$1)}`;
522
+ const through = `${A$1} 0 1 ${at$2(P$1)}`;
523
+ // what the two share: the corner of the square that lies in the circle
524
+ const shared = `M${at$2(P$1)}H${SQ.x1}V${f$2(Q[1])}${through}Z`;
525
+
526
+ // ---- a block with one corner worked: its other sides, and the corner's two ends
527
+ const CORNER = {
528
+ a: [10, 4.5],
529
+ b: [16.5, 11]
530
+ };
531
+ const worked = `M${at$2(CORNER.a)}H3.5V16.5H16.5V${CORNER.b[1]}`;
532
+
533
+ // ---- a part: a block with a step in it
534
+ const c$1 = cube.cam;
535
+ const step = {
536
+ outline: line([c$1([-0.5, -0.5, 0.5]), c$1([-0.5, 0.5, 0.5]), c$1([0, 0.5, 0.5]), c$1([0, 0.5, 0]), c$1([0.5, 0.5, 0]), c$1([0.5, 0.5, -0.5]), c$1([0.5, -0.5, -0.5]), c$1([-0.5, -0.5, -0.5])], true),
537
+ edges: line([c$1([-0.5, -0.5, 0.5]), c$1([0, -0.5, 0.5]), c$1([0, 0.5, 0.5])]) + line([c$1([0, -0.5, 0.5]), c$1([0, -0.5, 0]), c$1([0, 0.5, 0])]) + line([c$1([0, -0.5, 0]), c$1([0.5, -0.5, 0]), c$1([0.5, 0.5, 0])]) + line([c$1([0.5, -0.5, 0]), c$1([0.5, -0.5, -0.5])]),
538
+ tops: line([c$1([-0.5, -0.5, 0.5]), c$1([-0.5, 0.5, 0.5]), c$1([0, 0.5, 0.5]), c$1([0, -0.5, 0.5])], true) + line([c$1([0, -0.5, 0]), c$1([0, 0.5, 0]), c$1([0.5, 0.5, 0]), c$1([0.5, -0.5, 0])], true)
539
+ };
540
+ const features = sheet({
541
+ // ---- a sketch: a profile and its points
542
+ /** Sketch: a profile and its points. */
543
+ sketch: [['tone', 'M4 4H10V10H16V16H4Z'], ['', 'M4 4H10V10H16V16H4Z'], ['fill', dot$1([4, 4]) + dot$1([10, 10]) + dot$1([16, 16]) + dot$1([4, 16])]],
544
+ // ---- a profile made a body: raised, turned about an axis, raised with a twist
545
+ /** Extrusion: a profile raised into a body. */
546
+ extrusion: [['tone', raised.top], ['', raised.lines], ['', arrowTo(raisedTop, [10, 2.2], 3)]],
547
+ /** Revolve: a profile turned about an axis into a body. */
548
+ revolve: [['tone', 'M10 3A7.5 7.5 0 1 1 2.5 10.5H6.6A3.4 3.4 0 1 0 10 7.1Z'], ['', 'M10 3A7.5 7.5 0 1 1 2.5 10.5H6.6A3.4 3.4 0 1 0 10 7.1Z'], ['sub-fill', dot$1([10, 10.5], 1.2)]],
549
+ /** Twist: a profile raised with a twist. */
550
+ twist: [['tone', TWISTED.top], ['', TWISTED.outline + TWISTED.top + TWISTED.screws]],
551
+ // ---- bodies of their own
552
+ /** Box. */
553
+ box: [['tone', cube.top], ['', cube.lines]],
554
+ /** Cylinder. */
555
+ cylinder: [['tone', ellipse(10, 5.6, 6, 2.6)], ['', ellipse(10, 5.6, 6, 2.6) + 'M4 5.6V14.4' + 'M16 5.6V14.4' + arc(10, 14.4, 6, 2.6, 180, 0)]],
556
+ /** Cone. */
557
+ cone: [['tone', 'M10 2.8L3.75 14A6.4 2.7 0 0 0 16.25 14Z'], ['', 'M10 2.8L3.75 14A6.4 2.7 0 0 0 16.25 14Z']],
558
+ /** Sphere. */
559
+ sphere: [['tone', circle(10, 10, 7.2)], ['', circle(10, 10, 7.2) + arc(10, 10, 7.2, 2.7, 180, 0)]],
560
+ // ---- two bodies into one: joined, the one taken from the other, what they share
561
+ /** Union: two bodies joined into one. */
562
+ union: [['tone', sides + outside + 'Z'], ['', sides + outside + 'Z']],
563
+ /** Subtraction: the one body taken from the other. */
564
+ subtraction: [['sub-dash', `M${at$2(Q)}${outside}`], ['tone', sides + through + 'Z'], ['', sides + through + 'Z']],
565
+ /** Intersection: what two bodies share. */
566
+ intersection: [['sub', sides + outside], ['fill', shared], ['', shared]],
567
+ // ---- an edge worked: rounded, cut
568
+ /** Fillet: an edge rounded. */
569
+ fillet: [['sub', worked], ['', `M${at$2(CORNER.a)}A6.5 6.5 0 0 1 ${at$2(CORNER.b)}`]],
570
+ /** Chamfer: an edge cut. */
571
+ chamfer: [['sub', worked], ['', line([CORNER.a, CORNER.b])]],
572
+ // ---- a body cut in two: by a plane, by a sheet
573
+ /** Slice: a body cut in two by a plane. */
574
+ slice: [['tone', rect(4, 4, 12, 12, 1.2)], ['sub', rect(4, 4, 12, 12, 1.2)], ['', 'M1.8 13.4L18.2 6.6']],
575
+ /** Slice by sheet: a body cut in two by a sheet. */
576
+ sliceBySheet: [['tone', rect(4, 4, 12, 12, 1.2)], ['sub', rect(4, 4, 12, 12, 1.2)], ['', 'M1.8 12C6 12 6.5 7.5 10 10S14 12.5 18.2 8']],
577
+ // ---- a body repeated: in a mirror, along a line, about an axis
578
+ /** Mirror: a body repeated in a mirror. */
579
+ mirror: [['sub', 'M2 6.8L6 4.6V15.4L2 13.2Z'], ['axis', 'M10 2V18'], ['tone', 'M18 6.8L14 4.6V15.4L18 13.2Z'], ['', 'M18 6.8L14 4.6V15.4L18 13.2Z']],
580
+ /** Linear pattern: a body repeated along a line. */
581
+ linearPattern: [...copiesInRow(5.8), ['', arrowTo([1.6, 14.6], [18.4, 14.6], 3)]],
582
+ /** Circular pattern: a body repeated about an axis. */
583
+ circularPattern: copiesAround(),
584
+ // ---- a body moved: along a line, about an axis, from one coordinate system to another
585
+ /** Translate: a body moved along a line. */
586
+ translation: [...body$1, ['', arrowTo([12.6, 7.4], [17.6, 2.4], 3)]],
587
+ /** Rotate: a body turned about an axis. */
588
+ rotation: [...body$1, ['', turn([7, 13], 10.4, 10.4, -84, -8, 3)]],
589
+ /** Transform by coordinate systems: a body moved from one to another. */
590
+ transformByCsys: [...body$1, ['', 'M13 4.6V8H16' + head([13, 5], [13, 2.2], 2.4) + head([15.6, 8], [18.4, 8], 2.4)]],
591
+ // ---- what a part is measured from, made by hand
592
+ /** Work plane. */
593
+ workPlane: toned(PLANE$2.top),
594
+ /** Work axis. */
595
+ workAxis: [['', 'M3 17L7.6 12.4M12.4 7.6L17 3'], ['fill', dot$1([10, 10], 1.2)]],
596
+ /** Work point. */
597
+ workPoint: [['', 'M10 2.4V5.8M10 14.2V17.6M2.4 10H5.8M14.2 10H17.6'], ['fill', dot$1([10, 10], 2)]],
598
+ /** Work coordinate system. */
599
+ workCSys: [['', arrowTo(O$1, tip.x, 2.8) + arrowTo(O$1, tip.y, 2.8) + arrowTo(O$1, tip.z, 2.8)], ['fill', dot$1(O$1, 1.5)]],
600
+ // ---- what every part is measured from: its origin, its three axes, its three planes
601
+ /** The part's origin. */
602
+ origin: [['sub', axis$1('x') + axis$1('y') + axis$1('z')], ['fill', dot$1(O$1, 2.1)]],
603
+ /** The part's X axis. */
604
+ axisX: axisOf('x'),
605
+ /** The part's Y axis. */
606
+ axisY: axisOf('y'),
607
+ /** The part's Z axis. */
608
+ axisZ: axisOf('z'),
609
+ /** The part's top plane. */
610
+ planeTop: toned(PLANE$2.top),
611
+ /** The part's front plane. */
612
+ planeFront: toned(PLANE$2.front),
613
+ /** The part's right plane. */
614
+ planeRight: toned(PLANE$2.right),
615
+ // ---- a body, and a part
616
+ /** A body. */
617
+ solid: [['tone', cube.outline], ['tone', cube.top], ['', cube.lines]],
618
+ /** A part. */
619
+ part: [['tone', step.tops], ['', step.outline + step.edges]]
620
+ });
621
+
622
+ // Signs for what no other sheet holds: a document that is an assembly, what is taken out of a
623
+
624
+ // (two bodies, small enough to stand apart: closer, they run into one)
625
+ const back = block(3.8, [5.3, 6.4]);
626
+ const front = block(3.8, [14.7, 13.6]);
627
+ const glyphs = sheet({
628
+ // ---- an assembly: more than one body
629
+ /** Two bodies: an assembly. */
630
+ assembly: [['sub', back.outline + back.top], ['tone', front.outline], ['tone', front.top], ['', front.outline + front.top]],
631
+ // ---- a body, or a face of one, taken out again
632
+ /** A cube, crossed out: a body or a face taken out of a part again. */
633
+ entityDeletion: [['sub', cube.outline], ['', 'M6.4 6.4l7.2 7.2M13.6 6.4l-7.2 7.2']],
634
+ // ---- several curves, taken as one
635
+ /** A curve through points: several curves taken as one. */
636
+ compositeCurve: [['', 'M3.4 14.6C4.8 9 7 6 9.8 6c2.3 0 2.3 4.6 4.5 4.6 1.2 0 2-1.5 2.5-4.3'], ['fill', dot$1([3.4, 14.6]) + dot$1([9.8, 6]) + dot$1([14.3, 10.6]) + dot$1([16.8, 6.3])]],
637
+ // ---- a region of a sketch: what its curves close
638
+ /** A rectangle with a hole, filled: a region of a sketch. */
639
+ region: [['tone', rect(3.6, 5, 12.8, 10, 1.2) + circle(10, 10, 2.2)], ['', rect(3.6, 5, 12.8, 10, 1.2)], ['sub', circle(10, 10, 2.2)]]
640
+ });
641
+
642
+ // What a number field of a feature's window sets: a length, an angle, a count, a state. Each is a
643
+ // an angle about `m`, from a0 to a1 at the radius `r`: its arc, and the wedge the arc closes
644
+ const angled = (m, r, a0, a1) => {
645
+ const bow = arc(m[0], m[1], r, r, a0, a1);
646
+ return [['tone', line([m, on$1(m, r, r, a0)]) + bow.slice(bow.indexOf('A')) + 'Z'], ['', bow]];
647
+ };
648
+
649
+ // ---- the cube, its edges sorted by the way they run (X down to the right, Y up to the right, Z up)
650
+ const [L, H] = [-0.5, 0.5];
651
+ const edge = (a, b) => line([cube.cam(a), cube.cam(b)]);
652
+ const EDGES = {
653
+ x: edge([L, L, L], [H, L, L]) + edge([L, L, H], [H, L, H]) + edge([L, H, H], [H, H, H]),
654
+ y: edge([H, L, L], [H, H, L]) + edge([H, L, H], [H, H, H]) + edge([L, L, H], [L, H, H]),
655
+ z: edge([L, L, L], [L, L, H]) + edge([H, L, L], [H, L, H]) + edge([H, H, L], [H, H, H])
656
+ };
657
+ // a measure of the box: the edges that run its way in its axis' colour, the others in grey
658
+ const measure$1 = way => [['sub', (way === 'x' ? '' : EDGES.x) + (way === 'y' ? '' : EDGES.y) + (way === 'z' ? '' : EDGES.z)], [way, EDGES[way]]];
659
+
660
+ // ---- the slab a twist is raised from, low on the sheet: the turn has room over it
661
+ const SLAB = block(6, [10, 15], [-0.5, -0.5, -0.2], [0.5, 0.5, 0.2]).lines;
662
+
663
+ // ---- a revolve seen along its axis: the turn, from the top round towards the left; a hand from the axis out
664
+ // to where the turn starts (its tail) or to where it ends (what its head points at)
665
+ const AXIS = [10, 10.4];
666
+ const hand = a => [['sub', turn(AXIS, 6.8, 6.8, -90, 150, 2.8)], ['', line([AXIS, on$1(AXIS, 8.2, 8.2, a)])], ['fill', dot$1(AXIS)]];
667
+
668
+ // ---- a cylinder and a cone's stump, standing; `SIDE` is where a height stands beside a body
669
+ const CYLINDER = ellipse(8, 5, 5.4, 2.3) + 'M2.6 5V14.6M13.4 5V14.6' + arc(8, 14.6, 5.4, 2.3, 180, 0);
670
+ const CONE_TOP = ellipse(8, 5.2, 3.4, 1.45);
671
+ const CONE_BASE = ellipse(8, 14.9, 5.8, 2.45);
672
+ const CONE_SIDES = 'M4.6 5.2L2.2 14.9M11.4 5.2L13.8 14.9';
673
+ const CONE = CONE_TOP + CONE_SIDES + arc(8, 14.9, 5.8, 2.45, 180, 0);
674
+ const SIDE = 17;
675
+
676
+ // ---- a corner cut off by a chamfer: one face, the cut from P down to the other face
677
+ const CHAMFERED = 'M1.6 6.6H4.4L13.8 16V18.4';
678
+ const P = [4.4, 6.6];
679
+
680
+ // ---- what a pattern repeats: two of them and how far apart; the one that was there, its copies,
681
+ // and the way they go
682
+ const apart = (a, b, pen, from, to) => [['sub-fill', tile$1(a, 5) + tile$1(b, 5)], [pen, spanTo(from, to)]];
683
+ // two planes, one above the other, flat enough to lie well apart
684
+ const sheetAt = y => line([[2, y], [7.4, y - 2.4], [12.8, y], [7.4, y + 2.4]], true);
685
+ // the angle from one copy to the next: two of them a quarter turn apart, the axis, and the turn between them
686
+ const PIVOT = [5, 15];
687
+ const between = pen => [['sub-fill', tile$1(on$1(PIVOT, 6.8, 6.8, -90)) + tile$1(on$1(PIVOT, 6.8, 6.8, 0)) + dot$1(PIVOT, 1.3)], [pen, turn(PIVOT, 11.6, 11.6, -80, -14, 2.8)]];
688
+
689
+ // ---- two bodies that overlap, seen flat: each, and the two as one
690
+ const A = rect(2.5, 2.5, 10, 10, 1.2);
691
+ const B = rect(7.5, 7.5, 10, 10, 1.2);
692
+ const R = 'a1.2 1.2 0 0 1';
693
+ const BOTH = `M3.7 2.5h7.6${R} 1.2 1.2V7.5h3.8${R} 1.2 1.2v7.6${R} -1.2 1.2h-7.6${R} -1.2 -1.2V12.5H3.7${R} -1.2 -1.2v-7.6${R} 1.2 -1.2Z`;
694
+
695
+ // ---- two wheels in mesh, as the gear's own sign has them (a little smaller: their turns stay on the sheet)
696
+ const BIG$1 = [8.2, 11.4];
697
+ const LITTLE$1 = [14.8, 8.5];
698
+ const wheel = (m, r, meant = false) => meant ? [...toned(circle(m[0], m[1], r)), ['fill', dot$1(m, 1.1)]] : [['sub', circle(m[0], m[1], r)], ['sub-fill', dot$1(m, 1.1)]];
699
+
700
+ // ---- a ball in its cup, as the spherical mate's own sign draws it
701
+ const BALL = [10, 11.6];
702
+ const JOINT = 'M2.4 11.6h1.6a6 6 0 0 0 12 0h1.6' + circle(BALL[0], BALL[1], 3.2);
703
+ const params = sheet({
704
+ // ---- a box's three measures, each along one of its axes: the cube, and the edges that run that way
705
+ /** A box's length: the edges along X. */
706
+ boxLength: measure$1('x'),
707
+ /** A box's width: the edges along Y. */
708
+ boxWidth: measure$1('y'),
709
+ /** A box's height: the edges along Z. */
710
+ boxHeight: measure$1('z'),
711
+ // ---- how far an extrusion goes from its sketch's plane (seen edge on): up, or down
712
+ /** How far an extrusion goes up from its sketch's plane. */
713
+ limitUp: [['sub', 'M2.5 12H17.5'], ['', arrowTo([10, 12], [10, 2.6], 3)]],
714
+ /** How far an extrusion goes down from its sketch's plane. */
715
+ limitDown: [['sub', 'M2.5 8H17.5'], ['', arrowTo([10, 8], [10, 17.4], 3)]],
716
+ // ---- solid or sheet: the body closed, with its mass; of the same body the two walls towards us alone
717
+ /** A closed body: make a solid. */
718
+ capSolid: [['tone', cube.outline], ['tone', cube.top], ['', cube.lines]],
719
+ /** The walls alone: make a sheet. */
720
+ capSheet: toned(cube.left + cube.right),
721
+ // ---- a twist's angle: the slab it is raised from, and over it the turn about the way it rises
722
+ /** A twist's angle: the turn about the way it rises. */
723
+ twistAngle: [['sub', SLAB], ['', turn([10, 6.2], 6.2, 2.5, -64, 212, 2.8)]],
724
+ // ---- an angle: two lines from a point, and what lies between them
725
+ /** An angle between two lines. */
726
+ angle: [['sub', line([on$1([3, 10], 14.6, 14.6, -30), [3, 10], on$1([3, 10], 14.6, 14.6, 30)])], ...angled([3, 10], 9, -30, 30)],
727
+ // ---- a revolve: the axis it turns about (seen from the side); where the turn starts, where it ends
728
+ /** The axis a revolve turns about. */
729
+ revolveAxis: [['sub', turn([10, 10], 6.4, 2.7, -64, 212, 2.8)], ['', 'M10 2V18']],
730
+ /** Where a revolve's turn starts. */
731
+ revolveStart: hand(-90),
732
+ /** Where a revolve's turn ends. */
733
+ revolveEnd: hand(180),
734
+ // ---- a cylinder's height, beside it; its diameter, across it as it is seen from above
735
+ /** A cylinder's height. */
736
+ cylinderHeight: [['sub', CYLINDER], ['', spanTo([SIDE, 3.2], [SIDE, 16.4], 2.8)]],
737
+ /** A diameter: across a circle. */
738
+ diameter: [['sub', circle(10, 10, 7.2)], ['', spanTo(on$1([10, 10], 7.2, 7.2, 135), on$1([10, 10], 7.2, 7.2, -45))]],
739
+ // ---- a cone's height, the diameter of its base, the diameter of its top
740
+ // (a diameter is too short for a span here: it is the rim itself that is in ink)
741
+ /** A cone's height. */
742
+ coneHeight: [['sub', CONE], ['', spanTo([SIDE, 3.8], [SIDE, 16.6], 2.8)]],
743
+ /** The diameter of a cone's base. */
744
+ coneBase: [['sub', CONE_TOP + CONE_SIDES], ...toned(CONE_BASE)],
745
+ /** The diameter of a cone's top. */
746
+ coneTop: [['sub', CONE_SIDES + arc(8, 14.9, 5.8, 2.45, 180, 0)], ...toned(CONE_TOP)],
747
+ // ---- a radius: a rounded corner, its centre, and the way from the centre to the round
748
+ /** A fillet's radius: from the centre to the round. */
749
+ filletRadius: [['sub', 'M2.6 3.8H6.8' + arc(6.8, 13.8, 10, 10, -90, 0) + 'M16.8 13.8V17.6'], ['', arrowTo([6.8, 13.8], on$1([6.8, 13.8], 10, 10, -45), 2.8)], ['fill', dot$1([6.8, 13.8])]],
750
+ // ---- a chamfer's measures: along the one face, along the other; the angle of the cut against the face
751
+ // (which runs on in grey over what was cut away)
752
+ /** A chamfer's measure along the one face. */
753
+ chamferOffset1: [['sub', CHAMFERED], ['', spanTo([4.4, 3], [13.8, 3], 2.6)]],
754
+ /** A chamfer's measure along the other face. */
755
+ chamferOffset2: [['sub', CHAMFERED], ['', spanTo([SIDE, 6.6], [SIDE, 16], 2.6)]],
756
+ /** A chamfer's angle against the face. */
757
+ chamferAngle: [['sub', CHAMFERED + 'M4.4 6.6H17.6'], ...angled(P, 8, 0, 45)],
758
+ // ---- a pattern's spacing: along its first axis, along its second, and up the axis it turns about
759
+ /** A pattern's spacing along its first axis. */
760
+ distanceX: apart([4.5, 6.2], [15.5, 6.2], 'x', [2.4, 14.6], [17.6, 14.6]),
761
+ /** A pattern's spacing along its second axis. */
762
+ distanceY: apart([13.8, 15.5], [13.8, 4.5], 'y', [5.4, 17.6], [5.4, 2.4]),
763
+ /** A pattern's spacing up the axis it turns about. */
764
+ distanceZ: [['sub', sheetAt(5) + sheetAt(15)], ['z', spanTo([16.6, 3.4], [16.6, 16.6])]],
765
+ // ---- a pattern's count: the copies along its first axis, along its second, about its axis
766
+ /** A pattern's count along its first axis. */
767
+ countX: [...copiesInRow(5.8), ['x', arrowTo([1.6, 14.6], [18.4, 14.6], 3)]],
768
+ /** A pattern's count along its second axis. */
769
+ countY: [...copiesInRow(14.2, ([x, y]) => [y, 20 - x]), ['y', arrowTo([5.4, 18.4], [5.4, 1.6], 3)]],
770
+ /** A pattern's count about its axis. */
771
+ countAngular: copiesAround(),
772
+ // ---- the angle from one copy to the next: about the axis that was picked, about a mate's Z
773
+ /** The angle from one copy to the next, about the axis that was picked. */
774
+ anglePattern: between(''),
775
+ /** The angle from one copy to the next, about a mate's Z. */
776
+ angleZ: between('z'),
777
+ // ---- how far a body is moved, how far it is turned: the feature's own sign, the body in grey
778
+ /** How far a body is moved. */
779
+ translationDistance: [['sub', rect(2.5, 11.5, 6, 6, 1.2)], ['', spanTo([9.8, 10.2], [17.6, 2.4])]],
780
+ /** How far a body is turned. */
781
+ rotationAngle: [['sub', rect(2.5, 8.5, 9, 9, 1.2)], ['', turn([7, 13], 10.4, 10.4, -84, -8, 3)]],
782
+ // ---- merge solids: two bodies made one, or left two
783
+ /** Two bodies made one: merge the solids. */
784
+ merged: toned(BOTH),
785
+ /** Two bodies left two: keep the solids apart. */
786
+ notMerged: [['tone', A], ['tone', B], ['', A + B]],
787
+ // ---- a gear: its first wheel, its second, and how the one turns against the other
788
+ /** A gear's first wheel. */
789
+ gearFirst: [...wheel(LITTLE$1, 3), ...wheel(BIG$1, 4.2, true)],
790
+ /** A gear's second wheel. */
791
+ gearSecond: [...wheel(BIG$1, 4.2), ...wheel(LITTLE$1, 3, true)],
792
+ /** How a gear's one wheel turns against the other: its ratio. */
793
+ gearRatio: [...wheel(BIG$1, 4.2), ...wheel(LITTLE$1, 3), ['', turn(BIG$1, 6.6, 6.6, 110, 195, 2.4) + turn(LITTLE$1, 5.4, 5.4, -80, -140, 2.4)]],
794
+ // ---- a ball joint's largest swing: how far it tilts to either side
795
+ /** A ball joint's largest swing to either side. */
796
+ sphericalMax: [['sub', JOINT], ['', turn(BALL, 8.4, 8.4, -132, -48, 2.6) + turn(BALL, 8.4, 8.4, -48, -132, 2.6)]]
797
+ });
798
+
799
+ // Quantities and switches that belong to one of the three axes. The axes are drawn as the camera
800
+ const AXES$1 = ['x', 'y', 'z'];
801
+ const f$1 = v => Math.round(v * 100) / 100;
802
+ const at$1 = p => `${f$1(p[0])} ${f$1(p[1])}`;
803
+ const rad = a => a * Math.PI / 180;
804
+
805
+ // ---- the camera's three directions on the sheet, a unit long
806
+ const COS = Math.sqrt(3) / 2;
807
+ const DIR = {
808
+ x: [COS, 0.5],
809
+ y: [COS, -0.5],
810
+ z: [0, -1]
811
+ };
812
+ // how far the sheet is turned (clockwise) to bring what is drawn about Z onto another axis
813
+ const TURNED = {
814
+ z: 0,
815
+ y: 60,
816
+ x: 120
817
+ };
818
+ // the point `d` along an axis from `o` (behind it when negative)
819
+ const along$1 = (o, a, d) => [o[0] + DIR[a][0] * d, o[1] + DIR[a][1] * d];
820
+ // the other two axes from `o`, each as far as `reach` says: what the coloured one is read against
821
+ const others = (o, a, reach) => AXES$1.filter(b => b !== a).map(b => line([o, along$1(o, b, reach(b))])).join('');
822
+ // a stop: a short bar through `p`, square to the axis `a`
823
+ const stop = (p, a, half = 2.2) => {
824
+ const d = [Math.cos(rad(TURNED[a])) * half, Math.sin(rad(TURNED[a])) * half];
825
+ return line([[p[0] - d[0], p[1] - d[1]], [p[0] + d[0], p[1] + d[1]]]);
826
+ };
827
+ const C = [10, 10];
828
+
829
+ // ---- an axis picked: the three from their corner, the one that is meant an arrow in its colour
830
+ const O = [6.5, 11.5];
831
+ const REACH = {
832
+ x: 10.5,
833
+ y: 10.5,
834
+ z: 9.1
835
+ };
836
+ const direction$1 = a => [['sub', others(O, a, b => REACH[b])], [a, arrowTo(O, along$1(O, a, REACH[a]), 3)]];
837
+
838
+ // ---- an offset along an axis: the axis through the corner of the other two, and a point moved
839
+ // along it. A limit is a stop across the axis, in its colour, with the point up against it: at the
840
+ // low end the least it may be, at the high end the most.
841
+ const M = [8.4, 11];
842
+ const RAIL = {
843
+ low: -5.6,
844
+ high: 9,
845
+ at: 4.2
846
+ };
847
+ const offset = (a, limit) => {
848
+ const end = limit === 'min' ? RAIL.low : RAIL.high;
849
+ const rail = line([along$1(M, a, RAIL.low), along$1(M, a, RAIL.high)]);
850
+ return [['sub', others(M, a, () => 7.5)], [a, rail + (limit ? stop(along$1(M, a, end), a) : '')], ['fill', dot$1(along$1(M, a, limit ? end - Math.sign(end) * 2.3 : RAIL.at), 1.6)]];
851
+ };
852
+
853
+ // ---- a turn about an axis: the axis, and a ring round it that comes from behind it, passes in
854
+ // front of it and ends, an arrow, where it is widest. A limit is a stop across the ring where it is
855
+ // widest, in the axis' colour, with a point on the ring up against it: on the side the turn comes
856
+ // from the least it may be, on the side it goes to the most.
857
+ const RING = {
858
+ rx: 5.8,
859
+ ry: 4.4,
860
+ up: 1.6,
861
+ behind: 55
862
+ };
863
+ // a point of the ring about `a`: an ellipse, its short side along the axis
864
+ const onRing = (a, deg) => {
865
+ const c = along$1(C, a, RING.up);
866
+ const [x, y] = [RING.rx * Math.cos(rad(deg)), RING.ry * Math.sin(rad(deg))];
867
+ const [cos, sin] = [Math.cos(rad(TURNED[a])), Math.sin(rad(TURNED[a]))];
868
+ return [c[0] + x * cos - y * sin, c[1] + x * sin + y * cos];
869
+ };
870
+ const rotation = (a, limit) => {
871
+ // where the ring passes in front of the axis, the axis gives way
872
+ const front = RING.up - RING.ry;
873
+ const axis = line([along$1(C, a, -7.8), along$1(C, a, front - 2)]) + line([along$1(C, a, front + 2), along$1(C, a, 7.8)]);
874
+ // the ring runs against the clock round the front, between its two widest points (at 180 and 0)
875
+ // or from behind the axis on the one side, or to behind it on the other
876
+ const [from, to] = limit === 'min' ? [180, -RING.behind] : [180 + RING.behind, 0];
877
+ const ring = `M${at$1(onRing(a, from))}A${RING.rx} ${RING.ry} ${TURNED[a]} 1 0 ${at$1(onRing(a, to))}`;
878
+ return [[a, axis + (limit ? stop(onRing(a, limit === 'min' ? 180 : 0), a) : '')], ['', ring + (limit ? '' : head(onRing(a, 16), onRing(a, 0), 3))], ...(limit ? [['fill', dot$1(onRing(a, limit === 'min' ? 142 : 38), 1.6)]] : [])];
879
+ };
880
+
881
+ // ---- which way an axis points: one arrow through the middle, and the same arrow turned round
882
+ const switched = (a, second) => {
883
+ const [p, q] = [along$1(C, a, -8), along$1(C, a, 8)];
884
+ return [[a, second ? arrowTo(q, p, 3) : arrowTo(p, q, 3)]];
885
+ };
886
+
887
+ // ---- the main axis of a mate: from the mate's origin, the axis taken, one way or the other
888
+ const flip = (a, inverse = false) => {
889
+ const s = inverse ? -1 : 1;
890
+ const o = along$1(C, a, -7.2 * s);
891
+ return [[a, arrowTo(o, along$1(C, a, 7.6 * s), 3)], ['fill', dot$1(o, 1.9)]];
892
+ };
893
+
894
+ // ---- a mate turned about its main axis: a dial seen along the axis, a hand at nought, and the
895
+ // turn from it as far as the angle
896
+ const dial = deg => {
897
+ const end = on$1(C, 6.5, 6.5, -deg);
898
+ const swept = `H16.5A6.5 6.5 0 ${deg > 180 ? 1 : 0} 0 ${at$1(end)}`;
899
+ return [['sub', circle(10, 10, 6.5)], ...(deg ? [['tone', `M10 10${swept}Z`]] : []), ['', deg ? `M10 10${swept}` + head(on$1(C, 6.5, 6.5, 22 - deg), end, 2.6) : 'M10 10H16.5'], ['fill', dot$1(C, 1.5)]];
900
+ };
901
+
902
+ // ---- a frame turned in space: the frame a point is given in by its coordinates, seen flat (as
903
+ // the field beside it draws it), and a turn about its origin
904
+ const F = [3.9, 16.1];
905
+ const FRAME$1 = arrowTo(F, [F[0] + 13.6, F[1]], 2.6) + arrowTo(F, [F[0], F[1] - 13.6], 2.6);
906
+
907
+ // ---- a plane lying flat, for the normal that stands on it
908
+ const PLANE$1 = plate(C, 6.4);
909
+ const axes = sheet({
910
+ // ---- an offset along an axis, and its lower and upper limit
911
+ /** An offset along X. */
912
+ offsetX: offset('x'),
913
+ /** The lower limit of an offset along X. */
914
+ offsetXMin: offset('x', 'min'),
915
+ /** The upper limit of an offset along X. */
916
+ offsetXMax: offset('x', 'max'),
917
+ /** An offset along Y. */
918
+ offsetY: offset('y'),
919
+ /** The lower limit of an offset along Y. */
920
+ offsetYMin: offset('y', 'min'),
921
+ /** The upper limit of an offset along Y. */
922
+ offsetYMax: offset('y', 'max'),
923
+ /** An offset along Z. */
924
+ offsetZ: offset('z'),
925
+ /** The lower limit of an offset along Z. */
926
+ offsetZMin: offset('z', 'min'),
927
+ /** The upper limit of an offset along Z. */
928
+ offsetZMax: offset('z', 'max'),
929
+ // ---- an axis picked as a direction
930
+ /** The X axis picked as a direction. */
931
+ directionX: direction$1('x'),
932
+ /** The Y axis picked as a direction. */
933
+ directionY: direction$1('y'),
934
+ // ---- a turn about an axis, its lower and upper limit, and a turn in space
935
+ /** A turn about X. */
936
+ rotationX: rotation('x'),
937
+ /** A turn about Y. */
938
+ rotationY: rotation('y'),
939
+ /** A turn about Z. */
940
+ rotationZ: rotation('z'),
941
+ /** The lower limit of a turn about Z. */
942
+ rotationZMin: rotation('z', 'min'),
943
+ /** The upper limit of a turn about Z. */
944
+ rotationZMax: rotation('z', 'max'),
945
+ /** A turn in space. */
946
+ rotation3d: [['sub', FRAME$1], ['', turn(F, 9, 9, -78, -12, 3)]],
947
+ // ---- which way: the two states of a switch
948
+ /** A direction switch, the one way. */
949
+ switchDirection1: arrowTo([4.5, 15.5], [15.5, 4.5], 3),
950
+ /** A direction switch, the other way. */
951
+ switchDirection2: arrowTo([15.5, 4.5], [4.5, 15.5], 3),
952
+ /** A normal switch, the one way. */
953
+ switchNormal1: [['sub', PLANE$1], ['', arrowTo(C, [10, 2.4], 3)]],
954
+ /** A normal switch, the other way. */
955
+ switchNormal2: [['sub', PLANE$1], ['', arrowTo(C, [10, 17.6], 3)]],
956
+ /** A switch of X, the one way. */
957
+ switchX1: switched('x', false),
958
+ /** A switch of X, the other way. */
959
+ switchX2: switched('x', true),
960
+ /** A switch of Y, the one way. */
961
+ switchY1: switched('y', false),
962
+ /** A switch of Y, the other way. */
963
+ switchY2: switched('y', true),
964
+ // ---- how a mate lies: the axis that is its main one, and which way
965
+ /** A mate whose main axis is X. */
966
+ flipX: flip('x'),
967
+ /** A mate whose main axis is -X. */
968
+ flipXInv: flip('x', true),
969
+ /** A mate whose main axis is Y. */
970
+ flipY: flip('y'),
971
+ /** A mate whose main axis is -Y. */
972
+ flipYInv: flip('y', true),
973
+ /** A mate whose main axis is Z. */
974
+ flipZ: flip('z'),
975
+ /** A mate whose main axis is -Z. */
976
+ flipZInv: flip('z', true),
977
+ // ---- how a mate lies: turned about its main axis
978
+ /** A mate as it lies, not turned about its main axis. */
979
+ reorient0: dial(0),
980
+ /** A mate turned 90° about its main axis. */
981
+ reorient90: dial(90),
982
+ /** A mate turned 180° about its main axis. */
983
+ reorient180: dial(180),
984
+ /** A mate turned 270° about its main axis. */
985
+ reorient270: dial(270)
986
+ });
987
+
988
+ // The sketcher's signs: what it draws, what it holds a drawing by (constraints and dimensions),
989
+ // a point of the sketch: drawn with the 'point' pens, a ring with a light centre
990
+ const dot = (x, y, r = 1.45) => circle(x, y, r);
991
+
992
+ // a point a curve is led by but does not pass through: a small open square
993
+ const ctrl = (x, y, s = 2.6) => rect(x - s / 2, y - s / 2, s, s);
994
+
995
+ // the curve both splines draw, from one corner of the sheet towards the other
996
+ const curve = 'M4 16C4 14.23 4 12.12 6.12 11.06C8.24 10 12 10 14 9S16 6 16 4';
997
+
998
+ // a point on a circle about `c`, by its angle (degrees, clockwise on the sheet from its right)
999
+ const on = (c, r, a) => [c[0] + r * Math.cos(a * Math.PI / 180), c[1] + r * Math.sin(a * Math.PI / 180)];
1000
+
1001
+ // an arc about `c` from a0 to a1, with an arrow's head where it ends
1002
+ const sweep = (c, r, a0, a1, size = 2.6) => {
1003
+ const back = (a1 > a0 ? 1 : -1) * size * 0.6 * 180 / (Math.PI * r);
1004
+ return arc(c[0], c[1], r, r, a0, a1) + head(on(c, r, a1 - back), on(c, r, a1), size);
1005
+ };
1006
+
1007
+ // the sheet's middle, and an axis of symmetry upright through it: the chain laid out evenly about it
1008
+ const mid = [10, 10];
1009
+ const axis = 'M10 2.5v2.3M10 6.2v.6M10 8.2v3.6M10 13.2v.6M10 15.2v2.3';
1010
+
1011
+ // which way a thing runs: along X as it is drawn, or up along Y (the sheet mirrored about its rising diagonal)
1012
+
1013
+ const alongX = p => p;
1014
+ const alongY = ([x, y]) => [20 - y, 20 - x];
1015
+
1016
+ // ---- taking an edge of the body into the sketch: the body in grey, and under it the line it gives
1017
+ const body = block(5, [10, 7.4]);
1018
+ const taken = [[3.3, 16.6], [16.7, 16.6]];
1019
+ const takeEdge = pen => [['sub', body.lines], [pen, line(taken)]];
1020
+
1021
+ // ---- a shape and its mirror image, either side of the axis
1022
+ const shape = 'M1.8 14.4h4.8V5.6Z';
1023
+ const image = 'M18.2 14.4h-4.8V5.6Z';
1024
+
1025
+ // ---- a line through `c`, rising to the right
1026
+ const slope = c => line([on(c, 6.6, 135), on(c, 6.6, -45)]);
1027
+
1028
+ // ---- a piece of the sheet's rising diagonal, from t0 to t1 along it
1029
+ const piece = (t0, t1) => line([on([2.6, 17.4], t0, -45), on([2.6, 17.4], t1, -45)]);
1030
+
1031
+ // ---- a dimension between a line's two points, along one way of the sheet
1032
+ const measure = way => [['sub', line([way([4.5, 15]), way([15.5, 11.5])])], ['sub-point', dot(...way([4.5, 15])) + dot(...way([15.5, 11.5]))], ['', spanTo(way([4.5, 5.5]), way([15.5, 5.5]), 2.6)]];
1033
+ // the aligned dimension's own frame: along the line and across it, turned 40° about the sheet's middle
1034
+ const slanted = ([u, v]) => [9.9 + u * 0.766 + v * 0.643, 9.95 - u * 0.643 + v * 0.766];
1035
+
1036
+ // how many: the row (the one that was there, and its copies), and the way it is counted along
1037
+ const count = way => [['sub', arrowTo(way([1.6, 14.6]), way([18.4, 14.6]), 3)], ...copiesInRow(5.8, way)];
1038
+ // how far apart: two of them, and the distance between their middles
1039
+ const spacing = way => [['sub-fill', tile$1(way([4.5, 6.2]), 5) + tile$1(way([15.5, 6.2]), 5)], ['', spanTo(way([2.4, 14.6]), way([17.6, 14.6]), 2.8)]];
1040
+ // which way: the sketch's two axes from their origin, the one that is meant as an arrow
1041
+ const direction = way => [['sub', line([way([4.2, 15.8]), way([4.2, 3.6])])], ['', arrowTo(way([4.2, 15.8]), way([16.8, 15.8]), 3)]];
1042
+
1043
+ // the corner an angle between two copies is measured at
1044
+ const hub = [4.1, 15.2];
1045
+ const sketch = sheet({
1046
+ // ---- drawing: the curve, and the points it is given
1047
+ /** A point. */
1048
+ point: [['sub', 'M10 2.6v14.8M2.6 10h14.8'], ['point', dot(10, 10, 2)]],
1049
+ /** A line between two points. */
1050
+ line: [['', 'M4.5 15.5 15.5 4.5'], ['point', dot(4.5, 15.5) + dot(15.5, 4.5)]],
1051
+ /** A rectangle by two corners. */
1052
+ rect2Points: [['tone', rect(4, 5.5, 12, 9)], ['', rect(4, 5.5, 12, 9)], ['point', dot(4, 14.5) + dot(16, 5.5)]],
1053
+ /** A rectangle by its centre and a corner. */
1054
+ rectCenter: [['tone', rect(4, 5.5, 12, 9)], ['', rect(4, 5.5, 12, 9)], ['point', dot(10, 10) + dot(16, 5.5)]],
1055
+ /** A circle by its centre and a point on it. */
1056
+ circleCenter: [['tone', circle(10, 10, 6.5)], ['sub', 'M10 10 15.63 6.75'], ['', circle(10, 10, 6.5)], ['point', dot(10, 10) + dot(15.63, 6.75)]],
1057
+ // an arc that leaves a line's end the way the line runs
1058
+ /** An arc that leaves a line's end the way the line runs. */
1059
+ arcTangent: [['sub', 'M3.25 15.5h7'], ['', arc(10.25, 9.5, 6, 6, 90, -45)], ['point', dot(10.25, 15.5) + dot(...on([10.25, 9.5], 6, -45))]],
1060
+ /** An arc by its centre and its ends. */
1061
+ arcCenter: [['sub', 'M3.5 9.75 10 13.5 16.5 9.75'], ['', arc(10, 13.5, 7.5, 7.5, -150, -30)], ['point', dot(10, 13.5) + dot(3.5, 9.75) + dot(16.5, 9.75)]],
1062
+ /** An arc through three points. */
1063
+ arc3Points: [['', arc(10, 13.25, 6.5, 6.5, -180, 0)], ['point', dot(3.5, 13.25) + dot(10, 6.75) + dot(16.5, 13.25)]],
1064
+ // ---- free curves: dots for the points on the curve, squares for those it is led by
1065
+ spline: [['sub', 'M4 16V7.2L16 12.8V4'], ['', curve], ['', ctrl(4, 7.2) + ctrl(16, 12.8)], ['point', dot(4, 16) + dot(16, 4)]],
1066
+ intSpline: [['', curve], ['point', dot(4, 16) + dot(10, 10) + dot(16, 4)]],
1067
+ bezier: [['sub', 'M4.9 15.3 2.1 9.5 7.4 5.5 15.2 5.8 17.8 11.1'], ['', 'M4.9 15.3C4.6 14 4.3 12.7 4.95 11.3C5.6 9.85 7 9 8.2 8.65C9.35 8.3 11.6 8.05 13.6 8.6C15.6 9.15 16.7 10.1 17.8 11.1'], ['', ctrl(2.1, 9.5) + ctrl(7.4, 5.5) + ctrl(15.2, 5.8)], ['point', dot(4.9, 15.3) + dot(17.8, 11.1)]],
1068
+ // ---- changing what is drawn: a corner rounded, a line cut back, a line cut in two
1069
+ /** A sketch's corner rounded. */
1070
+ sketchFillet: [['sub', 'M3.5 3.5H10M16.5 10v6.5'], ['', arc(10, 10, 6.5, 6.5, -90, 0)]],
1071
+ /** A line cut back. */
1072
+ trim: [['sub', 'M5.5 16.5 10 3.5M2.5 10h5'], ['sub-dash', 'M8.2 10h9.3'], ['', 'M11.2 7.2l5.6 5.6M16.8 7.2l-5.6 5.6']],
1073
+ /** A line cut in two. */
1074
+ split: [['', 'M3.5 16.5 7.6 12.4M12.4 7.6 16.5 3.5'], ['point', dot(10, 10, 1.7)]],
1075
+ // ---- an edge of the body, taken into the sketch: as a line of its own, or as a reference only
1076
+ /** An edge of the body taken into the sketch as a line of its own. */
1077
+ useGeometry: takeEdge(''),
1078
+ /** An edge of the body taken into the sketch as a reference only. */
1079
+ useReference: takeEdge('dash'),
1080
+ // ---- kinds of line
1081
+ /** A line of the profile. */
1082
+ solidLine: [['', 'M4.5 15.5 15.5 4.5'], ['point', dot(4.5, 15.5) + dot(15.5, 4.5)]],
1083
+ /** A construction line: dashed, not part of the profile. */
1084
+ constructionLine: [['dash', 'M4.5 15.5 15.5 4.5'], ['point', dot(4.5, 15.5) + dot(15.5, 4.5)]],
1085
+ /** The line a sketch is mirrored in. */
1086
+ mirrorLine: [['sub-fill', shape + image], ['', axis]],
1087
+ // ---- holding: what is held in grey, what holds it in ink
1088
+ /** Horizontal: a line held level. */
1089
+ horizontal: [['sub', 'M3.5 15h13'], ['', 'M8 4.5v6.5M12 4.5v6.5M8 7.75h4']],
1090
+ /** Vertical: a line held upright. */
1091
+ vertical: [['sub', 'M5 3.5v13'], ['', 'M10 6.75l2 6.5 2-6.5']],
1092
+ /** Coincident: two points held as one. */
1093
+ coincident: [['sub', 'M3.5 15.5 10 9M16.5 5.5 10 9'], ['', circle(10, 9, 3)], ['point', dot(10, 9, 1.2)]],
1094
+ // a point on the ground: the bar, and its hatching below
1095
+ /** Fixed: a point held where it is. */
1096
+ fixed: [['', 'M3.5 10.4h13M6.9 10.4l-2.2 4.4M11.1 10.4l-2.2 4.4M15.3 10.4l-2.2 4.4'], ['point', dot(10, 6.4, 2)]],
1097
+ /** Tangent: a curve that leaves another the way it runs. */
1098
+ tangent: [['sub', circle(12.38, 12.38, 4.6)], ['', 'M3 15.4 15.4 3'], ['point', dot(9.13, 9.13, 1.7)]],
1099
+ /** Equal curvature: two curves held as round as each other. */
1100
+ equalCurvature: [['sub', 'M3.5 2.2C3.5 4 6.5 4.4 10 5.1C13.5 5.8 15.9 6 16.5 7.2' + 'M3.5 12.8C3.5 14.6 6.5 15 10 15.7C13.5 16.4 15.9 16.6 16.5 17.8'], ['', 'M6.5 8.3h7M6.5 11.7h7']],
1101
+ /** Parallel: two lines held parallel. */
1102
+ parallelLines: [['', slope(on(mid, 2.6, -135)) + slope(on(mid, 2.6, 45))]],
1103
+ /** Perpendicular: two lines held at a right angle. */
1104
+ perpendicular: [['', 'M3 16.5h14M10 16.5V3.5'], ['sub', 'M14.5 16.5V12H10']],
1105
+ // two pieces of one line: the line they lie on runs through both
1106
+ /** Colinear: two lines held on one line. */
1107
+ colinear: [['sub-dash', piece(0.4, 20.5)], ['', piece(3.2, 7.9) + piece(13, 17.7)]],
1108
+ /** Concentric: circles held about one centre. */
1109
+ concentric: [['', circle(10, 10, 7.2) + circle(10, 10, 3.4)], ['point', dot(10, 10, 1.2)]],
1110
+ // the point in a line's middle
1111
+ /** Midpoint: a point held in a line's middle. */
1112
+ midpoint: [['sub', 'M4 16 16 4'], ['sub-point', dot(4, 16) + dot(16, 4)], ['point', dot(10, 10, 2)]],
1113
+ /** Symmetric: two points held either side of a line. */
1114
+ symmetric: [['axis', 'M10 2v16'], ['', 'M3.6 10h2.6M13.8 10h2.6'], ['point', dot(4.6, 10, 1.9) + dot(15.4, 10, 1.9)]],
1115
+ /** Equal: two lines held as long, or two circles as large, as each other. */
1116
+ equal: [['sub', 'M3.5 5 16.5 3M3.5 17 16.5 15'], ['', 'M6.5 8.3h7M6.5 11.7h7']],
1117
+ /** Equal radius: two circles or arcs held as large as each other. */
1118
+ equalRadius: [['sub', arc(10, 11.04, 8.54, 8.54, -139.6, -40.4) + arc(10, 8.96, 8.54, 8.54, 40.4, 139.6)], ['', 'M6.5 8.3h7M6.5 11.7h7']],
1119
+ // several points held as one: a group's frame around them, a handle at each corner
1120
+ /** Rigid set: several shapes held as one. */
1121
+ rigidSet: [['', ctrl(3, 3, 2.4) + ctrl(17, 3, 2.4) + ctrl(3, 17, 2.4) + ctrl(17, 17, 2.4) + 'M4.3 3H7.4M12.6 3h3.1M4.3 17H7.4M12.6 17h3.1' + 'M3 4.3V7.4M3 12.6v3.1M17 4.3V7.4M17 12.6v3.1'], ['point', dot(8, 12, 2) + dot(12, 8, 2)]],
1122
+ // ---- measuring: the thing in grey, its dimension in ink
1123
+ /** A horizontal dimension. */
1124
+ dimHorizontal: measure(alongX),
1125
+ /** A vertical dimension. */
1126
+ dimVertical: measure(alongY),
1127
+ /** A dimension along a line. */
1128
+ dimLinear: [['sub', line([slanted([-5.5, 3.4]), slanted([5.5, 3.4])])], ['sub-point', dot(...slanted([-5.5, 3.4])) + dot(...slanted([5.5, 3.4]))], ['', spanTo(slanted([-5.5, -2.4]), slanted([5.5, -2.4]), 2.6)]],
1129
+ /** A radius. */
1130
+ radius: [['sub', arc(4, 16, 12, 12, -90, 0)], ['', arrowTo([4, 16], on([4, 16], 11.2, -45), 3.6)], ['point', dot(4, 16)]],
1131
+ /** A diameter. */
1132
+ sketchDiameter: [['sub', circle(10, 10, 7)], ['', spanTo(on(mid, 5.6, 135), on(mid, 5.6, -45), 2.8)]],
1133
+ // a line's angle against the X axis
1134
+ /** A line's angle against the X axis. */
1135
+ angleOX: [['sub', 'M3.5 16h13.5' + line([[3.5, 16], on([3.5, 16], 14, -62)])], ['', sweep([3.5, 16], 10.5, -4, -52)]],
1136
+ // ---- repeating: the original in grey, its copies in ink
1137
+ /** Shapes of a sketch repeated along a line. */
1138
+ pattern2dLinear: copiesInRow(10),
1139
+ /** Shapes of a sketch repeated about a point. */
1140
+ pattern2dCircular: copiesAround(),
1141
+ /** Shapes of a sketch mirrored in a line. */
1142
+ pattern2dMirror: [['sub-fill', shape], ['axis', 'M10 2v16'], ['fill', image]],
1143
+ // ---- what a pattern is set by: how far apart, which way, how many, at what angle
1144
+ /** A sketch pattern's spacing along its first direction. */
1145
+ sketchDistanceX: spacing(alongX),
1146
+ /** A sketch pattern's spacing along its second direction. */
1147
+ sketchDistanceY: spacing(alongY),
1148
+ /** A sketch pattern's first direction. */
1149
+ sketchDirectionX: direction(alongX),
1150
+ /** A sketch pattern's second direction. */
1151
+ sketchDirectionY: direction(alongY),
1152
+ /** A sketch pattern's count along its first direction. */
1153
+ sketchCountX: count(alongX),
1154
+ /** A sketch pattern's count along its second direction. */
1155
+ sketchCountY: count(alongY),
1156
+ /** A sketch pattern's count about its centre. */
1157
+ sketchCountAngular: copiesAround(),
1158
+ /** A sketch pattern's angle. */
1159
+ sketchAngle: [['sub', line([on(hub, 13, 0), hub, on(hub, 13, -62)])], ['', sweep(hub, 9, -4, -52, 2.6)], ['point', dot(hub[0], hub[1], 1.45)]]
1160
+ });
1161
+
1162
+ // What a pick field of a feature's window wants clicked on the model, or what the pick gives: an
1163
+ const f = v => Math.round(v * 100) / 100;
1164
+ const at = p => `${f(p[0])} ${f(p[1])}`;
1165
+ // a point that is picked or given: a larger dot than a shape's corner has, for here it is all a sign says
1166
+ const point = p => dot$1(p, 2);
1167
+ // the point `t` past `b` on the line from `a`
1168
+ const past = (a, b, t) => {
1169
+ const d = Math.hypot(b[0] - a[0], b[1] - a[1]);
1170
+ return [b[0] + (b[0] - a[0]) * t / d, b[1] + (b[1] - a[1]) * t / d];
1171
+ };
1172
+ const MID = [10, 10];
1173
+
1174
+ // ---- a body: the cube every sign of a body starts from. The corners of its top (left, far,
1175
+ // right, near), and the upright edge at its near corner
1176
+ const c = cube.cam;
1177
+ const TOP = [[-0.5, -0.5, 0.5], [-0.5, 0.5, 0.5], [0.5, 0.5, 0.5], [0.5, -0.5, 0.5]].map(c);
1178
+ const EDGE = [TOP[3], c([0.5, -0.5, -0.5])];
1179
+ // an end of an edge, where a chain of them is linked: smaller than a point that is picked
1180
+ const knot = p => dot$1(p, 1.6);
1181
+
1182
+ // ---- two bodies: small enough to stand apart, the second up and to the right of the first.
1183
+ // (So small, a cube keeps its outline and its top; the edge down its near corner would fill it.)
1184
+ const TWO = [block(3.8, [5.3, 13.6]), block(3.8, [14.7, 6.4])];
1185
+
1186
+ // ---- a sheet: a surface with no thickness, bent up along one side (its profile in XZ, swept along Y)
1187
+ const SHEET = (() => {
1188
+ const cam = iso(8.4, [2.72, 13.15]);
1189
+ const edge = y => [[0, y, 0.75], [0.06, y, 0.18], [0.4, y, 0], [1, y, 0]].map(cam);
1190
+ const [a, b] = [edge(0), edge(1).reverse()];
1191
+ return `M${at(a[0])}C${a.slice(1).map(at).join(' ')}L${at(b[0])}C${b.slice(1).map(at).join(' ')}Z`;
1192
+ })();
1193
+
1194
+ // ---- a frame, seen flat: two axes from its origin `o`, `a` long
1195
+ const frame = (o, a, size = 2.4) => arrowTo(o, [o[0] + a, o[1]], size) + arrowTo(o, [o[0], o[1] - a], size);
1196
+ // the first of two frames and the second: the second lies up and to the right of the first
1197
+ const FRAME = [frame([3.4, 16.2], 6.8), frame([11, 9.6], 6.8)];
1198
+ // the frame a point or a direction is given in by its coordinates: as large as the sheet takes
1199
+ const ORIGIN = [3.9, 16.1];
1200
+ const AXES = frame(ORIGIN, 13.6, 2.6);
1201
+
1202
+ // ---- the plane that is laid through a point, three points, a line: they lie on its rim
1203
+ const LAID = [10, 9.4];
1204
+ const PLANE = plate(LAID, 6.2);
1205
+ const rim = a => on$1(LAID, 6.2, 6.2 / Math.sqrt(3), a);
1206
+
1207
+ // ---- the line a direction lies on, the way it points: from 0 at its lower left to 1
1208
+ const along = t => [3 + 14 * t, 17 - 14 * t];
1209
+
1210
+ // ---- two planes that meet: a wall standing on a floor, both 7.4 wide. Where they meet runs along Y
1211
+ const CREASE = [[3.4, 13.4], [9.98, 9.6]];
1212
+ const up = p => [p[0], p[1] - 7.4];
1213
+ const out = p => [p[0] + 6.41, p[1] + 3.7];
1214
+ const WALL = line([CREASE[0], up(CREASE[0]), up(CREASE[1]), CREASE[1]]);
1215
+ const FLOOR = line([CREASE[0], out(CREASE[0]), out(CREASE[1]), CREASE[1]]);
1216
+
1217
+ // ---- a curve, and where the arrow leaves it, the way it runs there
1218
+ const LEAVE = [6.4, 12];
1219
+ const BEND = [LEAVE[0] + 6 * Math.SQRT1_2, LEAVE[1] + 6 * Math.SQRT1_2];
1220
+
1221
+ // ---- three lines, and the circle they hold
1222
+ const TRI = [[2, 17], [18, 17], [8, 2.4]];
1223
+ const INNER = (() => {
1224
+ const [a, b, d] = TRI;
1225
+ const len = (p, q) => Math.hypot(p[0] - q[0], p[1] - q[1]);
1226
+ const [la, lb, ld] = [len(b, d), len(a, d), len(a, b)];
1227
+ const sum = la + lb + ld;
1228
+ const area = Math.abs((b[0] - a[0]) * (d[1] - a[1]) - (d[0] - a[0]) * (b[1] - a[1])) / 2;
1229
+ const mid = [(la * a[0] + lb * b[0] + ld * d[0]) / sum, (la * a[1] + lb * b[1] + ld * d[1]) / sum];
1230
+ return {
1231
+ mid,
1232
+ r: 2 * area / sum
1233
+ };
1234
+ })();
1235
+
1236
+ // ---- two bodies side by side, seen flat as the mates draw them. A mate is the knob on the one
1237
+ // that is meant, on its side towards the other (and well clear of that other)
1238
+ const BODY = [rect(2, 5.5, 4.6, 9, 1.2), rect(13.4, 5.5, 4.6, 9, 1.2)];
1239
+ const mate = i => [['sub', BODY[1 - i]], ...toned(BODY[i]), ['fill', dot$1([8.3 + 3.4 * i, 10], 1.7)]];
1240
+
1241
+ // ---- a plane lying flat, low enough for two of them to lie well apart
1242
+ const flat$1 = y => line([[2, y], [7.4, y - 2.4], [12.8, y], [7.4, y + 2.4]], true);
1243
+ const refs = sheet({
1244
+ // ---- things on a body. The body is grey; what is picked on it is ink
1245
+ // an edge: one of the body's, from end to end
1246
+ /** An edge of a body, picked. */
1247
+ edges: [['sub', cube.lines], ['', line(EDGE)], ['fill', EDGE.map(knot).join('')]],
1248
+ // a face: the top, filled (the tone is laid three times: once does not show on so small a face)
1249
+ /** A face of a body, picked. */
1250
+ face: [['sub', cube.lines], ['tone', cube.top], ['tone', cube.top], ...toned(cube.top)],
1251
+ // a loop: the chain of edges round the top, link by link, and not the face in it
1252
+ /** A loop: the chain of edges around a face, picked. */
1253
+ loop: [['sub', cube.lines], ['', cube.top], ['fill', TOP.map(knot).join('')]],
1254
+ // ---- bodies
1255
+ // one body: the cube
1256
+ /** A body, picked. */
1257
+ instance: [['tone', cube.outline], ['tone', cube.top], ['', cube.lines]],
1258
+ // several: a second one beside the first
1259
+ /** Several bodies, picked. */
1260
+ instances: [['tone', TWO[0].outline + TWO[1].outline], ['tone', TWO[0].top + TWO[1].top], ['', TWO[0].outline + TWO[0].top + TWO[1].outline + TWO[1].top]],
1261
+ // several that are taken away (the other bodies of a cut): their outlines, with nothing in them
1262
+ /** Several bodies that are taken away (the other bodies of a cut). */
1263
+ instancesOpen: TWO[0].outline + TWO[1].outline,
1264
+ // a sheet: a surface with no thickness (`sheet` is the same, as a row of the geometry list)
1265
+ /** A sheet: a surface with no thickness, picked. */
1266
+ sheetBody: toned(SHEET),
1267
+ /** A sheet, as a row of the bodies' list. */
1268
+ sheet: toned(SHEET),
1269
+ // ---- two frames: the one to start from (the first in ink), the one to go to (the second)
1270
+ /** The coordinate system to start from. */
1271
+ csysFrom: [['sub', FRAME[1]], ['', FRAME[0]]],
1272
+ /** The coordinate system to go to. */
1273
+ csysTo: [['sub', FRAME[0]], ['', FRAME[1]]],
1274
+ // ---- given by coordinates: grey axes, and in them a point, or a direction from their origin
1275
+ /** A point given by its coordinates. */
1276
+ position: [['sub', AXES], ['fill', point([12.9, 7.1])]],
1277
+ /** A direction given by its coordinates. */
1278
+ direction3d: [['sub', AXES], ['', arrowTo(ORIGIN, [14.9, 5.1], 3)]],
1279
+ // ---- a direction: one ink arrow, and in grey what gives it
1280
+ // a line: the arrow lies on it
1281
+ /** A direction along a line. */
1282
+ direction: [['sub', line([along(-0.04), along(1.04)])], ['', arrowTo(along(0.08), along(0.84), 3)]],
1283
+ // two points: the arrow from the one to the other
1284
+ /** A direction from one point to another. */
1285
+ directionPoints: [['sub-fill', point(along(0.05)) + point(along(0.95))], ['', arrowTo(along(0.24), along(0.72), 3)]],
1286
+ // two planes: the arrow along where they meet
1287
+ /** A direction along where two planes meet. */
1288
+ directionPlanes: [['sub', WALL + FLOOR], ['', arrowTo(CREASE[0], past(CREASE[0], CREASE[1], 6.4), 3)]],
1289
+ // a curve: the arrow leaves it the way it runs
1290
+ /** A direction the way a curve runs. */
1291
+ directionCurve: [['sub', arc(BEND[0], BEND[1], 6, 6, 165, 325)], ['', arrowTo(LEAVE, [LEAVE[0] + 9.3, LEAVE[1] - 9.3], 3)]],
1292
+ // a plane: the arrow stands on it
1293
+ /** A direction that stands on a plane: its normal. */
1294
+ normal: [['sub', plate([10, 13.8], 7.2)], ['', arrowTo([10, 13.8], [10, 2.4], 3)]],
1295
+ // ---- a plane: how far it lies from the one it is taken from; what it is laid through
1296
+ /** A plane at an offset from another. */
1297
+ planeOffset: [['sub', flat$1(15)], ...toned(flat$1(5)), ['', spanTo([16.6, 3.4], [16.6, 16.6], 2.8)]],
1298
+ // one point: a dot on the rim
1299
+ /** A plane through a point. */
1300
+ pointOnPlane: [['sub', PLANE], ['fill', point(rim(90))]],
1301
+ // three points: a dot on three corners
1302
+ /** A plane through three points. */
1303
+ pointsOnPlane: [['sub', PLANE], ['fill', [180, 0, 90].map(a => point(rim(a))).join('')]],
1304
+ // a line: one side of the rim, running on past it
1305
+ /** A plane through a line. */
1306
+ lineOnPlane: [['sub', PLANE], ['', line([past(rim(90), rim(180), 2), past(rim(180), rim(90), 2)])]],
1307
+ // ---- a work point: the one ink dot, and in grey what it is the middle or the meeting of
1308
+ // the middle of a face of a body
1309
+ /** The middle of a body's face. */
1310
+ barycenter: [['sub', cube.lines], ['fill', point(c([0, 0, 0.5]))]],
1311
+ // the middle between two points
1312
+ /** The middle between two points. */
1313
+ midpointPoints: [['sub-fill', point([3.6, 16.4]) + point([16.4, 3.6])], ['fill', point(MID)]],
1314
+ // the middle of a line
1315
+ /** The middle of a line. */
1316
+ midpointLine: [['sub', 'M3.5 16.5L16.5 3.5'], ['fill', point(MID)]],
1317
+ // the middle of the circle three lines hold (a smaller dot: the circle is close around it)
1318
+ /** The centre of the circle three lines hold. */
1319
+ innerCircle: [['sub', line(TRI, true) + circle(INNER.mid[0], INNER.mid[1], INNER.r)], ['fill', dot$1(INNER.mid, 1.6)]],
1320
+ // where two lines cross
1321
+ /** Where two lines cross. */
1322
+ intersectionPoint: [['sub', 'M2.6 13.4L17.4 6.6M5.6 3L14.4 17'], ['fill', point(MID)]],
1323
+ // the centre of an arc
1324
+ /** The centre of an arc. */
1325
+ arc: [['sub', arc(10, 10, 7.2, 7.2, 40, 320)], ['fill', point(MID)]],
1326
+ // ---- two bodies to be joined: the mate on the first, the mate on the second
1327
+ /** The mate on the first of two instances to be joined. */
1328
+ mate1: mate(0),
1329
+ /** The mate on the second of two instances to be joined. */
1330
+ mate2: mate(1)
1331
+ });
1332
+
1333
+ // How two instances of an assembly are held to each other. Grey is the bodies. Ink is the one
1334
+ // ---- the ground, as a drawing shows what is fixed: a bar, and its hatching below
1335
+ const ground = 'M3 13.2h14M6.6 13.2l-2.2 4.2M10.8 13.2l-2.2 4.2M15 13.2l-2.2 4.2';
1336
+
1337
+ // ---- a pin upright through `x`, and a turn about it as it is seen from the side: the turn comes
1338
+ // round the pin's near side
1339
+ const pin = x => rect(x - 2.2, 2.4, 4.4, 15.2, 1.6);
1340
+ const about = (x, rx = 7) => turn([x, 10], rx, rx * 0.42, -55, 222, 2.8);
1341
+
1342
+ // ---- a plate lying flat, low enough for two of them to lie well apart
1343
+ const flat = y => line([[2, y], [7, y - 2.3], [12, y], [7, y + 2.3]], true);
1344
+
1345
+ // ---- two wheels that touch, the one driving the other
1346
+ const BIG = [7.2, 11];
1347
+ const LITTLE = [14.6, 8.2];
1348
+ const mates = sheet({
1349
+ // ---- nothing left free: held to the ground; held to one another, by a strap across where they touch
1350
+ /** Fastened origin: an instance held to the ground. */
1351
+ fastenedOrigin: [['sub', rect(5.5, 3.2, 9, 10, 1.2)], ['', ground]],
1352
+ /** Fastened: two instances held to one another. */
1353
+ fastened: [['sub', rect(2, 5.5, 6, 9, 1.2) + rect(12, 5.5, 6, 9, 1.2)], ['fill', rect(5.4, 8.4, 9.2, 3.2, 1.6)]],
1354
+ // ---- one way to slide: a block on its rail
1355
+ /** Slider: a block on its rail, free to slide one way. */
1356
+ slider: [['sub', 'M2.5 13.2H17.5' + rect(6, 10, 8, 6.4, 1.2)], ['', spanTo([3, 5.4], [17, 5.4], 2.8)]],
1357
+ // ---- a turn about an axis; and the same, free to slide along it too
1358
+ /** Revolute: a turn about an axis. */
1359
+ revolute: [['sub', pin(10)], ['', about(10)]],
1360
+ /** Cylindrical: a turn about an axis, free to slide along it too. */
1361
+ cylindrical: [['sub', pin(6.6)], ['', about(6.6, 4.4)], ['', spanTo([16.8, 3], [16.8, 17], 2.6)]],
1362
+ // ---- sliding on a plane: either way along both of its edges (the plate seen from above)
1363
+ /** Planar: free to slide on a plane. */
1364
+ planar: [['sub', rect(3, 3, 14, 14, 1.6)], ['', spanTo([10, 5.4], [10, 14.6], 2.4) + spanTo([5.4, 10], [14.6, 10], 2.4)]],
1365
+ // ---- two faces kept parallel: two plates, one above the other, and the sign for it
1366
+ /** Parallel: two faces kept parallel. */
1367
+ parallel: [['sub', flat(5.2) + flat(14.8)], ['', 'M14 13.4L15.4 6.6M17 13.4L18.4 6.6']],
1368
+ // ---- a turn about a point: a ball in its cup, and its swing
1369
+ /** Spherical: a ball in its cup, free to turn about a point. */
1370
+ spherical: [['sub', 'M2.4 11.6h1.6a6 6 0 0 0 12 0h1.6'], ['tone', circle(10, 11.6, 3.2)], ['', circle(10, 11.6, 3.2)], ['', turn([10, 11.6], 8.4, 8.4, -132, -48, 2.6) + turn([10, 11.6], 8.4, 8.4, -48, -132, 2.6)]],
1371
+ // ---- several instances, held as one: a frame around them
1372
+ /** Group: several instances held as one. */
1373
+ group: [['sub-fill', tile$1([6.8, 12.2]) + tile$1([13.2, 7.8])], ['dash', rect(2.4, 3, 15.2, 14, 3)]],
1374
+ // ---- an instance repeated: along a line, and about a point
1375
+ /** An instance repeated along a line (the assembly's linear pattern). */
1376
+ linearPatternConstraint: [...copiesInRow(5.8), ['', arrowTo([1.6, 14.6], [18.4, 14.6], 3)]],
1377
+ /** An instance repeated about a point (the assembly's circular pattern). */
1378
+ circularPatternConstraint: copiesAround(),
1379
+ // ---- two turns, the one driving the other
1380
+ /** Gear: two turns, the one driving the other. */
1381
+ gear: [['sub', circle(BIG[0], BIG[1], 4.6) + circle(LITTLE[0], LITTLE[1], 3.3)], ['sub-fill', dot$1(BIG, 1.1) + dot$1(LITTLE, 1.1)], ['', turn(BIG, 7.2, 7.2, 100, 185, 2.4) + turn(LITTLE, 5.8, 5.8, -80, -165, 2.4)]]
1382
+ });
1383
+
1384
+ function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1385
+ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1386
+
1387
+ // what stands in for a drawing that is not there: a dashed square. It is meant to be seen.
1388
+ const missing = sheet({
1389
+ /** A dashed square: what stands in for a name that has no drawing. */
1390
+ missing: [['sub-dash', 'M4 4h12v12H4Z']]
1391
+ });
1392
+
1393
+ /**
1394
+ * Every drawing the app has, by name: what {@link Icon} draws.
1395
+ *
1396
+ * The sheets are the app's own signs (its bars, rows and menus), the features, the sketch's tools and constraints,
1397
+ * what a field sets (a length, a count, an angle, along an axis), what a field picks, the mates of an assembly, and a
1398
+ * few glyphs. `missing` is the dashed square that stands in for a name that has no drawing.
1399
+ *
1400
+ * @example
1401
+ * ```tsx
1402
+ * import { Icon, icons } from '@classcad/react-cad'
1403
+ * import type { IconName } from '@classcad/react-cad'
1404
+ *
1405
+ * // a sheet of every icon there is, each with its name
1406
+ * const Sheet = () => (
1407
+ * <div style={{ display: 'grid', gridTemplateColumns: 'repeat(8, 1fr)', gap: 12 }}>
1408
+ * {(Object.keys(icons) as IconName[]).map((name) => (
1409
+ * <figure key={name}>
1410
+ * <Icon name={name} size={32} title={name} />
1411
+ * <figcaption>{name}</figcaption>
1412
+ * </figure>
1413
+ * ))}
1414
+ * </div>
1415
+ * )
1416
+ * ```
1417
+ *
1418
+ * @category Icons
1419
+ */
1420
+ const drawings = _objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1({}, missing), ui), glyphs), mates), params), axes), sketch), refs), features);
1421
+
1422
+ /**
1423
+ * The name of one of the app's drawings: a key of {@link icons}, such as `'extrusion'`.
1424
+ *
1425
+ * @category Icons
1426
+ */
1427
+
1428
+ /**
1429
+ * The drawing of a name, or the dashed square where there is none.
1430
+ *
1431
+ * @internal
1432
+ */
1433
+ const drawingOf = name => {
1434
+ var _name;
1435
+ return (_name = drawings[name]) != null ? _name : drawings.missing;
1436
+ };
1437
+
1438
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1439
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1440
+ const PREFIX = 'rcad:';
1441
+
1442
+ /**
1443
+ * An icon's reference: a string (`'rcad:extrusion'`) that goes wherever an image's url went before.
1444
+ *
1445
+ * It goes into a plugin description's `iconUrl` or a menu item's icon, say: {@link Icon} draws it from its `url`, and
1446
+ * shows anything else it is handed there as the image it is. {@link iconSvg} and {@link iconDataUrl} take it too.
1447
+ *
1448
+ * @param name - The drawing's name.
1449
+ * @example
1450
+ * ```tsx
1451
+ * import { Icon, iconRef } from '@classcad/react-cad'
1452
+ *
1453
+ * // what took an image's url takes the reference: it is drawn as the sign, in the theme's ink
1454
+ * const tools = [
1455
+ * { name: 'Extrude', iconUrl: iconRef('extrusion') },
1456
+ * { name: 'Logo', iconUrl: '/logo.svg' },
1457
+ * ]
1458
+ * const Tools = () => (
1459
+ * <>{tools.map((tool) => <Icon key={tool.name} url={tool.iconUrl} size={20} title={tool.name} />)}</>
1460
+ * )
1461
+ * ```
1462
+ *
1463
+ * @category Icons
1464
+ */
1465
+ const iconRef = name => PREFIX + name;
1466
+ /**
1467
+ * Whether a string is an icon's reference ({@link iconRef}) rather than an image's url.
1468
+ *
1469
+ * @internal
1470
+ */
1471
+ const isIconRef = url => typeof url === 'string' && url.startsWith(PREFIX);
1472
+ const layersOf = drawing => typeof drawing === 'string' ? [['', drawing]] : drawing;
1473
+
1474
+ // The circles of a drawing's points: what is cut away from its other layers, so their centres stay light.
1475
+ const holesOf = layers => layers.filter(([pen]) => isPointPen(pen)).map(([, d]) => d).join('');
1476
+
1477
+ // A line's weight is in px on screen, whatever the size the drawing is shown at.
1478
+ const weight = size => size <= 14 ? 1.3 : size <= 16 ? 1.4 : size <= 18 ? 1.45 : size <= 24 ? 1.5 : size <= 40 ? 1.75 : 2;
1479
+ // A point's ring, as a share of a line's weight, and how much ink its centre takes (as in rest.ts).
1480
+ const POINT_RING = 0.6;
1481
+ const POINT_CENTRE = 0.46;
1482
+
1483
+ /**
1484
+ * Props of {@link Icon}.
1485
+ *
1486
+ * @category Icons
1487
+ */
1488
+
1489
+ /**
1490
+ * Draws one of the app's icons: a sign on a 20 × 20 sheet, in two tones of the theme's ink.
1491
+ *
1492
+ * It is an inline `<svg>` that the stylesheet ({@link AppStyle}) inks: its lines are the theme's ink, what a sign
1493
+ * is done to is grey, and an axis is in its own colour. It is given the drawing's `name`, or a `url` that is a
1494
+ * reference ({@link iconRef}) or an image's url, which it shows as an `<img>`. A name that has no drawing shows a
1495
+ * dashed square. The drawings are {@link icons}. Its props: {@link IconProps}.
1496
+ *
1497
+ * @example
1498
+ * ```tsx
1499
+ * // on a page that only needs the icons: nothing but React
1500
+ * import { Icon, iconDataUrl, iconRef } from '@classcad/react-cad/icons'
1501
+ *
1502
+ * const ToolButton = ({ onClick }: { onClick: () => void }) => (
1503
+ * <button className="rcad-tool" onClick={onClick} title="Extrude">
1504
+ * <Icon name="extrusion" size={20} />
1505
+ * </button>
1506
+ * )
1507
+ * // a reference goes where an image's url went before; an image's url still shows as an <img>
1508
+ * const Fillet = () => <Icon url={iconRef('fillet')} size={16} title="Fillet" />
1509
+ * const Logo = () => <Icon url="/logo.svg" size={24} title="Our app" />
1510
+ * // where no stylesheet reaches: the same drawing in colours of its own
1511
+ * const Favicon = () => <link rel="icon" href={iconDataUrl('part', { ink: '#e7000b' }, 32)} />
1512
+ * ```
1513
+ *
1514
+ * @category Icons
1515
+ */
1516
+ const Icon = /*#__PURE__*/React.memo(function Icon({
1517
+ name,
1518
+ url,
1519
+ size = 20,
1520
+ className,
1521
+ style,
1522
+ title,
1523
+ mono = false
1524
+ }) {
1525
+ const maskId = 'rcad-pts' + React.useId().replace(/[^\w-]/g, '');
1526
+ if (!name && url && !isIconRef(url)) {
1527
+ return /*#__PURE__*/React.createElement("img", {
1528
+ src: url,
1529
+ width: size,
1530
+ height: size,
1531
+ alt: title != null ? title : '',
1532
+ className: className,
1533
+ style: style,
1534
+ draggable: false
1535
+ });
1536
+ }
1537
+ const key = name != null ? name : url ? url.slice(PREFIX.length) : 'missing';
1538
+ const layers = layersOf(drawingOf(key));
1539
+ const holes = holesOf(layers);
1540
+ const cut = holes ? `url(#${maskId})` : undefined;
1541
+ return /*#__PURE__*/React.createElement("svg", {
1542
+ className: ['rcad-icon', mono && 'rcad-mono', className].filter(Boolean).join(' '),
1543
+ viewBox: "0 0 20 20",
1544
+ width: size,
1545
+ height: size,
1546
+ style: _objectSpread({
1547
+ ['--w']: weight(size) * 20 / size
1548
+ }, style),
1549
+ role: title ? 'img' : undefined,
1550
+ "aria-label": title,
1551
+ "aria-hidden": title ? undefined : true,
1552
+ focusable: "false"
1553
+ }, holes && /*#__PURE__*/React.createElement("mask", {
1554
+ id: maskId,
1555
+ maskUnits: "userSpaceOnUse",
1556
+ x: -5,
1557
+ y: -5,
1558
+ width: 30,
1559
+ height: 30
1560
+ }, /*#__PURE__*/React.createElement("rect", {
1561
+ x: -5,
1562
+ y: -5,
1563
+ width: 30,
1564
+ height: 30,
1565
+ fill: "#fff",
1566
+ stroke: "none"
1567
+ }), /*#__PURE__*/React.createElement("path", {
1568
+ d: holes,
1569
+ fill: "#000",
1570
+ stroke: "none"
1571
+ })), layers.map(([pen, d], i) => {
1572
+ const mask = isPointPen(pen) ? undefined : cut;
1573
+ const {
1574
+ lines,
1575
+ solid
1576
+ } = partsOf(d);
1577
+ if (!solid) return /*#__PURE__*/React.createElement("path", {
1578
+ key: i,
1579
+ "data-t": pen || undefined,
1580
+ d: d,
1581
+ mask: mask
1582
+ });
1583
+ return /*#__PURE__*/React.createElement("g", {
1584
+ key: i,
1585
+ "data-t": pen || undefined,
1586
+ mask: mask
1587
+ }, lines && /*#__PURE__*/React.createElement("path", {
1588
+ d: lines
1589
+ }), /*#__PURE__*/React.createElement("path", {
1590
+ "data-solid": "",
1591
+ d: solid
1592
+ }));
1593
+ }));
1594
+ });
1595
+
1596
+ /**
1597
+ * The colours an icon is drawn in, where no stylesheet gives them.
1598
+ *
1599
+ * @inline
1600
+ */
1601
+
1602
+ /**
1603
+ * An icon as a standalone svg, its colours written into it: for where no stylesheet reaches.
1604
+ *
1605
+ * That is a texture on the canvas, say, or an image's url ({@link iconDataUrl}). Its lines are weighed for the size it
1606
+ * is seen at, which a texture drawn large, to stay sharp, and shown small says apart from its size.
1607
+ *
1608
+ * @param name - The drawing's name, or its reference ({@link iconRef}).
1609
+ * @param inks - Its colours, such as `{ ink: '#0f1320' }`.
1610
+ * @param size - The svg's width and height in px. Default `20`.
1611
+ * @param seenAt - The size in px it is seen at, which its lines are weighed for. Default: `size`.
1612
+ * @returns The svg's markup.
1613
+ *
1614
+ * @example
1615
+ * ```tsx
1616
+ * import * as THREE from 'three'
1617
+ * import { getStage, iconSvg } from '@classcad/react-cad'
1618
+ *
1619
+ * // a sign as a texture on the stage: drawn at 96 px to stay sharp, its lines weighed for 16 px on screen
1620
+ * const stage = getStage()
1621
+ * const svg = iconSvg('workPlane', { ink: stage.datum }, 96, 16)
1622
+ * const texture = new THREE.TextureLoader().load('data:image/svg+xml;utf8,' + encodeURIComponent(svg))
1623
+ * const material = new THREE.SpriteMaterial({ map: texture, transparent: true })
1624
+ * ```
1625
+ *
1626
+ * @advanced
1627
+ * @category Icons
1628
+ */
1629
+ function iconSvg(name, inks, size = 20, seenAt = size) {
1630
+ var _inks$x, _inks$y, _inks$z;
1631
+ const key = isIconRef(name) ? name.slice(PREFIX.length) : name;
1632
+ const w = weight(seenAt) * 20 / seenAt;
1633
+ const [x, y, z] = inks.mono ? [inks.ink, inks.ink, inks.ink] : [(_inks$x = inks.x) != null ? _inks$x : inks.ink, (_inks$y = inks.y) != null ? _inks$y : inks.ink, (_inks$z = inks.z) != null ? _inks$z : inks.ink];
1634
+ const grey = inks.mono ? undefined : 0.46;
1635
+ const DASH = '2.1 2.1';
1636
+ const pens = {
1637
+ '': {
1638
+ color: inks.ink
1639
+ },
1640
+ sub: {
1641
+ color: inks.ink,
1642
+ alpha: grey
1643
+ },
1644
+ dash: {
1645
+ color: inks.ink,
1646
+ dash: DASH
1647
+ },
1648
+ 'sub-dash': {
1649
+ color: inks.ink,
1650
+ alpha: grey,
1651
+ dash: DASH
1652
+ },
1653
+ axis: {
1654
+ color: inks.ink,
1655
+ alpha: grey,
1656
+ dash: '3.4 1.7 0.5 1.7'
1657
+ },
1658
+ fill: {
1659
+ color: inks.ink,
1660
+ filled: true
1661
+ },
1662
+ 'sub-fill': {
1663
+ color: inks.ink,
1664
+ alpha: grey,
1665
+ filled: true
1666
+ },
1667
+ point: {
1668
+ color: inks.ink,
1669
+ point: true
1670
+ },
1671
+ 'sub-point': {
1672
+ color: inks.ink,
1673
+ alpha: grey,
1674
+ point: true
1675
+ },
1676
+ tone: {
1677
+ color: inks.ink,
1678
+ alpha: 0.14,
1679
+ filled: true
1680
+ },
1681
+ x: {
1682
+ color: x
1683
+ },
1684
+ y: {
1685
+ color: y
1686
+ },
1687
+ z: {
1688
+ color: z
1689
+ }
1690
+ };
1691
+ const layers = layersOf(drawingOf(key));
1692
+ const holes = holesOf(layers);
1693
+ const cut = holes ? ' mask="url(#h)"' : '';
1694
+ const mask = holes ? '<mask id="h" maskUnits="userSpaceOnUse" x="-5" y="-5" width="30" height="30">' + `<rect x="-5" y="-5" width="30" height="30" fill="#fff"/><path fill="#000" d="${holes}"/></mask>` : '';
1695
+ const paths = layers.map(([pen, d]) => {
1696
+ const {
1697
+ color,
1698
+ alpha,
1699
+ dash,
1700
+ filled,
1701
+ point
1702
+ } = pens[pen];
1703
+ const faint = alpha ? ` opacity="${alpha}"` : '';
1704
+ if (point) {
1705
+ const ring = `stroke="${color}" stroke-width="${(w * POINT_RING).toFixed(3)}"`;
1706
+ return `<path fill="${color}" fill-opacity="${POINT_CENTRE}" ${ring}${faint} d="${d}"/>`;
1707
+ }
1708
+ if (filled) return `<path fill="${color}"${faint}${cut} d="${d}"/>`;
1709
+ const {
1710
+ lines,
1711
+ solid
1712
+ } = partsOf(d);
1713
+ const drawn = `stroke="${color}" stroke-width="${w.toFixed(3)}" stroke-linejoin="round"`;
1714
+ const ends = dash ? ` stroke-linecap="butt" stroke-dasharray="${dash}"` : ' stroke-linecap="round"';
1715
+ const line = lines ? `<path fill="none" ${drawn}${ends} d="${lines}"/>` : '';
1716
+ const body = solid ? `<path fill="${color}" ${drawn} d="${solid}"/>` : '';
1717
+ return `<g${faint}${cut}>${line}${body}</g>`;
1718
+ }).join('');
1719
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="${size}" height="${size}">${mask}${paths}</svg>`;
1720
+ }
1721
+
1722
+ /**
1723
+ * An icon as a `data:` url of its svg ({@link iconSvg}): for an `<img>`, a CSS background or a texture's loader.
1724
+ *
1725
+ * @param name - The drawing's name, or its reference ({@link iconRef}).
1726
+ * @param inks - Its colours, such as `{ ink: '#0f1320' }`.
1727
+ * @param size - The svg's width and height in px. Default `20`.
1728
+ * @param seenAt - The size in px it is seen at, which its lines are weighed for. Default: `size`.
1729
+ *
1730
+ * @example
1731
+ * ```tsx
1732
+ * import { iconDataUrl, useRCadTheme } from '@classcad/react-cad'
1733
+ *
1734
+ * // an icon as an <img>, in the theme's colours: the axes in their own
1735
+ * function AxisBadge() {
1736
+ * const colors = useRCadTheme()
1737
+ * const src = iconDataUrl('rotation3d', { ink: colors.ink, x: colors.axisX, y: colors.axisY, z: colors.axisZ }, 24)
1738
+ * return <img src={src} width={24} height={24} alt="Rotation" />
1739
+ * }
1740
+ * ```
1741
+ *
1742
+ * @category Icons
1743
+ */
1744
+ const iconDataUrl = (name, inks, size = 20, seenAt = size) => 'data:image/svg+xml;utf8,' + encodeURIComponent(iconSvg(name, inks, size, seenAt));
1745
+
1746
+ exports.Icon = Icon;
1747
+ exports.drawings = drawings;
1748
+ exports.iconDataUrl = iconDataUrl;
1749
+ exports.iconRef = iconRef;
1750
+ exports.iconSvg = iconSvg;
1751
+ exports.isIconRef = isIconRef;