cubing 0.21.0 → 0.22.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 (417) hide show
  1. package/dist/.DS_Store +0 -0
  2. package/dist/bin/puzzle-geometry-bin.js +9 -5
  3. package/dist/bin/puzzle-geometry-bin.js.map +2 -2
  4. package/dist/bundle-global/cubing.bundle-global.js +284 -303
  5. package/dist/esm/.DS_Store +0 -0
  6. package/dist/esm/3d-3WQVOHX5.js +21 -0
  7. package/dist/esm/3d-3WQVOHX5.js.map +7 -0
  8. package/dist/esm/alg/index.js +1 -1
  9. package/dist/esm/bluetooth/index.js +3 -3
  10. package/dist/esm/bluetooth/index.js.map +1 -1
  11. package/dist/esm/{chunk-RE7MIN5R.js → chunk-4IUYLRHT.js} +2 -2
  12. package/dist/esm/{chunk-RE7MIN5R.js.map → chunk-4IUYLRHT.js.map} +0 -0
  13. package/dist/esm/{chunk-7GADUDIG.js → chunk-7KI3I3Y7.js} +5 -5
  14. package/dist/esm/{chunk-7GADUDIG.js.map → chunk-7KI3I3Y7.js.map} +0 -0
  15. package/dist/esm/{chunk-5DN4DAAX.js → chunk-DLN5QS4V.js} +448 -1052
  16. package/dist/esm/chunk-DLN5QS4V.js.map +7 -0
  17. package/dist/esm/{chunk-BU5PUJK3.js → chunk-EWRBHQFX.js} +1 -1
  18. package/dist/esm/{chunk-BU5PUJK3.js.map → chunk-EWRBHQFX.js.map} +1 -1
  19. package/dist/esm/{chunk-CQS6JZ7G.js → chunk-HXKINJ7U.js} +6 -6
  20. package/dist/esm/{chunk-CQS6JZ7G.js.map → chunk-HXKINJ7U.js.map} +2 -2
  21. package/dist/esm/{chunk-YV3RT5PX.js → chunk-X6JHXPDX.js} +2 -2
  22. package/dist/esm/{chunk-YV3RT5PX.js.map → chunk-X6JHXPDX.js.map} +0 -0
  23. package/dist/esm/kpuzzle/index.js +2 -2
  24. package/dist/esm/notation/index.js +2 -2
  25. package/dist/esm/protocol/index.js +2 -2
  26. package/dist/esm/puzzle-geometry/index.js +10 -6
  27. package/dist/esm/puzzle-geometry/index.js.map +2 -2
  28. package/dist/esm/puzzles/index.js +7 -7
  29. package/dist/esm/scramble/index.js +4 -4
  30. package/dist/esm/search/index.js +4 -4
  31. package/dist/esm/stream/index.js +1 -1
  32. package/dist/esm/twisty/index.js +723 -2344
  33. package/dist/esm/twisty/index.js.map +3 -3
  34. package/dist/esm/{worker-inside-generated-string-KDZOUGJF.js → worker-inside-generated-string-ZA6E6672.js} +21 -21
  35. package/dist/esm/worker-inside-generated-string-ZA6E6672.js.map +7 -0
  36. package/dist/types/alg/index.d.ts +1 -0
  37. package/dist/types/alg/index.d.ts.map +1 -1
  38. package/dist/types/alg/units/leaves/Move.d.ts +1 -1
  39. package/dist/types/alg/units/leaves/Move.d.ts.map +1 -1
  40. package/dist/types/cubing.bundle-global.d.ts +1 -24
  41. package/dist/types/cubing.bundle-global.d.ts.map +1 -1
  42. package/dist/types/puzzle-geometry/PGPuzzles.spec.d.ts +3 -0
  43. package/dist/types/puzzle-geometry/PGPuzzles.spec.d.ts.map +1 -1
  44. package/dist/types/puzzle-geometry/PuzzleGeometry.d.ts +5 -1
  45. package/dist/types/puzzle-geometry/PuzzleGeometry.d.ts.map +1 -1
  46. package/dist/types/puzzles/index.d.ts +6 -2
  47. package/dist/types/puzzles/index.d.ts.map +1 -1
  48. package/dist/types/search/worker-inside-generated-string.d.ts +1 -1
  49. package/dist/types/search/worker-inside-generated-string.d.ts.map +1 -1
  50. package/dist/types/twisty/{old/animation/cursor/CursorTypes.d.ts → controllers/AnimationTypes.d.ts} +10 -3
  51. package/dist/types/twisty/controllers/AnimationTypes.d.ts.map +1 -0
  52. package/dist/types/twisty/{old/animation → controllers}/RenderScheduler.d.ts +0 -0
  53. package/dist/types/twisty/controllers/RenderScheduler.d.ts.map +1 -0
  54. package/dist/types/twisty/controllers/TwistyAnimationController.d.ts +1 -1
  55. package/dist/types/twisty/controllers/TwistyAnimationController.d.ts.map +1 -1
  56. package/dist/types/twisty/{old/animation → controllers}/easing.d.ts +0 -0
  57. package/dist/types/twisty/controllers/easing.d.ts.map +1 -0
  58. package/dist/types/twisty/{old/animation → controllers}/indexer/AlgDuration.d.ts +2 -2
  59. package/dist/types/twisty/controllers/indexer/AlgDuration.d.ts.map +1 -0
  60. package/dist/types/twisty/{old/animation → controllers}/indexer/AlgIndexer.d.ts +3 -3
  61. package/dist/types/twisty/controllers/indexer/AlgIndexer.d.ts.map +1 -0
  62. package/dist/types/twisty/{old/animation → controllers}/indexer/SimpleAlgIndexer.d.ts +3 -3
  63. package/dist/types/twisty/controllers/indexer/SimpleAlgIndexer.d.ts.map +1 -0
  64. package/dist/types/twisty/{old/animation → controllers}/indexer/simultaneous-moves/SimultaneousMoveIndexer.d.ts +3 -3
  65. package/dist/types/twisty/controllers/indexer/simultaneous-moves/SimultaneousMoveIndexer.d.ts.map +1 -0
  66. package/dist/types/twisty/{old/animation → controllers}/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.d.ts +3 -3
  67. package/dist/types/twisty/controllers/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.d.ts.map +1 -0
  68. package/dist/types/twisty/{old/animation → controllers}/indexer/simultaneous-moves/simul-moves.d.ts +2 -2
  69. package/dist/types/twisty/controllers/indexer/simultaneous-moves/simul-moves.d.ts.map +1 -0
  70. package/dist/types/twisty/{old/animation → controllers}/indexer/tree/AlgWalker.d.ts +2 -2
  71. package/dist/types/twisty/controllers/indexer/tree/AlgWalker.d.ts.map +1 -0
  72. package/dist/types/twisty/{old/animation → controllers}/indexer/tree/TreeAlgIndexer.d.ts +3 -3
  73. package/dist/types/twisty/controllers/indexer/tree/TreeAlgIndexer.d.ts.map +1 -0
  74. package/dist/types/twisty/controllers/indexer/tree/chunkAlgs.d.ts +3 -0
  75. package/dist/types/twisty/controllers/indexer/tree/chunkAlgs.d.ts.map +1 -0
  76. package/dist/types/twisty/{old/animation → controllers}/stream/timeline-move-calculation-draft.d.ts +2 -2
  77. package/dist/types/twisty/controllers/stream/timeline-move-calculation-draft.d.ts.map +1 -0
  78. package/dist/types/twisty/heavy-code-imports/dynamic-entries/3d.d.ts +1 -2
  79. package/dist/types/twisty/heavy-code-imports/dynamic-entries/3d.d.ts.map +1 -1
  80. package/dist/types/twisty/index.d.ts +9 -12
  81. package/dist/types/twisty/index.d.ts.map +1 -1
  82. package/dist/types/twisty/model/TwistyPlayerModel.d.ts +11 -0
  83. package/dist/types/twisty/model/TwistyPlayerModel.d.ts.map +1 -1
  84. package/dist/types/twisty/model/props/TwistyPropDebugger.d.ts +1 -1
  85. package/dist/types/twisty/model/props/TwistyPropDebugger.d.ts.map +1 -1
  86. package/dist/types/twisty/model/props/puzzle/display/FoundationDisplayProp.d.ts +6 -0
  87. package/dist/types/twisty/model/props/puzzle/display/FoundationDisplayProp.d.ts.map +1 -0
  88. package/dist/types/twisty/model/props/puzzle/display/HintFaceletProp.d.ts +5 -1
  89. package/dist/types/twisty/model/props/puzzle/display/HintFaceletProp.d.ts.map +1 -1
  90. package/dist/types/twisty/model/props/puzzle/display/StickeringProp.d.ts +44 -1
  91. package/dist/types/twisty/model/props/puzzle/display/StickeringProp.d.ts.map +1 -1
  92. package/dist/types/twisty/model/props/puzzle/state/AnchoredStartProp.d.ts +2 -2
  93. package/dist/types/twisty/model/props/puzzle/state/AnchoredStartProp.d.ts.map +1 -1
  94. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesProp.d.ts +1 -1
  95. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesProp.d.ts.map +1 -1
  96. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesSimplified.d.ts +1 -1
  97. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesSimplified.d.ts.map +1 -1
  98. package/dist/types/twisty/model/props/puzzle/state/CurrentTransformationProp.d.ts +1 -1
  99. package/dist/types/twisty/model/props/puzzle/state/CurrentTransformationProp.d.ts.map +1 -1
  100. package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorProp.d.ts +5 -2
  101. package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorProp.d.ts.map +1 -1
  102. package/dist/types/twisty/model/props/puzzle/state/IndexerProp.d.ts +2 -2
  103. package/dist/types/twisty/model/props/puzzle/state/IndexerProp.d.ts.map +1 -1
  104. package/dist/types/twisty/model/props/puzzle/state/LegacyPositionProp.d.ts +2 -2
  105. package/dist/types/twisty/model/props/puzzle/state/LegacyPositionProp.d.ts.map +1 -1
  106. package/dist/types/twisty/model/props/puzzle/state/MovePressInputProp.d.ts +6 -0
  107. package/dist/types/twisty/model/props/puzzle/state/MovePressInputProp.d.ts.map +1 -0
  108. package/dist/types/twisty/model/props/puzzle/state/NaiveMoveCountProp.d.ts +10 -0
  109. package/dist/types/twisty/model/props/puzzle/state/NaiveMoveCountProp.d.ts.map +1 -0
  110. package/dist/types/twisty/model/props/puzzle/state/SetupAnchorProp.d.ts +5 -1
  111. package/dist/types/twisty/model/props/puzzle/state/SetupAnchorProp.d.ts.map +1 -1
  112. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDProp.d.ts +1 -1
  113. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDProp.d.ts.map +1 -1
  114. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.d.ts +19 -1
  115. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.d.ts.map +1 -1
  116. package/dist/types/twisty/model/props/puzzle/structure/PuzzleLoaderProp.d.ts +1 -1
  117. package/dist/types/twisty/model/props/puzzle/structure/PuzzleLoaderProp.d.ts.map +1 -1
  118. package/dist/types/twisty/model/props/timeline/DetailedTimelineInfoProp.d.ts +2 -3
  119. package/dist/types/twisty/model/props/timeline/DetailedTimelineInfoProp.d.ts.map +1 -1
  120. package/dist/types/twisty/model/props/timeline/PlayingInfoProp.d.ts +1 -1
  121. package/dist/types/twisty/model/props/timeline/PlayingInfoProp.d.ts.map +1 -1
  122. package/dist/types/twisty/model/props/timeline/TimestampRequestProp.d.ts +1 -1
  123. package/dist/types/twisty/model/props/timeline/TimestampRequestProp.d.ts.map +1 -1
  124. package/dist/types/twisty/model/props/viewer/BackViewProp.d.ts +6 -1
  125. package/dist/types/twisty/model/props/viewer/BackViewProp.d.ts.map +1 -1
  126. package/dist/types/twisty/model/props/viewer/BackgroundProp.d.ts +5 -1
  127. package/dist/types/twisty/model/props/viewer/BackgroundProp.d.ts.map +1 -1
  128. package/dist/types/twisty/model/props/viewer/ControlPanelProp.d.ts +5 -1
  129. package/dist/types/twisty/model/props/viewer/ControlPanelProp.d.ts.map +1 -1
  130. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesProp.d.ts +18 -5
  131. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesProp.d.ts.map +1 -1
  132. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesRequestProp.d.ts +6 -6
  133. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesRequestProp.d.ts.map +1 -1
  134. package/dist/types/twisty/model/props/viewer/TimeRangeProp.d.ts +2 -2
  135. package/dist/types/twisty/model/props/viewer/TimeRangeProp.d.ts.map +1 -1
  136. package/dist/types/twisty/model/props/viewer/ViewerLinkProp.d.ts +5 -1
  137. package/dist/types/twisty/model/props/viewer/ViewerLinkProp.d.ts.map +1 -1
  138. package/dist/types/twisty/model/props/viewer/VisualizationProp.d.ts +7 -1
  139. package/dist/types/twisty/model/props/viewer/VisualizationProp.d.ts.map +1 -1
  140. package/dist/types/twisty/model/props/viewer/VisualizationStrategyProp.d.ts +1 -1
  141. package/dist/types/twisty/model/props/viewer/VisualizationStrategyProp.d.ts.map +1 -1
  142. package/dist/types/twisty/views/2D/Twisty2DPuzzle.css.d.ts +3 -0
  143. package/dist/types/twisty/views/2D/Twisty2DPuzzle.css.d.ts.map +1 -0
  144. package/dist/types/twisty/views/2D/Twisty2DPuzzle.d.ts +4 -6
  145. package/dist/types/twisty/views/2D/Twisty2DPuzzle.d.ts.map +1 -1
  146. package/dist/types/twisty/views/2D/Twisty2DPuzzleWrapper.d.ts +1 -1
  147. package/dist/types/twisty/views/2D/Twisty2DPuzzleWrapper.d.ts.map +1 -1
  148. package/dist/types/twisty/views/2D/Twisty2DSceneWrapper.d.ts +2 -2
  149. package/dist/types/twisty/views/2D/Twisty2DSceneWrapper.d.ts.map +1 -1
  150. package/dist/types/twisty/views/3D/DragTracker.d.ts +28 -0
  151. package/dist/types/twisty/views/3D/DragTracker.d.ts.map +1 -0
  152. package/dist/types/twisty/views/3D/RendererPool.d.ts.map +1 -1
  153. package/dist/types/twisty/views/3D/Twisty3DPuzzleWrapper.d.ts +6 -1
  154. package/dist/types/twisty/views/3D/Twisty3DPuzzleWrapper.d.ts.map +1 -1
  155. package/dist/types/twisty/views/3D/Twisty3DSceneWrapper.d.ts +9 -4
  156. package/dist/types/twisty/views/3D/Twisty3DSceneWrapper.d.ts.map +1 -1
  157. package/dist/types/twisty/views/3D/Twisty3DVantage.css.d.ts +3 -0
  158. package/dist/types/twisty/views/3D/Twisty3DVantage.css.d.ts.map +1 -0
  159. package/dist/types/twisty/views/3D/Twisty3DVantage.d.ts +12 -8
  160. package/dist/types/twisty/views/3D/Twisty3DVantage.d.ts.map +1 -1
  161. package/dist/types/twisty/views/3D/TwistyOrbitControls.d.ts +24 -0
  162. package/dist/types/twisty/views/3D/TwistyOrbitControls.d.ts.map +1 -0
  163. package/dist/types/twisty/views/3D/TwistyOrbitControls.spec.d.ts +5 -0
  164. package/dist/types/twisty/views/3D/TwistyOrbitControls.spec.d.ts.map +1 -0
  165. package/dist/types/twisty/views/3D/puzzles/Cube3D.d.ts +4 -4
  166. package/dist/types/twisty/views/3D/puzzles/Cube3D.d.ts.map +1 -1
  167. package/dist/types/twisty/views/3D/puzzles/PG3D.d.ts +17 -10
  168. package/dist/types/twisty/views/3D/puzzles/PG3D.d.ts.map +1 -1
  169. package/dist/types/twisty/views/3D/puzzles/Twisty3DPuzzle.d.ts +1 -1
  170. package/dist/types/twisty/views/3D/puzzles/Twisty3DPuzzle.d.ts.map +1 -1
  171. package/dist/types/twisty/{old/dom/element → views}/ClassListManager.d.ts +0 -0
  172. package/dist/types/twisty/views/ClassListManager.d.ts.map +1 -0
  173. package/dist/types/twisty/{old/dom/element → views}/ManagedCustomElement.d.ts +0 -0
  174. package/dist/types/twisty/views/ManagedCustomElement.d.ts.map +1 -0
  175. package/dist/types/twisty/views/TwistyAlgEditor/LeafTokens.d.ts +1 -1
  176. package/dist/types/twisty/views/TwistyAlgEditor/LeafTokens.d.ts.map +1 -1
  177. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.css.d.ts +1 -1
  178. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.css.d.ts.map +1 -1
  179. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.d.ts +2 -1
  180. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.d.ts.map +1 -1
  181. package/dist/types/twisty/views/TwistyAlgViewer.css.d.ts +1 -1
  182. package/dist/types/twisty/views/TwistyAlgViewer.css.d.ts.map +1 -1
  183. package/dist/types/twisty/views/TwistyAlgViewer.d.ts +2 -2
  184. package/dist/types/twisty/views/TwistyAlgViewer.d.ts.map +1 -1
  185. package/dist/types/twisty/views/TwistyPlayer.css.d.ts +3 -0
  186. package/dist/types/twisty/views/TwistyPlayer.css.d.ts.map +1 -0
  187. package/dist/types/twisty/views/TwistyPlayer.d.ts +7 -3
  188. package/dist/types/twisty/views/TwistyPlayer.d.ts.map +1 -1
  189. package/dist/types/twisty/views/TwistyPlayerSettable.d.ts +7 -4
  190. package/dist/types/twisty/views/TwistyPlayerSettable.d.ts.map +1 -1
  191. package/dist/types/twisty/views/TwistyViewerWrapper.css.d.ts +3 -0
  192. package/dist/types/twisty/views/TwistyViewerWrapper.css.d.ts.map +1 -0
  193. package/dist/types/twisty/{old/dom/viewers → views}/canvas.d.ts +0 -0
  194. package/dist/types/twisty/views/canvas.d.ts.map +1 -0
  195. package/dist/types/twisty/views/control-panel/TwistyButtonsV2.css.d.ts +4 -0
  196. package/dist/types/twisty/views/control-panel/TwistyButtonsV2.css.d.ts.map +1 -0
  197. package/dist/types/twisty/views/control-panel/TwistyButtonsV2.d.ts +1 -1
  198. package/dist/types/twisty/views/control-panel/TwistyButtonsV2.d.ts.map +1 -1
  199. package/dist/types/twisty/views/control-panel/TwistyScrubber.css.d.ts +3 -0
  200. package/dist/types/twisty/{old/dom/controls → views/control-panel}/TwistyScrubber.css.d.ts.map +1 -1
  201. package/dist/types/twisty/views/control-panel/TwistyScrubberV2.d.ts +1 -1
  202. package/dist/types/twisty/views/control-panel/TwistyScrubberV2.d.ts.map +1 -1
  203. package/dist/types/twisty/{old/dom/element → views}/node-custom-element-shims.d.ts +0 -0
  204. package/dist/types/twisty/views/node-custom-element-shims.d.ts.map +1 -0
  205. package/dist/types/twisty/views/stream/TwistyStreamSource.css.d.ts +3 -0
  206. package/dist/types/twisty/views/stream/TwistyStreamSource.css.d.ts.map +1 -0
  207. package/dist/types/twisty/{old/dom → views}/stream/TwistyStreamSource.d.ts +1 -1
  208. package/dist/types/twisty/views/stream/TwistyStreamSource.d.ts.map +1 -0
  209. package/docs/.DS_Store +0 -0
  210. package/docs/cubing/.DS_Store +0 -0
  211. package/docs/cubing/api/index.html +11 -52
  212. package/package.json +1 -1
  213. package/src/cubing/.DS_Store +0 -0
  214. package/src/cubing/alg/index.ts +1 -0
  215. package/src/cubing/alg/units/leaves/Move.ts +1 -1
  216. package/src/cubing/bluetooth/smart-timer/GanTimer.ts +1 -1
  217. package/src/cubing/cubing.bundle-global.ts +2 -2
  218. package/src/cubing/puzzle-geometry/PGPuzzles.spec.ts +4 -0
  219. package/src/cubing/puzzle-geometry/PuzzleGeometry.ts +14 -6
  220. package/src/cubing/puzzles/index.ts +3 -3
  221. package/src/cubing/search/worker-inside-generated-string.js +1 -1
  222. package/src/cubing/twisty/.DS_Store +0 -0
  223. package/src/cubing/{kpuzzle → twisty/controllers}/.DS_Store +0 -0
  224. package/src/cubing/twisty/{old/animation/cursor/CursorTypes.ts → controllers/AnimationTypes.ts} +11 -2
  225. package/src/cubing/twisty/{old/animation → controllers}/RenderScheduler.ts +0 -0
  226. package/src/cubing/twisty/controllers/TwistyAnimationController.ts +4 -4
  227. package/src/cubing/{search → twisty/controllers/animation}/.DS_Store +0 -0
  228. package/src/cubing/twisty/{old/animation → controllers}/easing.ts +0 -0
  229. package/src/cubing/{vendor → twisty/controllers/indexer}/.DS_Store +0 -0
  230. package/src/cubing/twisty/{old/animation → controllers}/indexer/AlgDuration.ts +2 -2
  231. package/src/cubing/twisty/{old/animation → controllers}/indexer/AlgIndexer.ts +4 -4
  232. package/src/cubing/twisty/{old/animation → controllers}/indexer/SimpleAlgIndexer.ts +4 -4
  233. package/src/cubing/twisty/{old/animation → controllers}/indexer/simultaneous-moves/SimultaneousMoveIndexer.ts +3 -3
  234. package/src/cubing/twisty/{old/animation → controllers}/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.ts +3 -3
  235. package/src/cubing/twisty/{old/animation → controllers}/indexer/simultaneous-moves/simul-moves.ts +2 -2
  236. package/src/cubing/twisty/{old/animation → controllers}/indexer/tree/AlgWalker.ts +4 -4
  237. package/src/cubing/twisty/{old/animation → controllers}/indexer/tree/TreeAlgIndexer.ts +3 -3
  238. package/src/cubing/twisty/{old/animation → controllers}/indexer/tree/chunkAlgs.ts +2 -2
  239. package/src/cubing/twisty/{old/animation → controllers}/stream/timeline-move-calculation-draft.spec.ts.TODO +0 -0
  240. package/src/cubing/twisty/{old/animation → controllers}/stream/timeline-move-calculation-draft.ts +2 -2
  241. package/src/cubing/{alg → twisty/heavy-code-imports}/.DS_Store +0 -0
  242. package/src/cubing/twisty/heavy-code-imports/dynamic-entries/3d.ts +2 -12
  243. package/src/cubing/twisty/index.ts +12 -19
  244. package/src/cubing/twisty/model/.DS_Store +0 -0
  245. package/src/cubing/twisty/model/TwistyPlayerModel.ts +30 -1
  246. package/src/cubing/twisty/model/props/.DS_Store +0 -0
  247. package/src/cubing/twisty/model/props/TwistyPropDebugger.ts +3 -3
  248. package/src/cubing/twisty/model/props/puzzle/.DS_Store +0 -0
  249. package/src/cubing/twisty/model/props/puzzle/display/FoundationDisplayProp.ts +9 -0
  250. package/src/cubing/twisty/model/props/puzzle/display/HintFaceletProp.ts +6 -1
  251. package/src/cubing/twisty/model/props/puzzle/display/StickeringProp.ts +47 -1
  252. package/src/cubing/twisty/model/props/puzzle/state/AlgTransformationProp.ts +1 -1
  253. package/src/cubing/twisty/model/props/puzzle/state/AnchoredStartProp.ts +2 -2
  254. package/src/cubing/twisty/model/props/puzzle/state/CurrentLeavesProp.ts +2 -2
  255. package/src/cubing/twisty/model/props/puzzle/state/CurrentLeavesSimplified.ts +1 -1
  256. package/src/cubing/twisty/model/props/puzzle/state/CurrentTransformationProp.ts +1 -1
  257. package/src/cubing/twisty/model/props/puzzle/state/IndexerConstructorProp.ts +12 -5
  258. package/src/cubing/twisty/model/props/puzzle/state/IndexerProp.ts +2 -2
  259. package/src/cubing/twisty/model/props/puzzle/state/LegacyPositionProp.ts +2 -2
  260. package/src/cubing/twisty/model/props/puzzle/state/MovePressInputProp.ts +9 -0
  261. package/src/cubing/twisty/model/props/puzzle/state/NaiveMoveCountProp.ts +20 -0
  262. package/src/cubing/twisty/model/props/puzzle/state/SetupAnchorProp.ts +7 -1
  263. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleIDProp.ts +1 -1
  264. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.ts +20 -1
  265. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleLoaderProp.ts +1 -1
  266. package/src/cubing/twisty/model/props/timeline/DetailedTimelineInfoProp.ts +5 -3
  267. package/src/cubing/twisty/model/props/timeline/PlayingInfoProp.ts +1 -4
  268. package/src/cubing/twisty/model/props/timeline/TimestampRequestProp.ts +1 -1
  269. package/src/cubing/twisty/model/props/viewer/BackViewProp.ts +7 -1
  270. package/src/cubing/twisty/model/props/viewer/BackgroundProp.ts +6 -1
  271. package/src/cubing/twisty/model/props/viewer/ControlPanelProp.ts +5 -1
  272. package/src/cubing/twisty/model/props/viewer/OrbitCoordinatesProp.ts +83 -12
  273. package/src/cubing/twisty/model/props/viewer/OrbitCoordinatesRequestProp.ts +8 -8
  274. package/src/cubing/twisty/model/props/viewer/TimeRangeProp.ts +2 -2
  275. package/src/cubing/twisty/model/props/viewer/ViewerLinkProp.ts +5 -1
  276. package/src/cubing/twisty/model/props/viewer/VisualizationProp.ts +8 -1
  277. package/src/cubing/twisty/model/props/viewer/VisualizationStrategyProp.ts +1 -1
  278. package/src/cubing/twisty/old/.DS_Store +0 -0
  279. package/src/cubing/twisty/old/animation/.DS_Store +0 -0
  280. package/src/cubing/twisty/old/dom/.DS_Store +0 -0
  281. package/src/cubing/twisty/views/.DS_Store +0 -0
  282. package/src/cubing/twisty/{old/dom/viewers/Twisty2DSVGView.css.ts → views/2D/Twisty2DPuzzle.css.ts} +1 -1
  283. package/src/cubing/twisty/views/2D/Twisty2DPuzzle.ts +8 -12
  284. package/src/cubing/twisty/views/2D/Twisty2DPuzzleWrapper.ts +1 -1
  285. package/src/cubing/twisty/views/2D/Twisty2DSceneWrapper.ts +4 -4
  286. package/src/cubing/twisty/{old/animation/indexer → views/3D}/.DS_Store +0 -0
  287. package/src/cubing/twisty/views/3D/DragTracker.ts +184 -0
  288. package/src/cubing/twisty/views/3D/RendererPool.ts +2 -1
  289. package/src/cubing/twisty/views/3D/Twisty3DPuzzleWrapper.ts +51 -5
  290. package/src/cubing/twisty/views/3D/Twisty3DSceneWrapper.ts +51 -10
  291. package/src/cubing/twisty/{old/dom/viewers/Twisty3DCanvas.css.ts → views/3D/Twisty3DVantage.css.ts} +2 -2
  292. package/src/cubing/twisty/views/3D/Twisty3DVantage.ts +103 -35
  293. package/src/cubing/twisty/views/3D/TwistyOrbitControls.spec.ts +213 -0
  294. package/src/cubing/twisty/views/3D/TwistyOrbitControls.ts +176 -0
  295. package/src/cubing/twisty/views/3D/puzzles/Cube3D.ts +5 -9
  296. package/src/cubing/twisty/views/3D/puzzles/PG3D.ts +127 -37
  297. package/src/cubing/twisty/views/3D/puzzles/Twisty3DPuzzle.ts +1 -1
  298. package/src/cubing/twisty/{old/dom/element → views}/ClassListManager.ts +0 -0
  299. package/src/cubing/twisty/{old/dom/element → views}/ManagedCustomElement.ts +0 -0
  300. package/src/cubing/twisty/views/TwistyAlgEditor/LeafTokens.ts +1 -1
  301. package/src/cubing/twisty/views/TwistyAlgEditor/TwistyAlgEditor.css.ts +1 -1
  302. package/src/cubing/twisty/views/TwistyAlgEditor/TwistyAlgEditor.ts +11 -4
  303. package/src/cubing/twisty/views/TwistyAlgViewer.css.ts +1 -1
  304. package/src/cubing/twisty/views/TwistyAlgViewer.ts +4 -4
  305. package/src/cubing/twisty/{old/dom → views}/TwistyPlayer.css.ts +4 -1
  306. package/src/cubing/twisty/views/TwistyPlayer.ts +16 -25
  307. package/src/cubing/twisty/views/TwistyPlayerSettable.ts +14 -10
  308. package/src/cubing/twisty/{old/dom/viewers → views}/TwistyViewerWrapper.css.ts +1 -1
  309. package/src/cubing/twisty/{old/dom/viewers → views}/canvas.ts +0 -0
  310. package/src/cubing/twisty/{old/dom/controls/buttons.css.ts → views/control-panel/TwistyButtonsV2.css.ts} +1 -1
  311. package/src/cubing/twisty/views/control-panel/TwistyButtonsV2.ts +5 -8
  312. package/src/cubing/twisty/{old/dom/controls → views/control-panel}/TwistyScrubber.css.ts +1 -1
  313. package/src/cubing/twisty/views/control-panel/TwistyScrubberV2.ts +3 -3
  314. package/src/cubing/twisty/{old/dom/element → views}/node-custom-element-shims.ts +0 -0
  315. package/src/cubing/twisty/{old/dom → views}/stream/TwistyStreamSource.css.ts +1 -1
  316. package/src/cubing/twisty/{old/dom → views}/stream/TwistyStreamSource.ts +9 -9
  317. package/dist/esm/3d-JZD3V366.js +0 -39
  318. package/dist/esm/3d-JZD3V366.js.map +0 -7
  319. package/dist/esm/chunk-5DN4DAAX.js.map +0 -7
  320. package/dist/esm/worker-inside-generated-string-KDZOUGJF.js.map +0 -7
  321. package/dist/types/twisty/old/animation/RenderScheduler.d.ts.map +0 -1
  322. package/dist/types/twisty/old/animation/Timeline.d.ts +0 -72
  323. package/dist/types/twisty/old/animation/Timeline.d.ts.map +0 -1
  324. package/dist/types/twisty/old/animation/cursor/AlgCursor.d.ts +0 -53
  325. package/dist/types/twisty/old/animation/cursor/AlgCursor.d.ts.map +0 -1
  326. package/dist/types/twisty/old/animation/cursor/CursorTypes.d.ts.map +0 -1
  327. package/dist/types/twisty/old/animation/easing.d.ts.map +0 -1
  328. package/dist/types/twisty/old/animation/indexer/AlgDuration.d.ts.map +0 -1
  329. package/dist/types/twisty/old/animation/indexer/AlgIndexer.d.ts.map +0 -1
  330. package/dist/types/twisty/old/animation/indexer/SimpleAlgIndexer.d.ts.map +0 -1
  331. package/dist/types/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexer.d.ts.map +0 -1
  332. package/dist/types/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.d.ts.map +0 -1
  333. package/dist/types/twisty/old/animation/indexer/simultaneous-moves/simul-moves.d.ts.map +0 -1
  334. package/dist/types/twisty/old/animation/indexer/tree/AlgWalker.d.ts.map +0 -1
  335. package/dist/types/twisty/old/animation/indexer/tree/TreeAlgIndexer.d.ts.map +0 -1
  336. package/dist/types/twisty/old/animation/indexer/tree/chunkAlgs.d.ts +0 -3
  337. package/dist/types/twisty/old/animation/indexer/tree/chunkAlgs.d.ts.map +0 -1
  338. package/dist/types/twisty/old/animation/stream/timeline-move-calculation-draft.d.ts.map +0 -1
  339. package/dist/types/twisty/old/dom/TwistyAlgViewerV1.css.d.ts +0 -3
  340. package/dist/types/twisty/old/dom/TwistyAlgViewerV1.css.d.ts.map +0 -1
  341. package/dist/types/twisty/old/dom/TwistyAlgViewerV1.d.ts +0 -52
  342. package/dist/types/twisty/old/dom/TwistyAlgViewerV1.d.ts.map +0 -1
  343. package/dist/types/twisty/old/dom/TwistyPlayer.css.d.ts +0 -3
  344. package/dist/types/twisty/old/dom/TwistyPlayer.css.d.ts.map +0 -1
  345. package/dist/types/twisty/old/dom/TwistyPlayer.d.ts +0 -92
  346. package/dist/types/twisty/old/dom/TwistyPlayer.d.ts.map +0 -1
  347. package/dist/types/twisty/old/dom/TwistyPlayer.spec.d.ts +0 -5
  348. package/dist/types/twisty/old/dom/TwistyPlayer.spec.d.ts.map +0 -1
  349. package/dist/types/twisty/old/dom/TwistyPlayerConfig.d.ts +0 -165
  350. package/dist/types/twisty/old/dom/TwistyPlayerConfig.d.ts.map +0 -1
  351. package/dist/types/twisty/old/dom/controls/TwistyControlElement.d.ts +0 -2
  352. package/dist/types/twisty/old/dom/controls/TwistyControlElement.d.ts.map +0 -1
  353. package/dist/types/twisty/old/dom/controls/TwistyScrubber.css.d.ts +0 -3
  354. package/dist/types/twisty/old/dom/controls/TwistyScrubber.d.ts +0 -14
  355. package/dist/types/twisty/old/dom/controls/TwistyScrubber.d.ts.map +0 -1
  356. package/dist/types/twisty/old/dom/controls/buttons.css.d.ts +0 -4
  357. package/dist/types/twisty/old/dom/controls/buttons.css.d.ts.map +0 -1
  358. package/dist/types/twisty/old/dom/controls/buttons.d.ts +0 -40
  359. package/dist/types/twisty/old/dom/controls/buttons.d.ts.map +0 -1
  360. package/dist/types/twisty/old/dom/controls/buttons.spec.d.ts +0 -5
  361. package/dist/types/twisty/old/dom/controls/buttons.spec.d.ts.map +0 -1
  362. package/dist/types/twisty/old/dom/element/ClassListManager.d.ts.map +0 -1
  363. package/dist/types/twisty/old/dom/element/ElementConfig.d.ts +0 -49
  364. package/dist/types/twisty/old/dom/element/ElementConfig.d.ts.map +0 -1
  365. package/dist/types/twisty/old/dom/element/ManagedCustomElement.d.ts.map +0 -1
  366. package/dist/types/twisty/old/dom/element/node-custom-element-shims.d.ts.map +0 -1
  367. package/dist/types/twisty/old/dom/stream/TwistyStreamSource.css.d.ts +0 -3
  368. package/dist/types/twisty/old/dom/stream/TwistyStreamSource.css.d.ts.map +0 -1
  369. package/dist/types/twisty/old/dom/stream/TwistyStreamSource.d.ts.map +0 -1
  370. package/dist/types/twisty/old/dom/viewers/Twisty2DSVG.d.ts +0 -26
  371. package/dist/types/twisty/old/dom/viewers/Twisty2DSVG.d.ts.map +0 -1
  372. package/dist/types/twisty/old/dom/viewers/Twisty2DSVGView.css.d.ts +0 -3
  373. package/dist/types/twisty/old/dom/viewers/Twisty2DSVGView.css.d.ts.map +0 -1
  374. package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.css.d.ts +0 -3
  375. package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.css.d.ts.map +0 -1
  376. package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.d.ts +0 -41
  377. package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.d.ts.map +0 -1
  378. package/dist/types/twisty/old/dom/viewers/TwistyOrbitControls.d.ts +0 -59
  379. package/dist/types/twisty/old/dom/viewers/TwistyOrbitControls.d.ts.map +0 -1
  380. package/dist/types/twisty/old/dom/viewers/TwistyViewerElement.d.ts +0 -4
  381. package/dist/types/twisty/old/dom/viewers/TwistyViewerElement.d.ts.map +0 -1
  382. package/dist/types/twisty/old/dom/viewers/TwistyViewerWrapper.css.d.ts +0 -3
  383. package/dist/types/twisty/old/dom/viewers/TwistyViewerWrapper.css.d.ts.map +0 -1
  384. package/dist/types/twisty/old/dom/viewers/TwistyViewerWrapper.d.ts +0 -18
  385. package/dist/types/twisty/old/dom/viewers/TwistyViewerWrapper.d.ts.map +0 -1
  386. package/dist/types/twisty/old/dom/viewers/canvas.d.ts.map +0 -1
  387. package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.d.ts +0 -41
  388. package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.d.ts.map +0 -1
  389. package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.spec.d.ts +0 -5
  390. package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.spec.d.ts.map +0 -1
  391. package/dist/types/twisty/views/3D/puzzles/TwistyTestBox.d.ts +0 -9
  392. package/dist/types/twisty/views/3D/puzzles/TwistyTestBox.d.ts.map +0 -1
  393. package/src/cubing/alg/units/.DS_Store +0 -0
  394. package/src/cubing/bluetooth/.DS_Store +0 -0
  395. package/src/cubing/puzzles/.DS_Store +0 -0
  396. package/src/cubing/puzzles/implementations/.DS_Store +0 -0
  397. package/src/cubing/stream/.DS_Store +0 -0
  398. package/src/cubing/twisty/old/animation/Timeline.ts +0 -378
  399. package/src/cubing/twisty/old/animation/cursor/AlgCursor.ts +0 -252
  400. package/src/cubing/twisty/old/dom/TwistyAlgViewerV1.css.ts +0 -25
  401. package/src/cubing/twisty/old/dom/TwistyAlgViewerV1.ts +0 -516
  402. package/src/cubing/twisty/old/dom/TwistyPlayer.spec.ts +0 -25
  403. package/src/cubing/twisty/old/dom/TwistyPlayer.ts +0 -927
  404. package/src/cubing/twisty/old/dom/TwistyPlayerConfig.ts +0 -378
  405. package/src/cubing/twisty/old/dom/controls/TwistyControlElement.ts +0 -1
  406. package/src/cubing/twisty/old/dom/controls/TwistyScrubber.ts +0 -53
  407. package/src/cubing/twisty/old/dom/controls/buttons.spec.ts +0 -37
  408. package/src/cubing/twisty/old/dom/controls/buttons.ts +0 -326
  409. package/src/cubing/twisty/old/dom/element/ElementConfig.ts +0 -180
  410. package/src/cubing/twisty/old/dom/viewers/Twisty2DSVG.ts +0 -118
  411. package/src/cubing/twisty/old/dom/viewers/Twisty3DCanvas.ts +0 -256
  412. package/src/cubing/twisty/old/dom/viewers/TwistyOrbitControls.ts +0 -420
  413. package/src/cubing/twisty/old/dom/viewers/TwistyViewerElement.ts +0 -5
  414. package/src/cubing/twisty/old/dom/viewers/TwistyViewerWrapper.ts +0 -45
  415. package/src/cubing/twisty/views/3D/TwistyOrbitControlsV2.spec.ts +0 -209
  416. package/src/cubing/twisty/views/3D/TwistyOrbitControlsV2.ts +0 -270
  417. package/src/cubing/twisty/views/3D/puzzles/TwistyTestBox.ts +0 -22
@@ -1,14 +1,15 @@
1
- import type { Texture as ThreeTexture } from "three";
1
+ import type { Raycaster, Texture as ThreeTexture } from "three";
2
2
  import { experimentalCubeAppearance, PuzzleLoader } from "../../../puzzles";
3
3
  import type { ExperimentalStickering } from "../../../twisty";
4
4
  import { proxy3D } from "../../heavy-code-imports/3d";
5
- import type { Cube3D, PG3D } from "../../heavy-code-imports/dynamic-entries/3d";
5
+ import { Cube3D, PG3D } from "../../heavy-code-imports/dynamic-entries/3d";
6
+ import type { FoundationDisplay } from "../../model/props/puzzle/display/FoundationDisplayProp";
6
7
  import type { HintFaceletStyleWithAuto } from "../../model/props/puzzle/display/HintFaceletProp";
8
+ import { FreshListenerManager } from "../../model/props/TwistyProp";
7
9
  import type { VisualizationStrategy } from "../../model/props/viewer/VisualizationStrategyProp";
8
10
  import type { TwistyPlayerModel } from "../../model/TwistyPlayerModel";
9
- import { FreshListenerManager } from "../../model/props/TwistyProp";
10
- import type { PuzzlePosition } from "../../old/animation/cursor/CursorTypes";
11
- import type { Schedulable } from "../../old/animation/RenderScheduler";
11
+ import type { PuzzlePosition } from "../../controllers/AnimationTypes";
12
+ import type { Schedulable } from "../../controllers/RenderScheduler";
12
13
  import type { Twisty3DPuzzle } from "./puzzles/Twisty3DPuzzle";
13
14
 
14
15
  export class Twisty3DPuzzleWrapper implements Schedulable {
@@ -61,6 +62,17 @@ export class Twisty3DPuzzleWrapper implements Schedulable {
61
62
  this.scheduleRender();
62
63
  },
63
64
  );
65
+ this.#freshListenerManager.addListener(
66
+ this.model.foundationDisplayProp,
67
+ async (foundationDisplay: FoundationDisplay) => {
68
+ (
69
+ (await this.twisty3DPuzzle()) as Cube3D | PG3D
70
+ ).experimentalUpdateOptions({
71
+ showFoundation: foundationDisplay !== "none",
72
+ });
73
+ this.scheduleRender();
74
+ },
75
+ );
64
76
  this.#freshListenerManager.addListener(
65
77
  this.model.stickeringProp,
66
78
  async (stickering: ExperimentalStickering) => {
@@ -165,4 +177,38 @@ export class Twisty3DPuzzleWrapper implements Schedulable {
165
177
  }
166
178
  })());
167
179
  }
180
+
181
+ async raycastMove(
182
+ raycasterPromise: Promise<Raycaster>,
183
+ transformations: {
184
+ invert: boolean;
185
+ depth?: "secondSlice" | "rotation" | "none";
186
+ },
187
+ ): Promise<void> {
188
+ const puzzle = await this.twisty3DPuzzle();
189
+ // TODO: check this differently.
190
+ if (!(puzzle instanceof PG3D)) {
191
+ console.info("not PG3D! skipping raycast");
192
+ return;
193
+ }
194
+
195
+ const targets = puzzle.experimentalGetControlTargets(); // TODO: sticker targets
196
+ const [raycaster] = await Promise.all([raycasterPromise]);
197
+
198
+ const intersects = raycaster.intersectObjects(targets);
199
+ if (intersects.length > 0) {
200
+ const closestMove = puzzle.getClosestMoveToAxis(
201
+ intersects[0].point,
202
+ transformations,
203
+ );
204
+ if (closestMove) {
205
+ this.model.experimentalAddMove(closestMove.move, {
206
+ coalesce: true,
207
+ mod: closestMove.order,
208
+ });
209
+ } else {
210
+ console.info("Skipping move!");
211
+ }
212
+ }
213
+ }
168
214
  }
@@ -1,17 +1,20 @@
1
- import type { Scene as ThreeScene } from "three";
1
+ import { PerspectiveCamera, Scene as ThreeScene, Vector2 } from "three";
2
2
  import type { PuzzleLoader } from "../../../puzzles";
3
3
  import { THREEJS } from "../../heavy-code-imports/3d";
4
- import type { BackViewLayoutWithAuto } from "../../model/props/viewer/BackViewProp";
5
- import type { VisualizationStrategy } from "../../model/props/viewer/VisualizationStrategyProp";
6
4
  import { StaleDropper } from "../../model/PromiseFreshener";
7
- import type { TwistyPlayerModel } from "../../model/TwistyPlayerModel";
8
5
  import { FreshListenerManager } from "../../model/props/TwistyProp";
9
- import type { Schedulable } from "../../old/animation/RenderScheduler";
10
- import { ClassListManager } from "../../old/dom/element/ClassListManager";
11
- import { ManagedCustomElement } from "../../old/dom/element/ManagedCustomElement";
12
- import { customElementsShim } from "../../old/dom/element/node-custom-element-shims";
13
- import type { BackViewLayout } from "../../old/dom/viewers/TwistyViewerWrapper";
14
- import { twistyViewerWrapperCSS } from "../../old/dom/viewers/TwistyViewerWrapper.css";
6
+ import type {
7
+ BackViewLayout,
8
+ BackViewLayoutWithAuto,
9
+ } from "../../model/props/viewer/BackViewProp";
10
+ import type { VisualizationStrategy } from "../../model/props/viewer/VisualizationStrategyProp";
11
+ import type { TwistyPlayerModel } from "../../model/TwistyPlayerModel";
12
+ import type { Schedulable } from "../../controllers/RenderScheduler";
13
+ import { ClassListManager } from "../ClassListManager";
14
+ import { ManagedCustomElement } from "../ManagedCustomElement";
15
+ import { customElementsShim } from "../node-custom-element-shims";
16
+ import { twistyViewerWrapperCSS } from "../TwistyViewerWrapper.css";
17
+ import type { PressInfo } from "./DragTracker";
15
18
  import { Twisty3DPuzzleWrapper } from "./Twisty3DPuzzleWrapper";
16
19
  import { Twisty3DVantage } from "./Twisty3DVantage";
17
20
 
@@ -79,6 +82,43 @@ export class Twisty3DSceneWrapper
79
82
  this.setBackView(backView);
80
83
  }
81
84
 
85
+ async onPress(
86
+ e: CustomEvent<{
87
+ pressInfo: PressInfo;
88
+ cameraPromise: Promise<PerspectiveCamera>;
89
+ }>,
90
+ ): Promise<void> {
91
+ const twisty3DPuzzleWrapper = this.#currentTwisty3DPuzzleWrapper;
92
+ if (!twisty3DPuzzleWrapper) {
93
+ console.info("no wrapper; skipping scene wrapper press!");
94
+ return;
95
+ }
96
+
97
+ const raycasterPromise = (async () => {
98
+ const [camera, three] = await Promise.all([
99
+ e.detail.cameraPromise,
100
+ THREEJS,
101
+ ]);
102
+
103
+ const raycaster = new three.Raycaster();
104
+ const mouse = new Vector2(
105
+ e.detail.pressInfo.normalizedX,
106
+ e.detail.pressInfo.normalizedY,
107
+ );
108
+ raycaster.setFromCamera(mouse, camera);
109
+ return raycaster;
110
+ })();
111
+
112
+ twisty3DPuzzleWrapper.raycastMove(raycasterPromise, {
113
+ invert: !e.detail.pressInfo.rightClick,
114
+ depth: e.detail.pressInfo.keys.ctrlOrMetaKey
115
+ ? "rotation"
116
+ : e.detail.pressInfo.keys.shiftKey
117
+ ? "secondSlice"
118
+ : "none",
119
+ });
120
+ }
121
+
82
122
  #cachedScene: Promise<ThreeScene> | null;
83
123
  async scene(): Promise<ThreeScene> {
84
124
  return (this.#cachedScene ??= (async () => new (await THREEJS).Scene())());
@@ -86,6 +126,7 @@ export class Twisty3DSceneWrapper
86
126
 
87
127
  #vantages: Set<Twisty3DVantage> = new Set();
88
128
  addVantage(vantage: Twisty3DVantage) {
129
+ vantage.addEventListener("press", this.onPress.bind(this));
89
130
  this.#vantages.add(vantage);
90
131
  this.contentWrapper.appendChild(vantage);
91
132
  }
@@ -1,4 +1,4 @@
1
- import { CSSSource } from "../element/ManagedCustomElement";
1
+ import { CSSSource } from "../ManagedCustomElement";
2
2
 
3
3
  // The `position` values are a hack for a bug in Safari where the canvas either
4
4
  // grows infinitely, or takes up the full `fr` of any encompassing grid (making
@@ -6,7 +6,7 @@ import { CSSSource } from "../element/ManagedCustomElement";
6
6
  // content` is a good fix for this, but there is no indication that Safari will
7
7
  // support it soon. https://developer.mozilla.org/en-US/docs/Web/CSS/contain
8
8
 
9
- export const twisty3DCanvasCSS = new CSSSource(`
9
+ export const twisty3DVantageCSS = new CSSSource(`
10
10
  :host {
11
11
  width: 384px;
12
12
  height: 256px;
@@ -3,26 +3,27 @@ import { Stats } from "../../../vendor/three/examples/jsm/libs/stats.modified.mo
3
3
  import { THREEJS } from "../../heavy-code-imports/3d";
4
4
  import { StaleDropper } from "../../model/PromiseFreshener";
5
5
  import type { TwistyPropParent } from "../../model/props/TwistyProp";
6
- import type { OrbitCoordinatesV2 } from "../../model/props/viewer/OrbitCoordinatesRequestProp";
6
+ import type { OrbitCoordinates } from "../../model/props/viewer/OrbitCoordinatesRequestProp";
7
7
  import type { TwistyPlayerModel } from "../../model/TwistyPlayerModel";
8
- import { RenderScheduler } from "../../old/animation/RenderScheduler";
9
- import { ManagedCustomElement } from "../../old/dom/element/ManagedCustomElement";
10
- import { customElementsShim } from "../../old/dom/element/node-custom-element-shims";
11
- import { pixelRatio } from "../../old/dom/viewers/canvas";
12
- import { twisty3DCanvasCSS } from "../../old/dom/viewers/Twisty3DCanvas.css";
8
+ import { RenderScheduler } from "../../controllers/RenderScheduler";
9
+ import { ManagedCustomElement } from "../ManagedCustomElement";
10
+ import { customElementsShim } from "../node-custom-element-shims";
11
+ import { pixelRatio } from "../canvas";
12
+ import { twisty3DVantageCSS } from "./Twisty3DVantage.css";
13
+ import { DragTracker, PressInfo } from "./DragTracker";
13
14
  import { newRenderer, renderPooled } from "./RendererPool";
14
15
  import { DEGREES_PER_RADIAN } from "./TAU";
15
16
  import type { Twisty3DSceneWrapper } from "./Twisty3DSceneWrapper";
16
- import { TwistyOrbitControlsV2 } from "./TwistyOrbitControlsV2";
17
+ import { TwistyOrbitControls } from "./TwistyOrbitControls";
17
18
 
18
19
  let SHOW_STATS = false;
19
- export function showStats(enable: boolean): void {
20
+ export function debugShowRenderStats(enable: boolean): void {
20
21
  SHOW_STATS = enable;
21
22
  }
22
23
 
23
24
  export async function setCameraFromOrbitCoordinates(
24
25
  camera: PerspectiveCamera,
25
- orbitCoordinates: OrbitCoordinatesV2,
26
+ orbitCoordinates: OrbitCoordinates,
26
27
  backView: boolean = false,
27
28
  ): Promise<void> {
28
29
  const spherical = new (await THREEJS).Spherical(
@@ -40,20 +41,30 @@ let shareAllNewRenderers: boolean | null = null;
40
41
  // WARNING: The current shared renderer implementation is not every efficient.
41
42
  // Avoid using for players that are likely to have dimensions approaching 1 megapixel or higher.
42
43
  // TODO: use a dedicated renderer while fullscreen?
43
- export function experimentalSetShareAllNewRenderers(share: boolean): void {
44
+ // - true: Force all new (i.e. constructed in the future) renderers to be shared
45
+ // - false: Force all new (i.e. constructed in the future) renderers to be dedicated
46
+ // - null: Reset to the default heuristics.
47
+ export function experimentalForceNewRendererSharing(
48
+ share: boolean | null,
49
+ ): void {
44
50
  shareAllNewRenderers = share;
45
51
  }
46
52
 
47
- let anyRenderersSofar = false;
53
+ let dedicatedRenderersSoFar = 0;
54
+ const DEFAULT_MAX_DEDICATED_RENDERERS = 2; // This allows for a front view and a back view (or two separate front views).
48
55
  function shareRenderer(): boolean {
49
56
  if (shareAllNewRenderers !== null) {
57
+ if (!shareAllNewRenderers) {
58
+ dedicatedRenderersSoFar++;
59
+ }
50
60
  return shareAllNewRenderers;
51
61
  }
52
- if (!anyRenderersSofar) {
53
- anyRenderersSofar = true;
62
+ if (dedicatedRenderersSoFar < DEFAULT_MAX_DEDICATED_RENDERERS) {
63
+ dedicatedRenderersSoFar++;
54
64
  return false;
65
+ } else {
66
+ return true;
55
67
  }
56
- return true;
57
68
  }
58
69
 
59
70
  export class Twisty3DVantage extends ManagedCustomElement {
@@ -79,18 +90,54 @@ export class Twisty3DVantage extends ManagedCustomElement {
79
90
  }
80
91
 
81
92
  async connectedCallback(): Promise<void> {
82
- this.addCSS(twisty3DCanvasCSS);
83
- this.addElement(await this.canvas());
93
+ this.addCSS(twisty3DVantageCSS);
94
+ this.addElement((await this.canvasInfo()).canvas);
84
95
 
85
96
  this.#onResize();
86
97
  const observer = new ResizeObserver(this.#onResize.bind(this));
87
98
  observer.observe(this.contentWrapper);
88
99
  this.orbitControls(); // TODO
100
+ this.#setupBasicPresses();
101
+
89
102
  this.scheduleRender();
90
103
  }
91
104
 
105
+ async #setupBasicPresses(): Promise<void> {
106
+ const dragTracker = await this.#dragTracker();
107
+ dragTracker.addEventListener("press", async (e: CustomEvent<PressInfo>) => {
108
+ const movePressInput = await this.model!.movePressInputProp.get();
109
+ if (movePressInput !== "basic") {
110
+ return;
111
+ }
112
+ this.dispatchEvent(
113
+ new CustomEvent("press", {
114
+ detail: {
115
+ pressInfo: e.detail,
116
+ cameraPromise: this.camera(),
117
+ },
118
+ }),
119
+ );
120
+ });
121
+ }
122
+
92
123
  #onResizeStaleDropper = new StaleDropper<PerspectiveCamera>();
93
124
 
125
+ async clearCanvas(): Promise<void> {
126
+ if (this.rendererIsShared) {
127
+ const canvasInfo = await this.canvasInfo();
128
+ canvasInfo.context.clearRect(
129
+ 0,
130
+ 0,
131
+ canvasInfo.canvas.width,
132
+ canvasInfo.canvas.height,
133
+ );
134
+ } else {
135
+ const renderer = await this.renderer();
136
+ const context = renderer.getContext();
137
+ context.clear(context.COLOR_BUFFER_BIT);
138
+ }
139
+ }
140
+
94
141
  // TODO: Why doesn't this work for the top-right back view height?
95
142
  #width: number = 0;
96
143
  #height: number = 0;
@@ -112,14 +159,17 @@ export class Twisty3DVantage extends ManagedCustomElement {
112
159
  camera.setViewOffset(w, h - excess, off, yoff, w, h);
113
160
  camera.updateProjectionMatrix(); // TODO
114
161
 
162
+ this.clearCanvas();
115
163
  if (this.rendererIsShared) {
116
- const canvas = await this.canvas();
117
- canvas.width = w * pixelRatio();
118
- canvas.height = h * pixelRatio();
119
- canvas.style.width = w.toString();
120
- canvas.style.height = w.toString();
164
+ const canvasInfo = await this.canvasInfo();
165
+
166
+ canvasInfo.canvas.width = w * pixelRatio();
167
+ canvasInfo.canvas.height = h * pixelRatio();
168
+ canvasInfo.canvas.style.width = w.toString();
169
+ canvasInfo.canvas.style.height = w.toString();
121
170
  } else {
122
- (await this.renderer()).setSize(w, h, true);
171
+ const renderer = await this.renderer();
172
+ renderer.setSize(w, h, true);
123
173
  }
124
174
 
125
175
  this.scheduleRender();
@@ -133,14 +183,31 @@ export class Twisty3DVantage extends ManagedCustomElement {
133
183
  return (this.#cachedRenderer ??= newRenderer());
134
184
  }
135
185
 
136
- #cachedCanvas: Promise<HTMLCanvasElement> | null = null;
137
- async canvas(): Promise<HTMLCanvasElement> {
186
+ #cachedCanvas: Promise<{
187
+ canvas: HTMLCanvasElement;
188
+ context: CanvasRenderingContext2D;
189
+ }> | null = null;
190
+ async canvasInfo(): Promise<{
191
+ canvas: HTMLCanvasElement;
192
+ context: CanvasRenderingContext2D;
193
+ }> {
138
194
  return (this.#cachedCanvas ??= (async () => {
195
+ let canvas: HTMLCanvasElement;
139
196
  if (this.rendererIsShared) {
140
- return this.addElement(document.createElement("canvas"));
197
+ canvas = this.addElement(document.createElement("canvas"));
198
+ } else {
199
+ const renderer = await this.renderer();
200
+ canvas = this.addElement(renderer.domElement);
141
201
  }
142
- const renderer = await this.renderer();
143
- return this.addElement(renderer.domElement);
202
+ const context = canvas.getContext("2d")!;
203
+ return { canvas, context };
204
+ })());
205
+ }
206
+
207
+ #cachedDragTracker: Promise<DragTracker> | null = null;
208
+ async #dragTracker(): Promise<DragTracker> {
209
+ return (this.#cachedDragTracker ??= (async () => {
210
+ return new DragTracker((await this.canvasInfo()).canvas);
144
211
  })());
145
212
  }
146
213
 
@@ -164,19 +231,20 @@ export class Twisty3DVantage extends ManagedCustomElement {
164
231
  })());
165
232
  }
166
233
 
167
- #cachedOrbitControls: Promise<TwistyOrbitControlsV2> | null = null;
168
- async orbitControls(): Promise<TwistyOrbitControlsV2> {
234
+ #cachedOrbitControls: Promise<TwistyOrbitControls> | null = null;
235
+ async orbitControls(): Promise<TwistyOrbitControls> {
169
236
  return (this.#cachedOrbitControls ??= (async () => {
170
- const orbitControls = new TwistyOrbitControlsV2(
237
+ const orbitControls = new TwistyOrbitControls(
171
238
  this.model!,
172
239
  !!this.options?.backView,
173
- await this.canvas(),
240
+ (await this.canvasInfo()).canvas,
241
+ await this.#dragTracker(),
174
242
  );
175
243
 
176
244
  if (this.model) {
177
245
  this.addListener(
178
246
  this.model.orbitCoordinatesProp,
179
- async (orbitCoordinates: OrbitCoordinatesV2) => {
247
+ async (orbitCoordinates: OrbitCoordinates) => {
180
248
  const camera = await this.camera();
181
249
  setCameraFromOrbitCoordinates(
182
250
  camera,
@@ -223,10 +291,10 @@ export class Twisty3DVantage extends ManagedCustomElement {
223
291
  const [scene, camera, canvas] = await Promise.all([
224
292
  this.scene.scene(),
225
293
  this.camera(),
226
- this.canvas(),
294
+ this.canvasInfo(),
227
295
  ]);
228
296
  if (this.rendererIsShared) {
229
- renderPooled(this.#width, this.#height, canvas, scene, camera);
297
+ renderPooled(this.#width, this.#height, canvas.canvas, scene, camera);
230
298
  } else {
231
299
  (await this.renderer()).render(scene, camera);
232
300
  }
@@ -241,4 +309,4 @@ export class Twisty3DVantage extends ManagedCustomElement {
241
309
  }
242
310
  }
243
311
 
244
- customElementsShim.define("twisty-3d-vantage-v2", Twisty3DVantage);
312
+ customElementsShim.define("twisty-3d-vantage", Twisty3DVantage);
@@ -0,0 +1,213 @@
1
+ /**
2
+ * @jest-environment jsdom
3
+ */
4
+
5
+ import {
6
+ PuzzleID,
7
+ PuzzleIDRequestProp,
8
+ } from "../../model/props/puzzle/structure/PuzzleIDRequestProp";
9
+ import type { TwistyPropParent } from "../../model/props/TwistyProp";
10
+ import { LatitudeLimitProp } from "../../model/props/viewer/LatitudeLimit";
11
+ import { OrbitCoordinatesProp } from "../../model/props/viewer/OrbitCoordinatesProp";
12
+ import { OrbitCoordinatesRequestProp } from "../../model/props/viewer/OrbitCoordinatesRequestProp";
13
+ import { VisualizationFormatProp } from "../../model/props/viewer/VisualizationProp";
14
+ import { VisualizationStrategyProp } from "../../model/props/viewer/VisualizationStrategyProp";
15
+
16
+ describe("TwistyOrbitControls", () => {
17
+ it("should update correctly", async () => {
18
+ const orbitCoordinatesRequestProp = new OrbitCoordinatesRequestProp();
19
+ const latLimit = new LatitudeLimitProp();
20
+ const puzzleIDRequestProp = new PuzzleIDRequestProp(
21
+ "3x3x3",
22
+ ) as TwistyPropParent<PuzzleID>;
23
+ const visualizationRequestProp = new VisualizationFormatProp();
24
+ const visualizationStrategyProp = new VisualizationStrategyProp({
25
+ puzzleID: puzzleIDRequestProp,
26
+ visualizationRequest: visualizationRequestProp,
27
+ });
28
+ const orbitCoordinatesProp = new OrbitCoordinatesProp({
29
+ orbitCoordinatesRequest: orbitCoordinatesRequestProp,
30
+ latitudeLimit: latLimit,
31
+ puzzleID: puzzleIDRequestProp,
32
+ strategy: visualizationStrategyProp,
33
+ });
34
+ // const mockModel = {
35
+ // orbitCoordinatesRequestProp,
36
+ // orbitCoordinatesProp: orbitCoordinatesProp,
37
+ // };
38
+
39
+ // Uncomment to watch changes.
40
+ // mockModel.orbitCoordinatesProp.addFreshListener(console.log);
41
+
42
+ expect(await orbitCoordinatesProp.get()).toEqual({
43
+ latitude: 35,
44
+ longitude: 30,
45
+ distance: 6,
46
+ });
47
+
48
+ expect(await orbitCoordinatesProp.get()).toEqual({
49
+ latitude: 35,
50
+ longitude: 30,
51
+ distance: 6,
52
+ });
53
+ // TODO
54
+
55
+ // // Values are:true if currently set, false if previously set, undefined otherwise.
56
+ // const canvasEventListenersRegistered: Record<string, boolean> = {};
57
+ // const windowEventListenersRegistered: Record<string, boolean> = {};
58
+ // window.addEventListener = (event: string): void => {
59
+ // windowEventListenersRegistered[event] = true;
60
+ // };
61
+ // window.removeEventListener = (event: string): void => {
62
+ // windowEventListenersRegistered[event] = false;
63
+ // };
64
+
65
+ // const mockCanvas = {
66
+ // offsetWidth: 100,
67
+ // offsetHeight: 100,
68
+ // addEventListener: (event: string) => {
69
+ // canvasEventListenersRegistered[event] = true;
70
+ // },
71
+ // removeEventListener: (event: string) => {
72
+ // canvasEventListenersRegistered[event] = false;
73
+ // },
74
+ // } as any as HTMLCanvasElement;
75
+
76
+ // const mockDragTracker = {} as DragTracker;
77
+
78
+ // const orbitControls = new TwistyOrbitControls(
79
+ // mockModel as TwistyPlayerModel,
80
+ // false,
81
+ // mockCanvas,
82
+ // mockDragTracker,
83
+ // );
84
+ // expect(canvasEventListenersRegistered).toEqual({
85
+ // mousedown: true,
86
+ // touchstart: true,
87
+ // });
88
+ // expect(windowEventListenersRegistered).toEqual({});
89
+
90
+ // expect(await orbitCoordinatesProp.get()).toEqual({
91
+ // latitude: 35,
92
+ // longitude: 30,
93
+ // distance: 6,
94
+ // });
95
+
96
+ // let preventedDefault = false;
97
+ // orbitControls.onMouseStart({
98
+ // timeStamp: 200,
99
+ // preventDefault: () => {
100
+ // preventedDefault = true;
101
+ // },
102
+ // } as MouseEvent);
103
+ // expect(preventedDefault).toBe(true);
104
+ // expect(canvasEventListenersRegistered).toEqual({
105
+ // mousedown: true,
106
+ // touchstart: true,
107
+ // });
108
+ // expect(windowEventListenersRegistered).toEqual({
109
+ // mousemove: true,
110
+ // mouseup: true,
111
+ // });
112
+
113
+ // expect(await orbitCoordinatesProp.get()).toEqual({
114
+ // latitude: 35,
115
+ // longitude: 30,
116
+ // distance: 6,
117
+ // });
118
+
119
+ // orbitControls.onMouseMove({
120
+ // timeStamp: 210,
121
+ // movementX: 10,
122
+ // movementY: 10,
123
+ // } as MouseEvent);
124
+
125
+ // expect(await orbitCoordinatesProp.get()).toEqual({
126
+ // latitude: 35,
127
+ // longitude: 16.76186399084088,
128
+ // distance: 6,
129
+ // });
130
+
131
+ // orbitControls.onMouseMove({
132
+ // timeStamp: 220,
133
+ // movementX: 1,
134
+ // movementY: -10,
135
+ // } as MouseEvent);
136
+
137
+ // expect(await orbitCoordinatesProp.get()).toEqual({
138
+ // latitude: 24.312125734137396,
139
+ // longitude: 14.941573641700643,
140
+ // distance: 6,
141
+ // });
142
+
143
+ // orbitControls.onMouseMove({
144
+ // timeStamp: 240,
145
+ // movementX: 0,
146
+ // movementY: 0,
147
+ // } as MouseEvent);
148
+
149
+ // expect(await orbitCoordinatesProp.get()).toEqual({
150
+ // latitude: 24.312125734137396,
151
+ // longitude: 14.941573641700643,
152
+ // distance: 6,
153
+ // });
154
+
155
+ // orbitControls.onMouseMove({
156
+ // timeStamp: 250,
157
+ // movementX: 2,
158
+ // movementY: 1,
159
+ // } as MouseEvent);
160
+
161
+ // expect(await orbitCoordinatesProp.get()).toEqual({
162
+ // latitude: 25.69334862750623,
163
+ // longitude: 11.459488402184547,
164
+ // distance: 6,
165
+ // });
166
+
167
+ // orbitControls.onMouseMove({
168
+ // timeStamp: 250,
169
+ // movementX: 10,
170
+ // movementY: 1,
171
+ // } as MouseEvent);
172
+ // // Protect against a regression.
173
+ // // https://www.speedsolving.com/threads/introducing-twizzle-alpha.85019/page-3#post-1454696
174
+ // expect((orbitControls as any).lastMouseMoveMomentumX).not.toBe(Infinity);
175
+
176
+ // expect(await orbitCoordinatesProp.get()).toEqual({
177
+ // latitude: 27.07457152087506,
178
+ // longitude: -1.7786476069745731,
179
+ // distance: 6,
180
+ // });
181
+
182
+ // orbitControls.onMouseMove({
183
+ // timeStamp: 1000,
184
+ // movementX: -3,
185
+ // movementY: 2,
186
+ // } as MouseEvent);
187
+ // expect(await orbitCoordinatesProp.get()).toEqual({
188
+ // latitude: 29.743827999090797,
189
+ // longitude: 3.232140742705951,
190
+ // distance: 6,
191
+ // });
192
+
193
+ // orbitControls.onMouseEnd({
194
+ // timeStamp: 1000, // Note: unused by the current implementation, but we provide it for consistency.
195
+ // preventDefault: () => {},
196
+ // } as MouseEvent);
197
+ // expect(await orbitCoordinatesProp.get()).toEqual({
198
+ // latitude: 29.743827999090797,
199
+ // longitude: 3.232140742705951,
200
+ // distance: 6,
201
+ // });
202
+ // expect(canvasEventListenersRegistered).toEqual({
203
+ // mousedown: true,
204
+ // touchstart: true,
205
+ // });
206
+ // expect(windowEventListenersRegistered).toEqual({
207
+ // mousemove: false,
208
+ // mouseup: false,
209
+ // });
210
+
211
+ // // TODO: test inertia separately?
212
+ });
213
+ });