@mathscan/geometry-engine 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (380) hide show
  1. package/README.md +1101 -0
  2. package/dist/coordinates/grid.d.cts +8 -0
  3. package/dist/coordinates/grid.d.ts +9 -0
  4. package/dist/coordinates/grid.d.ts.map +1 -0
  5. package/dist/coordinates/lineClipping.d.cts +3 -0
  6. package/dist/coordinates/lineClipping.d.ts +4 -0
  7. package/dist/coordinates/lineClipping.d.ts.map +1 -0
  8. package/dist/coordinates/transform.d.cts +18 -0
  9. package/dist/coordinates/transform.d.ts +19 -0
  10. package/dist/coordinates/transform.d.ts.map +1 -0
  11. package/dist/core.cjs +1 -0
  12. package/dist/core.mjs +4 -0
  13. package/dist/entries/core.d.cts +16 -0
  14. package/dist/entries/core.d.ts +17 -0
  15. package/dist/entries/core.d.ts.map +1 -0
  16. package/dist/entries/react.d.cts +18 -0
  17. package/dist/entries/react.d.ts +19 -0
  18. package/dist/entries/react.d.ts.map +1 -0
  19. package/dist/entries/schemas.d.cts +14 -0
  20. package/dist/entries/schemas.d.ts +15 -0
  21. package/dist/entries/schemas.d.ts.map +1 -0
  22. package/dist/entries/validation.d.cts +12 -0
  23. package/dist/entries/validation.d.ts +13 -0
  24. package/dist/entries/validation.d.ts.map +1 -0
  25. package/dist/exercise.schema-BV2b7rtN.cjs +2 -0
  26. package/dist/exercise.schema-BV2b7rtN.cjs.map +1 -0
  27. package/dist/exercise.schema-ckVBW9XA.js +212 -0
  28. package/dist/exercise.schema-ckVBW9XA.js.map +1 -0
  29. package/dist/geometry/distance.d.cts +9 -0
  30. package/dist/geometry/distance.d.ts +10 -0
  31. package/dist/geometry/distance.d.ts.map +1 -0
  32. package/dist/geometry/entities/circle.d.cts +36 -0
  33. package/dist/geometry/entities/circle.d.ts +37 -0
  34. package/dist/geometry/entities/circle.d.ts.map +1 -0
  35. package/dist/geometry/entities/index.d.cts +60 -0
  36. package/dist/geometry/entities/index.d.ts +61 -0
  37. package/dist/geometry/entities/index.d.ts.map +1 -0
  38. package/dist/geometry/entities/line.d.cts +43 -0
  39. package/dist/geometry/entities/line.d.ts +44 -0
  40. package/dist/geometry/entities/line.d.ts.map +1 -0
  41. package/dist/geometry/entities/point.d.cts +27 -0
  42. package/dist/geometry/entities/point.d.ts +28 -0
  43. package/dist/geometry/entities/point.d.ts.map +1 -0
  44. package/dist/geometry/entities/relations.d.cts +27 -0
  45. package/dist/geometry/entities/relations.d.ts +28 -0
  46. package/dist/geometry/entities/relations.d.ts.map +1 -0
  47. package/dist/geometry/entities/segment.d.cts +45 -0
  48. package/dist/geometry/entities/segment.d.ts +46 -0
  49. package/dist/geometry/entities/segment.d.ts.map +1 -0
  50. package/dist/geometry/entityCapabilities.d.cts +2 -0
  51. package/dist/geometry/entityCapabilities.d.ts +3 -0
  52. package/dist/geometry/entityCapabilities.d.ts.map +1 -0
  53. package/dist/geometry/entityModel.d.cts +139 -0
  54. package/dist/geometry/entityModel.d.ts +140 -0
  55. package/dist/geometry/entityModel.d.ts.map +1 -0
  56. package/dist/geometry/entityRecord.d.cts +27 -0
  57. package/dist/geometry/entityRecord.d.ts +28 -0
  58. package/dist/geometry/entityRecord.d.ts.map +1 -0
  59. package/dist/geometry/evaluateGraph.d.cts +37 -0
  60. package/dist/geometry/evaluateGraph.d.ts +38 -0
  61. package/dist/geometry/evaluateGraph.d.ts.map +1 -0
  62. package/dist/geometry/geometryObject.d.cts +4 -0
  63. package/dist/geometry/geometryObject.d.ts +5 -0
  64. package/dist/geometry/geometryObject.d.ts.map +1 -0
  65. package/dist/geometry/goalCandidate.d.cts +8 -0
  66. package/dist/geometry/goalCandidate.d.ts +9 -0
  67. package/dist/geometry/goalCandidate.d.ts.map +1 -0
  68. package/dist/geometry/hitTest.d.cts +23 -0
  69. package/dist/geometry/hitTest.d.ts +24 -0
  70. package/dist/geometry/hitTest.d.ts.map +1 -0
  71. package/dist/geometry/point.d.cts +5 -0
  72. package/dist/geometry/point.d.ts +6 -0
  73. package/dist/geometry/point.d.ts.map +1 -0
  74. package/dist/geometry/pointOrigin.d.cts +5 -0
  75. package/dist/geometry/pointOrigin.d.ts +6 -0
  76. package/dist/geometry/pointOrigin.d.ts.map +1 -0
  77. package/dist/geometry/v1Bridge.d.cts +41 -0
  78. package/dist/geometry/v1Bridge.d.ts +42 -0
  79. package/dist/geometry/v1Bridge.d.ts.map +1 -0
  80. package/dist/geometryAttemptStatus-5L_q6-9l.js +184 -0
  81. package/dist/geometryAttemptStatus-5L_q6-9l.js.map +1 -0
  82. package/dist/geometryAttemptStatus-N_XHIkiS.cjs +2 -0
  83. package/dist/geometryAttemptStatus-N_XHIkiS.cjs.map +1 -0
  84. package/dist/geometryState.schema-D0ixyGYE.js +955 -0
  85. package/dist/geometryState.schema-D0ixyGYE.js.map +1 -0
  86. package/dist/geometryState.schema-DKQ-durx.cjs +2 -0
  87. package/dist/geometryState.schema-DKQ-durx.cjs.map +1 -0
  88. package/dist/goals-C3ZwbEh_.js +451 -0
  89. package/dist/goals-C3ZwbEh_.js.map +1 -0
  90. package/dist/goals-CxR5qPDC.cjs +2 -0
  91. package/dist/goals-CxR5qPDC.cjs.map +1 -0
  92. package/dist/index.cjs +1 -0
  93. package/dist/index.d.cts +4 -0
  94. package/dist/index.d.ts +5 -0
  95. package/dist/index.d.ts.map +1 -0
  96. package/dist/index.mjs +10 -0
  97. package/dist/measure/geometryAdapter.d.cts +26 -0
  98. package/dist/measure/geometryAdapter.d.ts +27 -0
  99. package/dist/measure/geometryAdapter.d.ts.map +1 -0
  100. package/dist/measure/kernel.d.cts +25 -0
  101. package/dist/measure/kernel.d.ts +26 -0
  102. package/dist/measure/kernel.d.ts.map +1 -0
  103. package/dist/numerics/policy.d.cts +17 -0
  104. package/dist/numerics/policy.d.ts +18 -0
  105. package/dist/numerics/policy.d.ts.map +1 -0
  106. package/dist/react-BEcdx1f6.js +1851 -0
  107. package/dist/react-BEcdx1f6.js.map +1 -0
  108. package/dist/react-Pp_VSk--.cjs +2 -0
  109. package/dist/react-Pp_VSk--.cjs.map +1 -0
  110. package/dist/react.cjs +1 -0
  111. package/dist/react.mjs +2 -0
  112. package/dist/renderer/GeometryCanvas.d.cts +14 -0
  113. package/dist/renderer/GeometryCanvas.d.ts +15 -0
  114. package/dist/renderer/GeometryCanvas.d.ts.map +1 -0
  115. package/dist/renderer/GeometryCompanion.d.cts +29 -0
  116. package/dist/renderer/GeometryCompanion.d.ts +30 -0
  117. package/dist/renderer/GeometryCompanion.d.ts.map +1 -0
  118. package/dist/renderer/GeometryGrid.d.cts +7 -0
  119. package/dist/renderer/GeometryGrid.d.ts +8 -0
  120. package/dist/renderer/GeometryGrid.d.ts.map +1 -0
  121. package/dist/renderer/GeometryInstruments.d.cts +7 -0
  122. package/dist/renderer/GeometryInstruments.d.ts +8 -0
  123. package/dist/renderer/GeometryInstruments.d.ts.map +1 -0
  124. package/dist/renderer/StudentGeometryCanvas.d.cts +11 -0
  125. package/dist/renderer/StudentGeometryCanvas.d.ts +12 -0
  126. package/dist/renderer/StudentGeometryCanvas.d.ts.map +1 -0
  127. package/dist/renderer/StudentGeometryExercise.d.cts +36 -0
  128. package/dist/renderer/StudentGeometryExercise.d.ts +37 -0
  129. package/dist/renderer/StudentGeometryExercise.d.ts.map +1 -0
  130. package/dist/renderer/Toolbar.d.cts +7 -0
  131. package/dist/renderer/Toolbar.d.ts +8 -0
  132. package/dist/renderer/Toolbar.d.ts.map +1 -0
  133. package/dist/renderer/deriveRenderableGeometry.d.cts +15 -0
  134. package/dist/renderer/deriveRenderableGeometry.d.ts +16 -0
  135. package/dist/renderer/deriveRenderableGeometry.d.ts.map +1 -0
  136. package/dist/renderer/deriveSemanticScene.d.cts +58 -0
  137. package/dist/renderer/deriveSemanticScene.d.ts +59 -0
  138. package/dist/renderer/deriveSemanticScene.d.ts.map +1 -0
  139. package/dist/renderer/entityDisplayName.d.cts +12 -0
  140. package/dist/renderer/entityDisplayName.d.ts +13 -0
  141. package/dist/renderer/entityDisplayName.d.ts.map +1 -0
  142. package/dist/renderer/gesturePolicy.d.cts +97 -0
  143. package/dist/renderer/gesturePolicy.d.ts +98 -0
  144. package/dist/renderer/gesturePolicy.d.ts.map +1 -0
  145. package/dist/renderer/shapes/CircleShape.d.cts +17 -0
  146. package/dist/renderer/shapes/CircleShape.d.ts +18 -0
  147. package/dist/renderer/shapes/CircleShape.d.ts.map +1 -0
  148. package/dist/renderer/shapes/EntityLabel.d.cts +14 -0
  149. package/dist/renderer/shapes/EntityLabel.d.ts +15 -0
  150. package/dist/renderer/shapes/EntityLabel.d.ts.map +1 -0
  151. package/dist/renderer/shapes/EntityShape.d.cts +18 -0
  152. package/dist/renderer/shapes/EntityShape.d.ts +19 -0
  153. package/dist/renderer/shapes/EntityShape.d.ts.map +1 -0
  154. package/dist/renderer/shapes/LineShape.d.cts +16 -0
  155. package/dist/renderer/shapes/LineShape.d.ts +17 -0
  156. package/dist/renderer/shapes/LineShape.d.ts.map +1 -0
  157. package/dist/renderer/shapes/PointShape.d.cts +17 -0
  158. package/dist/renderer/shapes/PointShape.d.ts +18 -0
  159. package/dist/renderer/shapes/PointShape.d.ts.map +1 -0
  160. package/dist/renderer/shapes/SegmentShape.d.cts +17 -0
  161. package/dist/renderer/shapes/SegmentShape.d.ts +18 -0
  162. package/dist/renderer/shapes/SegmentShape.d.ts.map +1 -0
  163. package/dist/renderer/shapes/SnapMarker.d.cts +8 -0
  164. package/dist/renderer/shapes/SnapMarker.d.ts +9 -0
  165. package/dist/renderer/shapes/SnapMarker.d.ts.map +1 -0
  166. package/dist/renderer/shapes/StrokedLine.d.cts +18 -0
  167. package/dist/renderer/shapes/StrokedLine.d.ts +19 -0
  168. package/dist/renderer/shapes/StrokedLine.d.ts.map +1 -0
  169. package/dist/renderer/studentExerciseSession.d.cts +71 -0
  170. package/dist/renderer/studentExerciseSession.d.ts +72 -0
  171. package/dist/renderer/studentExerciseSession.d.ts.map +1 -0
  172. package/dist/renderer/useConnectionPreview.d.cts +44 -0
  173. package/dist/renderer/useConnectionPreview.d.ts +45 -0
  174. package/dist/renderer/useConnectionPreview.d.ts.map +1 -0
  175. package/dist/renderer/usePlacementSnap.d.cts +28 -0
  176. package/dist/renderer/usePlacementSnap.d.ts +29 -0
  177. package/dist/renderer/usePlacementSnap.d.ts.map +1 -0
  178. package/dist/renderer/usePointerGestures.d.cts +46 -0
  179. package/dist/renderer/usePointerGestures.d.ts +47 -0
  180. package/dist/renderer/usePointerGestures.d.ts.map +1 -0
  181. package/dist/schemas/circle.schema.d.cts +8 -0
  182. package/dist/schemas/circle.schema.d.ts +9 -0
  183. package/dist/schemas/circle.schema.d.ts.map +1 -0
  184. package/dist/schemas/entityDefinition.schema.d.cts +69 -0
  185. package/dist/schemas/entityDefinition.schema.d.ts +70 -0
  186. package/dist/schemas/entityDefinition.schema.d.ts.map +1 -0
  187. package/dist/schemas/entityDocument.d.cts +95 -0
  188. package/dist/schemas/entityDocument.d.ts +96 -0
  189. package/dist/schemas/entityDocument.d.ts.map +1 -0
  190. package/dist/schemas/entityPresentation.schema.d.cts +12 -0
  191. package/dist/schemas/entityPresentation.schema.d.ts +13 -0
  192. package/dist/schemas/entityPresentation.schema.d.ts.map +1 -0
  193. package/dist/schemas/exercise.schema.d.cts +217 -0
  194. package/dist/schemas/exercise.schema.d.ts +218 -0
  195. package/dist/schemas/exercise.schema.d.ts.map +1 -0
  196. package/dist/schemas/exerciseProjection.d.cts +10 -0
  197. package/dist/schemas/exerciseProjection.d.ts +11 -0
  198. package/dist/schemas/exerciseProjection.d.ts.map +1 -0
  199. package/dist/schemas/exerciseV2.schema.d.cts +137 -0
  200. package/dist/schemas/exerciseV2.schema.d.ts +138 -0
  201. package/dist/schemas/exerciseV2.schema.d.ts.map +1 -0
  202. package/dist/schemas/exerciseV3.schema.d.cts +149 -0
  203. package/dist/schemas/exerciseV3.schema.d.ts +150 -0
  204. package/dist/schemas/exerciseV3.schema.d.ts.map +1 -0
  205. package/dist/schemas/geometryObject.schema.d.cts +17 -0
  206. package/dist/schemas/geometryObject.schema.d.ts +18 -0
  207. package/dist/schemas/geometryObject.schema.d.ts.map +1 -0
  208. package/dist/schemas/geometryState.schema.d.cts +64 -0
  209. package/dist/schemas/geometryState.schema.d.ts +65 -0
  210. package/dist/schemas/geometryState.schema.d.ts.map +1 -0
  211. package/dist/schemas/givenElement.schema.d.cts +24 -0
  212. package/dist/schemas/givenElement.schema.d.ts +25 -0
  213. package/dist/schemas/givenElement.schema.d.ts.map +1 -0
  214. package/dist/schemas/goals/createGoal.schema.d.cts +12 -0
  215. package/dist/schemas/goals/createGoal.schema.d.ts +13 -0
  216. package/dist/schemas/goals/createGoal.schema.d.ts.map +1 -0
  217. package/dist/schemas/goals/geometryGoal.schema.d.cts +58 -0
  218. package/dist/schemas/goals/geometryGoal.schema.d.ts +59 -0
  219. package/dist/schemas/goals/geometryGoal.schema.d.ts.map +1 -0
  220. package/dist/schemas/goals/goalKindDeclaration.d.cts +53 -0
  221. package/dist/schemas/goals/goalKindDeclaration.d.ts +54 -0
  222. package/dist/schemas/goals/goalKindDeclaration.d.ts.map +1 -0
  223. package/dist/schemas/goals/midpointGoal.schema.d.cts +9 -0
  224. package/dist/schemas/goals/midpointGoal.schema.d.ts +10 -0
  225. package/dist/schemas/goals/midpointGoal.schema.d.ts.map +1 -0
  226. package/dist/schemas/goals/parallelGoal.schema.d.cts +15 -0
  227. package/dist/schemas/goals/parallelGoal.schema.d.ts +16 -0
  228. package/dist/schemas/goals/parallelGoal.schema.d.ts.map +1 -0
  229. package/dist/schemas/goals/perpendicularGoal.schema.d.cts +15 -0
  230. package/dist/schemas/goals/perpendicularGoal.schema.d.ts +16 -0
  231. package/dist/schemas/goals/perpendicularGoal.schema.d.ts.map +1 -0
  232. package/dist/schemas/goals/segmentLengthGoal.schema.d.cts +9 -0
  233. package/dist/schemas/goals/segmentLengthGoal.schema.d.ts +10 -0
  234. package/dist/schemas/goals/segmentLengthGoal.schema.d.ts.map +1 -0
  235. package/dist/schemas/goals/throughPointsGoal.schema.d.cts +13 -0
  236. package/dist/schemas/goals/throughPointsGoal.schema.d.ts +14 -0
  237. package/dist/schemas/goals/throughPointsGoal.schema.d.ts.map +1 -0
  238. package/dist/schemas/identifier.schema.d.cts +2 -0
  239. package/dist/schemas/identifier.schema.d.ts +3 -0
  240. package/dist/schemas/identifier.schema.d.ts.map +1 -0
  241. package/dist/schemas/line.schema.d.cts +7 -0
  242. package/dist/schemas/line.schema.d.ts +8 -0
  243. package/dist/schemas/line.schema.d.ts.map +1 -0
  244. package/dist/schemas/migrate.d.cts +21 -0
  245. package/dist/schemas/migrate.d.ts +22 -0
  246. package/dist/schemas/migrate.d.ts.map +1 -0
  247. package/dist/schemas/objectTypeName.schema.d.cts +8 -0
  248. package/dist/schemas/objectTypeName.schema.d.ts +9 -0
  249. package/dist/schemas/objectTypeName.schema.d.ts.map +1 -0
  250. package/dist/schemas/point.schema.d.cts +15 -0
  251. package/dist/schemas/point.schema.d.ts +16 -0
  252. package/dist/schemas/point.schema.d.ts.map +1 -0
  253. package/dist/schemas/pointOrigin.schema.d.cts +25 -0
  254. package/dist/schemas/pointOrigin.schema.d.ts +26 -0
  255. package/dist/schemas/pointOrigin.schema.d.ts.map +1 -0
  256. package/dist/schemas/segment.schema.d.cts +8 -0
  257. package/dist/schemas/segment.schema.d.ts +9 -0
  258. package/dist/schemas/segment.schema.d.ts.map +1 -0
  259. package/dist/schemas/v1ToV2.d.cts +37 -0
  260. package/dist/schemas/v1ToV2.d.ts +38 -0
  261. package/dist/schemas/v1ToV2.d.ts.map +1 -0
  262. package/dist/schemas/v2ToV3.d.cts +37 -0
  263. package/dist/schemas/v2ToV3.d.ts +38 -0
  264. package/dist/schemas/v2ToV3.d.ts.map +1 -0
  265. package/dist/schemas/v3ToV4.d.cts +3 -0
  266. package/dist/schemas/v3ToV4.d.ts +4 -0
  267. package/dist/schemas/v3ToV4.d.ts.map +1 -0
  268. package/dist/schemas/viewport.schema.d.cts +3 -0
  269. package/dist/schemas/viewport.schema.d.ts +4 -0
  270. package/dist/schemas/viewport.schema.d.ts.map +1 -0
  271. package/dist/schemas.cjs +1 -0
  272. package/dist/schemas.mjs +3 -0
  273. package/dist/snapping/computeSnap.d.cts +30 -0
  274. package/dist/snapping/computeSnap.d.ts +31 -0
  275. package/dist/snapping/computeSnap.d.ts.map +1 -0
  276. package/dist/state/geometryContext.d.cts +40 -0
  277. package/dist/state/geometryContext.d.ts +41 -0
  278. package/dist/state/geometryContext.d.ts.map +1 -0
  279. package/dist/state/resolvePoints.d.cts +51 -0
  280. package/dist/state/resolvePoints.d.ts +52 -0
  281. package/dist/state/resolvePoints.d.ts.map +1 -0
  282. package/dist/store/attemptChange.d.cts +30 -0
  283. package/dist/store/attemptChange.d.ts +31 -0
  284. package/dist/store/attemptChange.d.ts.map +1 -0
  285. package/dist/store/constructionCommand.d.cts +35 -0
  286. package/dist/store/constructionCommand.d.ts +36 -0
  287. package/dist/store/constructionCommand.d.ts.map +1 -0
  288. package/dist/store/constructionIdentity.d.cts +21 -0
  289. package/dist/store/constructionIdentity.d.ts +22 -0
  290. package/dist/store/constructionIdentity.d.ts.map +1 -0
  291. package/dist/store/createStore.d.cts +6 -0
  292. package/dist/store/createStore.d.ts +7 -0
  293. package/dist/store/createStore.d.ts.map +1 -0
  294. package/dist/store/history.d.cts +2 -0
  295. package/dist/store/history.d.ts +3 -0
  296. package/dist/store/history.d.ts.map +1 -0
  297. package/dist/store/studentStore.d.cts +151 -0
  298. package/dist/store/studentStore.d.ts +152 -0
  299. package/dist/store/studentStore.d.ts.map +1 -0
  300. package/dist/store/teacherStore.d.cts +111 -0
  301. package/dist/store/teacherStore.d.ts +112 -0
  302. package/dist/store/teacherStore.d.ts.map +1 -0
  303. package/dist/store/useStoreState.d.cts +2 -0
  304. package/dist/store/useStoreState.d.ts +3 -0
  305. package/dist/store/useStoreState.d.ts.map +1 -0
  306. package/dist/studentStore-CEKTtMCh.js +1162 -0
  307. package/dist/studentStore-CEKTtMCh.js.map +1 -0
  308. package/dist/studentStore-DLftfFAl.cjs +2 -0
  309. package/dist/studentStore-DLftfFAl.cjs.map +1 -0
  310. package/dist/validation/checkGeometryAnswer.d.cts +63 -0
  311. package/dist/validation/checkGeometryAnswer.d.ts +64 -0
  312. package/dist/validation/checkGeometryAnswer.d.ts.map +1 -0
  313. package/dist/validation/deriveGeometryCanvasFeedback.d.cts +7 -0
  314. package/dist/validation/deriveGeometryCanvasFeedback.d.ts +8 -0
  315. package/dist/validation/deriveGeometryCanvasFeedback.d.ts.map +1 -0
  316. package/dist/validation/exerciseLoad.d.cts +29 -0
  317. package/dist/validation/exerciseLoad.d.ts +30 -0
  318. package/dist/validation/exerciseLoad.d.ts.map +1 -0
  319. package/dist/validation/geometryAttemptStatus.d.cts +23 -0
  320. package/dist/validation/geometryAttemptStatus.d.ts +24 -0
  321. package/dist/validation/geometryAttemptStatus.d.ts.map +1 -0
  322. package/dist/validation/getGeometryExerciseWarnings.d.cts +16 -0
  323. package/dist/validation/getGeometryExerciseWarnings.d.ts +17 -0
  324. package/dist/validation/getGeometryExerciseWarnings.d.ts.map +1 -0
  325. package/dist/validation/goals/create.d.cts +3 -0
  326. package/dist/validation/goals/create.d.ts +4 -0
  327. package/dist/validation/goals/create.d.ts.map +1 -0
  328. package/dist/validation/goals/goalContext.d.cts +44 -0
  329. package/dist/validation/goals/goalContext.d.ts +45 -0
  330. package/dist/validation/goals/goalContext.d.ts.map +1 -0
  331. package/dist/validation/goals/goalKindHandler.d.cts +26 -0
  332. package/dist/validation/goals/goalKindHandler.d.ts +27 -0
  333. package/dist/validation/goals/goalKindHandler.d.ts.map +1 -0
  334. package/dist/validation/goals/index.d.cts +14 -0
  335. package/dist/validation/goals/index.d.ts +15 -0
  336. package/dist/validation/goals/index.d.ts.map +1 -0
  337. package/dist/validation/goals/midpoint.d.cts +4 -0
  338. package/dist/validation/goals/midpoint.d.ts +5 -0
  339. package/dist/validation/goals/midpoint.d.ts.map +1 -0
  340. package/dist/validation/goals/parallel.d.cts +3 -0
  341. package/dist/validation/goals/parallel.d.ts +4 -0
  342. package/dist/validation/goals/parallel.d.ts.map +1 -0
  343. package/dist/validation/goals/perpendicular.d.cts +3 -0
  344. package/dist/validation/goals/perpendicular.d.ts +4 -0
  345. package/dist/validation/goals/perpendicular.d.ts.map +1 -0
  346. package/dist/validation/goals/previewGeometry.d.cts +9 -0
  347. package/dist/validation/goals/previewGeometry.d.ts +10 -0
  348. package/dist/validation/goals/previewGeometry.d.ts.map +1 -0
  349. package/dist/validation/goals/segmentLength.d.cts +3 -0
  350. package/dist/validation/goals/segmentLength.d.ts +4 -0
  351. package/dist/validation/goals/segmentLength.d.ts.map +1 -0
  352. package/dist/validation/goals/throughPoints.d.cts +5 -0
  353. package/dist/validation/goals/throughPoints.d.ts +6 -0
  354. package/dist/validation/goals/throughPoints.d.ts.map +1 -0
  355. package/dist/validation/gradingFingerprints.d.cts +4 -0
  356. package/dist/validation/gradingFingerprints.d.ts +5 -0
  357. package/dist/validation/gradingFingerprints.d.ts.map +1 -0
  358. package/dist/validation/revealGeometryAnswers.d.cts +3 -0
  359. package/dist/validation/revealGeometryAnswers.d.ts +4 -0
  360. package/dist/validation/revealGeometryAnswers.d.ts.map +1 -0
  361. package/dist/validation/revealGeometryAttempt.d.cts +36 -0
  362. package/dist/validation/revealGeometryAttempt.d.ts +37 -0
  363. package/dist/validation/revealGeometryAttempt.d.ts.map +1 -0
  364. package/dist/validation/types.d.cts +58 -0
  365. package/dist/validation/types.d.ts +59 -0
  366. package/dist/validation/types.d.ts.map +1 -0
  367. package/dist/validation/validateGeometryExercise.d.cts +30 -0
  368. package/dist/validation/validateGeometryExercise.d.ts +31 -0
  369. package/dist/validation/validateGeometryExercise.d.ts.map +1 -0
  370. package/dist/validation/validateGeometryState.d.cts +16 -0
  371. package/dist/validation/validateGeometryState.d.ts +17 -0
  372. package/dist/validation/validateGeometryState.d.ts.map +1 -0
  373. package/dist/validation/validateGeometryStateInput.d.cts +22 -0
  374. package/dist/validation/validateGeometryStateInput.d.ts +23 -0
  375. package/dist/validation/validateGeometryStateInput.d.ts.map +1 -0
  376. package/dist/validation.cjs +2 -0
  377. package/dist/validation.cjs.map +1 -0
  378. package/dist/validation.mjs +269 -0
  379. package/dist/validation.mjs.map +1 -0
  380. package/package.json +150 -0
@@ -0,0 +1,152 @@
1
+ import { GeometryExercise } from '../schemas/exercise.schema.js';
2
+ import { GeometryState } from '../schemas/geometryState.schema.js';
3
+ import { PointDefinition } from '../geometry/entityModel.js';
4
+ import { ObjectTypeName } from '../schemas/objectTypeName.schema.js';
5
+ import { Point, PointId } from '../geometry/point.js';
6
+ import { RevealedAnswerShape } from '../validation/types.js';
7
+ import { ConstructionCommand, ConstructionNotice } from './constructionCommand.js';
8
+ import { StudentAttemptChangeReceipt } from './attemptChange.js';
9
+ import { Store } from './createStore.js';
10
+ export type { StudentAttemptChangeReceipt, StudentGeometryAction, StudentGeometryChangeMeta, } from './attemptChange.js';
11
+ export type { ConstructionCommand, ConstructionEndpoint, ConstructionNotice, } from './constructionCommand.js';
12
+ export interface StudentState {
13
+ exercise: GeometryExercise;
14
+ geometry: GeometryState;
15
+ pendingObjectType: ObjectTypeName | null;
16
+ pendingFirstPointId: PointId | null;
17
+ selectedObjectId: string | null;
18
+ past: GeometryState[];
19
+ future: GeometryState[];
20
+ coalesceTag: string | null;
21
+ interactionEpoch?: number;
22
+ constructionNotice?: ConstructionNotice | null;
23
+ readOnly?: boolean;
24
+ lastAttemptChange?: StudentAttemptChangeReceipt | null;
25
+ }
26
+ export interface StudentRemovalImpact {
27
+ constructionIds: string[];
28
+ pointIds: string[];
29
+ }
30
+ /**
31
+ * One store per attempt. Pass `savedGeometry` to resume a stored attempt —
32
+ * validate it first with validateGeometryStateJson(), which checks it against
33
+ * this exercise. A resumed attempt starts with empty history: undo must not
34
+ * reach back past what the student can see.
35
+ *
36
+ * The store holds the exercise without its authored `solution` (ADR 0015):
37
+ * the canonical answer is never student state.
38
+ */
39
+ export declare function createStudentStore(exercise: GeometryExercise, savedGeometry?: GeometryState): Store<StudentState>;
40
+ /**
41
+ * Locks or unlocks the attempt (RFC 0005 § Decision 3). While read-only every
42
+ * public student action that could change attempt data does nothing and no
43
+ * tool can be armed; selection stays available for inspection.
44
+ *
45
+ * Locking disarms the tool and clears the pending endpoint, the selection and
46
+ * the notice, and moves the epoch so a late pointer release writes nothing. A
47
+ * drag whose frames already moved a point keeps that position, its one undo
48
+ * entry and its one `point-moved` receipt, all in the locking transition.
49
+ * Unlocking moves the epoch as well, so a contact pressed during the lock
50
+ * cannot start editing once it lifts; no point is draggable while locked.
51
+ * `replaceStudentAttempt()` and `replaceStudentSession()` still work while
52
+ * locked; `store.setState()` is not guarded at all.
53
+ */
54
+ export declare function setStudentReadOnly(store: Store<StudentState>, readOnly: boolean): void;
55
+ /**
56
+ * Host authority: installs `attempt` on the same store, as a controlled value
57
+ * that differs from the current one (RFC 0005 § Decision 2). Both history
58
+ * stacks and all interaction state are cleared and the epoch moves, so it
59
+ * cannot be undone and a live gesture is dropped. Works while read-only, and is
60
+ * not a student action: `lastAttemptChange` is left as it was, and a drag it
61
+ * interrupts gets no receipt.
62
+ *
63
+ * The attempt is taken as already parsed and checked against this exercise —
64
+ * validate untrusted input first, as for `createStudentStore()`.
65
+ */
66
+ export declare function replaceStudentAttempt(store: Store<StudentState>, attempt: GeometryState): void;
67
+ /**
68
+ * Host authority: installs a different exercise and its attempt together, in
69
+ * one transition, so no subscriber ever sees the new exercise with the old
70
+ * attempt. An absent attempt is a fresh empty one. Otherwise it behaves as
71
+ * `replaceStudentAttempt()` does: same store, history and interaction state
72
+ * cleared, epoch moved, read-only kept, no receipt, and parsed input expected.
73
+ * As at creation, the authored `solution` is left out of the store.
74
+ */
75
+ export declare function replaceStudentSession(store: Store<StudentState>, exercise: GeometryExercise, attempt?: GeometryState): void;
76
+ export declare function selectStudentObjectType(store: Store<StudentState>, type: ObjectTypeName | null): void;
77
+ /**
78
+ * Abandons a click-click construction in progress: the first endpoint is
79
+ * forgotten and the tool stays armed. What a canvas calls when a gesture is
80
+ * cancelled — a system gesture, a second finger, a release off the canvas —
81
+ * so the next tap starts a construction rather than finishing a stale one.
82
+ */
83
+ export declare function cancelStudentConstruction(store: Store<StudentState>): void;
84
+ export declare function undoStudentChange(store: Store<StudentState>): void;
85
+ export declare function redoStudentChange(store: Store<StudentState>): void;
86
+ /**
87
+ * Starts the attempt over on the same store (RFC 0004 § Decision 2): the
88
+ * exercise and its givens stay, and everything the student did goes — their
89
+ * constructions, any given they dragged (it returns to where the teacher put
90
+ * it), the tool, the selection, a pending endpoint and the notice. A resumed
91
+ * attempt resets to empty, not to what was saved.
92
+ *
93
+ * Not undoable: both history stacks are emptied, so neither Undo nor Redo can
94
+ * bring the old attempt back. The store object and its subscribers are kept.
95
+ * The epoch moves even when the attempt was already empty, which is how a
96
+ * canvas drops a gesture in flight, and a host clearing checked feedback on a
97
+ * geometry or epoch change sees every reset. Nothing saved outside the store
98
+ * is touched.
99
+ *
100
+ * A student action: it does nothing while read-only, and it records a `reset`
101
+ * receipt even for an attempt that was already empty.
102
+ */
103
+ export declare function resetStudentAttempt(store: Store<StudentState>): void;
104
+ export declare function addStudentPoint(store: Store<StudentState>, definition: PointDefinition, countsAsConstruction?: boolean): PointId | null;
105
+ export declare function promoteStudentPoint(store: Store<StudentState>, pointId: PointId): void;
106
+ /**
107
+ * Drags a point to `point`, respecting what the point is:
108
+ * - free: takes the new coordinates;
109
+ * - on-object: slides along its object, so the drag re-parameterizes rather
110
+ * than detaching it (a point placed on a line stays on that line);
111
+ * - intersection: ignored — its position is its parents' to decide.
112
+ */
113
+ export declare function moveStudentPoint(store: Store<StudentState>, pointId: PointId, point: Point): void;
114
+ export declare function isStudentPointDraggable(state: StudentState, pointId: PointId): boolean;
115
+ export declare function endStudentPointDrag(store: Store<StudentState>): void;
116
+ /**
117
+ * The one way a gesture becomes geometry (RFC 0001 § 11).
118
+ *
119
+ * Two rules the pre-M2.9 code broke, both of them here now:
120
+ *
121
+ * 1. **One gesture is one commit is one undo.** Every entity the command needs
122
+ * is written inside a single `commitGeometry()`, so a segment that had to
123
+ * invent its endpoint still costs the student exactly one undo — and undoing
124
+ * it takes the invented point with it.
125
+ * 2. **An invented endpoint is not part of the answer.** Only the shape the
126
+ * student drew is, which is what keeps a `create` goal from being satisfied
127
+ * by scaffolding they never chose to make.
128
+ *
129
+ * A third since RFC 0004: **a construction the student already built is not
130
+ * built twice.** The whole staged document is dropped — no invented point, no
131
+ * history entry, the redo stack intact — and `constructionNotice` names the one
132
+ * that is there.
133
+ */
134
+ export declare function executeConstruction(store: Store<StudentState>, command: ConstructionCommand): void;
135
+ export declare function pickStudentPoint(store: Store<StudentState>, pointId: PointId): void;
136
+ export declare function selectStudentObject(store: Store<StudentState>, id: string | null): void;
137
+ export declare function isStudentOwned(state: StudentState, id: string): boolean;
138
+ /**
139
+ * Everything that disappears along with `id`, the target included, the same
140
+ * way getGivenRemovalImpact() reports cascades on the teacher side.
141
+ *
142
+ * The cascade follows the dependency graph upwards: a construction needs its
143
+ * endpoints, and a derived point needs its objects, so deleting a segment can
144
+ * strip an intersection point, which can strip a construction that used it,
145
+ * and so on. Since M2.2 that is one walk of the context's reverse edges — the
146
+ * fixpoint loop it replaces rescanned both documents once per entity it
147
+ * removed.
148
+ */
149
+ export declare function getStudentRemovalImpact(state: StudentState, id: string): StudentRemovalImpact;
150
+ export declare function deleteStudentObject(store: Store<StudentState>, id: string): void;
151
+ export declare function revealStudentAnswer(store: Store<StudentState>, shape: RevealedAnswerShape): void;
152
+ //# sourceMappingURL=studentStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"studentStore.d.ts","sourceRoot":"","sources":["../../src/store/studentStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAElE,OAAO,EAA8B,KAAK,aAAa,EAAE,MAAM,iCAAiC,CAAA;AAChG,OAAO,KAAK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Policy, GeometryExercise, ToolName } from '../schemas/exercise.schema.cjs';
2
+ import { ObjectTypeName } from '../schemas/objectTypeName.schema.cjs';
3
+ import { GeometryGoal } from '../schemas/goals/geometryGoal.schema.cjs';
4
+ import { MathViewport } from '../schemas/viewport.schema.cjs';
5
+ import { Point, PointId } from '../geometry/point.cjs';
6
+ import { EntityId, PointDefinition } from '../geometry/entityModel.cjs';
7
+ import { Store } from './createStore.cjs';
8
+ import { ConstructionCommand, ConstructionNotice } from './constructionCommand.cjs';
9
+ export interface TeacherEditorState {
10
+ exercise: GeometryExercise;
11
+ pendingObjectType: ObjectTypeName | null;
12
+ pendingFirstPointId: PointId | null;
13
+ selectedGivenId: string | null;
14
+ past: GeometryExercise[];
15
+ future: GeometryExercise[];
16
+ coalesceTag: string | null;
17
+ interactionEpoch?: number;
18
+ constructionNotice?: ConstructionNotice | null;
19
+ }
20
+ export interface GivenRemovalImpact {
21
+ dependentEntityIds: string[];
22
+ dependentGoalIds: string[];
23
+ }
24
+ export declare function createTeacherStore(initialExercise: GeometryExercise): Store<TeacherEditorState>;
25
+ export declare function loadExercise(store: Store<TeacherEditorState>, exercise: GeometryExercise): void;
26
+ export declare function undoTeacherChange(store: Store<TeacherEditorState>): void;
27
+ export declare function redoTeacherChange(store: Store<TeacherEditorState>): void;
28
+ export declare function selectGiven(store: Store<TeacherEditorState>, id: string | null): void;
29
+ export declare function setViewport(store: Store<TeacherEditorState>, viewport: MathViewport): void;
30
+ export declare function setShowGrid(store: Store<TeacherEditorState>, showGrid: boolean): void;
31
+ export declare function setAllowedObjects(store: Store<TeacherEditorState>, types: ObjectTypeName[]): void;
32
+ export declare function setTools(store: Store<TeacherEditorState>, tools: ToolName[]): void;
33
+ /**
34
+ * How the attempt is graded for answer entities no goal needed (ADR 0013).
35
+ * Undoable, like every other authoring change.
36
+ *
37
+ * `allow` **removes** the field rather than storing it: absence already means
38
+ * permissive, and an exercise that says so twice would differ from a migrated
39
+ * one for no reason a host could read. So choosing `allow` on an exercise that
40
+ * never stated a policy changes nothing and records no history entry, which is
41
+ * `commitExercise()`'s existing identity rule.
42
+ */
43
+ export declare function setExtraObjectPolicy(store: Store<TeacherEditorState>, policy: ExtraObjectPolicy): void;
44
+ export declare function addGoal(store: Store<TeacherEditorState>, goal: GeometryGoal): void;
45
+ export declare function replaceGoal(store: Store<TeacherEditorState>, goal: GeometryGoal): void;
46
+ export declare function removeGoal(store: Store<TeacherEditorState>, goalId: string): void;
47
+ /**
48
+ * Adds a point to the figure, from coordinates or from a whole origin. The
49
+ * Point tool passes an origin so a point the author placed on an object or at
50
+ * an intersection is stored as derived (M3.1-6); everything else passes
51
+ * coordinates and gets a free point.
52
+ *
53
+ * A given with exactly this origin is returned instead of stacked, unchanged:
54
+ * `draggable` does not rewrite a point that is already there.
55
+ */
56
+ export declare function addGivenPoint(store: Store<TeacherEditorState>, origin: Point | PointDefinition, draggable?: boolean): PointId;
57
+ /**
58
+ * Reveals scaffolding the figure already depends on: an implicit given becomes
59
+ * explicit, so it is drawn and selectable.
60
+ *
61
+ * One-way by design (M3.1-9, amendment 4). There is no demotion: hiding an
62
+ * entity an exercise or a goal refers to would silently change what the
63
+ * student is asked to do, while revealing one only shows what is already load
64
+ * bearing.
65
+ *
66
+ * Any kind, not points only, because an exercise may declare an implicit
67
+ * segment, line or circle — the `presentation` record says nothing about kind.
68
+ */
69
+ export declare function promoteGivenEntity(store: Store<TeacherEditorState>, id: EntityId): void;
70
+ /**
71
+ * The canvas gesture's promotion: the same rule, refused for anything but a
72
+ * point, because clicking with the Point tool is what calls it.
73
+ */
74
+ export declare function promoteGivenPoint(store: Store<TeacherEditorState>, pointId: PointId): void;
75
+ /**
76
+ * Turns one teacher gesture into its endpoints and shape in one undo step. A
77
+ * shape the exercise already declares is not declared twice: the staged
78
+ * endpoints are dropped with it, nothing enters history, and
79
+ * `constructionNotice` names the one that is there.
80
+ */
81
+ export declare function executeGivenConstruction(store: Store<TeacherEditorState>, command: ConstructionCommand): void;
82
+ export declare function moveGivenPoint(store: Store<TeacherEditorState>, id: PointId, position: Point): void;
83
+ export declare function isGivenPointDraggable(state: TeacherEditorState, pointId: PointId): boolean;
84
+ export declare function endGivenPointDrag(store: Store<TeacherEditorState>): void;
85
+ export declare function setGivenPointDraggable(store: Store<TeacherEditorState>, id: PointId, draggable: boolean): void;
86
+ /**
87
+ * Names an entity: the label both surfaces draw and the inspector lists, for
88
+ * every kind rather than points only (M3.1-8).
89
+ *
90
+ * An empty or blank label removes the entry's label rather than storing one,
91
+ * which is the rule `entityPresentationSchema` already states — a stored label
92
+ * is `min(1)` — and what `entityDisplayName()` reads as "no label".
93
+ *
94
+ * Typing coalesces into one undo entry per label, the way the X and Y inputs
95
+ * already coalesce through `moveGivenPoint`: a keystroke is not an edit a
96
+ * teacher means to undo on its own.
97
+ */
98
+ export declare function setGivenLabel(store: Store<TeacherEditorState>, id: EntityId, label: string): void;
99
+ export declare function getGivenRemovalImpact(exercise: GeometryExercise, id: string): GivenRemovalImpact;
100
+ export declare function removeGiven(store: Store<TeacherEditorState>, id: string): void;
101
+ export declare function addGivenSegment(store: Store<TeacherEditorState>, fromId: PointId, toId: PointId): string | null;
102
+ export declare function addGivenLine(store: Store<TeacherEditorState>, throughA: PointId, throughB: PointId): string | null;
103
+ export declare function selectPendingObjectType(store: Store<TeacherEditorState>, type: ObjectTypeName | null): void;
104
+ /**
105
+ * Abandons a click-click construction in progress: the first endpoint is
106
+ * forgotten and the tool stays armed, as does the selection. The authoring
107
+ * sibling of `cancelStudentConstruction()`, called when a canvas cancels a
108
+ * gesture.
109
+ */
110
+ export declare function cancelGivenConstruction(store: Store<TeacherEditorState>): void;
111
+ export declare function pickPointForPendingObject(store: Store<TeacherEditorState>, pointId: PointId): void;
@@ -0,0 +1,112 @@
1
+ import { ExtraObjectPolicy, GeometryExercise, ToolName } from '../schemas/exercise.schema.js';
2
+ import { ObjectTypeName } from '../schemas/objectTypeName.schema.js';
3
+ import { GeometryGoal } from '../schemas/goals/geometryGoal.schema.js';
4
+ import { MathViewport } from '../schemas/viewport.schema.js';
5
+ import { Point, PointId } from '../geometry/point.js';
6
+ import { EntityId, PointDefinition } from '../geometry/entityModel.js';
7
+ import { Store } from './createStore.js';
8
+ import { ConstructionCommand, ConstructionNotice } from './constructionCommand.js';
9
+ export interface TeacherEditorState {
10
+ exercise: GeometryExercise;
11
+ pendingObjectType: ObjectTypeName | null;
12
+ pendingFirstPointId: PointId | null;
13
+ selectedGivenId: string | null;
14
+ past: GeometryExercise[];
15
+ future: GeometryExercise[];
16
+ coalesceTag: string | null;
17
+ interactionEpoch?: number;
18
+ constructionNotice?: ConstructionNotice | null;
19
+ }
20
+ export interface GivenRemovalImpact {
21
+ dependentEntityIds: string[];
22
+ dependentGoalIds: string[];
23
+ }
24
+ export declare function createTeacherStore(initialExercise: GeometryExercise): Store<TeacherEditorState>;
25
+ export declare function loadExercise(store: Store<TeacherEditorState>, exercise: GeometryExercise): void;
26
+ export declare function undoTeacherChange(store: Store<TeacherEditorState>): void;
27
+ export declare function redoTeacherChange(store: Store<TeacherEditorState>): void;
28
+ export declare function selectGiven(store: Store<TeacherEditorState>, id: string | null): void;
29
+ export declare function setViewport(store: Store<TeacherEditorState>, viewport: MathViewport): void;
30
+ export declare function setShowGrid(store: Store<TeacherEditorState>, showGrid: boolean): void;
31
+ export declare function setAllowedObjects(store: Store<TeacherEditorState>, types: ObjectTypeName[]): void;
32
+ export declare function setTools(store: Store<TeacherEditorState>, tools: ToolName[]): void;
33
+ /**
34
+ * How the attempt is graded for answer entities no goal needed (ADR 0013).
35
+ * Undoable, like every other authoring change.
36
+ *
37
+ * `allow` **removes** the field rather than storing it: absence already means
38
+ * permissive, and an exercise that says so twice would differ from a migrated
39
+ * one for no reason a host could read. So choosing `allow` on an exercise that
40
+ * never stated a policy changes nothing and records no history entry, which is
41
+ * `commitExercise()`'s existing identity rule.
42
+ */
43
+ export declare function setExtraObjectPolicy(store: Store<TeacherEditorState>, policy: ExtraObjectPolicy): void;
44
+ export declare function addGoal(store: Store<TeacherEditorState>, goal: GeometryGoal): void;
45
+ export declare function replaceGoal(store: Store<TeacherEditorState>, goal: GeometryGoal): void;
46
+ export declare function removeGoal(store: Store<TeacherEditorState>, goalId: string): void;
47
+ /**
48
+ * Adds a point to the figure, from coordinates or from a whole origin. The
49
+ * Point tool passes an origin so a point the author placed on an object or at
50
+ * an intersection is stored as derived (M3.1-6); everything else passes
51
+ * coordinates and gets a free point.
52
+ *
53
+ * A given with exactly this origin is returned instead of stacked, unchanged:
54
+ * `draggable` does not rewrite a point that is already there.
55
+ */
56
+ export declare function addGivenPoint(store: Store<TeacherEditorState>, origin: Point | PointDefinition, draggable?: boolean): PointId;
57
+ /**
58
+ * Reveals scaffolding the figure already depends on: an implicit given becomes
59
+ * explicit, so it is drawn and selectable.
60
+ *
61
+ * One-way by design (M3.1-9, amendment 4). There is no demotion: hiding an
62
+ * entity an exercise or a goal refers to would silently change what the
63
+ * student is asked to do, while revealing one only shows what is already load
64
+ * bearing.
65
+ *
66
+ * Any kind, not points only, because an exercise may declare an implicit
67
+ * segment, line or circle — the `presentation` record says nothing about kind.
68
+ */
69
+ export declare function promoteGivenEntity(store: Store<TeacherEditorState>, id: EntityId): void;
70
+ /**
71
+ * The canvas gesture's promotion: the same rule, refused for anything but a
72
+ * point, because clicking with the Point tool is what calls it.
73
+ */
74
+ export declare function promoteGivenPoint(store: Store<TeacherEditorState>, pointId: PointId): void;
75
+ /**
76
+ * Turns one teacher gesture into its endpoints and shape in one undo step. A
77
+ * shape the exercise already declares is not declared twice: the staged
78
+ * endpoints are dropped with it, nothing enters history, and
79
+ * `constructionNotice` names the one that is there.
80
+ */
81
+ export declare function executeGivenConstruction(store: Store<TeacherEditorState>, command: ConstructionCommand): void;
82
+ export declare function moveGivenPoint(store: Store<TeacherEditorState>, id: PointId, position: Point): void;
83
+ export declare function isGivenPointDraggable(state: TeacherEditorState, pointId: PointId): boolean;
84
+ export declare function endGivenPointDrag(store: Store<TeacherEditorState>): void;
85
+ export declare function setGivenPointDraggable(store: Store<TeacherEditorState>, id: PointId, draggable: boolean): void;
86
+ /**
87
+ * Names an entity: the label both surfaces draw and the inspector lists, for
88
+ * every kind rather than points only (M3.1-8).
89
+ *
90
+ * An empty or blank label removes the entry's label rather than storing one,
91
+ * which is the rule `entityPresentationSchema` already states — a stored label
92
+ * is `min(1)` — and what `entityDisplayName()` reads as "no label".
93
+ *
94
+ * Typing coalesces into one undo entry per label, the way the X and Y inputs
95
+ * already coalesce through `moveGivenPoint`: a keystroke is not an edit a
96
+ * teacher means to undo on its own.
97
+ */
98
+ export declare function setGivenLabel(store: Store<TeacherEditorState>, id: EntityId, label: string): void;
99
+ export declare function getGivenRemovalImpact(exercise: GeometryExercise, id: string): GivenRemovalImpact;
100
+ export declare function removeGiven(store: Store<TeacherEditorState>, id: string): void;
101
+ export declare function addGivenSegment(store: Store<TeacherEditorState>, fromId: PointId, toId: PointId): string | null;
102
+ export declare function addGivenLine(store: Store<TeacherEditorState>, throughA: PointId, throughB: PointId): string | null;
103
+ export declare function selectPendingObjectType(store: Store<TeacherEditorState>, type: ObjectTypeName | null): void;
104
+ /**
105
+ * Abandons a click-click construction in progress: the first endpoint is
106
+ * forgotten and the tool stays armed, as does the selection. The authoring
107
+ * sibling of `cancelStudentConstruction()`, called when a canvas cancels a
108
+ * gesture.
109
+ */
110
+ export declare function cancelGivenConstruction(store: Store<TeacherEditorState>): void;
111
+ export declare function pickPointForPendingObject(store: Store<TeacherEditorState>, pointId: PointId): void;
112
+ //# sourceMappingURL=teacherStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"teacherStore.d.ts","sourceRoot":"","sources":["../../src/store/teacherStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAC/F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AACtE,OAAO,KAAK,EAAE,YA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,OAAO,EACf,IAAI,EAAE,OAAO,GACZ,MAAM,GAAG,IAAI,CAEf;AAED,wBAAgB,YAAY,CAC1B,KAAK,EAAE,KAAK,CAAC,kBAAkB,CAAC,EAChC,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,OAAO,GAChB,MAAM,GAAG,IAAI,CAEf;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,KAAK,CAAC,kBAAkB,CAAC,EAChC,IAAI,EAAE,cAAc,GAAG,IAAI,GAC1B,IAAI,CAQN;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,KAAK,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAG9E;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,KAAK,CAAC,kBAAkB,CAAC,EAChC,OAAO,EAAE,OAAO,GACf,IAAI,CAiBN"}
@@ -0,0 +1,2 @@
1
+ import { Store } from './createStore.cjs';
2
+ export declare function useStoreState<T>(store: Store<T>): T;
@@ -0,0 +1,3 @@
1
+ import { Store } from './createStore.js';
2
+ export declare function useStoreState<T>(store: Store<T>): T;
3
+ //# sourceMappingURL=useStoreState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStoreState.d.ts","sourceRoot":"","sources":["../../src/store/useStoreState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAK1C,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAKnD"}