cubing 0.21.0-pre8 → 0.21.2

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 (311) hide show
  1. package/{src/cubing/search/inside/solve → dist}/.DS_Store +0 -0
  2. package/dist/bin/puzzle-geometry-bin.js +1 -1
  3. package/dist/bin/puzzle-geometry-bin.js.map +2 -2
  4. package/dist/bundle-global/cubing.bundle-global.js +876 -797
  5. package/dist/esm/{3d-TYWC5MQY.js → 3d-B25DP5PE.js} +3 -3
  6. package/dist/esm/{3d-TYWC5MQY.js.map → 3d-B25DP5PE.js.map} +0 -0
  7. package/dist/esm/bluetooth/index.js +1 -1
  8. package/dist/esm/bluetooth/index.js.map +1 -1
  9. package/dist/esm/{chunk-6BXLPCNQ.js → chunk-APIIMJG6.js} +98 -95
  10. package/dist/esm/chunk-APIIMJG6.js.map +7 -0
  11. package/dist/esm/{chunk-HUPF5GPN.js → chunk-CSVAFZSB.js} +3 -3
  12. package/dist/esm/{chunk-HUPF5GPN.js.map → chunk-CSVAFZSB.js.map} +0 -0
  13. package/dist/esm/{chunk-L6K5FKPV.js → chunk-MUQMBH2S.js} +48 -26
  14. package/dist/esm/{chunk-L6K5FKPV.js.map → chunk-MUQMBH2S.js.map} +2 -2
  15. package/dist/esm/puzzle-geometry/index.js +1 -1
  16. package/dist/esm/puzzle-geometry/index.js.map +2 -2
  17. package/dist/esm/puzzles/index.js +5 -5
  18. package/dist/esm/scramble/index.js +2 -2
  19. package/dist/esm/search/index.js +2 -2
  20. package/dist/esm/twisty/index.js +313 -78
  21. package/dist/esm/twisty/index.js.map +3 -3
  22. package/dist/esm/{worker-inside-generated-string-DOHINKQX.js → worker-inside-generated-string-KDZOUGJF.js} +20 -20
  23. package/dist/esm/worker-inside-generated-string-KDZOUGJF.js.map +7 -0
  24. package/{src/cubing/search/inside/solve/vendor/cstimer → dist/types}/.DS_Store +0 -0
  25. package/dist/types/bluetooth/smart-puzzle/bluetooth-puzzle.d.ts +1 -1
  26. package/dist/types/bluetooth/smart-puzzle/bluetooth-puzzle.d.ts.map +1 -1
  27. package/dist/types/cubing.bundle-global.d.ts +1 -24
  28. package/dist/types/cubing.bundle-global.d.ts.map +1 -1
  29. package/dist/types/puzzles/implementations/fto/index.d.ts +2 -2
  30. package/dist/types/puzzles/implementations/fto/index.d.ts.map +1 -1
  31. package/dist/types/puzzles/index.d.ts +5 -1
  32. package/dist/types/puzzles/index.d.ts.map +1 -1
  33. package/dist/types/puzzles/stickerings/fto-stickerings.d.ts.map +1 -1
  34. package/dist/types/search/inside/api.d.ts.map +1 -1
  35. package/dist/types/search/worker-inside-generated-string.d.ts +1 -1
  36. package/dist/types/search/worker-inside-generated-string.d.ts.map +1 -1
  37. package/dist/types/twisty/controllers/TwistyAnimationController.d.ts +4 -1
  38. package/dist/types/twisty/controllers/TwistyAnimationController.d.ts.map +1 -1
  39. package/dist/types/twisty/index.d.ts +3 -2
  40. package/dist/types/twisty/index.d.ts.map +1 -1
  41. package/dist/types/twisty/model/TwistyPlayerModel.d.ts +41 -37
  42. package/dist/types/twisty/model/TwistyPlayerModel.d.ts.map +1 -1
  43. package/dist/types/twisty/model/UserVisibleErrorTracker.d.ts +11 -0
  44. package/dist/types/twisty/model/UserVisibleErrorTracker.d.ts.map +1 -0
  45. package/dist/types/twisty/model/{TwistyProp.d.ts → props/TwistyProp.d.ts} +3 -1
  46. package/dist/types/twisty/model/props/TwistyProp.d.ts.map +1 -0
  47. package/dist/types/twisty/model/{TwistyProp.spec.d.ts → props/TwistyProp.spec.d.ts} +0 -0
  48. package/dist/types/twisty/model/props/TwistyProp.spec.d.ts.map +1 -0
  49. package/dist/types/twisty/model/{TwistyPropDebugger.d.ts → props/TwistyPropDebugger.d.ts} +2 -2
  50. package/dist/types/twisty/model/props/TwistyPropDebugger.d.ts.map +1 -0
  51. package/dist/types/twisty/model/{depth-0 → props/general}/URLProp.d.ts +0 -0
  52. package/dist/types/twisty/model/props/general/URLProp.d.ts.map +1 -0
  53. package/dist/types/twisty/model/{depth-0 → props/puzzle/display}/HintFaceletProp.d.ts +2 -2
  54. package/dist/types/twisty/model/props/puzzle/display/HintFaceletProp.d.ts.map +1 -0
  55. package/dist/types/twisty/model/{depth-1 → props/puzzle/display}/SpriteProp.d.ts +1 -1
  56. package/dist/types/twisty/model/props/puzzle/display/SpriteProp.d.ts.map +1 -0
  57. package/dist/types/twisty/model/props/puzzle/display/StickeringProp.d.ts +6 -0
  58. package/dist/types/twisty/model/props/puzzle/display/StickeringProp.d.ts.map +1 -0
  59. package/dist/types/twisty/model/{depth-0 → props/puzzle/state}/AlgProp.d.ts +2 -2
  60. package/dist/types/twisty/model/props/puzzle/state/AlgProp.d.ts.map +1 -0
  61. package/dist/types/twisty/model/{depth-4 → props/puzzle/state}/AlgTransformationProp.d.ts +4 -4
  62. package/dist/types/twisty/model/props/puzzle/state/AlgTransformationProp.d.ts.map +1 -0
  63. package/dist/types/twisty/model/{depth-6 → props/puzzle/state}/AnchoredStartProp.d.ts +4 -4
  64. package/dist/types/twisty/model/props/puzzle/state/AnchoredStartProp.d.ts.map +1 -0
  65. package/dist/types/twisty/model/props/puzzle/state/CatchUpMoveProp.d.ts +11 -0
  66. package/dist/types/twisty/model/props/puzzle/state/CatchUpMoveProp.d.ts.map +1 -0
  67. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesProp.d.ts +14 -0
  68. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesProp.d.ts.map +1 -0
  69. package/dist/types/twisty/model/{depth-9 → props/puzzle/state}/CurrentLeavesSimplified.d.ts +3 -3
  70. package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesSimplified.d.ts.map +1 -0
  71. package/dist/types/twisty/model/{depth-10 → props/puzzle/state}/CurrentTransformationProp.d.ts +4 -4
  72. package/dist/types/twisty/model/props/puzzle/state/CurrentTransformationProp.d.ts.map +1 -0
  73. package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorProp.d.ts +17 -0
  74. package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorProp.d.ts.map +1 -0
  75. package/dist/types/twisty/model/{depth-0 → props/puzzle/state}/IndexerConstructorRequestProp.d.ts +1 -1
  76. package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorRequestProp.d.ts.map +1 -0
  77. package/dist/types/twisty/model/props/puzzle/state/IndexerProp.d.ts +15 -0
  78. package/dist/types/twisty/model/props/puzzle/state/IndexerProp.d.ts.map +1 -0
  79. package/dist/types/twisty/model/props/puzzle/state/LegacyPositionProp.d.ts +12 -0
  80. package/dist/types/twisty/model/props/puzzle/state/LegacyPositionProp.d.ts.map +1 -0
  81. package/dist/types/twisty/model/{depth-3 → props/puzzle/state}/PuzzleAlgProp.d.ts +3 -3
  82. package/dist/types/twisty/model/props/puzzle/state/PuzzleAlgProp.d.ts.map +1 -0
  83. package/dist/types/twisty/model/props/puzzle/state/SetupAnchorProp.d.ts +6 -0
  84. package/dist/types/twisty/model/props/puzzle/state/SetupAnchorProp.d.ts.map +1 -0
  85. package/dist/types/twisty/model/props/puzzle/structure/PuzzleDefProp.d.ts +11 -0
  86. package/dist/types/twisty/model/props/puzzle/structure/PuzzleDefProp.d.ts.map +1 -0
  87. package/dist/types/twisty/model/props/puzzle/structure/PuzzleDescriptionProp.d.ts +6 -0
  88. package/dist/types/twisty/model/props/puzzle/structure/PuzzleDescriptionProp.d.ts.map +1 -0
  89. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDProp.d.ts +11 -0
  90. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDProp.d.ts.map +1 -0
  91. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.d.ts +6 -0
  92. package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.d.ts.map +1 -0
  93. package/dist/types/twisty/model/props/puzzle/structure/PuzzleLoaderProp.d.ts +13 -0
  94. package/dist/types/twisty/model/props/puzzle/structure/PuzzleLoaderProp.d.ts.map +1 -0
  95. package/dist/types/twisty/model/{depth-8 → props/timeline}/CoarseTimelineInfoProp.d.ts +3 -3
  96. package/dist/types/twisty/model/props/timeline/CoarseTimelineInfoProp.d.ts.map +1 -0
  97. package/dist/types/twisty/model/{depth-7 → props/timeline}/DetailedTimelineInfoProp.d.ts +4 -4
  98. package/dist/types/twisty/model/props/timeline/DetailedTimelineInfoProp.d.ts.map +1 -0
  99. package/dist/types/twisty/model/{depth-0 → props/timeline}/PlayingInfoProp.d.ts +1 -1
  100. package/dist/types/twisty/model/props/timeline/PlayingInfoProp.d.ts.map +1 -0
  101. package/dist/types/twisty/model/{depth-0 → props/timeline}/TempoScaleProp.d.ts +0 -0
  102. package/dist/types/twisty/model/props/timeline/TempoScaleProp.d.ts.map +1 -0
  103. package/dist/types/twisty/model/{depth-0 → props/timeline}/TimestampRequestProp.d.ts +1 -1
  104. package/dist/types/twisty/model/props/timeline/TimestampRequestProp.d.ts.map +1 -0
  105. package/dist/types/twisty/model/{depth-0 → props/viewer}/BackViewProp.d.ts +1 -1
  106. package/dist/types/twisty/model/props/viewer/BackViewProp.d.ts.map +1 -0
  107. package/dist/types/twisty/model/{depth-0 → props/viewer}/BackgroundProp.d.ts +1 -1
  108. package/dist/types/twisty/model/props/viewer/BackgroundProp.d.ts.map +1 -0
  109. package/dist/types/twisty/model/{depth-9 → props/viewer}/ButtonAppearanceProp.d.ts +3 -3
  110. package/dist/types/twisty/model/props/viewer/ButtonAppearanceProp.d.ts.map +1 -0
  111. package/dist/types/twisty/model/{depth-0 → props/viewer}/ControlPanelProp.d.ts +1 -1
  112. package/dist/types/twisty/model/props/viewer/ControlPanelProp.d.ts.map +1 -0
  113. package/dist/types/twisty/model/{depth-0 → props/viewer}/LatitudeLimit.d.ts +0 -0
  114. package/dist/types/twisty/model/props/viewer/LatitudeLimit.d.ts.map +1 -0
  115. package/dist/types/twisty/model/{depth-4 → props/viewer}/OrbitCoordinatesProp.d.ts +3 -3
  116. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesProp.d.ts.map +1 -0
  117. package/dist/types/twisty/model/{depth-0 → props/viewer}/OrbitCoordinatesRequestProp.d.ts +0 -0
  118. package/dist/types/twisty/model/props/viewer/OrbitCoordinatesRequestProp.d.ts.map +1 -0
  119. package/dist/types/twisty/model/{depth-6 → props/viewer}/TimeRangeProp.d.ts +2 -2
  120. package/dist/types/twisty/model/props/viewer/TimeRangeProp.d.ts.map +1 -0
  121. package/dist/types/twisty/model/{depth-0 → props/viewer}/ViewerLinkProp.d.ts +1 -1
  122. package/dist/types/twisty/model/props/viewer/ViewerLinkProp.d.ts.map +1 -0
  123. package/dist/types/twisty/model/{depth-0 → props/viewer}/VisualizationProp.d.ts +1 -1
  124. package/dist/types/twisty/model/props/viewer/VisualizationProp.d.ts.map +1 -0
  125. package/dist/types/twisty/model/{depth-3 → props/viewer}/VisualizationStrategyProp.d.ts +2 -2
  126. package/dist/types/twisty/model/props/viewer/VisualizationStrategyProp.d.ts.map +1 -0
  127. package/dist/types/twisty/old/animation/indexer/AlgIndexer.d.ts.map +1 -1
  128. package/dist/types/twisty/old/dom/TwistyPlayer.css.d.ts.map +1 -1
  129. package/dist/types/twisty/old/dom/TwistyPlayerConfig.d.ts +2 -1
  130. package/dist/types/twisty/old/dom/TwistyPlayerConfig.d.ts.map +1 -1
  131. package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.d.ts +0 -1
  132. package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.d.ts.map +1 -1
  133. package/dist/types/twisty/views/3D/RendererPool.d.ts +4 -0
  134. package/dist/types/twisty/views/3D/RendererPool.d.ts.map +1 -0
  135. package/dist/types/twisty/views/3D/Twisty3DPuzzleWrapper.d.ts +1 -1
  136. package/dist/types/twisty/views/3D/Twisty3DPuzzleWrapper.d.ts.map +1 -1
  137. package/dist/types/twisty/views/3D/Twisty3DSceneWrapper.d.ts +2 -1
  138. package/dist/types/twisty/views/3D/Twisty3DSceneWrapper.d.ts.map +1 -1
  139. package/dist/types/twisty/views/3D/Twisty3DVantage.d.ts +5 -3
  140. package/dist/types/twisty/views/3D/Twisty3DVantage.d.ts.map +1 -1
  141. package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.d.ts +1 -1
  142. package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.d.ts.map +1 -1
  143. package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.d.ts.map +1 -1
  144. package/dist/types/twisty/views/TwistyAlgEditor/model.d.ts +2 -2
  145. package/dist/types/twisty/views/TwistyAlgEditor/model.d.ts.map +1 -1
  146. package/dist/types/twisty/views/TwistyPlayer.d.ts +12 -7
  147. package/dist/types/twisty/views/TwistyPlayer.d.ts.map +1 -1
  148. package/dist/types/twisty/views/TwistyPlayerSettable.d.ts +8 -8
  149. package/dist/types/twisty/views/TwistyPlayerSettable.d.ts.map +1 -1
  150. package/dist/types/twisty/views/control-panel/TwistyButtonsV2.d.ts +1 -1
  151. package/dist/types/twisty/views/control-panel/TwistyButtonsV2.d.ts.map +1 -1
  152. package/dist/types/twisty/views/control-panel/TwistyScrubberV2.d.ts +1 -1
  153. package/dist/types/twisty/views/control-panel/TwistyScrubberV2.d.ts.map +1 -1
  154. package/dist/types/vendor/three/examples/jsm/libs/stats.modified.module.d.ts +33 -0
  155. package/dist/types/vendor/three/examples/jsm/libs/stats.modified.module.d.ts.map +1 -0
  156. package/docs/.DS_Store +0 -0
  157. package/docs/cubing/.DS_Store +0 -0
  158. package/docs/cubing/scramble/index.html +35 -19
  159. package/package.json +5 -5
  160. package/src/cubing/.DS_Store +0 -0
  161. package/src/cubing/bluetooth/connect/index.ts +1 -1
  162. package/src/cubing/bluetooth/smart-puzzle/bluetooth-puzzle.ts +1 -1
  163. package/src/cubing/cubing.bundle-global.ts +5 -1
  164. package/src/cubing/puzzle-geometry/PermOriSet.ts +1 -1
  165. package/src/cubing/puzzles/PuzzleLoader.ts +1 -1
  166. package/src/cubing/puzzles/implementations/fto/index.ts +19 -11
  167. package/src/cubing/puzzles/index.ts +25 -18
  168. package/src/cubing/puzzles/stickerings/fto-stickerings.ts +9 -0
  169. package/src/cubing/search/inside/api.spec.ts +1 -0
  170. package/src/cubing/search/inside/api.ts +1 -0
  171. package/src/cubing/search/worker-inside-generated-string.js +1 -1
  172. package/src/cubing/twisty/.DS_Store +0 -0
  173. package/src/cubing/twisty/controllers/TwistyAnimationController.ts +80 -3
  174. package/src/cubing/twisty/index.ts +2 -2
  175. package/src/cubing/twisty/model/TwistyPlayerModel.ts +52 -41
  176. package/src/cubing/twisty/model/UserVisibleErrorTracker.ts +22 -0
  177. package/src/cubing/twisty/model/{TwistyProp.spec.ts → props/TwistyProp.spec.ts} +0 -0
  178. package/src/cubing/twisty/model/{TwistyProp.ts → props/TwistyProp.ts} +17 -9
  179. package/src/cubing/twisty/model/{TwistyPropDebugger.ts → props/TwistyPropDebugger.ts} +7 -7
  180. package/src/cubing/twisty/model/{depth-0 → props/general}/URLProp.ts +0 -0
  181. package/src/cubing/twisty/model/{depth-0 → props/puzzle/display}/HintFaceletProp.ts +2 -2
  182. package/src/cubing/twisty/model/{depth-1 → props/puzzle/display}/SpriteProp.ts +2 -2
  183. package/src/cubing/twisty/model/{depth-0 → props/puzzle/display}/StickeringProp.ts +2 -2
  184. package/src/cubing/twisty/model/{depth-0 → props/puzzle/state}/AlgProp.ts +3 -3
  185. package/src/cubing/twisty/model/{depth-4 → props/puzzle/state}/AlgTransformationProp.ts +6 -6
  186. package/src/cubing/twisty/model/{depth-6 → props/puzzle/state}/AnchoredStartProp.ts +4 -4
  187. package/src/cubing/twisty/model/props/puzzle/state/CatchUpMoveProp.ts +17 -0
  188. package/src/cubing/twisty/model/{depth-8 → props/puzzle/state}/CurrentLeavesProp.ts +27 -9
  189. package/src/cubing/twisty/model/{depth-9 → props/puzzle/state}/CurrentLeavesSimplified.ts +4 -4
  190. package/src/cubing/twisty/model/{depth-10 → props/puzzle/state}/CurrentTransformationProp.ts +5 -5
  191. package/src/cubing/twisty/model/{depth-4 → props/puzzle/state}/IndexerConstructorProp.ts +10 -10
  192. package/src/cubing/twisty/model/{depth-0 → props/puzzle/state}/IndexerConstructorRequestProp.ts +1 -1
  193. package/src/cubing/twisty/model/{depth-5 → props/puzzle/state}/IndexerProp.ts +6 -6
  194. package/src/cubing/twisty/model/{depth-11 → props/puzzle/state}/LegacyPositionProp.ts +4 -4
  195. package/src/cubing/twisty/model/{depth-3 → props/puzzle/state}/PuzzleAlgProp.ts +4 -4
  196. package/src/cubing/twisty/model/{depth-0 → props/puzzle/state}/SetupAnchorProp.ts +2 -2
  197. package/src/cubing/twisty/model/{depth-2 → props/puzzle/structure}/PuzzleDefProp.ts +3 -3
  198. package/src/cubing/twisty/model/{depth-0 → props/puzzle/structure}/PuzzleDescriptionProp.ts +6 -2
  199. package/src/cubing/twisty/model/{depth-2 → props/puzzle/structure}/PuzzleIDProp.ts +3 -3
  200. package/src/cubing/twisty/model/{depth-0 → props/puzzle/structure}/PuzzleIDRequestProp.ts +6 -2
  201. package/src/cubing/twisty/model/{depth-1 → props/puzzle/structure}/PuzzleLoaderProp.ts +11 -5
  202. package/src/cubing/twisty/model/{depth-8 → props/timeline}/CoarseTimelineInfoProp.ts +3 -3
  203. package/src/cubing/twisty/model/{depth-7 → props/timeline}/DetailedTimelineInfoProp.ts +4 -4
  204. package/src/cubing/twisty/model/{depth-0 → props/timeline}/PlayingInfoProp.ts +1 -1
  205. package/src/cubing/twisty/model/{depth-0 → props/timeline}/TempoScaleProp.ts +0 -0
  206. package/src/cubing/twisty/model/{depth-0 → props/timeline}/TimestampRequestProp.ts +1 -1
  207. package/src/cubing/twisty/model/{depth-0 → props/viewer}/BackViewProp.ts +1 -1
  208. package/src/cubing/twisty/model/{depth-0 → props/viewer}/BackgroundProp.ts +1 -1
  209. package/src/cubing/twisty/model/{depth-9 → props/viewer}/ButtonAppearanceProp.ts +4 -4
  210. package/src/cubing/twisty/model/{depth-0 → props/viewer}/ControlPanelProp.ts +1 -1
  211. package/src/cubing/twisty/model/{depth-0 → props/viewer}/LatitudeLimit.ts +0 -0
  212. package/src/cubing/twisty/model/{depth-4 → props/viewer}/OrbitCoordinatesProp.ts +3 -3
  213. package/src/cubing/twisty/model/{depth-0 → props/viewer}/OrbitCoordinatesRequestProp.ts +1 -1
  214. package/src/cubing/twisty/model/{depth-6 → props/viewer}/TimeRangeProp.ts +2 -2
  215. package/src/cubing/twisty/model/{depth-0 → props/viewer}/ViewerLinkProp.ts +1 -1
  216. package/src/cubing/twisty/model/{depth-0 → props/viewer}/VisualizationProp.ts +1 -1
  217. package/src/cubing/twisty/model/{depth-3 → props/viewer}/VisualizationStrategyProp.ts +2 -2
  218. package/src/cubing/twisty/old/animation/indexer/AlgIndexer.ts +1 -0
  219. package/src/cubing/twisty/old/dom/TwistyPlayer.css.ts +20 -0
  220. package/src/cubing/twisty/old/dom/TwistyPlayerConfig.ts +2 -1
  221. package/src/cubing/twisty/old/dom/viewers/Twisty3DCanvas.ts +3 -10
  222. package/src/cubing/twisty/{old → views}/.DS_Store +0 -0
  223. package/src/cubing/twisty/views/2D/Twisty2DPuzzle.ts +2 -2
  224. package/src/cubing/twisty/views/2D/Twisty2DPuzzleWrapper.ts +1 -1
  225. package/src/cubing/twisty/views/2D/Twisty2DSceneWrapper.ts +1 -1
  226. package/src/cubing/{search/inside → twisty/views/3D}/.DS_Store +0 -0
  227. package/src/cubing/twisty/views/3D/RendererPool.ts +53 -0
  228. package/src/cubing/twisty/views/3D/Twisty3DPuzzleWrapper.ts +9 -8
  229. package/src/cubing/twisty/views/3D/Twisty3DSceneWrapper.ts +7 -3
  230. package/src/cubing/twisty/views/3D/Twisty3DVantage.ts +69 -33
  231. package/src/cubing/twisty/views/3D/TwistyOrbitControlsV2.spec.ts +7 -7
  232. package/src/cubing/twisty/views/3D/TwistyOrbitControlsV2.ts +1 -1
  233. package/src/cubing/twisty/views/TwistyAlgEditor/TwistyAlgEditor.ts +6 -2
  234. package/src/cubing/twisty/views/TwistyAlgEditor/model.ts +2 -2
  235. package/src/cubing/twisty/views/TwistyAlgViewer.ts +2 -2
  236. package/src/cubing/twisty/views/TwistyPlayer.ts +67 -11
  237. package/src/cubing/twisty/views/TwistyPlayerSettable.ts +8 -8
  238. package/src/cubing/twisty/views/control-panel/TwistyButtonsV2.ts +1 -1
  239. package/src/cubing/twisty/views/control-panel/TwistyScrubberV2.ts +1 -1
  240. package/src/cubing/vendor/three/examples/jsm/libs/stats.modified.module.ts +179 -0
  241. package/dist/esm/chunk-6BXLPCNQ.js.map +0 -7
  242. package/dist/esm/worker-inside-generated-string-DOHINKQX.js.map +0 -7
  243. package/dist/types/twisty/model/TwistyProp.d.ts.map +0 -1
  244. package/dist/types/twisty/model/TwistyProp.spec.d.ts.map +0 -1
  245. package/dist/types/twisty/model/TwistyPropDebugger.d.ts.map +0 -1
  246. package/dist/types/twisty/model/depth-0/AlgProp.d.ts.map +0 -1
  247. package/dist/types/twisty/model/depth-0/BackViewProp.d.ts.map +0 -1
  248. package/dist/types/twisty/model/depth-0/BackgroundProp.d.ts.map +0 -1
  249. package/dist/types/twisty/model/depth-0/ControlPanelProp.d.ts.map +0 -1
  250. package/dist/types/twisty/model/depth-0/HintFaceletProp.d.ts.map +0 -1
  251. package/dist/types/twisty/model/depth-0/IndexerConstructorRequestProp.d.ts.map +0 -1
  252. package/dist/types/twisty/model/depth-0/LatitudeLimit.d.ts.map +0 -1
  253. package/dist/types/twisty/model/depth-0/OrbitCoordinatesRequestProp.d.ts.map +0 -1
  254. package/dist/types/twisty/model/depth-0/PlayingInfoProp.d.ts.map +0 -1
  255. package/dist/types/twisty/model/depth-0/PuzzleDescriptionProp.d.ts +0 -6
  256. package/dist/types/twisty/model/depth-0/PuzzleDescriptionProp.d.ts.map +0 -1
  257. package/dist/types/twisty/model/depth-0/PuzzleIDRequestProp.d.ts +0 -6
  258. package/dist/types/twisty/model/depth-0/PuzzleIDRequestProp.d.ts.map +0 -1
  259. package/dist/types/twisty/model/depth-0/SetupAnchorProp.d.ts +0 -6
  260. package/dist/types/twisty/model/depth-0/SetupAnchorProp.d.ts.map +0 -1
  261. package/dist/types/twisty/model/depth-0/StickeringProp.d.ts +0 -6
  262. package/dist/types/twisty/model/depth-0/StickeringProp.d.ts.map +0 -1
  263. package/dist/types/twisty/model/depth-0/TempoScaleProp.d.ts.map +0 -1
  264. package/dist/types/twisty/model/depth-0/TimestampRequestProp.d.ts.map +0 -1
  265. package/dist/types/twisty/model/depth-0/URLProp.d.ts.map +0 -1
  266. package/dist/types/twisty/model/depth-0/ViewerLinkProp.d.ts.map +0 -1
  267. package/dist/types/twisty/model/depth-0/VisualizationProp.d.ts.map +0 -1
  268. package/dist/types/twisty/model/depth-1/PuzzleLoaderProp.d.ts +0 -13
  269. package/dist/types/twisty/model/depth-1/PuzzleLoaderProp.d.ts.map +0 -1
  270. package/dist/types/twisty/model/depth-1/SpriteProp.d.ts.map +0 -1
  271. package/dist/types/twisty/model/depth-10/CurrentTransformationProp.d.ts.map +0 -1
  272. package/dist/types/twisty/model/depth-11/LegacyPositionProp.d.ts +0 -12
  273. package/dist/types/twisty/model/depth-11/LegacyPositionProp.d.ts.map +0 -1
  274. package/dist/types/twisty/model/depth-2/PuzzleDefProp.d.ts +0 -11
  275. package/dist/types/twisty/model/depth-2/PuzzleDefProp.d.ts.map +0 -1
  276. package/dist/types/twisty/model/depth-2/PuzzleIDProp.d.ts +0 -11
  277. package/dist/types/twisty/model/depth-2/PuzzleIDProp.d.ts.map +0 -1
  278. package/dist/types/twisty/model/depth-3/PuzzleAlgProp.d.ts.map +0 -1
  279. package/dist/types/twisty/model/depth-3/VisualizationStrategyProp.d.ts.map +0 -1
  280. package/dist/types/twisty/model/depth-4/AlgTransformationProp.d.ts.map +0 -1
  281. package/dist/types/twisty/model/depth-4/IndexerConstructorProp.d.ts +0 -17
  282. package/dist/types/twisty/model/depth-4/IndexerConstructorProp.d.ts.map +0 -1
  283. package/dist/types/twisty/model/depth-4/OrbitCoordinatesProp.d.ts.map +0 -1
  284. package/dist/types/twisty/model/depth-5/IndexerProp.d.ts +0 -15
  285. package/dist/types/twisty/model/depth-5/IndexerProp.d.ts.map +0 -1
  286. package/dist/types/twisty/model/depth-6/AnchoredStartProp.d.ts.map +0 -1
  287. package/dist/types/twisty/model/depth-6/TimeRangeProp.d.ts.map +0 -1
  288. package/dist/types/twisty/model/depth-7/DetailedTimelineInfoProp.d.ts.map +0 -1
  289. package/dist/types/twisty/model/depth-8/CoarseTimelineInfoProp.d.ts.map +0 -1
  290. package/dist/types/twisty/model/depth-8/CurrentLeavesProp.d.ts +0 -12
  291. package/dist/types/twisty/model/depth-8/CurrentLeavesProp.d.ts.map +0 -1
  292. package/dist/types/twisty/model/depth-9/ButtonAppearanceProp.d.ts.map +0 -1
  293. package/dist/types/twisty/model/depth-9/CurrentLeavesSimplified.d.ts.map +0 -1
  294. package/dist/types/twisty/views/3D/puzzles/TwistyTestBox.d.ts +0 -9
  295. package/dist/types/twisty/views/3D/puzzles/TwistyTestBox.d.ts.map +0 -1
  296. package/dist/types/vendor/three/examples/jsm/libs/stats.module.d.ts +0 -21
  297. package/dist/types/vendor/three/examples/jsm/libs/stats.module.d.ts.map +0 -1
  298. package/src/cubing/alg/.DS_Store +0 -0
  299. package/src/cubing/bluetooth/.DS_Store +0 -0
  300. package/src/cubing/kpuzzle/.DS_Store +0 -0
  301. package/src/cubing/puzzles/.DS_Store +0 -0
  302. package/src/cubing/search/.DS_Store +0 -0
  303. package/src/cubing/search/inside/solve/vendor/.DS_Store +0 -0
  304. package/src/cubing/search/inside/solve/vendor/cstimer/src/.DS_Store +0 -0
  305. package/src/cubing/search/inside/solve/vendor/cstimer/src/js/.DS_Store +0 -0
  306. package/src/cubing/stream/.DS_Store +0 -0
  307. package/src/cubing/twisty/old/dom/.DS_Store +0 -0
  308. package/src/cubing/twisty/views/3D/puzzles/TwistyTestBox.ts +0 -22
  309. package/src/cubing/vendor/.DS_Store +0 -0
  310. package/src/cubing/vendor/three/examples/jsm/libs/stats.module.d.ts +0 -24
  311. package/src/cubing/vendor/three/examples/jsm/libs/stats.module.js +0 -179
@@ -1,15 +1,16 @@
1
1
  import type { PerspectiveCamera, WebGLRenderer } from "three";
2
- import { Stats } from "../../../vendor/three/examples/jsm/libs/stats.module";
2
+ import { Stats } from "../../../vendor/three/examples/jsm/libs/stats.modified.module";
3
3
  import { THREEJS } from "../../heavy-code-imports/3d";
4
- import type { OrbitCoordinatesV2 } from "../../model/depth-0/OrbitCoordinatesRequestProp";
5
4
  import { StaleDropper } from "../../model/PromiseFreshener";
5
+ import type { TwistyPropParent } from "../../model/props/TwistyProp";
6
+ import type { OrbitCoordinatesV2 } from "../../model/props/viewer/OrbitCoordinatesRequestProp";
6
7
  import type { TwistyPlayerModel } from "../../model/TwistyPlayerModel";
7
- import type { TwistyPropParent } from "../../model/TwistyProp";
8
8
  import { RenderScheduler } from "../../old/animation/RenderScheduler";
9
9
  import { ManagedCustomElement } from "../../old/dom/element/ManagedCustomElement";
10
10
  import { customElementsShim } from "../../old/dom/element/node-custom-element-shims";
11
11
  import { pixelRatio } from "../../old/dom/viewers/canvas";
12
12
  import { twisty3DCanvasCSS } from "../../old/dom/viewers/Twisty3DCanvas.css";
13
+ import { newRenderer, renderPooled } from "./RendererPool";
13
14
  import { DEGREES_PER_RADIAN } from "./TAU";
14
15
  import type { Twisty3DSceneWrapper } from "./Twisty3DSceneWrapper";
15
16
  import { TwistyOrbitControlsV2 } from "./TwistyOrbitControlsV2";
@@ -34,11 +35,44 @@ export async function setCameraFromOrbitCoordinates(
34
35
  camera.lookAt(0, 0, 0);
35
36
  }
36
37
 
38
+ let shareAllNewRenderers: boolean | null = null;
39
+
40
+ // WARNING: The current shared renderer implementation is not every efficient.
41
+ // Avoid using for players that are likely to have dimensions approaching 1 megapixel or higher.
42
+ // TODO: use a dedicated renderer while fullscreen?
43
+ // - true: Force all new (i.e. constructed in the future) renderers to be shared
44
+ // - false: Force all new (i.e. constructed in the future) renderers to be dedicated
45
+ // - null: Reset to the default heuristics.
46
+ export function experimentalForceNewRendererSharing(
47
+ share: boolean | null,
48
+ ): void {
49
+ shareAllNewRenderers = share;
50
+ }
51
+
52
+ let dedicatedRenderersSoFar = 0;
53
+ const DEFAULT_MAX_DEDICATED_RENDERERS = 2; // This allows for a front view and a back view (or two separate front views).
54
+ function shareRenderer(): boolean {
55
+ if (shareAllNewRenderers !== null) {
56
+ if (!shareAllNewRenderers) {
57
+ dedicatedRenderersSoFar++;
58
+ }
59
+ return shareAllNewRenderers;
60
+ }
61
+ if (dedicatedRenderersSoFar < DEFAULT_MAX_DEDICATED_RENDERERS) {
62
+ dedicatedRenderersSoFar++;
63
+ return false;
64
+ } else {
65
+ return true;
66
+ }
67
+ }
68
+
37
69
  export class Twisty3DVantage extends ManagedCustomElement {
38
70
  scene: Twisty3DSceneWrapper | null = null;
39
71
 
40
72
  stats: Stats | null = null;
41
73
 
74
+ private rendererIsShared: boolean = shareRenderer();
75
+
42
76
  constructor(
43
77
  private model?: TwistyPlayerModel,
44
78
  scene?: Twisty3DSceneWrapper,
@@ -48,7 +82,7 @@ export class Twisty3DVantage extends ManagedCustomElement {
48
82
  this.scene = scene ?? null;
49
83
 
50
84
  if (SHOW_STATS) {
51
- this.stats = Stats();
85
+ this.stats = new Stats();
52
86
  this.stats.dom.style.position = "absolute";
53
87
  this.contentWrapper.appendChild(this.stats.dom);
54
88
  }
@@ -65,18 +99,18 @@ export class Twisty3DVantage extends ManagedCustomElement {
65
99
  this.scheduleRender();
66
100
  }
67
101
 
68
- #onResizeStaleDropper = new StaleDropper<
69
- [PerspectiveCamera, WebGLRenderer]
70
- >();
102
+ #onResizeStaleDropper = new StaleDropper<PerspectiveCamera>();
71
103
 
72
104
  // TODO: Why doesn't this work for the top-right back view height?
105
+ #width: number = 0;
106
+ #height: number = 0;
73
107
  async #onResize(): Promise<void> {
74
- const [camera, renderer] = await this.#onResizeStaleDropper.queue(
75
- Promise.all([this.camera(), this.renderer()]),
76
- );
108
+ const camera = await this.#onResizeStaleDropper.queue(this.camera());
77
109
 
78
110
  const w = this.contentWrapper.clientWidth;
79
111
  const h = this.contentWrapper.clientHeight;
112
+ this.#width = w;
113
+ this.#height = h;
80
114
  const off = 0;
81
115
  let yoff = 0;
82
116
  let excess = 0;
@@ -88,36 +122,35 @@ export class Twisty3DVantage extends ManagedCustomElement {
88
122
  camera.setViewOffset(w, h - excess, off, yoff, w, h);
89
123
  camera.updateProjectionMatrix(); // TODO
90
124
 
91
- // if (this.rendererIsShared) {
92
- // canvas.width = w * pixelRatio();
93
- // canvas.height = h * pixelRatio();
94
- // canvas.style.width = w.toString();
95
- // canvas.style.height = w.toString();
96
- // } else {
97
- renderer.setPixelRatio(pixelRatio());
98
- renderer.setSize(w, h, true);
99
- // }
125
+ if (this.rendererIsShared) {
126
+ const canvas = await this.canvas();
127
+ canvas.width = w * pixelRatio();
128
+ canvas.height = h * pixelRatio();
129
+ canvas.style.width = w.toString();
130
+ canvas.style.height = w.toString();
131
+ } else {
132
+ (await this.renderer()).setSize(w, h, true);
133
+ }
100
134
 
101
135
  this.scheduleRender();
102
136
  }
103
137
 
104
138
  #cachedRenderer: Promise<WebGLRenderer> | null = null;
105
139
  async renderer(): Promise<WebGLRenderer> {
106
- return (this.#cachedRenderer ??= (async () => {
107
- const rendererConstructor = (await THREEJS).WebGLRenderer;
108
- const renderer = new rendererConstructor({
109
- antialias: true,
110
- alpha: true,
111
- });
112
- renderer.setPixelRatio(pixelRatio());
113
- return renderer;
114
- })());
140
+ if (this.rendererIsShared) {
141
+ throw new Error("renderer expected to be shared.");
142
+ }
143
+ return (this.#cachedRenderer ??= newRenderer());
115
144
  }
116
145
 
117
146
  #cachedCanvas: Promise<HTMLCanvasElement> | null = null;
118
147
  async canvas(): Promise<HTMLCanvasElement> {
119
148
  return (this.#cachedCanvas ??= (async () => {
120
- return (await this.renderer()).domElement;
149
+ if (this.rendererIsShared) {
150
+ return this.addElement(document.createElement("canvas"));
151
+ }
152
+ const renderer = await this.renderer();
153
+ return this.addElement(renderer.domElement);
121
154
  })());
122
155
  }
123
156
 
@@ -197,13 +230,16 @@ export class Twisty3DVantage extends ManagedCustomElement {
197
230
 
198
231
  this.stats?.begin();
199
232
 
200
- const [renderer, scene, camera] = await Promise.all([
201
- this.renderer(),
233
+ const [scene, camera, canvas] = await Promise.all([
202
234
  this.scene.scene(),
203
235
  this.camera(),
236
+ this.canvas(),
204
237
  ]);
205
- // console.log("rendering!!!!", renderer, scene, camera);
206
- renderer.render(scene, camera); // TODO
238
+ if (this.rendererIsShared) {
239
+ renderPooled(this.#width, this.#height, canvas, scene, camera);
240
+ } else {
241
+ (await this.renderer()).render(scene, camera);
242
+ }
207
243
 
208
244
  this.stats?.end();
209
245
  }
@@ -2,14 +2,14 @@
2
2
  * @jest-environment jsdom
3
3
  */
4
4
 
5
- import { LatitudeLimitProp } from "../../model/depth-0/LatitudeLimit";
6
- import { OrbitCoordinatesRequestProp } from "../../model/depth-0/OrbitCoordinatesRequestProp";
7
- import { PuzzleIDRequestProp } from "../../model/depth-0/PuzzleIDRequestProp";
8
- import { VisualizationFormatProp } from "../../model/depth-0/VisualizationProp";
9
- import { VisualizationStrategyProp } from "../../model/depth-3/VisualizationStrategyProp";
10
- import { OrbitCoordinatesProp } from "../../model/depth-4/OrbitCoordinatesProp";
5
+ import { LatitudeLimitProp } from "../../model/props/viewer/LatitudeLimit";
6
+ import { OrbitCoordinatesRequestProp } from "../../model/props/viewer/OrbitCoordinatesRequestProp";
7
+ import { PuzzleIDRequestProp } from "../../model/props/puzzle/structure/PuzzleIDRequestProp";
8
+ import { VisualizationFormatProp } from "../../model/props/viewer/VisualizationProp";
9
+ import { VisualizationStrategyProp } from "../../model/props/viewer/VisualizationStrategyProp";
10
+ import { OrbitCoordinatesProp } from "../../model/props/viewer/OrbitCoordinatesProp";
11
11
  import type { TwistyPlayerModel } from "../../model/TwistyPlayerModel";
12
- import type { TwistyPropParent } from "../../model/TwistyProp";
12
+ import type { TwistyPropParent } from "../../model/props/TwistyProp";
13
13
  import type { PuzzleID } from "../../old/dom/TwistyPlayerConfig";
14
14
  import { TwistyOrbitControlsV2 } from "./TwistyOrbitControlsV2";
15
15
 
@@ -1,7 +1,7 @@
1
1
  import { Spherical, Vector3 } from "three";
2
2
  import { DEGREES_PER_RADIAN } from "./TAU";
3
3
  import { RenderScheduler } from "../../old/animation/RenderScheduler";
4
- import type { OrbitCoordinatesV2 } from "../../model/depth-0/OrbitCoordinatesRequestProp";
4
+ import type { OrbitCoordinatesV2 } from "../../model/props/viewer/OrbitCoordinatesRequestProp";
5
5
  import type { TwistyPlayerModel } from "../../model/TwistyPlayerModel";
6
6
  import type { CameraLatitudeLimits } from "../../old/dom/TwistyPlayerConfig";
7
7
 
@@ -14,8 +14,11 @@
14
14
  import type { ExperimentalParsed } from "../../../alg";
15
15
  import { Alg, Move, Pause } from "../../../alg";
16
16
  import type { Parsed } from "../../../alg/parse";
17
- import type { AlgProp, AlgWithIssues } from "../../model/depth-0/AlgProp";
18
- import type { CurrentLeavesSimplified } from "../../model/depth-9/CurrentLeavesSimplified";
17
+ import type {
18
+ AlgProp,
19
+ AlgWithIssues,
20
+ } from "../../model/props/puzzle/state/AlgProp";
21
+ import type { CurrentLeavesSimplified } from "../../model/props/puzzle/state/CurrentLeavesSimplified";
19
22
  import { ClassListManager } from "../../old/dom/element/ClassListManager";
20
23
  import { ManagedCustomElement } from "../../old/dom/element/ManagedCustomElement";
21
24
  import { customElementsShim } from "../../old/dom/element/node-custom-element-shims";
@@ -76,6 +79,7 @@ export class TwistyAlgEditor extends ManagedCustomElement {
76
79
  this.#carbonCopySuffix.classList.add("suffix");
77
80
  this.#carbonCopy.appendChild(this.#carbonCopySuffix);
78
81
 
82
+ this.#textarea.placeholder = "Alg";
79
83
  // Prevent iOS from defaulting to smart quotes.
80
84
  this.#textarea.setAttribute("spellcheck", "false");
81
85
 
@@ -5,12 +5,12 @@ import type { Parsed } from "../../../alg/parse";
5
5
  import {
6
6
  AlgWithIssues,
7
7
  algWithIssuesFromString,
8
- } from "../../model/depth-0/AlgProp";
8
+ } from "../../model/props/puzzle/state/AlgProp";
9
9
  import {
10
10
  SimpleTwistyPropSource,
11
11
  TwistyPropDerived,
12
12
  TwistyPropSource,
13
- } from "../../model/TwistyProp";
13
+ } from "../../model/props/TwistyProp";
14
14
  import {
15
15
  AnimatedLeafUnitInfo,
16
16
  leafTokens,
@@ -13,8 +13,8 @@ import {
13
13
  Unit,
14
14
  } from "../../alg";
15
15
  import type { Parsed } from "../../alg/parse";
16
- import type { AlgWithIssues } from "../model/depth-0/AlgProp";
17
- import type { DetailedTimelineInfo } from "../model/depth-7/DetailedTimelineInfoProp";
16
+ import type { AlgWithIssues } from "../model/props/puzzle/state/AlgProp";
17
+ import type { DetailedTimelineInfo } from "../model/props/timeline/DetailedTimelineInfoProp";
18
18
  import type { MillisecondTimestamp } from "../old/animation/cursor/CursorTypes";
19
19
  import type { CurrentMoveInfo } from "../old/animation/indexer/AlgIndexer";
20
20
  import { ManagedCustomElement } from "../old/dom/element/ManagedCustomElement";
@@ -1,15 +1,15 @@
1
- import type { ExperimentalStickering } from "..";
2
- import { Alg, Move } from "../../alg";
1
+ import type { ExperimentalStickering, PG3D } from "..";
2
+ import { Alg, experimentalAppendMove, Move } from "../../alg";
3
3
  import type { PuzzleDescriptionString } from "../../puzzle-geometry/PGPuzzles";
4
4
  import type { TwistyAnimationControllerDelegate } from "../controllers/TwistyAnimationController";
5
5
  import { TwistyPlayerController } from "../controllers/TwistyPlayerController";
6
- import type { BackgroundThemeWithAuto } from "../model/depth-0/BackgroundProp";
7
- import type { BackViewLayoutWithAuto } from "../model/depth-0/BackViewProp";
8
- import type { ControlPanelThemeWithAuto } from "../model/depth-0/ControlPanelProp";
9
- import type { HintFaceletStyleWithAuto } from "../model/depth-0/HintFaceletProp";
10
- import type { ViewerLinkPageWithAuto } from "../model/depth-0/ViewerLinkProp";
11
- import type { VisualizationFormatWithAuto } from "../model/depth-0/VisualizationProp";
12
- import type { VisualizationStrategy } from "../model/depth-3/VisualizationStrategyProp";
6
+ import type { HintFaceletStyleWithAuto } from "../model/props/puzzle/display/HintFaceletProp";
7
+ import type { BackgroundThemeWithAuto } from "../model/props/viewer/BackgroundProp";
8
+ import type { BackViewLayoutWithAuto } from "../model/props/viewer/BackViewProp";
9
+ import type { ControlPanelThemeWithAuto } from "../model/props/viewer/ControlPanelProp";
10
+ import type { ViewerLinkPageWithAuto } from "../model/props/viewer/ViewerLinkProp";
11
+ import type { VisualizationFormatWithAuto } from "../model/props/viewer/VisualizationProp";
12
+ import type { VisualizationStrategy } from "../model/props/viewer/VisualizationStrategyProp";
13
13
  import { ClassListManager } from "../old/dom/element/ClassListManager";
14
14
  import { customElementsShim } from "../old/dom/element/node-custom-element-shims";
15
15
  import { twistyPlayerCSS } from "../old/dom/TwistyPlayer.css";
@@ -125,6 +125,11 @@ export class TwistyPlayer
125
125
 
126
126
  buttons: TwistyButtonsV2;
127
127
 
128
+ experimentalCanvasClickCallback: (...args: any) => void = () => {};
129
+ // #onCanvasClick() {
130
+
131
+ // }
132
+
128
133
  constructor(config: TwistyPlayerConfig = {}) {
129
134
  super();
130
135
 
@@ -148,12 +153,29 @@ export class TwistyPlayer
148
153
  );
149
154
 
150
155
  #visualizationWrapperElem = document.createElement("div"); // TODO: Better pattern.
156
+ #errorElem = document.createElement("div"); // TODO: Better pattern.
157
+ #alreadyConnected = false; // TODO: support resetting
151
158
  async connectedCallback(): Promise<void> {
159
+ if (this.#alreadyConnected) {
160
+ return;
161
+ }
162
+ this.#alreadyConnected = true;
152
163
  this.addCSS(twistyPlayerCSS);
153
164
 
154
165
  this.addElement(this.#visualizationWrapperElem).classList.add(
155
166
  "visualization-wrapper",
156
167
  );
168
+ this.addElement(this.#errorElem).classList.add("error-elem");
169
+ this.#errorElem.textContent = "Error";
170
+ this.experimentalModel.userVisibleErrorTracker.addFreshListener(
171
+ (userVisibleError) => {
172
+ const errorString: string | null = userVisibleError.errors[0] ?? null;
173
+ this.contentWrapper.classList.toggle("error", !!errorString);
174
+ if (errorString) {
175
+ this.#errorElem.textContent = errorString;
176
+ }
177
+ },
178
+ );
157
179
 
158
180
  const scrubber = new TwistyScrubberV2(this.experimentalModel);
159
181
  this.contentWrapper.appendChild(scrubber);
@@ -224,6 +246,28 @@ export class TwistyPlayer
224
246
  }
225
247
  }
226
248
 
249
+ async experimentalCurrentCanvases(): Promise<HTMLCanvasElement[]> {
250
+ this.connectedCallback();
251
+ const wrapper = this.#visualizationWrapper;
252
+ const canvases: HTMLCanvasElement[] = [];
253
+ if (wrapper instanceof Twisty3DSceneWrapper) {
254
+ const vantages = wrapper.experimentalVantages();
255
+ for (const vantage of vantages) {
256
+ canvases.push(await vantage.canvas());
257
+ }
258
+ }
259
+ return canvases;
260
+ }
261
+
262
+ async experimentalPG3D(): Promise<PG3D | null> {
263
+ this.connectedCallback();
264
+ const wrapper = this.#visualizationWrapper;
265
+ if (wrapper instanceof Twisty3DSceneWrapper) {
266
+ wrapper;
267
+ }
268
+ return null;
269
+ }
270
+
227
271
  jumpToStart(options?: { flash: boolean }): void {
228
272
  this.controller.jumpToStart(options);
229
273
  }
@@ -249,11 +293,23 @@ export class TwistyPlayer
249
293
  }
250
294
 
251
295
  // TODO: Animate the new move.
252
- experimentalAddMove(move: Move): void {
296
+ experimentalAddMove(
297
+ flexibleMove: Move | string,
298
+ options: { coalesce?: boolean } = {},
299
+ ): void {
300
+ const move =
301
+ typeof flexibleMove === "string" ? new Move(flexibleMove) : flexibleMove;
253
302
  (async () => {
254
303
  const alg = (await this.experimentalModel.algProp.get()).alg;
255
- this.experimentalModel.algProp.set(new Alg(alg.concat([move])));
304
+ const newAlg = experimentalAppendMove(alg, move, {
305
+ coalesce: options?.coalesce,
306
+ });
307
+ this.experimentalModel.algProp.set(newAlg);
256
308
  this.experimentalModel.timestampRequestProp.set("end");
309
+ this.experimentalModel.catchUpMoveProp.set({
310
+ move: move,
311
+ amount: 0,
312
+ });
257
313
  })();
258
314
  }
259
315
 
@@ -1,14 +1,14 @@
1
1
  import type { Alg } from "../../alg";
2
2
  import type { PuzzleDescriptionString } from "../../puzzle-geometry/PGPuzzles";
3
3
  import type { ExperimentalStickering } from "../../twisty";
4
- import type { BackgroundThemeWithAuto } from "../model/depth-0/BackgroundProp";
5
- import type { BackViewLayoutWithAuto } from "../model/depth-0/BackViewProp";
6
- import type { ControlPanelThemeWithAuto } from "../model/depth-0/ControlPanelProp";
7
- import type { HintFaceletStyleWithAuto } from "../model/depth-0/HintFaceletProp";
8
- import type { IndexerStrategyName } from "../model/depth-0/IndexerConstructorRequestProp";
9
- import type { TimestampRequest } from "../model/depth-0/TimestampRequestProp";
10
- import type { ViewerLinkPageWithAuto } from "../model/depth-0/ViewerLinkProp";
11
- import type { VisualizationFormatWithAuto } from "../model/depth-0/VisualizationProp";
4
+ import type { BackgroundThemeWithAuto } from "../model/props/viewer/BackgroundProp";
5
+ import type { BackViewLayoutWithAuto } from "../model/props/viewer/BackViewProp";
6
+ import type { ControlPanelThemeWithAuto } from "../model/props/viewer/ControlPanelProp";
7
+ import type { HintFaceletStyleWithAuto } from "../model/props/puzzle/display/HintFaceletProp";
8
+ import type { IndexerStrategyName } from "../model/props/puzzle/state/IndexerConstructorRequestProp";
9
+ import type { TimestampRequest } from "../model/props/timeline/TimestampRequestProp";
10
+ import type { ViewerLinkPageWithAuto } from "../model/props/viewer/ViewerLinkProp";
11
+ import type { VisualizationFormatWithAuto } from "../model/props/viewer/VisualizationProp";
12
12
  import { TwistyPlayerModel } from "../model/TwistyPlayerModel";
13
13
  import type { MillisecondTimestamp } from "../old/animation/cursor/CursorTypes";
14
14
  import { ManagedCustomElement } from "../old/dom/element/ManagedCustomElement";
@@ -10,7 +10,7 @@ import {
10
10
  ButtonAppearances,
11
11
  ButtonIcon,
12
12
  buttonIcons,
13
- } from "../../model/depth-9/ButtonAppearanceProp";
13
+ } from "../../model/props/viewer/ButtonAppearanceProp";
14
14
  import type { TwistyPlayerModel } from "../../model/TwistyPlayerModel";
15
15
  import type { TwistyPlayerController } from "../../controllers/TwistyPlayerController";
16
16
  import {
@@ -1,7 +1,7 @@
1
1
  import { twistyScrubberCSS } from "../../old/dom/controls/TwistyScrubber.css";
2
2
  import { ManagedCustomElement } from "../../old/dom/element/ManagedCustomElement";
3
3
  import { customElementsShim } from "../../old/dom/element/node-custom-element-shims";
4
- import type { DetailedTimelineInfo } from "../../model/depth-7/DetailedTimelineInfoProp";
4
+ import type { DetailedTimelineInfo } from "../../model/props/timeline/DetailedTimelineInfoProp";
5
5
  import type { TwistyPlayerModel } from "../../model/TwistyPlayerModel";
6
6
  import { globalSafeDocument } from "../document";
7
7
 
@@ -0,0 +1,179 @@
1
+ /**
2
+ * @author mrdoob / http://mrdoob.com/
3
+ * ESM conversion by Lucas Garron, 2021-12-21
4
+ */
5
+
6
+ const performance:
7
+ | null
8
+ | (Performance & {
9
+ memory?: {
10
+ usedJSHeapSize: number;
11
+ jsHeapSizeLimit: number;
12
+ };
13
+ }) = globalThis.performance;
14
+
15
+ export class Stats {
16
+ mode = 0;
17
+
18
+ dom = document.createElement("div");
19
+
20
+ constructor() {
21
+ this.dom.style.cssText =
22
+ "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000";
23
+ this.dom.addEventListener(
24
+ "click",
25
+ (event) => {
26
+ event.preventDefault();
27
+ this.showPanel(++this.mode % this.dom.children.length);
28
+ },
29
+ false,
30
+ );
31
+
32
+ this.showPanel(0);
33
+ }
34
+
35
+ addPanel(panel: StatsPanel): StatsPanel {
36
+ this.dom.appendChild(panel.dom);
37
+ return panel;
38
+ }
39
+
40
+ showPanel(id: number): void {
41
+ for (let i = 0; i < this.dom.children.length; i++) {
42
+ (this.dom.children[i] as HTMLElement).style.display =
43
+ i === id ? "block" : "none";
44
+ }
45
+
46
+ this.mode = id;
47
+ }
48
+
49
+ beginTime = (performance || Date).now();
50
+ prevTime = this.beginTime;
51
+ frames = 0;
52
+
53
+ fpsPanel = this.addPanel(new StatsPanel("FPS", "#0ff", "#002"));
54
+ msPanel = this.addPanel(new StatsPanel("MS", "#0f0", "#020"));
55
+ memPanel = performance?.memory
56
+ ? this.addPanel(new StatsPanel("MB", "#f08", "#201"))
57
+ : null;
58
+ REVISION = 16;
59
+
60
+ begin() {
61
+ this.beginTime = (performance || Date).now();
62
+ }
63
+
64
+ end() {
65
+ this.frames++;
66
+
67
+ const time = (performance || Date).now();
68
+
69
+ this.msPanel.update(time - this.beginTime, 200);
70
+
71
+ if (time >= this.prevTime + 1000) {
72
+ this.fpsPanel.update((this.frames * 1000) / (time - this.prevTime), 100);
73
+
74
+ this.prevTime = time;
75
+ this.frames = 0;
76
+
77
+ if (this.memPanel) {
78
+ const memory = performance!.memory!;
79
+ this.memPanel.update(
80
+ memory.usedJSHeapSize / 1048576,
81
+ memory.jsHeapSizeLimit / 1048576,
82
+ );
83
+ }
84
+ }
85
+
86
+ return time;
87
+ }
88
+
89
+ update() {
90
+ this.beginTime = this.end();
91
+ }
92
+ }
93
+
94
+ const PR = Math.round(globalThis?.window?.devicePixelRatio ?? 1);
95
+
96
+ const WIDTH = 80 * PR,
97
+ HEIGHT = 48 * PR,
98
+ TEXT_X = 3 * PR,
99
+ TEXT_Y = 2 * PR,
100
+ GRAPH_X = 3 * PR,
101
+ GRAPH_Y = 15 * PR,
102
+ GRAPH_WIDTH = 74 * PR,
103
+ GRAPH_HEIGHT = 30 * PR;
104
+
105
+ export class StatsPanel {
106
+ min = Infinity;
107
+ max = 0;
108
+ dom = document.createElement("canvas");
109
+ context = this.dom.getContext("2d")!;
110
+ constructor(private name: string, private fg: string, private bg: string) {
111
+ this.dom.width = WIDTH;
112
+ this.dom.height = HEIGHT;
113
+ this.dom.style.cssText = "width:80px;height:48px";
114
+
115
+ this.context.font = `bold ${9 * PR}px Helvetica,Arial,sans-serif`;
116
+ this.context.textBaseline = "top";
117
+
118
+ this.context.fillStyle = bg;
119
+ this.context.fillRect(0, 0, WIDTH, HEIGHT);
120
+
121
+ this.context.fillStyle = fg;
122
+ this.context.fillText(name, TEXT_X, TEXT_Y);
123
+ this.context.fillRect(GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT);
124
+
125
+ this.context.fillStyle = bg;
126
+ this.context.globalAlpha = 0.9;
127
+ this.context.fillRect(GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT);
128
+ }
129
+
130
+ update(value: number, maxValue: number) {
131
+ this.min = Math.min(this.min, value);
132
+ this.max = Math.max(this.max, value);
133
+
134
+ this.context.fillStyle = this.bg;
135
+ this.context.globalAlpha = 1;
136
+ this.context.fillRect(0, 0, WIDTH, GRAPH_Y);
137
+ this.context.fillStyle = this.fg;
138
+ this.context.fillText(
139
+ Math.round(value) +
140
+ " " +
141
+ this.name +
142
+ " (" +
143
+ Math.round(this.min) +
144
+ "-" +
145
+ Math.round(this.max) +
146
+ ")",
147
+ TEXT_X,
148
+ TEXT_Y,
149
+ );
150
+
151
+ this.context.drawImage(
152
+ this.dom,
153
+ GRAPH_X + PR,
154
+ GRAPH_Y,
155
+ GRAPH_WIDTH - PR,
156
+ GRAPH_HEIGHT,
157
+ GRAPH_X,
158
+ GRAPH_Y,
159
+ GRAPH_WIDTH - PR,
160
+ GRAPH_HEIGHT,
161
+ );
162
+
163
+ this.context.fillRect(
164
+ GRAPH_X + GRAPH_WIDTH - PR,
165
+ GRAPH_Y,
166
+ PR,
167
+ GRAPH_HEIGHT,
168
+ );
169
+
170
+ this.context.fillStyle = this.bg;
171
+ this.context.globalAlpha = 0.9;
172
+ this.context.fillRect(
173
+ GRAPH_X + GRAPH_WIDTH - PR,
174
+ GRAPH_Y,
175
+ PR,
176
+ Math.round((1 - value / maxValue) * GRAPH_HEIGHT),
177
+ );
178
+ }
179
+ }