@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,47 @@
1
+ import { RefObject } from 'react';
2
+ import { Stage } from 'konva/lib/Stage';
3
+ import { CanvasSize } from '../coordinates/transform.js';
4
+ import { PointId } from '../geometry/point.js';
5
+ import { ObjectTypeName } from '../schemas/objectTypeName.schema.js';
6
+ import { Store } from '../store/createStore.js';
7
+ import { ScreenPoint } from './gesturePolicy.js';
8
+ import { ConnectionPreview } from './useConnectionPreview.js';
9
+ type EpochStore = Pick<Store<{
10
+ interactionEpoch?: number;
11
+ }>, 'getState' | 'subscribe'>;
12
+ export interface PointerGestureHandlers {
13
+ tool: ObjectTypeName | null;
14
+ connection: ConnectionPreview;
15
+ placement: {
16
+ trackAt(pointer: ScreenPoint): void;
17
+ clearPointer(): void;
18
+ };
19
+ pointOnScreen(id: PointId): ScreenPoint | null;
20
+ canDragPoint(id: PointId): boolean;
21
+ dragPoint(id: PointId, to: ScreenPoint): void;
22
+ endPointDrag(id: PointId): void;
23
+ tapPoint(id: PointId): void;
24
+ tapObject(id: string): void;
25
+ tapStage(pointer: ScreenPoint): void;
26
+ abandonConstruction(): void;
27
+ disarmTool(): void;
28
+ }
29
+ /**
30
+ * The one pointer lifecycle behind both canvases (RFC 0004 § Decision 4,
31
+ * ADR 0011).
32
+ *
33
+ * Native Pointer Events on the stage's container, one contact at a time,
34
+ * identified by `pointerId` and captured while it is down. A contact is a tap
35
+ * until it moves its pointer type's threshold and a drag from then on, and it
36
+ * becomes geometry only through a normal release on the canvas — no Konva
37
+ * click, tap or drag handler, and no compatibility mouse event, can build or
38
+ * select anything on its own, so one contact is at most one creation.
39
+ *
40
+ * Every other ending is a cancellation, and every cancellation clears the
41
+ * preview, the snap marker, the pending endpoint and the contact, and closes a
42
+ * point drag's undo step where it stands: a dragged point keeps the last
43
+ * position it was moved to, and one Undo takes it back.
44
+ */
45
+ export declare function usePointerGestures(stageRef: RefObject<Stage | null>, canvas: CanvasSize, store: EpochStore, handlers: PointerGestureHandlers): void;
46
+ export {};
47
+ //# sourceMappingURL=usePointerGestures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePointerGestures.d.ts","sourceRoot":"","sources":["../../src/renderer/usePointerGestures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAC1E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AACtE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EASL,KAAK,WAAW,EACjB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,KAAK,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC;IAAE,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC,CAAA;AA+BtF,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,cAAc,GAAG,IAAI,CAAA;IAC3B,UAAU,EAAE,iBAAiB,CAAA;IAC7B,SAAS,EAAE;QAAE,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;QAAC,YAAY,IAAI,IAAI,CAAA;KAAE,CAAA;IAGxE,aAAa,CAAC,EAAE,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,CAAA;IAC9C,YAAY,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO,CAAA;IAGlC,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,GAAG,IAAI,CAAA;IAC7C,YAAY,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAAA;IAC/B,QAAQ,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAAA;IAC3B,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAA;IAEpC,mBAAmB,IAAI,IAAI,CAAA;IAE3B,UAAU,IAAI,IAAI,CAAA;CACnB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,SAAS,CAAC,KAAK,GAAG,IAAI,CAAC,EACjC,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,sBAAsB,GAC/B,IAAI,CA8VN"}
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+ export declare const circleSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ type: z.ZodLiteral<"circle">;
5
+ center: z.ZodString;
6
+ through: z.ZodString;
7
+ }, z.core.$strict>;
8
+ export type Circle = z.infer<typeof circleSchema>;
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ export declare const circleSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ type: z.ZodLiteral<"circle">;
5
+ center: z.ZodString;
6
+ through: z.ZodString;
7
+ }, z.core.$strict>;
8
+ export type Circle = z.infer<typeof circleSchema>;
9
+ //# sourceMappingURL=circle.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"circle.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/circle.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAYvB,eAAO,MAAM,YAAY;;;;;kBAOd,CAAA;AAEX,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA"}
@@ -0,0 +1,69 @@
1
+ import { z } from 'zod';
2
+ export declare const freePointDefinitionSchema: z.ZodObject<{
3
+ kind: z.ZodLiteral<"point">;
4
+ at: z.ZodObject<{
5
+ x: z.ZodNumber;
6
+ y: z.ZodNumber;
7
+ }, z.core.$strict>;
8
+ }, z.core.$strict>;
9
+ export declare const onEntityPointDefinitionSchema: z.ZodObject<{
10
+ kind: z.ZodLiteral<"point">;
11
+ on: z.ZodString;
12
+ t: z.ZodNumber;
13
+ }, z.core.$strict>;
14
+ export declare const intersectionPointDefinitionSchema: z.ZodObject<{
15
+ kind: z.ZodLiteral<"point">;
16
+ intersectionOf: z.ZodReadonly<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
17
+ which: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
18
+ }, z.core.$strict>;
19
+ export declare const pointDefinitionSchema: z.ZodUnion<readonly [z.ZodObject<{
20
+ kind: z.ZodLiteral<"point">;
21
+ at: z.ZodObject<{
22
+ x: z.ZodNumber;
23
+ y: z.ZodNumber;
24
+ }, z.core.$strict>;
25
+ }, z.core.$strict>, z.ZodObject<{
26
+ kind: z.ZodLiteral<"point">;
27
+ on: z.ZodString;
28
+ t: z.ZodNumber;
29
+ }, z.core.$strict>, z.ZodObject<{
30
+ kind: z.ZodLiteral<"point">;
31
+ intersectionOf: z.ZodReadonly<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
32
+ which: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
33
+ }, z.core.$strict>]>;
34
+ export declare const segmentDefinitionSchema: z.ZodObject<{
35
+ kind: z.ZodLiteral<"segment">;
36
+ parents: z.ZodReadonly<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
37
+ }, z.core.$strict>;
38
+ export declare const lineDefinitionSchema: z.ZodObject<{
39
+ kind: z.ZodLiteral<"line">;
40
+ parents: z.ZodReadonly<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
41
+ }, z.core.$strict>;
42
+ export declare const circleDefinitionSchema: z.ZodObject<{
43
+ kind: z.ZodLiteral<"circle">;
44
+ parents: z.ZodReadonly<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
45
+ }, z.core.$strict>;
46
+ export declare const entityDefinitionSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
47
+ kind: z.ZodLiteral<"point">;
48
+ at: z.ZodObject<{
49
+ x: z.ZodNumber;
50
+ y: z.ZodNumber;
51
+ }, z.core.$strict>;
52
+ }, z.core.$strict>, z.ZodObject<{
53
+ kind: z.ZodLiteral<"point">;
54
+ on: z.ZodString;
55
+ t: z.ZodNumber;
56
+ }, z.core.$strict>, z.ZodObject<{
57
+ kind: z.ZodLiteral<"point">;
58
+ intersectionOf: z.ZodReadonly<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
59
+ which: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
60
+ }, z.core.$strict>]>, z.ZodObject<{
61
+ kind: z.ZodLiteral<"segment">;
62
+ parents: z.ZodReadonly<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
63
+ }, z.core.$strict>, z.ZodObject<{
64
+ kind: z.ZodLiteral<"line">;
65
+ parents: z.ZodReadonly<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
66
+ }, z.core.$strict>, z.ZodObject<{
67
+ kind: z.ZodLiteral<"circle">;
68
+ parents: z.ZodReadonly<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
69
+ }, z.core.$strict>]>;
@@ -0,0 +1,70 @@
1
+ import { z } from 'zod';
2
+ export declare const freePointDefinitionSchema: z.ZodObject<{
3
+ kind: z.ZodLiteral<"point">;
4
+ at: z.ZodObject<{
5
+ x: z.ZodNumber;
6
+ y: z.ZodNumber;
7
+ }, z.core.$strict>;
8
+ }, z.core.$strict>;
9
+ export declare const onEntityPointDefinitionSchema: z.ZodObject<{
10
+ kind: z.ZodLiteral<"point">;
11
+ on: z.ZodString;
12
+ t: z.ZodNumber;
13
+ }, z.core.$strict>;
14
+ export declare const intersectionPointDefinitionSchema: z.ZodObject<{
15
+ kind: z.ZodLiteral<"point">;
16
+ intersectionOf: z.ZodReadonly<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
17
+ which: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
18
+ }, z.core.$strict>;
19
+ export declare const pointDefinitionSchema: z.ZodUnion<readonly [z.ZodObject<{
20
+ kind: z.ZodLiteral<"point">;
21
+ at: z.ZodObject<{
22
+ x: z.ZodNumber;
23
+ y: z.ZodNumber;
24
+ }, z.core.$strict>;
25
+ }, z.core.$strict>, z.ZodObject<{
26
+ kind: z.ZodLiteral<"point">;
27
+ on: z.ZodString;
28
+ t: z.ZodNumber;
29
+ }, z.core.$strict>, z.ZodObject<{
30
+ kind: z.ZodLiteral<"point">;
31
+ intersectionOf: z.ZodReadonly<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
32
+ which: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
33
+ }, z.core.$strict>]>;
34
+ export declare const segmentDefinitionSchema: z.ZodObject<{
35
+ kind: z.ZodLiteral<"segment">;
36
+ parents: z.ZodReadonly<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
37
+ }, z.core.$strict>;
38
+ export declare const lineDefinitionSchema: z.ZodObject<{
39
+ kind: z.ZodLiteral<"line">;
40
+ parents: z.ZodReadonly<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
41
+ }, z.core.$strict>;
42
+ export declare const circleDefinitionSchema: z.ZodObject<{
43
+ kind: z.ZodLiteral<"circle">;
44
+ parents: z.ZodReadonly<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
45
+ }, z.core.$strict>;
46
+ export declare const entityDefinitionSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
47
+ kind: z.ZodLiteral<"point">;
48
+ at: z.ZodObject<{
49
+ x: z.ZodNumber;
50
+ y: z.ZodNumber;
51
+ }, z.core.$strict>;
52
+ }, z.core.$strict>, z.ZodObject<{
53
+ kind: z.ZodLiteral<"point">;
54
+ on: z.ZodString;
55
+ t: z.ZodNumber;
56
+ }, z.core.$strict>, z.ZodObject<{
57
+ kind: z.ZodLiteral<"point">;
58
+ intersectionOf: z.ZodReadonly<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
59
+ which: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
60
+ }, z.core.$strict>]>, z.ZodObject<{
61
+ kind: z.ZodLiteral<"segment">;
62
+ parents: z.ZodReadonly<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
63
+ }, z.core.$strict>, z.ZodObject<{
64
+ kind: z.ZodLiteral<"line">;
65
+ parents: z.ZodReadonly<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
66
+ }, z.core.$strict>, z.ZodObject<{
67
+ kind: z.ZodLiteral<"circle">;
68
+ parents: z.ZodReadonly<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
69
+ }, z.core.$strict>]>;
70
+ //# sourceMappingURL=entityDefinition.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entityDefinition.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/entityDefinition.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAqBvB,eAAO,MAAM,yBAAyB;;;;;;kBAK3B,CAAA;AAMX,eAAO,MAAM,6BAA6B;;;;kBAM/B,CAAA;AAKX,eAAO,MAAM,iCAAiC;;;;kBAMnC,CAAA;AAMX,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;oBAIhC,CAAA;AAQF,eAAO,MAAM,uBAAuB;;;kBAEzB,CAAA;AAEX,eAAO,MAAM,oBAAoB;;;kBAEtB,CAAA;AAIX,eAAO,MAAM,sBAAsB;;;kBAExB,CAAA;AAEX,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;oBAKuB,CAAA"}
@@ -0,0 +1,95 @@
1
+ import { z } from 'zod';
2
+ import { EntityDefinition, EntityId, EntityPresentation } from '../geometry/entityModel.cjs';
3
+ /**
4
+ * The `entities` / `presentation` record shape, guarded before `z.record()`
5
+ * sees it.
6
+ *
7
+ * `z.record()` reports success and drops a `__proto__` entry, so a v2 document
8
+ * this engine wrote and read back loses that entity at load with no error at
9
+ * all. Two tidier places to catch it do not work, and were measured rather than
10
+ * argued (M2.G.1): a key schema is never asked, because zod skips a `__proto__`
11
+ * key *before* validating it, and a `superRefine` on the record runs after the
12
+ * entry is already gone. `z.preprocess` is the one hook that still sees the own
13
+ * property.
14
+ *
15
+ * One helper for all four records — both records of both documents — because a
16
+ * guard copied four times is a guard three of them will eventually not have.
17
+ */
18
+ export declare function entityRecordSchema<Value extends z.ZodType>(value: Value): z.ZodType<Record<EntityId, z.output<Value>>, unknown>;
19
+ /** A structural fault, at a path relative to the document that produced it. */
20
+ export interface EntityDocumentIssue {
21
+ path: Array<string | number>;
22
+ message: string;
23
+ }
24
+ /** The half of either v2 document these rules read. */
25
+ export interface EntityDocumentShape {
26
+ entities: Record<EntityId, EntityDefinition>;
27
+ presentation: Record<EntityId, EntityPresentation>;
28
+ }
29
+ export interface EntityDocumentRules {
30
+ /**
31
+ * Whether a parent this document does not declare is an error.
32
+ *
33
+ * True for an exercise, which is self-contained. **False for an attempt**: a
34
+ * student's point sits on a given segment, and since ADR 0008's amendment a
35
+ * v2 attempt no longer copies the givens, so most of its parents live in the
36
+ * other document. `validateGeometryStateInput()` completes the check once it
37
+ * has the exercise — the same staging v1 used for point origins.
38
+ */
39
+ parentsMustBeDeclared: boolean;
40
+ }
41
+ /**
42
+ * Every structural fault a single v2 document can see in itself.
43
+ *
44
+ * Returned rather than reported, so both `superRefine` blocks map them onto
45
+ * their own issue paths and neither owns the rules.
46
+ */
47
+ export declare function entityDocumentIssues(document: EntityDocumentShape, rules: EntityDocumentRules): EntityDocumentIssue[];
48
+ /**
49
+ * The parent rules a v2 attempt cannot check alone, completed against the
50
+ * exercise it is an attempt at.
51
+ *
52
+ * `entityDocumentIssues()` skips a parent an attempt does not declare, because
53
+ * since ADR 0008 § Amendment most of them are given entities living in the
54
+ * other document. This is the other half, and the reason it is here rather than
55
+ * in `validateGeometryStateInput()`: a parent that turns out to be a given is
56
+ * judged by exactly the rules a declared one is, in exactly the same words.
57
+ *
58
+ * The *kind* rules are asked only of the parents the attempt does not declare —
59
+ * the rest have already been reported by the schema, and reporting them twice
60
+ * would make one fault look like two. One rule reaches the declared ones as
61
+ * well, because the schema cannot ask it: an entity **the exercise declares**
62
+ * may not be defined on an entity it does not (M2.G.5), and a parent the
63
+ * attempt declares is exactly the case that violates it.
64
+ */
65
+ export declare function crossDocumentParentIssues(attempt: EntityDocumentShape, given: Record<EntityId, EntityDefinition>): EntityDocumentIssue[];
66
+ /**
67
+ * Whether the two documents declaring the same id is a *collision* rather than
68
+ * a re-declaration.
69
+ *
70
+ * One rule, read by both callers, because they answer for the same document
71
+ * pair and had no reason to say it twice: `buildGeometryContext()` asks it to
72
+ * decide whether to drop the attempt's entity and report `duplicate-id`, and
73
+ * `validateGeometryStateInput()` asks it to refuse the document outright.
74
+ *
75
+ * A given **point** re-declared as a **point** is the one shared id that is
76
+ * not a collision — it is how the student moves a draggable given, and how
77
+ * every migrated v1 attempt arrives (ADR 0008 § Amendment). Every other pair
78
+ * is one document claiming an id the other already gave a different meaning.
79
+ */
80
+ export declare function isCrossDocumentIdCollision(given: EntityDefinition, declared: EntityDefinition): boolean;
81
+ /**
82
+ * The collisions of `isCrossDocumentIdCollision()`, as load errors.
83
+ *
84
+ * The context reports these as `duplicate-id` issues and then resolves the id
85
+ * to the *exercise's* declaration, so an attempt declaring segment `A` over
86
+ * given point `A` used to load clean and then have the given graded as the
87
+ * student's construction (M2.G.2). Refusing the document is the fix: nothing
88
+ * downstream has to decide what a contested id means, because it never gets
89
+ * one.
90
+ */
91
+ export declare function crossDocumentIdCollisionIssues(attempt: EntityDocumentShape, given: Record<EntityId, EntityDefinition>): EntityDocumentIssue[];
92
+ /** `answerEntityIds` and `draggableEntityIds` are the same list rule twice. */
93
+ export declare function entityIdListIssues(ids: readonly EntityId[], field: string, document: EntityDocumentShape, options?: {
94
+ pointsOnly?: boolean;
95
+ }): EntityDocumentIssue[];
@@ -0,0 +1,96 @@
1
+ import { z } from 'zod';
2
+ import { EntityDefinition, EntityId, EntityPresentation } from '../geometry/entityModel.js';
3
+ /**
4
+ * The `entities` / `presentation` record shape, guarded before `z.record()`
5
+ * sees it.
6
+ *
7
+ * `z.record()` reports success and drops a `__proto__` entry, so a v2 document
8
+ * this engine wrote and read back loses that entity at load with no error at
9
+ * all. Two tidier places to catch it do not work, and were measured rather than
10
+ * argued (M2.G.1): a key schema is never asked, because zod skips a `__proto__`
11
+ * key *before* validating it, and a `superRefine` on the record runs after the
12
+ * entry is already gone. `z.preprocess` is the one hook that still sees the own
13
+ * property.
14
+ *
15
+ * One helper for all four records — both records of both documents — because a
16
+ * guard copied four times is a guard three of them will eventually not have.
17
+ */
18
+ export declare function entityRecordSchema<Value extends z.ZodType>(value: Value): z.ZodType<Record<EntityId, z.output<Value>>, unknown>;
19
+ /** A structural fault, at a path relative to the document that produced it. */
20
+ export interface EntityDocumentIssue {
21
+ path: Array<string | number>;
22
+ message: string;
23
+ }
24
+ /** The half of either v2 document these rules read. */
25
+ export interface EntityDocumentShape {
26
+ entities: Record<EntityId, EntityDefinition>;
27
+ presentation: Record<EntityId, EntityPresentation>;
28
+ }
29
+ export interface EntityDocumentRules {
30
+ /**
31
+ * Whether a parent this document does not declare is an error.
32
+ *
33
+ * True for an exercise, which is self-contained. **False for an attempt**: a
34
+ * student's point sits on a given segment, and since ADR 0008's amendment a
35
+ * v2 attempt no longer copies the givens, so most of its parents live in the
36
+ * other document. `validateGeometryStateInput()` completes the check once it
37
+ * has the exercise — the same staging v1 used for point origins.
38
+ */
39
+ parentsMustBeDeclared: boolean;
40
+ }
41
+ /**
42
+ * Every structural fault a single v2 document can see in itself.
43
+ *
44
+ * Returned rather than reported, so both `superRefine` blocks map them onto
45
+ * their own issue paths and neither owns the rules.
46
+ */
47
+ export declare function entityDocumentIssues(document: EntityDocumentShape, rules: EntityDocumentRules): EntityDocumentIssue[];
48
+ /**
49
+ * The parent rules a v2 attempt cannot check alone, completed against the
50
+ * exercise it is an attempt at.
51
+ *
52
+ * `entityDocumentIssues()` skips a parent an attempt does not declare, because
53
+ * since ADR 0008 § Amendment most of them are given entities living in the
54
+ * other document. This is the other half, and the reason it is here rather than
55
+ * in `validateGeometryStateInput()`: a parent that turns out to be a given is
56
+ * judged by exactly the rules a declared one is, in exactly the same words.
57
+ *
58
+ * The *kind* rules are asked only of the parents the attempt does not declare —
59
+ * the rest have already been reported by the schema, and reporting them twice
60
+ * would make one fault look like two. One rule reaches the declared ones as
61
+ * well, because the schema cannot ask it: an entity **the exercise declares**
62
+ * may not be defined on an entity it does not (M2.G.5), and a parent the
63
+ * attempt declares is exactly the case that violates it.
64
+ */
65
+ export declare function crossDocumentParentIssues(attempt: EntityDocumentShape, given: Record<EntityId, EntityDefinition>): EntityDocumentIssue[];
66
+ /**
67
+ * Whether the two documents declaring the same id is a *collision* rather than
68
+ * a re-declaration.
69
+ *
70
+ * One rule, read by both callers, because they answer for the same document
71
+ * pair and had no reason to say it twice: `buildGeometryContext()` asks it to
72
+ * decide whether to drop the attempt's entity and report `duplicate-id`, and
73
+ * `validateGeometryStateInput()` asks it to refuse the document outright.
74
+ *
75
+ * A given **point** re-declared as a **point** is the one shared id that is
76
+ * not a collision — it is how the student moves a draggable given, and how
77
+ * every migrated v1 attempt arrives (ADR 0008 § Amendment). Every other pair
78
+ * is one document claiming an id the other already gave a different meaning.
79
+ */
80
+ export declare function isCrossDocumentIdCollision(given: EntityDefinition, declared: EntityDefinition): boolean;
81
+ /**
82
+ * The collisions of `isCrossDocumentIdCollision()`, as load errors.
83
+ *
84
+ * The context reports these as `duplicate-id` issues and then resolves the id
85
+ * to the *exercise's* declaration, so an attempt declaring segment `A` over
86
+ * given point `A` used to load clean and then have the given graded as the
87
+ * student's construction (M2.G.2). Refusing the document is the fix: nothing
88
+ * downstream has to decide what a contested id means, because it never gets
89
+ * one.
90
+ */
91
+ export declare function crossDocumentIdCollisionIssues(attempt: EntityDocumentShape, given: Record<EntityId, EntityDefinition>): EntityDocumentIssue[];
92
+ /** `answerEntityIds` and `draggableEntityIds` are the same list rule twice. */
93
+ export declare function entityIdListIssues(ids: readonly EntityId[], field: string, document: EntityDocumentShape, options?: {
94
+ pointsOnly?: boolean;
95
+ }): EntityDocumentIssue[];
96
+ //# sourceMappingURL=entityDocument.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entityDocument.d.ts","sourceRoot":"","sources":["../../src/schemas/entityDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAqB7F;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,SAAS,CAAC,CAAC,OAAO,EACxD,KAAK,EAAE,KAAK,GACX,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,CAmBvD;AAED,+EAA+E;AAC/E,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAA;IAC5B,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,uDAAuD;AACvD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAA;IAC5C,YAAY,EAAE,MAAM,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAA;CACnD;AAED,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;OAQG;IACH,qBAAqB,EAAE,OAAO,CAAA;CAC/B;AAuBD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,mBAAmB,EAC7B,KAAK,EAAE,mBAAmB,GACzB,mBAAmB,EAAE,CAuEvB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,mBAAmB,EAC5B,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC,GACxC,mBAAmB,EAAE,CAwCvB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,gBAAgB,EACvB,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAET;AAED;;;;;;;;;GASG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,mBAAmB,EAC5B,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC,GACxC,mBAAmB,EAAE,CAWvB;AAED,+EAA+E;AAC/E,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,SAAS,QAAQ,EAAE,EACxB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,mBAAmB,EAC7B,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,GACrC,mBAAmB,EAAE,CAevB"}
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ export declare const entityRoleSchema: z.ZodEnum<{
3
+ implicit: "implicit";
4
+ explicit: "explicit";
5
+ }>;
6
+ export declare const entityPresentationSchema: z.ZodObject<{
7
+ role: z.ZodEnum<{
8
+ implicit: "implicit";
9
+ explicit: "explicit";
10
+ }>;
11
+ label: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strict>;
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ export declare const entityRoleSchema: z.ZodEnum<{
3
+ implicit: "implicit";
4
+ explicit: "explicit";
5
+ }>;
6
+ export declare const entityPresentationSchema: z.ZodObject<{
7
+ role: z.ZodEnum<{
8
+ implicit: "implicit";
9
+ explicit: "explicit";
10
+ }>;
11
+ label: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strict>;
13
+ //# sourceMappingURL=entityPresentation.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entityPresentation.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/entityPresentation.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAWvB,eAAO,MAAM,gBAAgB;;;EAAmC,CAAA;AAMhE,eAAO,MAAM,wBAAwB;;;;;;kBAOkC,CAAA"}
@@ -0,0 +1,217 @@
1
+ import { z } from 'zod';
2
+ import { MigrationOutcome, MigrationStep } from './migrate.cjs';
3
+ export declare const toolNameSchema: z.ZodEnum<{
4
+ ruler: "ruler";
5
+ setSquare: "setSquare";
6
+ protractor: "protractor";
7
+ }>;
8
+ export type ToolName = z.infer<typeof toolNameSchema>;
9
+ export declare const latestGeometryExerciseVersion = 4;
10
+ export declare const extraObjectPolicySchema: z.ZodEnum<{
11
+ allow: "allow";
12
+ reject: "reject";
13
+ }>;
14
+ export type ExtraObjectPolicy = z.infer<typeof extraObjectPolicySchema>;
15
+ export declare const exerciseGradingSchema: z.ZodObject<{
16
+ extraObjects: z.ZodEnum<{
17
+ allow: "allow";
18
+ reject: "reject";
19
+ }>;
20
+ }, z.core.$strict>;
21
+ export type ExerciseGrading = z.infer<typeof exerciseGradingSchema>;
22
+ export declare const geometryExerciseSchema: z.ZodObject<{
23
+ schemaVersion: z.ZodLiteral<4>;
24
+ id: z.ZodString;
25
+ viewport: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
26
+ showGrid: z.ZodOptional<z.ZodBoolean>;
27
+ entities: z.ZodType<Record<string, {
28
+ kind: "point";
29
+ at: {
30
+ x: number;
31
+ y: number;
32
+ };
33
+ } | {
34
+ kind: "point";
35
+ on: string;
36
+ t: number;
37
+ } | {
38
+ kind: "point";
39
+ intersectionOf: readonly [string, string];
40
+ which?: 0 | 1 | undefined;
41
+ } | {
42
+ kind: "segment";
43
+ parents: readonly [string, string];
44
+ } | {
45
+ kind: "line";
46
+ parents: readonly [string, string];
47
+ } | {
48
+ kind: "circle";
49
+ parents: readonly [string, string];
50
+ }>, unknown, z.core.$ZodTypeInternals<Record<string, {
51
+ kind: "point";
52
+ at: {
53
+ x: number;
54
+ y: number;
55
+ };
56
+ } | {
57
+ kind: "point";
58
+ on: string;
59
+ t: number;
60
+ } | {
61
+ kind: "point";
62
+ intersectionOf: readonly [string, string];
63
+ which?: 0 | 1 | undefined;
64
+ } | {
65
+ kind: "segment";
66
+ parents: readonly [string, string];
67
+ } | {
68
+ kind: "line";
69
+ parents: readonly [string, string];
70
+ } | {
71
+ kind: "circle";
72
+ parents: readonly [string, string];
73
+ }>, unknown>>;
74
+ presentation: z.ZodType<Record<string, {
75
+ role: "implicit" | "explicit";
76
+ label?: string | undefined;
77
+ }>, unknown, z.core.$ZodTypeInternals<Record<string, {
78
+ role: "implicit" | "explicit";
79
+ label?: string | undefined;
80
+ }>, unknown>>;
81
+ draggableEntityIds: z.ZodArray<z.ZodString>;
82
+ allowedObjects: z.ZodArray<z.ZodEnum<{
83
+ point: "point";
84
+ segment: "segment";
85
+ line: "line";
86
+ circle: "circle";
87
+ }>>;
88
+ tools: z.ZodArray<z.ZodEnum<{
89
+ ruler: "ruler";
90
+ setSquare: "setSquare";
91
+ protractor: "protractor";
92
+ }>>;
93
+ goals: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
94
+ id: z.ZodString;
95
+ type: z.ZodLiteral<"create">;
96
+ objectType: z.ZodEnum<{
97
+ point: "point";
98
+ segment: "segment";
99
+ line: "line";
100
+ circle: "circle";
101
+ }>;
102
+ }, z.core.$strict>, z.ZodObject<{
103
+ id: z.ZodString;
104
+ type: z.ZodLiteral<"throughPoints">;
105
+ objectType: z.ZodEnum<{
106
+ point: "point";
107
+ segment: "segment";
108
+ line: "line";
109
+ circle: "circle";
110
+ }>;
111
+ pointIds: z.ZodArray<z.ZodString>;
112
+ }, z.core.$strict>, z.ZodObject<{
113
+ id: z.ZodString;
114
+ type: z.ZodLiteral<"perpendicular">;
115
+ objectType: z.ZodEnum<{
116
+ point: "point";
117
+ segment: "segment";
118
+ line: "line";
119
+ circle: "circle";
120
+ }>;
121
+ referenceObjectId: z.ZodString;
122
+ throughPointId: z.ZodString;
123
+ toleranceDegrees: z.ZodNumber;
124
+ }, z.core.$strict>, z.ZodObject<{
125
+ id: z.ZodString;
126
+ type: z.ZodLiteral<"parallel">;
127
+ objectType: z.ZodEnum<{
128
+ point: "point";
129
+ segment: "segment";
130
+ line: "line";
131
+ circle: "circle";
132
+ }>;
133
+ referenceObjectId: z.ZodString;
134
+ throughPointId: z.ZodString;
135
+ toleranceDegrees: z.ZodNumber;
136
+ }, z.core.$strict>, z.ZodObject<{
137
+ id: z.ZodString;
138
+ type: z.ZodLiteral<"segmentLength">;
139
+ objectType: z.ZodLiteral<"segment">;
140
+ targetLength: z.ZodNumber;
141
+ toleranceUnits: z.ZodNumber;
142
+ }, z.core.$strict>, z.ZodObject<{
143
+ id: z.ZodString;
144
+ type: z.ZodLiteral<"midpoint">;
145
+ objectType: z.ZodLiteral<"point">;
146
+ referenceObjectId: z.ZodString;
147
+ toleranceUnits: z.ZodNumber;
148
+ }, z.core.$strict>], "type">>;
149
+ grading: z.ZodOptional<z.ZodObject<{
150
+ extraObjects: z.ZodEnum<{
151
+ allow: "allow";
152
+ reject: "reject";
153
+ }>;
154
+ }, z.core.$strict>>;
155
+ solution: z.ZodOptional<z.ZodObject<{
156
+ schemaVersion: z.ZodLiteral<2>;
157
+ entities: z.ZodType<Record<string, {
158
+ kind: "point";
159
+ at: {
160
+ x: number;
161
+ y: number;
162
+ };
163
+ } | {
164
+ kind: "point";
165
+ on: string;
166
+ t: number;
167
+ } | {
168
+ kind: "point";
169
+ intersectionOf: readonly [string, string];
170
+ which?: 0 | 1 | undefined;
171
+ } | {
172
+ kind: "segment";
173
+ parents: readonly [string, string];
174
+ } | {
175
+ kind: "line";
176
+ parents: readonly [string, string];
177
+ } | {
178
+ kind: "circle";
179
+ parents: readonly [string, string];
180
+ }>, unknown, z.core.$ZodTypeInternals<Record<string, {
181
+ kind: "point";
182
+ at: {
183
+ x: number;
184
+ y: number;
185
+ };
186
+ } | {
187
+ kind: "point";
188
+ on: string;
189
+ t: number;
190
+ } | {
191
+ kind: "point";
192
+ intersectionOf: readonly [string, string];
193
+ which?: 0 | 1 | undefined;
194
+ } | {
195
+ kind: "segment";
196
+ parents: readonly [string, string];
197
+ } | {
198
+ kind: "line";
199
+ parents: readonly [string, string];
200
+ } | {
201
+ kind: "circle";
202
+ parents: readonly [string, string];
203
+ }>, unknown>>;
204
+ presentation: z.ZodType<Record<string, {
205
+ role: "implicit" | "explicit";
206
+ label?: string | undefined;
207
+ }>, unknown, z.core.$ZodTypeInternals<Record<string, {
208
+ role: "implicit" | "explicit";
209
+ label?: string | undefined;
210
+ }>, unknown>>;
211
+ answerEntityIds: z.ZodArray<z.ZodString>;
212
+ }, z.core.$strict>>;
213
+ }, z.core.$strict>;
214
+ export type GeometryExercise = z.infer<typeof geometryExerciseSchema>;
215
+ export declare const geometryExerciseMigrations: readonly MigrationStep[];
216
+ export declare function parseGeometryExercise(input: unknown): GeometryExercise;
217
+ export declare function migrateGeometryExercise(input: unknown): MigrationOutcome;