cubing 0.21.3 → 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 (406) 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-CSVAFZSB.js → chunk-7KI3I3Y7.js} +5 -5
  14. package/dist/esm/{chunk-CSVAFZSB.js.map → chunk-7KI3I3Y7.js.map} +0 -0
  15. package/dist/esm/{chunk-APIIMJG6.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-MUQMBH2S.js → chunk-HXKINJ7U.js} +3 -3
  20. package/dist/esm/{chunk-MUQMBH2S.js.map → chunk-HXKINJ7U.js.map} +1 -1
  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 +3 -3
  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 +715 -2341
  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/puzzle-geometry/PGPuzzles.spec.d.ts +3 -0
  41. package/dist/types/puzzle-geometry/PGPuzzles.spec.d.ts.map +1 -1
  42. package/dist/types/puzzle-geometry/PuzzleGeometry.d.ts +5 -1
  43. package/dist/types/puzzle-geometry/PuzzleGeometry.d.ts.map +1 -1
  44. package/dist/types/puzzles/index.d.ts +1 -1
  45. package/dist/types/puzzles/index.d.ts.map +1 -1
  46. package/dist/types/search/worker-inside-generated-string.d.ts +1 -1
  47. package/dist/types/search/worker-inside-generated-string.d.ts.map +1 -1
  48. package/dist/types/twisty/{old/animation/cursor/CursorTypes.d.ts → controllers/AnimationTypes.d.ts} +10 -3
  49. package/dist/types/twisty/controllers/AnimationTypes.d.ts.map +1 -0
  50. package/dist/types/twisty/{old/animation → controllers}/RenderScheduler.d.ts +0 -0
  51. package/dist/types/twisty/controllers/RenderScheduler.d.ts.map +1 -0
  52. package/dist/types/twisty/controllers/TwistyAnimationController.d.ts +1 -1
  53. package/dist/types/twisty/controllers/TwistyAnimationController.d.ts.map +1 -1
  54. package/dist/types/twisty/{old/animation → controllers}/easing.d.ts +0 -0
  55. package/dist/types/twisty/controllers/easing.d.ts.map +1 -0
  56. package/dist/types/twisty/{old/animation → controllers}/indexer/AlgDuration.d.ts +2 -2
  57. package/dist/types/twisty/controllers/indexer/AlgDuration.d.ts.map +1 -0
  58. package/dist/types/twisty/{old/animation → controllers}/indexer/AlgIndexer.d.ts +3 -3
  59. package/dist/types/twisty/controllers/indexer/AlgIndexer.d.ts.map +1 -0
  60. package/dist/types/twisty/{old/animation → controllers}/indexer/SimpleAlgIndexer.d.ts +3 -3
  61. package/dist/types/twisty/controllers/indexer/SimpleAlgIndexer.d.ts.map +1 -0
  62. package/dist/types/twisty/{old/animation → controllers}/indexer/simultaneous-moves/SimultaneousMoveIndexer.d.ts +3 -3
  63. package/dist/types/twisty/controllers/indexer/simultaneous-moves/SimultaneousMoveIndexer.d.ts.map +1 -0
  64. package/dist/types/twisty/{old/animation → controllers}/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.d.ts +3 -3
  65. package/dist/types/twisty/controllers/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.d.ts.map +1 -0
  66. package/dist/types/twisty/{old/animation → controllers}/indexer/simultaneous-moves/simul-moves.d.ts +2 -2
  67. package/dist/types/twisty/controllers/indexer/simultaneous-moves/simul-moves.d.ts.map +1 -0
  68. package/dist/types/twisty/{old/animation → controllers}/indexer/tree/AlgWalker.d.ts +2 -2
  69. package/dist/types/twisty/controllers/indexer/tree/AlgWalker.d.ts.map +1 -0
  70. package/dist/types/twisty/{old/animation → controllers}/indexer/tree/TreeAlgIndexer.d.ts +3 -3
  71. package/dist/types/twisty/controllers/indexer/tree/TreeAlgIndexer.d.ts.map +1 -0
  72. package/dist/types/twisty/controllers/indexer/tree/chunkAlgs.d.ts +3 -0
  73. package/dist/types/twisty/controllers/indexer/tree/chunkAlgs.d.ts.map +1 -0
  74. package/dist/types/twisty/{old/animation → controllers}/stream/timeline-move-calculation-draft.d.ts +2 -2
  75. package/dist/types/twisty/controllers/stream/timeline-move-calculation-draft.d.ts.map +1 -0
  76. package/dist/types/twisty/heavy-code-imports/dynamic-entries/3d.d.ts +1 -2
  77. package/dist/types/twisty/heavy-code-imports/dynamic-entries/3d.d.ts.map +1 -1
  78. package/dist/types/twisty/index.d.ts +8 -11
  79. package/dist/types/twisty/index.d.ts.map +1 -1
  80. package/dist/types/twisty/model/TwistyPlayerModel.d.ts +11 -0
  81. package/dist/types/twisty/model/TwistyPlayerModel.d.ts.map +1 -1
  82. package/dist/types/twisty/model/props/TwistyPropDebugger.d.ts +1 -1
  83. package/dist/types/twisty/model/props/TwistyPropDebugger.d.ts.map +1 -1
  84. package/dist/types/twisty/model/props/puzzle/display/FoundationDisplayProp.d.ts +6 -0
  85. package/dist/types/twisty/model/props/puzzle/display/FoundationDisplayProp.d.ts.map +1 -0
  86. package/dist/types/twisty/model/props/puzzle/display/HintFaceletProp.d.ts +5 -1
  87. package/dist/types/twisty/model/props/puzzle/display/HintFaceletProp.d.ts.map +1 -1
  88. package/dist/types/twisty/model/props/puzzle/display/StickeringProp.d.ts +44 -1
  89. package/dist/types/twisty/model/props/puzzle/display/StickeringProp.d.ts.map +1 -1
  90. package/dist/types/twisty/model/props/puzzle/state/AnchoredStartProp.d.ts +2 -2
  91. package/dist/types/twisty/model/props/puzzle/state/AnchoredStartProp.d.ts.map +1 -1
  92. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesProp.d.ts +1 -1
  93. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesProp.d.ts.map +1 -1
  94. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesSimplified.d.ts +1 -1
  95. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesSimplified.d.ts.map +1 -1
  96. package/dist/types/twisty/model/props/puzzle/state/CurrentTransformationProp.d.ts +1 -1
  97. package/dist/types/twisty/model/props/puzzle/state/CurrentTransformationProp.d.ts.map +1 -1
  98. package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorProp.d.ts +5 -2
  99. package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorProp.d.ts.map +1 -1
  100. package/dist/types/twisty/model/props/puzzle/state/IndexerProp.d.ts +2 -2
  101. package/dist/types/twisty/model/props/puzzle/state/IndexerProp.d.ts.map +1 -1
  102. package/dist/types/twisty/model/props/puzzle/state/LegacyPositionProp.d.ts +2 -2
  103. package/dist/types/twisty/model/props/puzzle/state/LegacyPositionProp.d.ts.map +1 -1
  104. package/dist/types/twisty/model/props/puzzle/state/MovePressInputProp.d.ts +6 -0
  105. package/dist/types/twisty/model/props/puzzle/state/MovePressInputProp.d.ts.map +1 -0
  106. package/dist/types/twisty/model/props/puzzle/state/NaiveMoveCountProp.d.ts +10 -0
  107. package/dist/types/twisty/model/props/puzzle/state/NaiveMoveCountProp.d.ts.map +1 -0
  108. package/dist/types/twisty/model/props/puzzle/state/SetupAnchorProp.d.ts +5 -1
  109. package/dist/types/twisty/model/props/puzzle/state/SetupAnchorProp.d.ts.map +1 -1
  110. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDProp.d.ts +1 -1
  111. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDProp.d.ts.map +1 -1
  112. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.d.ts +19 -1
  113. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.d.ts.map +1 -1
  114. package/dist/types/twisty/model/props/puzzle/structure/PuzzleLoaderProp.d.ts +1 -1
  115. package/dist/types/twisty/model/props/puzzle/structure/PuzzleLoaderProp.d.ts.map +1 -1
  116. package/dist/types/twisty/model/props/timeline/DetailedTimelineInfoProp.d.ts +2 -3
  117. package/dist/types/twisty/model/props/timeline/DetailedTimelineInfoProp.d.ts.map +1 -1
  118. package/dist/types/twisty/model/props/timeline/PlayingInfoProp.d.ts +1 -1
  119. package/dist/types/twisty/model/props/timeline/PlayingInfoProp.d.ts.map +1 -1
  120. package/dist/types/twisty/model/props/timeline/TimestampRequestProp.d.ts +1 -1
  121. package/dist/types/twisty/model/props/timeline/TimestampRequestProp.d.ts.map +1 -1
  122. package/dist/types/twisty/model/props/viewer/BackViewProp.d.ts +6 -1
  123. package/dist/types/twisty/model/props/viewer/BackViewProp.d.ts.map +1 -1
  124. package/dist/types/twisty/model/props/viewer/BackgroundProp.d.ts +5 -1
  125. package/dist/types/twisty/model/props/viewer/BackgroundProp.d.ts.map +1 -1
  126. package/dist/types/twisty/model/props/viewer/ControlPanelProp.d.ts +5 -1
  127. package/dist/types/twisty/model/props/viewer/ControlPanelProp.d.ts.map +1 -1
  128. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesProp.d.ts +18 -5
  129. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesProp.d.ts.map +1 -1
  130. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesRequestProp.d.ts +6 -6
  131. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesRequestProp.d.ts.map +1 -1
  132. package/dist/types/twisty/model/props/viewer/TimeRangeProp.d.ts +2 -2
  133. package/dist/types/twisty/model/props/viewer/TimeRangeProp.d.ts.map +1 -1
  134. package/dist/types/twisty/model/props/viewer/ViewerLinkProp.d.ts +5 -1
  135. package/dist/types/twisty/model/props/viewer/ViewerLinkProp.d.ts.map +1 -1
  136. package/dist/types/twisty/model/props/viewer/VisualizationProp.d.ts +7 -1
  137. package/dist/types/twisty/model/props/viewer/VisualizationProp.d.ts.map +1 -1
  138. package/dist/types/twisty/model/props/viewer/VisualizationStrategyProp.d.ts +1 -1
  139. package/dist/types/twisty/model/props/viewer/VisualizationStrategyProp.d.ts.map +1 -1
  140. package/dist/types/twisty/views/2D/Twisty2DPuzzle.css.d.ts +3 -0
  141. package/dist/types/twisty/views/2D/Twisty2DPuzzle.css.d.ts.map +1 -0
  142. package/dist/types/twisty/views/2D/Twisty2DPuzzle.d.ts +4 -6
  143. package/dist/types/twisty/views/2D/Twisty2DPuzzle.d.ts.map +1 -1
  144. package/dist/types/twisty/views/2D/Twisty2DPuzzleWrapper.d.ts +1 -1
  145. package/dist/types/twisty/views/2D/Twisty2DPuzzleWrapper.d.ts.map +1 -1
  146. package/dist/types/twisty/views/2D/Twisty2DSceneWrapper.d.ts +2 -2
  147. package/dist/types/twisty/views/2D/Twisty2DSceneWrapper.d.ts.map +1 -1
  148. package/dist/types/twisty/views/3D/DragTracker.d.ts +28 -0
  149. package/dist/types/twisty/views/3D/DragTracker.d.ts.map +1 -0
  150. package/dist/types/twisty/views/3D/RendererPool.d.ts.map +1 -1
  151. package/dist/types/twisty/views/3D/Twisty3DPuzzleWrapper.d.ts +6 -1
  152. package/dist/types/twisty/views/3D/Twisty3DPuzzleWrapper.d.ts.map +1 -1
  153. package/dist/types/twisty/views/3D/Twisty3DSceneWrapper.d.ts +9 -4
  154. package/dist/types/twisty/views/3D/Twisty3DSceneWrapper.d.ts.map +1 -1
  155. package/dist/types/twisty/views/3D/Twisty3DVantage.css.d.ts +3 -0
  156. package/dist/types/twisty/views/3D/Twisty3DVantage.css.d.ts.map +1 -0
  157. package/dist/types/twisty/views/3D/Twisty3DVantage.d.ts +11 -7
  158. package/dist/types/twisty/views/3D/Twisty3DVantage.d.ts.map +1 -1
  159. package/dist/types/twisty/views/3D/TwistyOrbitControls.d.ts +24 -0
  160. package/dist/types/twisty/views/3D/TwistyOrbitControls.d.ts.map +1 -0
  161. package/dist/types/twisty/views/3D/TwistyOrbitControls.spec.d.ts +5 -0
  162. package/dist/types/twisty/views/3D/TwistyOrbitControls.spec.d.ts.map +1 -0
  163. package/dist/types/twisty/views/3D/puzzles/Cube3D.d.ts +4 -4
  164. package/dist/types/twisty/views/3D/puzzles/Cube3D.d.ts.map +1 -1
  165. package/dist/types/twisty/views/3D/puzzles/PG3D.d.ts +17 -10
  166. package/dist/types/twisty/views/3D/puzzles/PG3D.d.ts.map +1 -1
  167. package/dist/types/twisty/views/3D/puzzles/Twisty3DPuzzle.d.ts +1 -1
  168. package/dist/types/twisty/views/3D/puzzles/Twisty3DPuzzle.d.ts.map +1 -1
  169. package/dist/types/twisty/{old/dom/element → views}/ClassListManager.d.ts +0 -0
  170. package/dist/types/twisty/views/ClassListManager.d.ts.map +1 -0
  171. package/dist/types/twisty/{old/dom/element → views}/ManagedCustomElement.d.ts +0 -0
  172. package/dist/types/twisty/views/ManagedCustomElement.d.ts.map +1 -0
  173. package/dist/types/twisty/views/TwistyAlgEditor/LeafTokens.d.ts +1 -1
  174. package/dist/types/twisty/views/TwistyAlgEditor/LeafTokens.d.ts.map +1 -1
  175. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.css.d.ts +1 -1
  176. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.css.d.ts.map +1 -1
  177. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.d.ts +2 -1
  178. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.d.ts.map +1 -1
  179. package/dist/types/twisty/views/TwistyAlgViewer.css.d.ts +1 -1
  180. package/dist/types/twisty/views/TwistyAlgViewer.css.d.ts.map +1 -1
  181. package/dist/types/twisty/views/TwistyAlgViewer.d.ts +2 -2
  182. package/dist/types/twisty/views/TwistyAlgViewer.d.ts.map +1 -1
  183. package/dist/types/twisty/views/TwistyPlayer.css.d.ts +3 -0
  184. package/dist/types/twisty/views/TwistyPlayer.css.d.ts.map +1 -0
  185. package/dist/types/twisty/views/TwistyPlayer.d.ts +7 -3
  186. package/dist/types/twisty/views/TwistyPlayer.d.ts.map +1 -1
  187. package/dist/types/twisty/views/TwistyPlayerSettable.d.ts +7 -4
  188. package/dist/types/twisty/views/TwistyPlayerSettable.d.ts.map +1 -1
  189. package/dist/types/twisty/views/TwistyViewerWrapper.css.d.ts +3 -0
  190. package/dist/types/twisty/views/TwistyViewerWrapper.css.d.ts.map +1 -0
  191. package/dist/types/twisty/{old/dom/viewers → views}/canvas.d.ts +0 -0
  192. package/dist/types/twisty/views/canvas.d.ts.map +1 -0
  193. package/dist/types/twisty/views/control-panel/TwistyButtonsV2.css.d.ts +4 -0
  194. package/dist/types/twisty/views/control-panel/TwistyButtonsV2.css.d.ts.map +1 -0
  195. package/dist/types/twisty/views/control-panel/TwistyButtonsV2.d.ts +1 -1
  196. package/dist/types/twisty/views/control-panel/TwistyButtonsV2.d.ts.map +1 -1
  197. package/dist/types/twisty/views/control-panel/TwistyScrubber.css.d.ts +3 -0
  198. package/dist/types/twisty/{old/dom/controls → views/control-panel}/TwistyScrubber.css.d.ts.map +1 -1
  199. package/dist/types/twisty/views/control-panel/TwistyScrubberV2.d.ts +1 -1
  200. package/dist/types/twisty/views/control-panel/TwistyScrubberV2.d.ts.map +1 -1
  201. package/dist/types/twisty/{old/dom/element → views}/node-custom-element-shims.d.ts +0 -0
  202. package/dist/types/twisty/views/node-custom-element-shims.d.ts.map +1 -0
  203. package/dist/types/twisty/views/stream/TwistyStreamSource.css.d.ts +3 -0
  204. package/dist/types/twisty/views/stream/TwistyStreamSource.css.d.ts.map +1 -0
  205. package/dist/types/twisty/{old/dom → views}/stream/TwistyStreamSource.d.ts +1 -1
  206. package/dist/types/twisty/views/stream/TwistyStreamSource.d.ts.map +1 -0
  207. package/docs/.DS_Store +0 -0
  208. package/docs/cubing/.DS_Store +0 -0
  209. package/docs/cubing/api/index.html +11 -52
  210. package/package.json +1 -1
  211. package/src/cubing/.DS_Store +0 -0
  212. package/src/cubing/alg/index.ts +1 -0
  213. package/src/cubing/alg/units/leaves/Move.ts +1 -1
  214. package/src/cubing/bluetooth/smart-timer/GanTimer.ts +1 -1
  215. package/src/cubing/puzzle-geometry/PGPuzzles.spec.ts +4 -0
  216. package/src/cubing/puzzle-geometry/PuzzleGeometry.ts +14 -6
  217. package/src/cubing/puzzles/index.ts +1 -1
  218. package/src/cubing/search/worker-inside-generated-string.js +1 -1
  219. package/src/cubing/twisty/.DS_Store +0 -0
  220. package/{dist/types → src/cubing/twisty/controllers}/.DS_Store +0 -0
  221. package/src/cubing/twisty/{old/animation/cursor/CursorTypes.ts → controllers/AnimationTypes.ts} +11 -2
  222. package/src/cubing/twisty/{old/animation → controllers}/RenderScheduler.ts +0 -0
  223. package/src/cubing/twisty/controllers/TwistyAnimationController.ts +4 -4
  224. package/src/cubing/twisty/controllers/animation/.DS_Store +0 -0
  225. package/src/cubing/twisty/{old/animation → controllers}/easing.ts +0 -0
  226. package/src/cubing/twisty/controllers/indexer/.DS_Store +0 -0
  227. package/src/cubing/twisty/{old/animation → controllers}/indexer/AlgDuration.ts +2 -2
  228. package/src/cubing/twisty/{old/animation → controllers}/indexer/AlgIndexer.ts +4 -4
  229. package/src/cubing/twisty/{old/animation → controllers}/indexer/SimpleAlgIndexer.ts +4 -4
  230. package/src/cubing/twisty/{old/animation → controllers}/indexer/simultaneous-moves/SimultaneousMoveIndexer.ts +3 -3
  231. package/src/cubing/twisty/{old/animation → controllers}/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.ts +3 -3
  232. package/src/cubing/twisty/{old/animation → controllers}/indexer/simultaneous-moves/simul-moves.ts +2 -2
  233. package/src/cubing/twisty/{old/animation → controllers}/indexer/tree/AlgWalker.ts +4 -4
  234. package/src/cubing/twisty/{old/animation → controllers}/indexer/tree/TreeAlgIndexer.ts +3 -3
  235. package/src/cubing/twisty/{old/animation → controllers}/indexer/tree/chunkAlgs.ts +2 -2
  236. package/src/cubing/twisty/{old/animation → controllers}/stream/timeline-move-calculation-draft.spec.ts.TODO +0 -0
  237. package/src/cubing/twisty/{old/animation → controllers}/stream/timeline-move-calculation-draft.ts +2 -2
  238. package/src/cubing/twisty/heavy-code-imports/.DS_Store +0 -0
  239. package/src/cubing/twisty/heavy-code-imports/dynamic-entries/3d.ts +2 -12
  240. package/src/cubing/twisty/index.ts +11 -18
  241. package/src/cubing/twisty/model/.DS_Store +0 -0
  242. package/src/cubing/twisty/model/TwistyPlayerModel.ts +30 -1
  243. package/src/cubing/twisty/model/props/.DS_Store +0 -0
  244. package/src/cubing/twisty/model/props/TwistyPropDebugger.ts +3 -3
  245. package/src/cubing/twisty/model/props/puzzle/.DS_Store +0 -0
  246. package/src/cubing/twisty/model/props/puzzle/display/FoundationDisplayProp.ts +9 -0
  247. package/src/cubing/twisty/model/props/puzzle/display/HintFaceletProp.ts +6 -1
  248. package/src/cubing/twisty/model/props/puzzle/display/StickeringProp.ts +47 -1
  249. package/src/cubing/twisty/model/props/puzzle/state/AlgTransformationProp.ts +1 -1
  250. package/src/cubing/twisty/model/props/puzzle/state/AnchoredStartProp.ts +2 -2
  251. package/src/cubing/twisty/model/props/puzzle/state/CurrentLeavesProp.ts +2 -2
  252. package/src/cubing/twisty/model/props/puzzle/state/CurrentLeavesSimplified.ts +1 -1
  253. package/src/cubing/twisty/model/props/puzzle/state/CurrentTransformationProp.ts +1 -1
  254. package/src/cubing/twisty/model/props/puzzle/state/IndexerConstructorProp.ts +12 -5
  255. package/src/cubing/twisty/model/props/puzzle/state/IndexerProp.ts +2 -2
  256. package/src/cubing/twisty/model/props/puzzle/state/LegacyPositionProp.ts +2 -2
  257. package/src/cubing/twisty/model/props/puzzle/state/MovePressInputProp.ts +9 -0
  258. package/src/cubing/twisty/model/props/puzzle/state/NaiveMoveCountProp.ts +20 -0
  259. package/src/cubing/twisty/model/props/puzzle/state/SetupAnchorProp.ts +7 -1
  260. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleIDProp.ts +1 -1
  261. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.ts +20 -1
  262. package/src/cubing/twisty/model/props/puzzle/structure/PuzzleLoaderProp.ts +1 -1
  263. package/src/cubing/twisty/model/props/timeline/DetailedTimelineInfoProp.ts +5 -3
  264. package/src/cubing/twisty/model/props/timeline/PlayingInfoProp.ts +1 -4
  265. package/src/cubing/twisty/model/props/timeline/TimestampRequestProp.ts +1 -1
  266. package/src/cubing/twisty/model/props/viewer/BackViewProp.ts +7 -1
  267. package/src/cubing/twisty/model/props/viewer/BackgroundProp.ts +6 -1
  268. package/src/cubing/twisty/model/props/viewer/ControlPanelProp.ts +5 -1
  269. package/src/cubing/twisty/model/props/viewer/OrbitCoordinatesProp.ts +83 -12
  270. package/src/cubing/twisty/model/props/viewer/OrbitCoordinatesRequestProp.ts +8 -8
  271. package/src/cubing/twisty/model/props/viewer/TimeRangeProp.ts +2 -2
  272. package/src/cubing/twisty/model/props/viewer/ViewerLinkProp.ts +5 -1
  273. package/src/cubing/twisty/model/props/viewer/VisualizationProp.ts +8 -1
  274. package/src/cubing/twisty/model/props/viewer/VisualizationStrategyProp.ts +1 -1
  275. package/src/cubing/twisty/old/.DS_Store +0 -0
  276. package/src/cubing/twisty/old/animation/.DS_Store +0 -0
  277. package/src/cubing/twisty/old/dom/.DS_Store +0 -0
  278. package/src/cubing/twisty/views/.DS_Store +0 -0
  279. package/src/cubing/twisty/{old/dom/viewers/Twisty2DSVGView.css.ts → views/2D/Twisty2DPuzzle.css.ts} +1 -1
  280. package/src/cubing/twisty/views/2D/Twisty2DPuzzle.ts +8 -12
  281. package/src/cubing/twisty/views/2D/Twisty2DPuzzleWrapper.ts +1 -1
  282. package/src/cubing/twisty/views/2D/Twisty2DSceneWrapper.ts +4 -4
  283. package/src/cubing/twisty/views/3D/.DS_Store +0 -0
  284. package/src/cubing/twisty/views/3D/DragTracker.ts +184 -0
  285. package/src/cubing/twisty/views/3D/RendererPool.ts +2 -1
  286. package/src/cubing/twisty/views/3D/Twisty3DPuzzleWrapper.ts +51 -5
  287. package/src/cubing/twisty/views/3D/Twisty3DSceneWrapper.ts +51 -10
  288. package/src/cubing/twisty/{old/dom/viewers/Twisty3DCanvas.css.ts → views/3D/Twisty3DVantage.css.ts} +2 -2
  289. package/src/cubing/twisty/views/3D/Twisty3DVantage.ts +88 -30
  290. package/src/cubing/twisty/views/3D/TwistyOrbitControls.spec.ts +213 -0
  291. package/src/cubing/twisty/views/3D/TwistyOrbitControls.ts +176 -0
  292. package/src/cubing/twisty/views/3D/puzzles/Cube3D.ts +5 -9
  293. package/src/cubing/twisty/views/3D/puzzles/PG3D.ts +127 -37
  294. package/src/cubing/twisty/views/3D/puzzles/Twisty3DPuzzle.ts +1 -1
  295. package/src/cubing/twisty/{old/dom/element → views}/ClassListManager.ts +0 -0
  296. package/src/cubing/twisty/{old/dom/element → views}/ManagedCustomElement.ts +0 -0
  297. package/src/cubing/twisty/views/TwistyAlgEditor/LeafTokens.ts +1 -1
  298. package/src/cubing/twisty/views/TwistyAlgEditor/TwistyAlgEditor.css.ts +1 -1
  299. package/src/cubing/twisty/views/TwistyAlgEditor/TwistyAlgEditor.ts +11 -4
  300. package/src/cubing/twisty/views/TwistyAlgViewer.css.ts +1 -1
  301. package/src/cubing/twisty/views/TwistyAlgViewer.ts +4 -4
  302. package/src/cubing/twisty/{old/dom → views}/TwistyPlayer.css.ts +4 -1
  303. package/src/cubing/twisty/views/TwistyPlayer.ts +16 -25
  304. package/src/cubing/twisty/views/TwistyPlayerSettable.ts +14 -10
  305. package/src/cubing/twisty/{old/dom/viewers → views}/TwistyViewerWrapper.css.ts +1 -1
  306. package/src/cubing/twisty/{old/dom/viewers → views}/canvas.ts +0 -0
  307. package/src/cubing/twisty/{old/dom/controls/buttons.css.ts → views/control-panel/TwistyButtonsV2.css.ts} +1 -1
  308. package/src/cubing/twisty/views/control-panel/TwistyButtonsV2.ts +5 -8
  309. package/src/cubing/twisty/{old/dom/controls → views/control-panel}/TwistyScrubber.css.ts +1 -1
  310. package/src/cubing/twisty/views/control-panel/TwistyScrubberV2.ts +3 -3
  311. package/src/cubing/twisty/{old/dom/element → views}/node-custom-element-shims.ts +0 -0
  312. package/src/cubing/twisty/{old/dom → views}/stream/TwistyStreamSource.css.ts +1 -1
  313. package/src/cubing/twisty/{old/dom → views}/stream/TwistyStreamSource.ts +9 -9
  314. package/dist/esm/3d-B25DP5PE.js +0 -39
  315. package/dist/esm/3d-B25DP5PE.js.map +0 -7
  316. package/dist/esm/chunk-APIIMJG6.js.map +0 -7
  317. package/dist/esm/worker-inside-generated-string-KDZOUGJF.js.map +0 -7
  318. package/dist/types/twisty/old/animation/RenderScheduler.d.ts.map +0 -1
  319. package/dist/types/twisty/old/animation/Timeline.d.ts +0 -72
  320. package/dist/types/twisty/old/animation/Timeline.d.ts.map +0 -1
  321. package/dist/types/twisty/old/animation/cursor/AlgCursor.d.ts +0 -53
  322. package/dist/types/twisty/old/animation/cursor/AlgCursor.d.ts.map +0 -1
  323. package/dist/types/twisty/old/animation/cursor/CursorTypes.d.ts.map +0 -1
  324. package/dist/types/twisty/old/animation/easing.d.ts.map +0 -1
  325. package/dist/types/twisty/old/animation/indexer/AlgDuration.d.ts.map +0 -1
  326. package/dist/types/twisty/old/animation/indexer/AlgIndexer.d.ts.map +0 -1
  327. package/dist/types/twisty/old/animation/indexer/SimpleAlgIndexer.d.ts.map +0 -1
  328. package/dist/types/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexer.d.ts.map +0 -1
  329. package/dist/types/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.d.ts.map +0 -1
  330. package/dist/types/twisty/old/animation/indexer/simultaneous-moves/simul-moves.d.ts.map +0 -1
  331. package/dist/types/twisty/old/animation/indexer/tree/AlgWalker.d.ts.map +0 -1
  332. package/dist/types/twisty/old/animation/indexer/tree/TreeAlgIndexer.d.ts.map +0 -1
  333. package/dist/types/twisty/old/animation/indexer/tree/chunkAlgs.d.ts +0 -3
  334. package/dist/types/twisty/old/animation/indexer/tree/chunkAlgs.d.ts.map +0 -1
  335. package/dist/types/twisty/old/animation/stream/timeline-move-calculation-draft.d.ts.map +0 -1
  336. package/dist/types/twisty/old/dom/TwistyAlgViewerV1.css.d.ts +0 -3
  337. package/dist/types/twisty/old/dom/TwistyAlgViewerV1.css.d.ts.map +0 -1
  338. package/dist/types/twisty/old/dom/TwistyAlgViewerV1.d.ts +0 -52
  339. package/dist/types/twisty/old/dom/TwistyAlgViewerV1.d.ts.map +0 -1
  340. package/dist/types/twisty/old/dom/TwistyPlayer.css.d.ts +0 -3
  341. package/dist/types/twisty/old/dom/TwistyPlayer.css.d.ts.map +0 -1
  342. package/dist/types/twisty/old/dom/TwistyPlayer.d.ts +0 -92
  343. package/dist/types/twisty/old/dom/TwistyPlayer.d.ts.map +0 -1
  344. package/dist/types/twisty/old/dom/TwistyPlayer.spec.d.ts +0 -5
  345. package/dist/types/twisty/old/dom/TwistyPlayer.spec.d.ts.map +0 -1
  346. package/dist/types/twisty/old/dom/TwistyPlayerConfig.d.ts +0 -165
  347. package/dist/types/twisty/old/dom/TwistyPlayerConfig.d.ts.map +0 -1
  348. package/dist/types/twisty/old/dom/controls/TwistyControlElement.d.ts +0 -2
  349. package/dist/types/twisty/old/dom/controls/TwistyControlElement.d.ts.map +0 -1
  350. package/dist/types/twisty/old/dom/controls/TwistyScrubber.css.d.ts +0 -3
  351. package/dist/types/twisty/old/dom/controls/TwistyScrubber.d.ts +0 -14
  352. package/dist/types/twisty/old/dom/controls/TwistyScrubber.d.ts.map +0 -1
  353. package/dist/types/twisty/old/dom/controls/buttons.css.d.ts +0 -4
  354. package/dist/types/twisty/old/dom/controls/buttons.css.d.ts.map +0 -1
  355. package/dist/types/twisty/old/dom/controls/buttons.d.ts +0 -40
  356. package/dist/types/twisty/old/dom/controls/buttons.d.ts.map +0 -1
  357. package/dist/types/twisty/old/dom/controls/buttons.spec.d.ts +0 -5
  358. package/dist/types/twisty/old/dom/controls/buttons.spec.d.ts.map +0 -1
  359. package/dist/types/twisty/old/dom/element/ClassListManager.d.ts.map +0 -1
  360. package/dist/types/twisty/old/dom/element/ElementConfig.d.ts +0 -49
  361. package/dist/types/twisty/old/dom/element/ElementConfig.d.ts.map +0 -1
  362. package/dist/types/twisty/old/dom/element/ManagedCustomElement.d.ts.map +0 -1
  363. package/dist/types/twisty/old/dom/element/node-custom-element-shims.d.ts.map +0 -1
  364. package/dist/types/twisty/old/dom/stream/TwistyStreamSource.css.d.ts +0 -3
  365. package/dist/types/twisty/old/dom/stream/TwistyStreamSource.css.d.ts.map +0 -1
  366. package/dist/types/twisty/old/dom/stream/TwistyStreamSource.d.ts.map +0 -1
  367. package/dist/types/twisty/old/dom/viewers/Twisty2DSVG.d.ts +0 -26
  368. package/dist/types/twisty/old/dom/viewers/Twisty2DSVG.d.ts.map +0 -1
  369. package/dist/types/twisty/old/dom/viewers/Twisty2DSVGView.css.d.ts +0 -3
  370. package/dist/types/twisty/old/dom/viewers/Twisty2DSVGView.css.d.ts.map +0 -1
  371. package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.css.d.ts +0 -3
  372. package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.css.d.ts.map +0 -1
  373. package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.d.ts +0 -41
  374. package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.d.ts.map +0 -1
  375. package/dist/types/twisty/old/dom/viewers/TwistyOrbitControls.d.ts +0 -59
  376. package/dist/types/twisty/old/dom/viewers/TwistyOrbitControls.d.ts.map +0 -1
  377. package/dist/types/twisty/old/dom/viewers/TwistyViewerElement.d.ts +0 -4
  378. package/dist/types/twisty/old/dom/viewers/TwistyViewerElement.d.ts.map +0 -1
  379. package/dist/types/twisty/old/dom/viewers/TwistyViewerWrapper.css.d.ts +0 -3
  380. package/dist/types/twisty/old/dom/viewers/TwistyViewerWrapper.css.d.ts.map +0 -1
  381. package/dist/types/twisty/old/dom/viewers/TwistyViewerWrapper.d.ts +0 -18
  382. package/dist/types/twisty/old/dom/viewers/TwistyViewerWrapper.d.ts.map +0 -1
  383. package/dist/types/twisty/old/dom/viewers/canvas.d.ts.map +0 -1
  384. package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.d.ts +0 -41
  385. package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.d.ts.map +0 -1
  386. package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.spec.d.ts +0 -5
  387. package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.spec.d.ts.map +0 -1
  388. package/src/cubing/twisty/old/animation/Timeline.ts +0 -378
  389. package/src/cubing/twisty/old/animation/cursor/AlgCursor.ts +0 -252
  390. package/src/cubing/twisty/old/dom/TwistyAlgViewerV1.css.ts +0 -25
  391. package/src/cubing/twisty/old/dom/TwistyAlgViewerV1.ts +0 -516
  392. package/src/cubing/twisty/old/dom/TwistyPlayer.spec.ts +0 -25
  393. package/src/cubing/twisty/old/dom/TwistyPlayer.ts +0 -927
  394. package/src/cubing/twisty/old/dom/TwistyPlayerConfig.ts +0 -378
  395. package/src/cubing/twisty/old/dom/controls/TwistyControlElement.ts +0 -1
  396. package/src/cubing/twisty/old/dom/controls/TwistyScrubber.ts +0 -53
  397. package/src/cubing/twisty/old/dom/controls/buttons.spec.ts +0 -37
  398. package/src/cubing/twisty/old/dom/controls/buttons.ts +0 -326
  399. package/src/cubing/twisty/old/dom/element/ElementConfig.ts +0 -180
  400. package/src/cubing/twisty/old/dom/viewers/Twisty2DSVG.ts +0 -118
  401. package/src/cubing/twisty/old/dom/viewers/Twisty3DCanvas.ts +0 -256
  402. package/src/cubing/twisty/old/dom/viewers/TwistyOrbitControls.ts +0 -420
  403. package/src/cubing/twisty/old/dom/viewers/TwistyViewerElement.ts +0 -5
  404. package/src/cubing/twisty/old/dom/viewers/TwistyViewerWrapper.ts +0 -45
  405. package/src/cubing/twisty/views/3D/TwistyOrbitControlsV2.spec.ts +0 -209
  406. package/src/cubing/twisty/views/3D/TwistyOrbitControlsV2.ts +0 -270
@@ -1,927 +0,0 @@
1
- import { Vector3 } from "three";
2
- import { Alg, experimentalAppendMove, Move } from "../../../alg";
3
- import type { KPuzzleDefinition, Transformation } from "../../../kpuzzle";
4
- import { countMoves } from "../../../notation"; // TODO
5
- import type { StickerDat } from "../../../puzzle-geometry";
6
- import { puzzles } from "../../../puzzles";
7
- import type { PuzzleLoader } from "../../../puzzles/PuzzleLoader";
8
- import type { PuzzleAppearance } from "../../../puzzles/stickerings/appearance";
9
- import { Cube3D } from "../../views/3D/puzzles/Cube3D";
10
- import { PG3D, PG3DOptions } from "../../views/3D/puzzles/PG3D";
11
- import type { Twisty3DPuzzle } from "../../views/3D/puzzles/Twisty3DPuzzle";
12
- import { Twisty3DScene } from "../../views/3D/Twisty3DScene";
13
- import { AlgCursor, IndexerConstructor } from "../animation/cursor/AlgCursor";
14
- import { SimpleAlgIndexer } from "../animation/indexer/SimpleAlgIndexer";
15
- import { SimultaneousMoveIndexer } from "../animation/indexer/simultaneous-moves/SimultaneousMoveIndexer";
16
- import { TreeAlgIndexer } from "../animation/indexer/tree/TreeAlgIndexer";
17
- import {
18
- Timeline,
19
- TimelineAction,
20
- TimelineActionEvent,
21
- TimestampLocationType,
22
- } from "../animation/Timeline";
23
- import { TwistyControlButtonPanel } from "./controls/buttons";
24
- import type { TwistyControlElement } from "./controls/TwistyControlElement";
25
- import { TwistyScrubber } from "./controls/TwistyScrubber";
26
- import { ClassListManager } from "./element/ClassListManager";
27
- import { ManagedCustomElement } from "./element/ManagedCustomElement";
28
- import { customElementsShim } from "./element/node-custom-element-shims";
29
- import { twistyPlayerCSS } from "./TwistyPlayer.css";
30
- import {
31
- BackgroundTheme,
32
- CameraLatitudeLimits,
33
- ControlsLocation,
34
- defaultCameraOrbitCoordinates,
35
- ExperimentalStickering,
36
- HintFaceletStyle,
37
- PuzzleID,
38
- pyraminxLookAt,
39
- SetupToLocation,
40
- TwistyPlayerConfig,
41
- TwistyPlayerInitialConfig,
42
- ViewerLinkPage,
43
- VisualizationFormat,
44
- } from "./TwistyPlayerConfig";
45
- import { Twisty2DSVG, Twisty2DSVGOptions } from "./viewers/Twisty2DSVG";
46
- import { Twisty3DCanvas } from "./viewers/Twisty3DCanvas";
47
- import type {
48
- OrbitCoordinates,
49
- TwistyOrbitControls,
50
- } from "./viewers/TwistyOrbitControls";
51
- import type { TwistyViewerElement } from "./viewers/TwistyViewerElement";
52
- import {
53
- BackViewLayout,
54
- TwistyViewerWrapper,
55
- } from "./viewers/TwistyViewerWrapper";
56
-
57
- export interface LegacyExperimentalPG3DViewConfig {
58
- def: KPuzzleDefinition;
59
- stickerDat: StickerDat;
60
- experimentalPolarVantages?: boolean;
61
- showFoundation?: boolean;
62
- hintStickers?: boolean;
63
- hintStickerHeightScale?: number;
64
- }
65
-
66
- function is3DVisualization(visualizationFormat: VisualizationFormat): boolean {
67
- return ["3D", "PG3D"].includes(visualizationFormat);
68
- }
69
-
70
- interface PendingPuzzleUpdate {
71
- cancelled: boolean;
72
- }
73
-
74
- const indexerMap = {
75
- simple: SimpleAlgIndexer,
76
- tree: TreeAlgIndexer,
77
- simultaneous: SimultaneousMoveIndexer,
78
- };
79
-
80
- export class TwistyPlayerV1 extends ManagedCustomElement {
81
- #config: TwistyPlayerConfig;
82
-
83
- timeline: Timeline;
84
- cursor: AlgCursor | null;
85
- scene: Twisty3DScene | null = null;
86
- twisty3D: Twisty3DPuzzle | null = null;
87
-
88
- #connected = false;
89
- #legacyExperimentalPG3DViewConfig: LegacyExperimentalPG3DViewConfig | null =
90
- null;
91
-
92
- /** @deprecated */
93
- public legacyExperimentalPG3D: PG3D | null = null;
94
- #experimentalStartStateOverride: Transformation | null = null;
95
-
96
- viewerElems: TwistyViewerElement[] = []; // TODO: can we represent the intermediate state better?
97
- controlElems: TwistyControlElement[] = []; // TODO: can we represent the intermediate state better?
98
-
99
- #hackyPendingFinalMoveCoalesce = false;
100
-
101
- #viewerWrapper: TwistyViewerWrapper;
102
- public legacyExperimentalCoalesceModFunc: (move: Move) => number = (
103
- _move: Move,
104
- ): number => 0;
105
-
106
- #controlsClassListManager: ClassListManager<ControlsLocation> =
107
- new ClassListManager(this, "controls-", ["none", "bottom-row"]);
108
-
109
- #experimentalInvalidInitialAlgCallback: (alg: Alg) => void;
110
- #initialized = false;
111
-
112
- // TODO: support config from DOM.
113
- constructor(
114
- initialConfig: TwistyPlayerInitialConfig = {},
115
- legacyExperimentalPG3DViewConfig: LegacyExperimentalPG3DViewConfig | null = null,
116
- experimentalInvalidInitialAlgCallback: (alg: Alg) => void = () => {
117
- // stub
118
- },
119
- ) {
120
- super();
121
- this.addCSS(twistyPlayerCSS);
122
- this.#config = new TwistyPlayerConfig(this, initialConfig);
123
- this.#experimentalInvalidInitialAlgCallback =
124
- experimentalInvalidInitialAlgCallback;
125
-
126
- this.timeline = new Timeline();
127
- this.timeline.addActionListener(this);
128
-
129
- // We also do this in connectedCallback, but for now we also do it here so
130
- // that there is some visual change even if the rest of construction or
131
- // initialization fails.
132
- this.contentWrapper.classList.add("checkered");
133
-
134
- this.#legacyExperimentalPG3DViewConfig = legacyExperimentalPG3DViewConfig;
135
- }
136
-
137
- set alg(newAlg: Alg | string) {
138
- // TODO: do validation for other algs as well.
139
- if (typeof newAlg === "string") {
140
- newAlg = Alg.fromString(newAlg);
141
- }
142
- this.#config.attributes["alg"].setValue(newAlg);
143
- this.cursor?.setAlg(newAlg, this.#indexerConstructor()); // TODO: can we ensure the cursor already exists?
144
- this.#setCursorStartState();
145
-
146
- this.dispatchEvent(
147
- new CustomEvent("experimental-alg-update", { detail: { alg: this.alg } }),
148
- );
149
- }
150
-
151
- get alg(): Alg {
152
- return this.#config.attributes["alg"].value;
153
- }
154
-
155
- /** @deprecated */
156
- set experimentalSetupAlg(newAlg: Alg | string) {
157
- // TODO: do validation for other algs as well.
158
- if (typeof newAlg === "string") {
159
- console.warn(
160
- "`experimentalSetupAlg` for a `TwistyPlayer` was set using a string. It should be set using a `Sequence`!",
161
- );
162
- newAlg = new Alg(newAlg as unknown as string);
163
- }
164
- this.#config.attributes["experimental-setup-alg"].setValue(newAlg);
165
- this.#setCursorStartState();
166
- }
167
-
168
- /** @deprecated */
169
- get experimentalSetupAlg(): Alg {
170
- return this.#config.attributes["experimental-setup-alg"].value;
171
- }
172
-
173
- #setCursorStartState(): void {
174
- if (this.cursor) {
175
- this.cursor.setStartState(
176
- this.#experimentalStartStateOverride ??
177
- this.cursor.algToState(this.#cursorStartAlg()),
178
- ); // TODO
179
- }
180
- }
181
-
182
- #cursorStartAlg(): Alg {
183
- let startAlg = this.experimentalSetupAlg;
184
- if (this.experimentalSetupAnchor === "end") {
185
- startAlg = startAlg.concat(this.alg.invert());
186
- }
187
- return startAlg; // TODO
188
- }
189
-
190
- /** @deprecated */
191
- set experimentalSetupAnchor(setupToLocation: SetupToLocation) {
192
- this.#config.attributes["experimental-setup-anchor"].setValue(
193
- setupToLocation,
194
- );
195
- this.#setCursorStartState();
196
- }
197
-
198
- /** @deprecated */
199
- get experimentalSetupAnchor(): SetupToLocation {
200
- return this.#config.attributes["experimental-setup-anchor"].value;
201
- }
202
-
203
- set puzzle(puzzle: PuzzleID) {
204
- if (this.#config.attributes["puzzle"].setValue(puzzle)) {
205
- this.updatePuzzleDOM();
206
- }
207
- }
208
-
209
- get puzzle(): PuzzleID {
210
- return this.#config.attributes["puzzle"].value;
211
- }
212
-
213
- set visualization(visualization: VisualizationFormat) {
214
- if (this.#config.attributes["visualization"].setValue(visualization)) {
215
- this.updatePuzzleDOM();
216
- }
217
- }
218
-
219
- get visualization(): VisualizationFormat {
220
- return this.#config.attributes["visualization"].value;
221
- }
222
-
223
- set hintFacelets(hintFacelets: HintFaceletStyle) {
224
- // TODO: implement this for PG3D.
225
- if (this.#config.attributes["hint-facelets"].setValue(hintFacelets)) {
226
- if (this.twisty3D instanceof Cube3D) {
227
- this.twisty3D.experimentalUpdateOptions({ hintFacelets });
228
- }
229
- }
230
- }
231
-
232
- get hintFacelets(): HintFaceletStyle {
233
- return this.#config.attributes["hint-facelets"].value;
234
- }
235
-
236
- // TODO: Implement for PG3D
237
- /** @deprecated */
238
- set experimentalStickering(experimentalStickering: ExperimentalStickering) {
239
- if (
240
- this.#config.attributes["experimental-stickering"].setValue(
241
- experimentalStickering,
242
- )
243
- ) {
244
- const twisty3D = this.twisty3D;
245
- if (twisty3D instanceof Cube3D) {
246
- twisty3D.experimentalUpdateOptions({
247
- experimentalStickering,
248
- });
249
- }
250
- if (twisty3D instanceof PG3D) {
251
- (async () => {
252
- const appearance = await this.#getPG3DAppearance();
253
- twisty3D.experimentalSetAppearance(appearance!); // TODO
254
- })();
255
- }
256
- if (this.viewerElems[0] instanceof Twisty2DSVG) {
257
- this.viewerElems[0].experimentalSetStickering(
258
- this.experimentalStickering,
259
- );
260
- }
261
- }
262
- }
263
-
264
- // TODO: Implement for PG3D
265
- /** @deprecated */
266
- get experimentalStickering(): ExperimentalStickering {
267
- return this.#config.attributes["experimental-stickering"].value;
268
- }
269
-
270
- set background(background: BackgroundTheme) {
271
- if (this.#config.attributes["background"].setValue(background)) {
272
- this.contentWrapper.classList.toggle(
273
- "checkered",
274
- background === "checkered",
275
- );
276
- }
277
- }
278
-
279
- get background(): BackgroundTheme {
280
- return this.#config.attributes["background"].value;
281
- }
282
-
283
- set controlPanel(controlPanel: ControlsLocation) {
284
- this.#config.attributes["control-panel"].setValue(controlPanel);
285
- this.#controlsClassListManager.setValue(controlPanel);
286
- }
287
-
288
- get controlPanel(): ControlsLocation {
289
- return this.#config.attributes["control-panel"].value;
290
- }
291
-
292
- /** @deprecated use `controlPanel */
293
- set controls(controls: ControlsLocation) {
294
- this.controlPanel = controls;
295
- }
296
-
297
- /** @deprecated use `controlPanel */
298
- get controls(): ControlsLocation {
299
- return this.controlPanel;
300
- }
301
-
302
- set backView(backView: BackViewLayout) {
303
- this.#config.attributes["back-view"].setValue(backView);
304
- if (backView !== "none" && this.viewerElems.length === 1) {
305
- this.#createBackViewer();
306
- }
307
- if (backView === "none" && this.viewerElems.length > 1) {
308
- this.#removeBackViewerElem();
309
- }
310
- if (this.#viewerWrapper && this.#viewerWrapper.setBackView(backView)) {
311
- for (const viewer of this.viewerElems as Twisty3DCanvas[]) {
312
- viewer.makeInvisibleUntilRender(); // TODO: can we do this more elegantly?
313
- }
314
- }
315
- }
316
-
317
- get backView(): BackViewLayout {
318
- return this.#config.attributes["back-view"].value;
319
- }
320
-
321
- #orbitControls(): TwistyOrbitControls | null {
322
- if (
323
- !["3D", "PG3D"].includes(this.#config.attributes["visualization"].value)
324
- ) {
325
- return null;
326
- }
327
- return (this.viewerElems[0] as Twisty3DCanvas)?.orbitControls ?? null;
328
- }
329
-
330
- #backOrbitControls(): TwistyOrbitControls | null {
331
- if (
332
- !["3D", "PG3D"].includes(this.#config.attributes["visualization"].value)
333
- ) {
334
- return null;
335
- }
336
- return (this.viewerElems[1] as Twisty3DCanvas)?.orbitControls ?? null;
337
- }
338
-
339
- set experimentalCameraLatitude(latitude: number | null) {
340
- this.#config.attributes["experimental-camera-latitude"].setValue(latitude);
341
- const orbitControls = this.#orbitControls();
342
- if (orbitControls && latitude !== null) {
343
- orbitControls.latitude = latitude;
344
- this.viewerElems[0].scheduleRender();
345
- this.viewerElems[1]?.scheduleRender();
346
- }
347
- }
348
-
349
- get experimentalCameraLatitude(): number | null {
350
- if (
351
- this.#config.attributes["experimental-camera-latitude"].value !== null
352
- ) {
353
- return this.#config.attributes["experimental-camera-latitude"].value;
354
- }
355
- return this.#orbitControls()?.latitude ?? null;
356
- }
357
-
358
- set experimentalCameraLongitude(longitude: number | null) {
359
- this.#config.attributes["experimental-camera-longitude"].setValue(
360
- longitude,
361
- );
362
- const orbitControls = this.#orbitControls();
363
- if (orbitControls && longitude !== null) {
364
- orbitControls.longitude = longitude;
365
- this.viewerElems[0].scheduleRender();
366
- this.viewerElems[1]?.scheduleRender();
367
- }
368
- }
369
-
370
- get experimentalCameraLongitude(): number | null {
371
- if (
372
- this.#config.attributes["experimental-camera-longitude"].value !== null
373
- ) {
374
- return this.#config.attributes["experimental-camera-longitude"].value;
375
- }
376
- return this.#orbitControls()?.longitude ?? null;
377
- }
378
-
379
- set experimentalCameraLatitudeLimits(latitudeLimits: CameraLatitudeLimits) {
380
- this.#config.attributes["experimental-camera-latitude-limits"].setValue(
381
- latitudeLimits,
382
- );
383
- const orbitControls = this.#orbitControls();
384
- console.log({ orbitControls });
385
- if (orbitControls) {
386
- orbitControls.experimentalLatitudeLimits = latitudeLimits;
387
- }
388
- const backOrbitControls = this.#backOrbitControls(); // TODO: propagate through direct orbit controls as source of truth.
389
- if (backOrbitControls) {
390
- backOrbitControls.experimentalLatitudeLimits = latitudeLimits;
391
- }
392
- }
393
-
394
- get experimentalCameraLatitudeLimits(): CameraLatitudeLimits {
395
- // TODO: sync with orbit controls
396
- return this.#config.attributes["experimental-camera-latitude-limits"].value;
397
- }
398
-
399
- set viewerLink(viewerLinkPage: ViewerLinkPage) {
400
- this.#config.attributes["viewer-link"].setValue(viewerLinkPage);
401
- const maybePanel = this.controlElems[1] as
402
- | TwistyControlButtonPanel
403
- | undefined;
404
- if (maybePanel?.setViewerLink) {
405
- maybePanel.setViewerLink(viewerLinkPage);
406
- }
407
- }
408
-
409
- get viewerLink(): ViewerLinkPage {
410
- return this.#config.attributes["viewer-link"].value;
411
- }
412
-
413
- /** @deprecated */
414
- experimentalSetCameraOrbitCoordinates(coords: OrbitCoordinates): void {
415
- this.experimentalCameraLatitude = coords.latitude;
416
- this.experimentalCameraLongitude = coords.longitude;
417
- const orbitControls = this.#orbitControls();
418
- if (orbitControls) {
419
- orbitControls.distance = coords.distance;
420
- }
421
- }
422
-
423
- /** @deprecated */
424
- experimentalDerivedCameraOrbitCoordinates(): OrbitCoordinates {
425
- const defaultCoordinatesForPuzzle = defaultCameraOrbitCoordinates(
426
- this.puzzle,
427
- this.twisty3D instanceof PG3D ? "PG3D" : "Cube3D",
428
- );
429
-
430
- return {
431
- latitude:
432
- this.experimentalCameraLatitude ?? defaultCoordinatesForPuzzle.latitude,
433
- longitude:
434
- this.experimentalCameraLongitude ??
435
- defaultCoordinatesForPuzzle.longitude,
436
- distance: defaultCoordinatesForPuzzle.distance, // TODO
437
- };
438
- }
439
-
440
- #lookAt(): Vector3 {
441
- switch (this.puzzle) {
442
- case "pyraminx":
443
- case "master_tetraminx":
444
- return pyraminxLookAt;
445
- default:
446
- return new Vector3(0, 0, 0);
447
- }
448
- }
449
-
450
- static get observedAttributes(): string[] {
451
- return TwistyPlayerConfig.observedAttributes;
452
- }
453
-
454
- attributeChangedCallback(
455
- attributeName: string,
456
- oldValue: string,
457
- newValue: string,
458
- ): void {
459
- this.#config.attributeChangedCallback(attributeName, oldValue, newValue);
460
- }
461
-
462
- experimentalSetStartStateOverride(state: Transformation | null): void {
463
- this.#experimentalStartStateOverride = state;
464
- this.#setCursorStartState();
465
- }
466
-
467
- #cursorIndexerName: "simple" | "tree" | "simultaneous" = "tree";
468
- /** @deprecated */
469
- public experimentalSetCursorIndexer(
470
- cursorName: "simple" | "tree" | "simultaneous",
471
- ): void {
472
- if (this.#cursorIndexerName === cursorName) {
473
- // TODO: This is a hacky optimization.
474
- return;
475
- }
476
- this.#cursorIndexerName = cursorName;
477
- this.cursor?.experimentalSetIndexer(this.#indexerConstructor());
478
- }
479
-
480
- #indexerConstructor(): IndexerConstructor {
481
- return indexerMap[this.#cursorIndexerName];
482
- }
483
-
484
- // TODO: It seems this called after the `attributeChangedCallback`s for initial values. Can we rely on this?
485
- protected connectedCallback(): void {
486
- this.contentWrapper.classList.toggle(
487
- "checkered",
488
- this.background === "checkered",
489
- );
490
-
491
- // TODO: specify exactly when back views are possible.
492
- // TODO: Are there any SVGs where we'd want a separate back view?
493
- const setBackView: boolean =
494
- this.backView && is3DVisualization(this.visualization);
495
- const backView: BackViewLayout = setBackView ? this.backView : "none";
496
- this.#viewerWrapper = new TwistyViewerWrapper({
497
- backView,
498
- });
499
- this.addElement(this.#viewerWrapper);
500
-
501
- const scrubber = new TwistyScrubber(this.timeline);
502
- const controlButtonGrid = new TwistyControlButtonPanel(this.timeline, {
503
- fullscreenElement: this,
504
- viewerLinkCallback: this.visitTwizzleLink.bind(this),
505
- viewerLink: this.viewerLink,
506
- });
507
-
508
- this.controlElems = [scrubber, controlButtonGrid];
509
-
510
- this.#controlsClassListManager.setValue(this.controlPanel);
511
-
512
- this.addElement(this.controlElems[0]);
513
- this.addElement(this.controlElems[1]);
514
-
515
- this.#connected = true;
516
- this.updatePuzzleDOM(true).then(() => {
517
- if (!this.#initialized) {
518
- this.#initialized = true;
519
- // TODO: warn if `initialized` listener is registered after initialized?
520
- this.dispatchEvent(new CustomEvent("initialized"));
521
- }
522
- });
523
- }
524
-
525
- get initialized(): boolean {
526
- return this.#initialized;
527
- }
528
-
529
- public twizzleLink(): string {
530
- const url = new URL("https://alpha.twizzle.net/edit/");
531
- if (!this.alg.experimentalIsEmpty()) {
532
- url.searchParams.set("alg", this.alg.toString());
533
- }
534
- if (!this.experimentalSetupAlg.experimentalIsEmpty()) {
535
- url.searchParams.set(
536
- "experimental-setup-alg",
537
- this.experimentalSetupAlg.toString(),
538
- );
539
- }
540
- if (this.experimentalSetupAnchor !== "start") {
541
- url.searchParams.set(
542
- "experimental-setup-anchor",
543
- this.experimentalSetupAnchor,
544
- );
545
- }
546
- if (this.experimentalStickering !== "full") {
547
- url.searchParams.set(
548
- "experimental-stickering",
549
- this.experimentalStickering,
550
- );
551
- }
552
- if (this.puzzle !== "3x3x3") {
553
- url.searchParams.set("puzzle", this.puzzle);
554
- }
555
- return url.toString();
556
- }
557
-
558
- public visitTwizzleLink(): void {
559
- const a = document.createElement("a");
560
- a.href = this.twizzleLink();
561
- a.target = "_blank";
562
- a.click();
563
- }
564
-
565
- #pendingPuzzleUpdates: PendingPuzzleUpdate[] = [];
566
- #renderMode: "2D" | "3D" | null = null;
567
-
568
- // Idempotent
569
- #clearRenderMode(): void {
570
- switch (this.#renderMode) {
571
- case "3D":
572
- this.scene = null;
573
- this.twisty3D = null;
574
- this.legacyExperimentalPG3D = null;
575
- this.viewerElems = [];
576
- this.#viewerWrapper.clear();
577
- break;
578
- case "2D":
579
- this.viewerElems = [];
580
- this.#viewerWrapper.clear();
581
- break;
582
- }
583
- this.#renderMode = null;
584
- }
585
-
586
- #setRenderMode2D(): void {
587
- if (this.#renderMode === "2D") {
588
- return;
589
- }
590
- this.#clearRenderMode();
591
- this.#renderMode = "2D";
592
- }
593
-
594
- #setTwisty2DSVG(twisty2DSVG: Twisty2DSVG): void {
595
- this.#setRenderMode2D();
596
-
597
- this.#viewerWrapper.clear();
598
- this.#viewerWrapper.addElement(twisty2DSVG);
599
- this.viewerElems.push(twisty2DSVG);
600
- }
601
-
602
- #setRenderMode3D(): void {
603
- if (this.#renderMode === "3D") {
604
- return;
605
- }
606
- this.#clearRenderMode();
607
-
608
- this.scene = new Twisty3DScene();
609
- const mainViewer = new Twisty3DCanvas(this.scene, {
610
- orbitCoordinates: this.experimentalDerivedCameraOrbitCoordinates(),
611
- });
612
- mainViewer.orbitControls.experimentalLatitudeLimits =
613
- this.experimentalCameraLatitudeLimits;
614
- this.viewerElems.push(mainViewer);
615
- this.#viewerWrapper.addElement(mainViewer);
616
-
617
- if (this.backView !== "none") {
618
- this.#createBackViewer();
619
- }
620
- this.#renderMode = "3D";
621
- }
622
-
623
- #setTwisty3D(twisty3D: Twisty3DPuzzle): void {
624
- if (this.twisty3D) {
625
- this.scene!.removeTwisty3DPuzzle(this.twisty3D);
626
- if (this.twisty3D instanceof PG3D) {
627
- this.twisty3D.dispose();
628
- }
629
- this.twisty3D = null;
630
- }
631
- this.twisty3D = twisty3D;
632
- this.scene!.addTwisty3DPuzzle(twisty3D);
633
- const orbitControls = this.#orbitControls();
634
- if (orbitControls) {
635
- orbitControls.lookAt(this.#lookAt());
636
- }
637
- }
638
-
639
- #setCursor(cursor: AlgCursor): void {
640
- const oldCursor = this.cursor;
641
- this.cursor = cursor;
642
- try {
643
- this.cursor.setAlg(this.alg, this.#indexerConstructor());
644
- this.#setCursorStartState();
645
- } catch (e) {
646
- this.cursor.setAlg(new Alg(), this.#indexerConstructor());
647
- this.cursor.setStartState(this.cursor.algToState(new Alg()));
648
- this.#experimentalInvalidInitialAlgCallback(this.alg);
649
- }
650
- this.#setCursorStartState();
651
- this.timeline.addCursor(cursor);
652
- if (oldCursor) {
653
- this.timeline.removeCursor(oldCursor);
654
- this.timeline.removeTimestampListener(oldCursor);
655
- }
656
- this.experimentalSetCursorIndexer(this.#cursorIndexerName);
657
- }
658
-
659
- async updatePuzzleDOM(initial = false): Promise<void> {
660
- if (!this.#connected) {
661
- return;
662
- }
663
-
664
- let puzzleLoader: PuzzleLoader;
665
- if (this.puzzle === "custom") {
666
- puzzleLoader = {
667
- id: "custom",
668
- fullName: "Custom (PG3D)",
669
- def: () => Promise.resolve(this.#legacyExperimentalPG3DViewConfig!.def),
670
- svg: () => {
671
- throw "unimplemented";
672
- },
673
- };
674
- } else {
675
- puzzleLoader = puzzles[this.puzzle];
676
- }
677
-
678
- for (const pendingPuzzleUpdate of this.#pendingPuzzleUpdates) {
679
- pendingPuzzleUpdate.cancelled = true;
680
- }
681
- this.#pendingPuzzleUpdates = [];
682
- const pendingPuzzleUpdate: PendingPuzzleUpdate = { cancelled: false };
683
- this.#pendingPuzzleUpdates.push(pendingPuzzleUpdate);
684
-
685
- const def: KPuzzleDefinition = await puzzleLoader.def();
686
- if (pendingPuzzleUpdate.cancelled) {
687
- return;
688
- }
689
-
690
- let cursor: AlgCursor;
691
- try {
692
- cursor = new AlgCursor(
693
- this.timeline,
694
- def,
695
- this.alg,
696
- this.#cursorStartAlg(),
697
- this.#indexerConstructor(),
698
- ); // TODO: validate more directly if the alg is okay for the puzzle.
699
- this.#setCursor(cursor);
700
- } catch (e) {
701
- if (initial) {
702
- // TODO: also take into account setup alg.
703
- this.#experimentalInvalidInitialAlgCallback(this.alg);
704
- }
705
- cursor = new AlgCursor(
706
- this.timeline,
707
- def,
708
- new Alg(),
709
- new Alg(),
710
- this.#indexerConstructor(),
711
- );
712
- this.#setCursor(cursor);
713
- }
714
- if (
715
- initial &&
716
- this.experimentalSetupAlg.experimentalIsEmpty() &&
717
- this.experimentalSetupAnchor !== "end"
718
- ) {
719
- this.timeline.jumpToEnd();
720
- }
721
- switch (this.visualization) {
722
- case "2D":
723
- case "experimental-2D-LL":
724
- {
725
- const options: Twisty2DSVGOptions = {};
726
- if (this.experimentalStickering) {
727
- options.experimentalStickering = this.experimentalStickering;
728
- }
729
-
730
- this.#setRenderMode2D();
731
- const svgPromiseFn =
732
- this.visualization === "2D"
733
- ? puzzleLoader.svg
734
- : puzzleLoader.llSVG ?? puzzleLoader.svg;
735
- const mainViewer = new Twisty2DSVG(
736
- cursor,
737
- def,
738
- await svgPromiseFn(),
739
- options,
740
- puzzleLoader,
741
- );
742
- if (!pendingPuzzleUpdate.cancelled) {
743
- this.#setTwisty2DSVG(mainViewer);
744
- }
745
- }
746
- break;
747
- case "3D":
748
- case "PG3D":
749
- {
750
- this.#setRenderMode3D();
751
- const scene = this.scene!;
752
-
753
- let twisty3D: Twisty3DPuzzle;
754
- if (this.visualization === "3D" && this.puzzle === "3x3x3") {
755
- twisty3D = new Cube3D(
756
- def,
757
- cursor,
758
- scene.scheduleRender.bind(scene),
759
- {
760
- hintFacelets: this.hintFacelets,
761
- experimentalStickering: this.experimentalStickering,
762
- },
763
- );
764
- } else {
765
- let def: KPuzzleDefinition;
766
- let stickerDat: StickerDat;
767
- const pgGetter = puzzleLoader.pg;
768
- if (this.puzzle === "custom") {
769
- def = this.#legacyExperimentalPG3DViewConfig!.def;
770
- stickerDat = this.#legacyExperimentalPG3DViewConfig!.stickerDat;
771
- } else if (pgGetter) {
772
- const pg = await pgGetter();
773
- if (pendingPuzzleUpdate.cancelled) {
774
- return;
775
- }
776
- def = pg.writekpuzzle(true); // TODO
777
- stickerDat = pg.get3d();
778
- } else {
779
- throw "Unimplemented!";
780
- }
781
- const options: PG3DOptions = {};
782
-
783
- const heightMap: Record<string, number> = {
784
- megaminx: 1.5,
785
- pyraminx: 1.75,
786
- };
787
- const hintStickerHeightScale =
788
- this.#legacyExperimentalPG3DViewConfig?.hintStickerHeightScale ??
789
- heightMap[this.puzzle] ??
790
- 1;
791
- const pg3d = new PG3D(
792
- cursor,
793
- scene.scheduleRender.bind(scene),
794
- def,
795
- stickerDat,
796
- this.#legacyExperimentalPG3DViewConfig?.showFoundation ?? true,
797
- this.#legacyExperimentalPG3DViewConfig?.hintStickers ??
798
- this.hintFacelets === "floating",
799
- hintStickerHeightScale,
800
- options,
801
- );
802
- (async () => {
803
- const appearance = await this.#getPG3DAppearance();
804
- if (appearance) {
805
- pg3d.experimentalSetAppearance(appearance);
806
- }
807
- })();
808
- this.legacyExperimentalPG3D = pg3d;
809
- twisty3D = pg3d;
810
- }
811
- this.#setTwisty3D(twisty3D);
812
- }
813
- break;
814
- }
815
- }
816
-
817
- async #getPG3DAppearance(): Promise<PuzzleAppearance | null> {
818
- const puzzleLoader = puzzles[this.puzzle];
819
- if (puzzleLoader?.appearance) {
820
- return puzzleLoader.appearance(this.experimentalStickering ?? "full");
821
- }
822
- return null;
823
- }
824
-
825
- #createBackViewer(): void {
826
- if (!is3DVisualization(this.visualization)) {
827
- throw new Error("Back viewer requires a 3D visualization");
828
- }
829
-
830
- const backViewer = new Twisty3DCanvas(this.scene!, {
831
- orbitCoordinates: this.experimentalDerivedCameraOrbitCoordinates(),
832
- negateCameraPosition: true,
833
- });
834
- backViewer.orbitControls.experimentalLatitudeLimits =
835
- this.experimentalCameraLatitudeLimits;
836
- this.viewerElems.push(backViewer);
837
- (this.viewerElems[0] as Twisty3DCanvas).setMirror(backViewer);
838
- this.#viewerWrapper.addElement(backViewer);
839
- }
840
-
841
- #removeBackViewerElem(): void {
842
- // TODO: Validate visualization.
843
- if (this.viewerElems.length !== 2) {
844
- throw new Error("Tried to remove non-existent back view!");
845
- }
846
- this.#viewerWrapper.removeElement(this.viewerElems.pop()!);
847
- }
848
-
849
- async setCustomPuzzleGeometry(
850
- legacyExperimentalPG3DViewConfig: LegacyExperimentalPG3DViewConfig,
851
- ): Promise<void> {
852
- this.puzzle = "custom";
853
- this.#legacyExperimentalPG3DViewConfig = legacyExperimentalPG3DViewConfig;
854
- await this.updatePuzzleDOM();
855
- }
856
-
857
- // TODO: Handle playing the new move vs. just modying the alg.
858
- // Note: setting `coalesce`
859
- experimentalAddMove(
860
- move: Move,
861
- coalesce = false,
862
- coalesceDelayed = false,
863
- ): void {
864
- if (this.#hackyPendingFinalMoveCoalesce) {
865
- this.#hackyCoalescePending();
866
- }
867
- const oldNumMoves = countMoves(this.alg); // TODO
868
- const newAlg = experimentalAppendMove(this.alg, move, {
869
- coalesce: coalesce && !coalesceDelayed,
870
- mod: this.legacyExperimentalCoalesceModFunc(move),
871
- });
872
- // const newAlg = experimentalAppendBlockMove(
873
- // this.alg,
874
- // move,
875
- // coalesce && !coalesceDelayed,
876
- // this.legacyExperimentalCoalesceModFunc(move),
877
- // );
878
- if (coalesce && coalesceDelayed) {
879
- this.#hackyPendingFinalMoveCoalesce = true;
880
- }
881
-
882
- this.alg = newAlg;
883
- // TODO
884
- if (oldNumMoves <= countMoves(newAlg)) {
885
- this.timeline.experimentalJumpToLastMove();
886
- } else {
887
- this.timeline.jumpToEnd();
888
- }
889
- this.timeline.play();
890
- }
891
-
892
- onTimelineAction(actionEvent: TimelineActionEvent): void {
893
- if (
894
- actionEvent.action === TimelineAction.Pausing &&
895
- actionEvent.locationType === TimestampLocationType.EndOfTimeline &&
896
- this.#hackyPendingFinalMoveCoalesce
897
- ) {
898
- this.#hackyCoalescePending();
899
- this.timeline.jumpToEnd();
900
- }
901
- }
902
-
903
- #hackyCoalescePending(): void {
904
- const units = Array.from(this.alg.units());
905
- const length = units.length;
906
- const pending = this.#hackyPendingFinalMoveCoalesce;
907
- this.#hackyPendingFinalMoveCoalesce = false;
908
- if (pending && length > 1 && units[length - 1].is(Move)) {
909
- const finalMove = units[length - 1] as Move;
910
- const newAlg = experimentalAppendMove(
911
- new Alg(units.slice(0, length - 1)),
912
- finalMove,
913
- {
914
- coalesce: true,
915
- mod: this.legacyExperimentalCoalesceModFunc(finalMove),
916
- },
917
- );
918
- this.alg = newAlg;
919
- }
920
- }
921
-
922
- fullscreen(): void {
923
- this.requestFullscreen();
924
- }
925
- }
926
-
927
- customElementsShim.define("twisty-player-v1", TwistyPlayerV1);