cubing 0.21.1 → 0.22.1
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.
- package/README.md +4 -7
- package/{src/cubing/kpuzzle → dist}/.DS_Store +0 -0
- package/dist/bin/order.js +16675 -0
- package/dist/bin/order.js.map +7 -0
- package/dist/bin/puzzle-geometry-bin.js +13 -9
- package/dist/bin/puzzle-geometry-bin.js.map +2 -2
- package/dist/bundle-global/cubing.bundle-global.js +555 -298
- package/dist/esm/3d-M7GBIT3X.js +21 -0
- package/dist/esm/3d-M7GBIT3X.js.map +7 -0
- package/dist/esm/alg/index.js +1 -1
- package/dist/esm/bluetooth/index.js +10 -8
- package/dist/esm/bluetooth/index.js.map +3 -3
- package/dist/esm/{chunk-RE7MIN5R.js → chunk-4IUYLRHT.js} +2 -2
- package/dist/esm/{chunk-RE7MIN5R.js.map → chunk-4IUYLRHT.js.map} +0 -0
- package/dist/esm/{chunk-CSVAFZSB.js → chunk-6BZSKSG7.js} +724 -735
- package/dist/esm/chunk-6BZSKSG7.js.map +7 -0
- package/dist/esm/{chunk-BU5PUJK3.js → chunk-EWRBHQFX.js} +1 -1
- package/dist/esm/{chunk-BU5PUJK3.js.map → chunk-EWRBHQFX.js.map} +1 -1
- package/dist/esm/{chunk-APIIMJG6.js → chunk-GF76PWEV.js} +450 -1052
- package/dist/esm/chunk-GF76PWEV.js.map +7 -0
- package/dist/esm/{chunk-MUQMBH2S.js → chunk-R3HRHYIW.js} +16 -4
- package/dist/esm/chunk-R3HRHYIW.js.map +7 -0
- package/dist/esm/{chunk-YV3RT5PX.js → chunk-X6JHXPDX.js} +2 -2
- package/dist/esm/{chunk-YV3RT5PX.js.map → chunk-X6JHXPDX.js.map} +0 -0
- package/dist/esm/esm-test-worker.js +2 -2
- package/dist/esm/esm-test-worker.js.map +2 -2
- package/dist/esm/kpuzzle/index.js +2 -2
- package/dist/esm/{node-WEHVBEKP.js → node-HFBX5WHK.js} +2 -2
- package/dist/esm/{node-WEHVBEKP.js.map → node-HFBX5WHK.js.map} +1 -1
- package/dist/esm/{node-BSAQKO3G.js → node-SP4L2AKI.js} +2 -2
- package/dist/esm/{node-BSAQKO3G.js.map → node-SP4L2AKI.js.map} +1 -1
- package/dist/esm/notation/index.js +2 -2
- package/dist/esm/protocol/index.js +2 -2
- package/dist/esm/puzzle-geometry/index.js +14 -10
- package/dist/esm/puzzle-geometry/index.js.map +2 -2
- package/dist/esm/puzzles/index.js +3 -3
- package/dist/esm/scramble/index.js +4 -4
- package/dist/esm/search/index.js +4 -4
- package/dist/esm/stream/index.js +1 -1
- package/dist/esm/twisty/index.js +729 -2346
- package/dist/esm/twisty/index.js.map +3 -3
- package/dist/esm/worker-inside-generated-string-RQYYANYQ.js +3107 -0
- package/dist/esm/worker-inside-generated-string-RQYYANYQ.js.map +7 -0
- package/dist/types/alg/index.d.ts +1 -0
- package/dist/types/alg/index.d.ts.map +1 -1
- package/dist/types/alg/units/leaves/Move.d.ts +1 -1
- package/dist/types/alg/units/leaves/Move.d.ts.map +1 -1
- package/dist/types/bluetooth/smart-puzzle/gan.d.ts.map +1 -1
- package/dist/types/cubing.bundle-global.d.ts +1 -24
- package/dist/types/cubing.bundle-global.d.ts.map +1 -1
- package/dist/types/cubing.bundle-global.exports.d.ts +25 -0
- package/dist/types/cubing.bundle-global.exports.d.ts.map +1 -0
- package/dist/types/puzzle-geometry/PGPuzzles.spec.d.ts +3 -0
- package/dist/types/puzzle-geometry/PGPuzzles.spec.d.ts.map +1 -1
- package/dist/types/puzzle-geometry/PuzzleGeometry.d.ts +7 -3
- package/dist/types/puzzle-geometry/PuzzleGeometry.d.ts.map +1 -1
- package/dist/types/puzzle-geometry/index.d.ts +1 -1
- package/dist/types/puzzle-geometry/index.d.ts.map +1 -1
- package/dist/types/puzzles/index.d.ts +1 -1
- package/dist/types/puzzles/index.d.ts.map +1 -1
- package/dist/types/puzzles/stickerings/cube-stickerings.d.ts.map +1 -1
- package/dist/types/search/inside/api.d.ts.map +1 -1
- package/dist/types/search/inside/solve/puzzles/4x4x4.d.ts +1 -1
- package/dist/types/search/inside/solve/puzzles/4x4x4.d.ts.map +1 -1
- package/dist/types/search/inside/solve/puzzles/fto.d.ts +6 -0
- package/dist/types/search/inside/solve/puzzles/fto.d.ts.map +1 -0
- package/dist/types/search/inside/solve/puzzles/fto.sgs.json.d.ts +5 -0
- package/dist/types/search/inside/solve/puzzles/fto.sgs.json.d.ts.map +1 -0
- package/dist/types/search/inside/solve/tremble.d.ts.map +1 -1
- package/dist/types/search/worker-inside-generated-string.d.ts +1 -1
- package/dist/types/search/worker-inside-generated-string.d.ts.map +1 -1
- package/dist/types/twisty/{old/animation/cursor/CursorTypes.d.ts → controllers/AnimationTypes.d.ts} +10 -3
- package/dist/types/twisty/controllers/AnimationTypes.d.ts.map +1 -0
- package/dist/types/twisty/{old/animation → controllers}/RenderScheduler.d.ts +0 -0
- package/dist/types/twisty/controllers/RenderScheduler.d.ts.map +1 -0
- package/dist/types/twisty/controllers/TwistyAnimationController.d.ts +1 -1
- package/dist/types/twisty/controllers/TwistyAnimationController.d.ts.map +1 -1
- package/dist/types/twisty/{old/animation → controllers}/easing.d.ts +0 -0
- package/dist/types/twisty/controllers/easing.d.ts.map +1 -0
- package/dist/types/twisty/{old/animation → controllers}/indexer/AlgDuration.d.ts +2 -2
- package/dist/types/twisty/controllers/indexer/AlgDuration.d.ts.map +1 -0
- package/dist/types/twisty/{old/animation → controllers}/indexer/AlgIndexer.d.ts +3 -3
- package/dist/types/twisty/controllers/indexer/AlgIndexer.d.ts.map +1 -0
- package/dist/types/twisty/{old/animation → controllers}/indexer/SimpleAlgIndexer.d.ts +3 -3
- package/dist/types/twisty/controllers/indexer/SimpleAlgIndexer.d.ts.map +1 -0
- package/dist/types/twisty/{old/animation → controllers}/indexer/simultaneous-moves/SimultaneousMoveIndexer.d.ts +3 -3
- package/dist/types/twisty/controllers/indexer/simultaneous-moves/SimultaneousMoveIndexer.d.ts.map +1 -0
- package/dist/types/twisty/{old/animation → controllers}/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.d.ts +3 -3
- package/dist/types/twisty/controllers/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.d.ts.map +1 -0
- package/dist/types/twisty/{old/animation → controllers}/indexer/simultaneous-moves/simul-moves.d.ts +2 -2
- package/dist/types/twisty/controllers/indexer/simultaneous-moves/simul-moves.d.ts.map +1 -0
- package/dist/types/twisty/{old/animation → controllers}/indexer/tree/AlgWalker.d.ts +2 -2
- package/dist/types/twisty/controllers/indexer/tree/AlgWalker.d.ts.map +1 -0
- package/dist/types/twisty/{old/animation → controllers}/indexer/tree/TreeAlgIndexer.d.ts +3 -3
- package/dist/types/twisty/controllers/indexer/tree/TreeAlgIndexer.d.ts.map +1 -0
- package/dist/types/twisty/controllers/indexer/tree/chunkAlgs.d.ts +3 -0
- package/dist/types/twisty/controllers/indexer/tree/chunkAlgs.d.ts.map +1 -0
- package/dist/types/twisty/{old/animation → controllers}/stream/timeline-move-calculation-draft.d.ts +2 -2
- package/dist/types/twisty/controllers/stream/timeline-move-calculation-draft.d.ts.map +1 -0
- package/dist/types/twisty/heavy-code-imports/dynamic-entries/3d.d.ts +1 -2
- package/dist/types/twisty/heavy-code-imports/dynamic-entries/3d.d.ts.map +1 -1
- package/dist/types/twisty/index.d.ts +9 -12
- package/dist/types/twisty/index.d.ts.map +1 -1
- package/dist/types/twisty/model/TwistyPlayerModel.d.ts +11 -0
- package/dist/types/twisty/model/TwistyPlayerModel.d.ts.map +1 -1
- package/dist/types/twisty/model/props/TwistyPropDebugger.d.ts +1 -1
- package/dist/types/twisty/model/props/TwistyPropDebugger.d.ts.map +1 -1
- package/dist/types/twisty/model/props/puzzle/display/FoundationDisplayProp.d.ts +6 -0
- package/dist/types/twisty/model/props/puzzle/display/FoundationDisplayProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/puzzle/display/HintFaceletProp.d.ts +5 -1
- package/dist/types/twisty/model/props/puzzle/display/HintFaceletProp.d.ts.map +1 -1
- package/dist/types/twisty/model/props/puzzle/display/StickeringProp.d.ts +46 -1
- package/dist/types/twisty/model/props/puzzle/display/StickeringProp.d.ts.map +1 -1
- package/dist/types/twisty/model/props/puzzle/state/AnchoredStartProp.d.ts +2 -2
- package/dist/types/twisty/model/props/puzzle/state/AnchoredStartProp.d.ts.map +1 -1
- package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesProp.d.ts +1 -1
- package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesProp.d.ts.map +1 -1
- package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesSimplified.d.ts +1 -1
- package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesSimplified.d.ts.map +1 -1
- package/dist/types/twisty/model/props/puzzle/state/CurrentTransformationProp.d.ts +1 -1
- package/dist/types/twisty/model/props/puzzle/state/CurrentTransformationProp.d.ts.map +1 -1
- package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorProp.d.ts +5 -2
- package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorProp.d.ts.map +1 -1
- package/dist/types/twisty/model/props/puzzle/state/IndexerProp.d.ts +2 -2
- package/dist/types/twisty/model/props/puzzle/state/IndexerProp.d.ts.map +1 -1
- package/dist/types/twisty/model/props/puzzle/state/LegacyPositionProp.d.ts +2 -2
- package/dist/types/twisty/model/props/puzzle/state/LegacyPositionProp.d.ts.map +1 -1
- package/dist/types/twisty/model/props/puzzle/state/MovePressInputProp.d.ts +11 -0
- package/dist/types/twisty/model/props/puzzle/state/MovePressInputProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/puzzle/state/NaiveMoveCountProp.d.ts +10 -0
- package/dist/types/twisty/model/props/puzzle/state/NaiveMoveCountProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/puzzle/state/SetupAnchorProp.d.ts +5 -1
- package/dist/types/twisty/model/props/puzzle/state/SetupAnchorProp.d.ts.map +1 -1
- package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDProp.d.ts +1 -1
- package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDProp.d.ts.map +1 -1
- package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.d.ts +19 -1
- package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.d.ts.map +1 -1
- package/dist/types/twisty/model/props/puzzle/structure/PuzzleLoaderProp.d.ts +1 -1
- package/dist/types/twisty/model/props/puzzle/structure/PuzzleLoaderProp.d.ts.map +1 -1
- package/dist/types/twisty/model/props/timeline/DetailedTimelineInfoProp.d.ts +2 -3
- package/dist/types/twisty/model/props/timeline/DetailedTimelineInfoProp.d.ts.map +1 -1
- package/dist/types/twisty/model/props/timeline/PlayingInfoProp.d.ts +1 -1
- package/dist/types/twisty/model/props/timeline/PlayingInfoProp.d.ts.map +1 -1
- package/dist/types/twisty/model/props/timeline/TimestampRequestProp.d.ts +1 -1
- package/dist/types/twisty/model/props/timeline/TimestampRequestProp.d.ts.map +1 -1
- package/dist/types/twisty/model/props/viewer/BackViewProp.d.ts +6 -1
- package/dist/types/twisty/model/props/viewer/BackViewProp.d.ts.map +1 -1
- package/dist/types/twisty/model/props/viewer/BackgroundProp.d.ts +5 -1
- package/dist/types/twisty/model/props/viewer/BackgroundProp.d.ts.map +1 -1
- package/dist/types/twisty/model/props/viewer/ControlPanelProp.d.ts +5 -1
- package/dist/types/twisty/model/props/viewer/ControlPanelProp.d.ts.map +1 -1
- package/dist/types/twisty/model/props/viewer/OrbitCoordinatesProp.d.ts +18 -5
- package/dist/types/twisty/model/props/viewer/OrbitCoordinatesProp.d.ts.map +1 -1
- package/dist/types/twisty/model/props/viewer/OrbitCoordinatesRequestProp.d.ts +6 -6
- package/dist/types/twisty/model/props/viewer/OrbitCoordinatesRequestProp.d.ts.map +1 -1
- package/dist/types/twisty/model/props/viewer/TimeRangeProp.d.ts +2 -2
- package/dist/types/twisty/model/props/viewer/TimeRangeProp.d.ts.map +1 -1
- package/dist/types/twisty/model/props/viewer/ViewerLinkProp.d.ts +5 -1
- package/dist/types/twisty/model/props/viewer/ViewerLinkProp.d.ts.map +1 -1
- package/dist/types/twisty/model/props/viewer/VisualizationProp.d.ts +7 -1
- package/dist/types/twisty/model/props/viewer/VisualizationProp.d.ts.map +1 -1
- package/dist/types/twisty/model/props/viewer/VisualizationStrategyProp.d.ts +1 -1
- package/dist/types/twisty/model/props/viewer/VisualizationStrategyProp.d.ts.map +1 -1
- package/dist/types/twisty/views/2D/Twisty2DPuzzle.css.d.ts +3 -0
- package/dist/types/twisty/views/2D/Twisty2DPuzzle.css.d.ts.map +1 -0
- package/dist/types/twisty/views/2D/Twisty2DPuzzle.d.ts +4 -6
- package/dist/types/twisty/views/2D/Twisty2DPuzzle.d.ts.map +1 -1
- package/dist/types/twisty/views/2D/Twisty2DPuzzleWrapper.d.ts +1 -1
- package/dist/types/twisty/views/2D/Twisty2DPuzzleWrapper.d.ts.map +1 -1
- package/dist/types/twisty/views/2D/Twisty2DSceneWrapper.d.ts +2 -2
- package/dist/types/twisty/views/2D/Twisty2DSceneWrapper.d.ts.map +1 -1
- package/dist/types/twisty/views/3D/DragTracker.d.ts +28 -0
- package/dist/types/twisty/views/3D/DragTracker.d.ts.map +1 -0
- package/dist/types/twisty/views/3D/RendererPool.d.ts.map +1 -1
- package/dist/types/twisty/views/3D/Twisty3DPuzzleWrapper.d.ts +6 -1
- package/dist/types/twisty/views/3D/Twisty3DPuzzleWrapper.d.ts.map +1 -1
- package/dist/types/twisty/views/3D/Twisty3DSceneWrapper.d.ts +9 -4
- package/dist/types/twisty/views/3D/Twisty3DSceneWrapper.d.ts.map +1 -1
- package/dist/types/twisty/views/3D/Twisty3DVantage.css.d.ts +3 -0
- package/dist/types/twisty/views/3D/Twisty3DVantage.css.d.ts.map +1 -0
- package/dist/types/twisty/views/3D/Twisty3DVantage.d.ts +12 -8
- package/dist/types/twisty/views/3D/Twisty3DVantage.d.ts.map +1 -1
- package/dist/types/twisty/views/3D/TwistyOrbitControls.d.ts +24 -0
- package/dist/types/twisty/views/3D/TwistyOrbitControls.d.ts.map +1 -0
- package/dist/types/twisty/views/3D/TwistyOrbitControls.spec.d.ts +5 -0
- package/dist/types/twisty/views/3D/TwistyOrbitControls.spec.d.ts.map +1 -0
- package/dist/types/twisty/views/3D/puzzles/Cube3D.d.ts +4 -4
- package/dist/types/twisty/views/3D/puzzles/Cube3D.d.ts.map +1 -1
- package/dist/types/twisty/views/3D/puzzles/PG3D.d.ts +17 -10
- package/dist/types/twisty/views/3D/puzzles/PG3D.d.ts.map +1 -1
- package/dist/types/twisty/views/3D/puzzles/Twisty3DPuzzle.d.ts +1 -1
- package/dist/types/twisty/views/3D/puzzles/Twisty3DPuzzle.d.ts.map +1 -1
- package/dist/types/twisty/{old/dom/element → views}/ClassListManager.d.ts +0 -0
- package/dist/types/twisty/views/ClassListManager.d.ts.map +1 -0
- package/dist/types/twisty/{old/dom/element → views}/ManagedCustomElement.d.ts +0 -0
- package/dist/types/twisty/views/ManagedCustomElement.d.ts.map +1 -0
- package/dist/types/twisty/views/TwistyAlgEditor/LeafTokens.d.ts +1 -1
- package/dist/types/twisty/views/TwistyAlgEditor/LeafTokens.d.ts.map +1 -1
- package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.css.d.ts +1 -1
- package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.css.d.ts.map +1 -1
- package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.d.ts +2 -1
- package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.d.ts.map +1 -1
- package/dist/types/twisty/views/TwistyAlgViewer.css.d.ts +1 -1
- package/dist/types/twisty/views/TwistyAlgViewer.css.d.ts.map +1 -1
- package/dist/types/twisty/views/TwistyAlgViewer.d.ts +2 -2
- package/dist/types/twisty/views/TwistyAlgViewer.d.ts.map +1 -1
- package/dist/types/twisty/views/TwistyPlayer.css.d.ts +3 -0
- package/dist/types/twisty/views/TwistyPlayer.css.d.ts.map +1 -0
- package/dist/types/twisty/views/TwistyPlayer.d.ts +7 -3
- package/dist/types/twisty/views/TwistyPlayer.d.ts.map +1 -1
- package/dist/types/twisty/views/TwistyPlayerSettable.d.ts +7 -4
- package/dist/types/twisty/views/TwistyPlayerSettable.d.ts.map +1 -1
- package/dist/types/twisty/views/TwistyViewerWrapper.css.d.ts +3 -0
- package/dist/types/twisty/views/TwistyViewerWrapper.css.d.ts.map +1 -0
- package/dist/types/twisty/{old/dom/viewers → views}/canvas.d.ts +0 -0
- package/dist/types/twisty/views/canvas.d.ts.map +1 -0
- package/dist/types/twisty/views/control-panel/TwistyButtonsV2.css.d.ts +4 -0
- package/dist/types/twisty/views/control-panel/TwistyButtonsV2.css.d.ts.map +1 -0
- package/dist/types/twisty/views/control-panel/TwistyButtonsV2.d.ts +1 -1
- package/dist/types/twisty/views/control-panel/TwistyButtonsV2.d.ts.map +1 -1
- package/dist/types/twisty/views/control-panel/TwistyScrubber.css.d.ts +3 -0
- package/dist/types/twisty/{old/dom/controls → views/control-panel}/TwistyScrubber.css.d.ts.map +1 -1
- package/dist/types/twisty/views/control-panel/TwistyScrubberV2.d.ts +1 -1
- package/dist/types/twisty/views/control-panel/TwistyScrubberV2.d.ts.map +1 -1
- package/dist/types/twisty/{old/dom/element → views}/node-custom-element-shims.d.ts +0 -0
- package/dist/types/twisty/views/node-custom-element-shims.d.ts.map +1 -0
- package/dist/types/twisty/views/stream/TwistyStreamSource.css.d.ts +3 -0
- package/dist/types/twisty/views/stream/TwistyStreamSource.css.d.ts.map +1 -0
- package/dist/types/twisty/{old/dom → views}/stream/TwistyStreamSource.d.ts +1 -1
- package/dist/types/twisty/views/stream/TwistyStreamSource.d.ts.map +1 -0
- package/dist/types/{search/vendor → vendor}/comlink-everywhere/inside/index.d.ts +0 -0
- package/dist/types/vendor/comlink-everywhere/inside/index.d.ts.map +1 -0
- package/dist/types/{search/vendor → vendor}/comlink-everywhere/inside/node.d.ts +0 -0
- package/dist/types/vendor/comlink-everywhere/inside/node.d.ts.map +1 -0
- package/dist/types/{search/vendor → vendor}/comlink-everywhere/outside/index.d.ts +0 -0
- package/dist/types/vendor/comlink-everywhere/outside/index.d.ts.map +1 -0
- package/dist/types/{search/vendor → vendor}/comlink-everywhere/outside/node.d.ts +0 -0
- package/dist/types/vendor/comlink-everywhere/outside/node.d.ts.map +1 -0
- package/dist/types/{search/inside/solve/vendor → vendor}/cstimer/src/js/lib/mathlib.d.ts +0 -0
- package/dist/types/vendor/cstimer/src/js/lib/mathlib.d.ts.map +1 -0
- package/dist/types/{search/inside/solve/vendor → vendor}/cstimer/src/js/scramble/scramble_444.d.ts +1 -1
- package/dist/types/vendor/cstimer/src/js/scramble/scramble_444.d.ts.map +1 -0
- package/dist/types/{search/inside/solve/vendor → vendor}/min2phase/gwt.d.ts +0 -0
- package/dist/types/vendor/min2phase/gwt.d.ts.map +1 -0
- package/dist/types/{search/inside/solve/vendor → vendor}/random-uint-below/get-random-values.d.ts +0 -0
- package/dist/types/vendor/random-uint-below/get-random-values.d.ts.map +1 -0
- package/dist/types/{search/inside/solve/vendor → vendor}/random-uint-below/index.d.ts +1 -1
- package/dist/types/vendor/random-uint-below/index.d.ts.map +1 -0
- package/dist/types/{search/inside/solve/vendor → vendor}/random-uint-below/random-choice.d.ts +0 -0
- package/dist/types/vendor/random-uint-below/random-choice.d.ts.map +1 -0
- package/dist/types/{search/inside/solve/vendor/random-uint-below/random-int.d.ts → vendor/random-uint-below/random53BitValue.d.ts} +1 -1
- package/dist/types/vendor/random-uint-below/random53BitValue.d.ts.map +1 -0
- package/dist/types/{search/inside/solve/vendor → vendor}/sq12phase/scramble_sq1.d.ts +0 -0
- package/dist/types/vendor/sq12phase/scramble_sq1.d.ts.map +1 -0
- package/dist/types/{bluetooth/smart-puzzle → vendor/unsafe-raw-aes}/unsafe-raw-aes.d.ts +0 -0
- package/dist/types/vendor/unsafe-raw-aes/unsafe-raw-aes.d.ts.map +1 -0
- package/docs/.DS_Store +0 -0
- package/docs/cubing/.DS_Store +0 -0
- package/docs/cubing/api/index.html +11 -52
- package/docs/cubing/index.html +67 -27
- package/docs/main.css +7 -6
- package/package.json +8 -9
- package/src/cubing/.DS_Store +0 -0
- package/src/cubing/alg/index.ts +1 -0
- package/src/cubing/alg/units/leaves/Move.ts +1 -1
- package/src/cubing/bluetooth/smart-puzzle/gan.ts +4 -1
- package/src/cubing/bluetooth/smart-timer/GanTimer.ts +1 -1
- package/src/cubing/cubing.bundle-global.exports.ts +25 -0
- package/src/cubing/cubing.bundle-global.ts +3 -27
- package/src/cubing/puzzle-geometry/PGPuzzles.spec.ts +4 -0
- package/src/cubing/puzzle-geometry/PuzzleGeometry.ts +20 -8
- package/src/cubing/puzzle-geometry/index.ts +2 -2
- package/src/cubing/puzzles/.DS_Store +0 -0
- package/src/cubing/puzzles/implementations/.DS_Store +0 -0
- package/src/cubing/puzzles/index.ts +1 -1
- package/src/cubing/puzzles/stickerings/cube-stickerings.ts +18 -0
- package/src/cubing/puzzles/stickerings/global-custom-stickering-hack.ts +1 -1
- package/src/cubing/search/.DS_Store +0 -0
- package/src/cubing/search/esm-test-worker.js +1 -1
- package/src/cubing/search/inside/.DS_Store +0 -0
- package/src/cubing/search/inside/api.ts +3 -0
- package/src/cubing/search/inside/entry.js +1 -1
- package/src/cubing/search/inside/inside-worker.ts +1 -1
- package/src/cubing/search/inside/solve/.DS_Store +0 -0
- package/src/cubing/search/inside/solve/addOrientationSuffix.ts +1 -1
- package/src/cubing/{alg → search/inside/solve/puzzles}/.DS_Store +0 -0
- package/src/cubing/search/inside/solve/puzzles/2x2x2.ts +1 -1
- package/src/cubing/search/inside/solve/puzzles/3x3x3/index.ts +2 -2
- package/src/cubing/search/inside/solve/puzzles/4x4x4.ts +2 -2
- package/src/cubing/search/inside/solve/puzzles/big-cubes.ts +1 -1
- package/src/cubing/search/inside/solve/puzzles/clock.ts +1 -1
- package/src/cubing/search/inside/solve/puzzles/{FTO.sgs → fto.sgs.json.ts} +116 -80
- package/src/cubing/search/inside/solve/puzzles/fto.ts +58 -0
- package/src/cubing/search/inside/solve/puzzles/sq1.ts +1 -1
- package/src/cubing/search/inside/solve/puzzles/wca-minx.ts +1 -1
- package/src/cubing/search/inside/solve/tremble.ts +2 -1
- package/src/cubing/search/inside/solve/vendor/.DS_Store +0 -0
- package/src/cubing/search/instantiator.ts +1 -1
- package/src/cubing/search/worker-inside-generated-string.js +1 -1
- package/src/cubing/twisty/.DS_Store +0 -0
- package/src/cubing/{alg/units → twisty/controllers}/.DS_Store +0 -0
- package/src/cubing/twisty/{old/animation/cursor/CursorTypes.ts → controllers/AnimationTypes.ts} +11 -2
- package/src/cubing/twisty/{old/animation → controllers}/RenderScheduler.ts +0 -0
- package/src/cubing/twisty/controllers/TwistyAnimationController.ts +4 -4
- package/src/cubing/twisty/controllers/animation/.DS_Store +0 -0
- package/src/cubing/twisty/{old/animation → controllers}/easing.ts +0 -0
- package/src/cubing/{stream → twisty/controllers/indexer}/.DS_Store +0 -0
- package/src/cubing/twisty/{old/animation → controllers}/indexer/AlgDuration.ts +2 -2
- package/src/cubing/twisty/{old/animation → controllers}/indexer/AlgIndexer.ts +4 -4
- package/src/cubing/twisty/{old/animation → controllers}/indexer/SimpleAlgIndexer.ts +4 -4
- package/src/cubing/twisty/{old/animation → controllers}/indexer/simultaneous-moves/SimultaneousMoveIndexer.ts +3 -3
- package/src/cubing/twisty/{old/animation → controllers}/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.ts +3 -3
- package/src/cubing/twisty/{old/animation → controllers}/indexer/simultaneous-moves/simul-moves.ts +2 -2
- package/src/cubing/twisty/{old/animation → controllers}/indexer/tree/AlgWalker.ts +4 -4
- package/src/cubing/twisty/{old/animation → controllers}/indexer/tree/TreeAlgIndexer.ts +3 -3
- package/src/cubing/twisty/{old/animation → controllers}/indexer/tree/chunkAlgs.ts +2 -2
- package/src/cubing/twisty/{old/animation → controllers}/stream/timeline-move-calculation-draft.spec.ts.TODO +0 -0
- package/src/cubing/twisty/{old/animation → controllers}/stream/timeline-move-calculation-draft.ts +2 -2
- package/src/cubing/twisty/heavy-code-imports/.DS_Store +0 -0
- package/src/cubing/twisty/heavy-code-imports/dynamic-entries/3d.ts +2 -12
- package/src/cubing/twisty/index.ts +12 -19
- package/src/cubing/twisty/model/.DS_Store +0 -0
- package/src/cubing/twisty/model/TwistyPlayerModel.ts +38 -7
- package/src/cubing/twisty/model/props/.DS_Store +0 -0
- package/src/cubing/twisty/model/props/TwistyPropDebugger.ts +3 -3
- package/src/cubing/twisty/model/props/puzzle/.DS_Store +0 -0
- package/src/cubing/twisty/model/props/puzzle/display/FoundationDisplayProp.ts +9 -0
- package/src/cubing/twisty/model/props/puzzle/display/HintFaceletProp.ts +6 -1
- package/src/cubing/twisty/model/props/puzzle/display/StickeringProp.ts +49 -1
- package/src/cubing/twisty/model/props/puzzle/state/AlgTransformationProp.ts +1 -1
- package/src/cubing/twisty/model/props/puzzle/state/AnchoredStartProp.ts +2 -2
- package/src/cubing/twisty/model/props/puzzle/state/CurrentLeavesProp.ts +2 -2
- package/src/cubing/twisty/model/props/puzzle/state/CurrentLeavesSimplified.ts +1 -1
- package/src/cubing/twisty/model/props/puzzle/state/CurrentTransformationProp.ts +1 -1
- package/src/cubing/twisty/model/props/puzzle/state/IndexerConstructorProp.ts +12 -5
- package/src/cubing/twisty/model/props/puzzle/state/IndexerProp.ts +2 -2
- package/src/cubing/twisty/model/props/puzzle/state/LegacyPositionProp.ts +2 -2
- package/src/cubing/twisty/model/props/puzzle/state/MovePressInputProp.ts +14 -0
- package/src/cubing/twisty/model/props/puzzle/state/NaiveMoveCountProp.ts +20 -0
- package/src/cubing/twisty/model/props/puzzle/state/SetupAnchorProp.ts +7 -1
- package/src/cubing/twisty/model/props/puzzle/structure/PuzzleIDProp.ts +1 -1
- package/src/cubing/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.ts +20 -1
- package/src/cubing/twisty/model/props/puzzle/structure/PuzzleLoaderProp.ts +1 -1
- package/src/cubing/twisty/model/props/timeline/DetailedTimelineInfoProp.ts +5 -3
- package/src/cubing/twisty/model/props/timeline/PlayingInfoProp.ts +1 -4
- package/src/cubing/twisty/model/props/timeline/TimestampRequestProp.ts +1 -1
- package/src/cubing/twisty/model/props/viewer/BackViewProp.ts +7 -1
- package/src/cubing/twisty/model/props/viewer/BackgroundProp.ts +6 -1
- package/src/cubing/twisty/model/props/viewer/ControlPanelProp.ts +5 -1
- package/src/cubing/twisty/model/props/viewer/OrbitCoordinatesProp.ts +83 -12
- package/src/cubing/twisty/model/props/viewer/OrbitCoordinatesRequestProp.ts +8 -8
- package/src/cubing/twisty/model/props/viewer/TimeRangeProp.ts +2 -2
- package/src/cubing/twisty/model/props/viewer/ViewerLinkProp.ts +5 -1
- package/src/cubing/twisty/model/props/viewer/VisualizationProp.ts +8 -1
- package/src/cubing/twisty/model/props/viewer/VisualizationStrategyProp.ts +1 -1
- package/src/cubing/twisty/old/.DS_Store +0 -0
- package/src/cubing/twisty/old/animation/.DS_Store +0 -0
- package/src/cubing/twisty/old/dom/.DS_Store +0 -0
- package/src/cubing/twisty/views/.DS_Store +0 -0
- package/src/cubing/twisty/{old/dom/viewers/Twisty2DSVGView.css.ts → views/2D/Twisty2DPuzzle.css.ts} +1 -1
- package/src/cubing/twisty/views/2D/Twisty2DPuzzle.ts +8 -12
- package/src/cubing/twisty/views/2D/Twisty2DPuzzleWrapper.ts +1 -1
- package/src/cubing/twisty/views/2D/Twisty2DSceneWrapper.ts +4 -4
- package/src/cubing/{bluetooth → twisty/views/3D}/.DS_Store +0 -0
- package/src/cubing/twisty/views/3D/DragTracker.ts +184 -0
- package/src/cubing/twisty/views/3D/RendererPool.ts +2 -1
- package/src/cubing/twisty/views/3D/Twisty3DPuzzleWrapper.ts +51 -5
- package/src/cubing/twisty/views/3D/Twisty3DSceneWrapper.ts +51 -10
- package/src/cubing/twisty/{old/dom/viewers/Twisty3DCanvas.css.ts → views/3D/Twisty3DVantage.css.ts} +2 -2
- package/src/cubing/twisty/views/3D/Twisty3DVantage.ts +103 -35
- package/src/cubing/twisty/views/3D/TwistyOrbitControls.spec.ts +213 -0
- package/src/cubing/twisty/views/3D/TwistyOrbitControls.ts +176 -0
- package/src/cubing/twisty/views/3D/puzzles/Cube3D.ts +5 -9
- package/src/cubing/twisty/views/3D/puzzles/PG3D.ts +127 -37
- package/src/cubing/twisty/views/3D/puzzles/Twisty3DPuzzle.ts +1 -1
- package/src/cubing/twisty/{old/dom/element → views}/ClassListManager.ts +0 -0
- package/src/cubing/twisty/{old/dom/element → views}/ManagedCustomElement.ts +0 -0
- package/src/cubing/twisty/views/TwistyAlgEditor/LeafTokens.ts +1 -1
- package/src/cubing/twisty/views/TwistyAlgEditor/TwistyAlgEditor.css.ts +1 -1
- package/src/cubing/twisty/views/TwistyAlgEditor/TwistyAlgEditor.ts +11 -4
- package/src/cubing/twisty/views/TwistyAlgViewer.css.ts +1 -1
- package/src/cubing/twisty/views/TwistyAlgViewer.ts +4 -4
- package/src/cubing/twisty/{old/dom → views}/TwistyPlayer.css.ts +4 -1
- package/src/cubing/twisty/views/TwistyPlayer.ts +16 -25
- package/src/cubing/twisty/views/TwistyPlayerSettable.ts +14 -10
- package/src/cubing/twisty/{old/dom/viewers → views}/TwistyViewerWrapper.css.ts +1 -1
- package/src/cubing/twisty/{old/dom/viewers → views}/canvas.ts +0 -0
- package/src/cubing/twisty/{old/dom/controls/buttons.css.ts → views/control-panel/TwistyButtonsV2.css.ts} +1 -1
- package/src/cubing/twisty/views/control-panel/TwistyButtonsV2.ts +5 -8
- package/src/cubing/twisty/{old/dom/controls → views/control-panel}/TwistyScrubber.css.ts +1 -1
- package/src/cubing/twisty/views/control-panel/TwistyScrubberV2.ts +3 -3
- package/src/cubing/twisty/{old/dom/element → views}/node-custom-element-shims.ts +2 -2
- package/src/cubing/twisty/{old/dom → views}/stream/TwistyStreamSource.css.ts +1 -1
- package/src/cubing/twisty/{old/dom → views}/stream/TwistyStreamSource.ts +9 -9
- package/src/cubing/vendor/.DS_Store +0 -0
- package/src/cubing/{twisty/old/animation/indexer → vendor/comlink-everywhere}/.DS_Store +0 -0
- package/src/cubing/{search/vendor → vendor}/comlink-everywhere/comlink-everywhere.webloc +0 -0
- package/src/cubing/{search/vendor → vendor}/comlink-everywhere/inside/index.d.ts +0 -0
- package/src/cubing/{search/vendor → vendor}/comlink-everywhere/inside/index.js +0 -0
- package/src/cubing/{search/vendor → vendor}/comlink-everywhere/inside/node.js +0 -0
- package/src/cubing/{search/vendor → vendor}/comlink-everywhere/outside/index.d.ts +0 -0
- package/src/cubing/{search/vendor → vendor}/comlink-everywhere/outside/index.js +0 -0
- package/src/cubing/{search/vendor → vendor}/comlink-everywhere/outside/node.js +0 -0
- package/src/cubing/vendor/cstimer/.DS_Store +0 -0
- package/src/cubing/{search/inside/solve/vendor → vendor}/cstimer/LICENSE +0 -0
- package/src/cubing/{search/inside/solve/vendor → vendor}/cstimer/src/js/lib/mathlib.ts +0 -0
- package/src/cubing/{search/inside/solve/vendor → vendor}/cstimer/src/js/scramble/scramble_444.ts +3 -3
- package/src/cubing/{search/inside/solve/vendor → vendor}/min2phase/gwt.d.ts +0 -0
- package/src/cubing/{search/inside/solve/vendor → vendor}/min2phase/gwt.js +0 -0
- package/src/cubing/vendor/random-uint-below/get-random-values.ts +23 -0
- package/src/cubing/{search/inside/solve/vendor → vendor}/random-uint-below/index.ts +2 -2
- package/src/cubing/{search/inside/solve/vendor → vendor}/random-uint-below/random-choice.ts +1 -1
- package/src/cubing/{search/inside/solve/vendor/random-uint-below/random-int.ts → vendor/random-uint-below/random53BitValue.ts} +0 -0
- package/src/cubing/{search/inside/solve/vendor → vendor}/sq12phase/scramble_sq1.js +0 -0
- package/src/cubing/{bluetooth/smart-puzzle → vendor/unsafe-raw-aes}/unsafe-raw-aes.ts +18 -20
- package/dist/esm/3d-B25DP5PE.js +0 -39
- package/dist/esm/3d-B25DP5PE.js.map +0 -7
- package/dist/esm/chunk-APIIMJG6.js.map +0 -7
- package/dist/esm/chunk-CSVAFZSB.js.map +0 -7
- package/dist/esm/chunk-MUQMBH2S.js.map +0 -7
- package/dist/esm/worker-inside-generated-string-KDZOUGJF.js +0 -2831
- package/dist/esm/worker-inside-generated-string-KDZOUGJF.js.map +0 -7
- package/dist/types/bluetooth/smart-puzzle/unsafe-raw-aes.d.ts.map +0 -1
- package/dist/types/search/inside/solve/vendor/cstimer/src/js/lib/mathlib.d.ts.map +0 -1
- package/dist/types/search/inside/solve/vendor/cstimer/src/js/scramble/scramble_444.d.ts.map +0 -1
- package/dist/types/search/inside/solve/vendor/min2phase/gwt.d.ts.map +0 -1
- package/dist/types/search/inside/solve/vendor/random-uint-below/get-random-values.d.ts.map +0 -1
- package/dist/types/search/inside/solve/vendor/random-uint-below/index.d.ts.map +0 -1
- package/dist/types/search/inside/solve/vendor/random-uint-below/random-choice.d.ts.map +0 -1
- package/dist/types/search/inside/solve/vendor/random-uint-below/random-int.d.ts.map +0 -1
- package/dist/types/search/inside/solve/vendor/sq12phase/scramble_sq1.d.ts.map +0 -1
- package/dist/types/search/vendor/comlink-everywhere/inside/index.d.ts.map +0 -1
- package/dist/types/search/vendor/comlink-everywhere/inside/node.d.ts.map +0 -1
- package/dist/types/search/vendor/comlink-everywhere/outside/index.d.ts.map +0 -1
- package/dist/types/search/vendor/comlink-everywhere/outside/node.d.ts.map +0 -1
- package/dist/types/twisty/old/animation/RenderScheduler.d.ts.map +0 -1
- package/dist/types/twisty/old/animation/Timeline.d.ts +0 -72
- package/dist/types/twisty/old/animation/Timeline.d.ts.map +0 -1
- package/dist/types/twisty/old/animation/cursor/AlgCursor.d.ts +0 -53
- package/dist/types/twisty/old/animation/cursor/AlgCursor.d.ts.map +0 -1
- package/dist/types/twisty/old/animation/cursor/CursorTypes.d.ts.map +0 -1
- package/dist/types/twisty/old/animation/easing.d.ts.map +0 -1
- package/dist/types/twisty/old/animation/indexer/AlgDuration.d.ts.map +0 -1
- package/dist/types/twisty/old/animation/indexer/AlgIndexer.d.ts.map +0 -1
- package/dist/types/twisty/old/animation/indexer/SimpleAlgIndexer.d.ts.map +0 -1
- package/dist/types/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexer.d.ts.map +0 -1
- package/dist/types/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.d.ts.map +0 -1
- package/dist/types/twisty/old/animation/indexer/simultaneous-moves/simul-moves.d.ts.map +0 -1
- package/dist/types/twisty/old/animation/indexer/tree/AlgWalker.d.ts.map +0 -1
- package/dist/types/twisty/old/animation/indexer/tree/TreeAlgIndexer.d.ts.map +0 -1
- package/dist/types/twisty/old/animation/indexer/tree/chunkAlgs.d.ts +0 -3
- package/dist/types/twisty/old/animation/indexer/tree/chunkAlgs.d.ts.map +0 -1
- package/dist/types/twisty/old/animation/stream/timeline-move-calculation-draft.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/TwistyAlgViewerV1.css.d.ts +0 -3
- package/dist/types/twisty/old/dom/TwistyAlgViewerV1.css.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/TwistyAlgViewerV1.d.ts +0 -52
- package/dist/types/twisty/old/dom/TwistyAlgViewerV1.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/TwistyPlayer.css.d.ts +0 -3
- package/dist/types/twisty/old/dom/TwistyPlayer.css.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/TwistyPlayer.d.ts +0 -92
- package/dist/types/twisty/old/dom/TwistyPlayer.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/TwistyPlayer.spec.d.ts +0 -5
- package/dist/types/twisty/old/dom/TwistyPlayer.spec.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/TwistyPlayerConfig.d.ts +0 -165
- package/dist/types/twisty/old/dom/TwistyPlayerConfig.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/controls/TwistyControlElement.d.ts +0 -2
- package/dist/types/twisty/old/dom/controls/TwistyControlElement.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/controls/TwistyScrubber.css.d.ts +0 -3
- package/dist/types/twisty/old/dom/controls/TwistyScrubber.d.ts +0 -14
- package/dist/types/twisty/old/dom/controls/TwistyScrubber.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/controls/buttons.css.d.ts +0 -4
- package/dist/types/twisty/old/dom/controls/buttons.css.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/controls/buttons.d.ts +0 -40
- package/dist/types/twisty/old/dom/controls/buttons.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/controls/buttons.spec.d.ts +0 -5
- package/dist/types/twisty/old/dom/controls/buttons.spec.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/element/ClassListManager.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/element/ElementConfig.d.ts +0 -49
- package/dist/types/twisty/old/dom/element/ElementConfig.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/element/ManagedCustomElement.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/element/node-custom-element-shims.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/stream/TwistyStreamSource.css.d.ts +0 -3
- package/dist/types/twisty/old/dom/stream/TwistyStreamSource.css.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/stream/TwistyStreamSource.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/viewers/Twisty2DSVG.d.ts +0 -26
- package/dist/types/twisty/old/dom/viewers/Twisty2DSVG.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/viewers/Twisty2DSVGView.css.d.ts +0 -3
- package/dist/types/twisty/old/dom/viewers/Twisty2DSVGView.css.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.css.d.ts +0 -3
- package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.css.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.d.ts +0 -41
- package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/viewers/TwistyOrbitControls.d.ts +0 -59
- package/dist/types/twisty/old/dom/viewers/TwistyOrbitControls.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/viewers/TwistyViewerElement.d.ts +0 -4
- package/dist/types/twisty/old/dom/viewers/TwistyViewerElement.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/viewers/TwistyViewerWrapper.css.d.ts +0 -3
- package/dist/types/twisty/old/dom/viewers/TwistyViewerWrapper.css.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/viewers/TwistyViewerWrapper.d.ts +0 -18
- package/dist/types/twisty/old/dom/viewers/TwistyViewerWrapper.d.ts.map +0 -1
- package/dist/types/twisty/old/dom/viewers/canvas.d.ts.map +0 -1
- package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.d.ts +0 -41
- package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.d.ts.map +0 -1
- package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.spec.d.ts +0 -5
- package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.spec.d.ts.map +0 -1
- package/dist/types/twisty/views/3D/puzzles/TwistyTestBox.d.ts +0 -9
- package/dist/types/twisty/views/3D/puzzles/TwistyTestBox.d.ts.map +0 -1
- package/src/cubing/search/inside/solve/vendor/random-uint-below/get-random-values.ts +0 -38
- package/src/cubing/twisty/old/animation/Timeline.ts +0 -378
- package/src/cubing/twisty/old/animation/cursor/AlgCursor.ts +0 -252
- package/src/cubing/twisty/old/dom/TwistyAlgViewerV1.css.ts +0 -25
- package/src/cubing/twisty/old/dom/TwistyAlgViewerV1.ts +0 -516
- package/src/cubing/twisty/old/dom/TwistyPlayer.spec.ts +0 -25
- package/src/cubing/twisty/old/dom/TwistyPlayer.ts +0 -927
- package/src/cubing/twisty/old/dom/TwistyPlayerConfig.ts +0 -378
- package/src/cubing/twisty/old/dom/controls/TwistyControlElement.ts +0 -1
- package/src/cubing/twisty/old/dom/controls/TwistyScrubber.ts +0 -53
- package/src/cubing/twisty/old/dom/controls/buttons.spec.ts +0 -37
- package/src/cubing/twisty/old/dom/controls/buttons.ts +0 -326
- package/src/cubing/twisty/old/dom/element/ElementConfig.ts +0 -180
- package/src/cubing/twisty/old/dom/viewers/Twisty2DSVG.ts +0 -118
- package/src/cubing/twisty/old/dom/viewers/Twisty3DCanvas.ts +0 -256
- package/src/cubing/twisty/old/dom/viewers/TwistyOrbitControls.ts +0 -420
- package/src/cubing/twisty/old/dom/viewers/TwistyViewerElement.ts +0 -5
- package/src/cubing/twisty/old/dom/viewers/TwistyViewerWrapper.ts +0 -45
- package/src/cubing/twisty/views/3D/TwistyOrbitControlsV2.spec.ts +0 -209
- package/src/cubing/twisty/views/3D/TwistyOrbitControlsV2.ts +0 -270
- package/src/cubing/twisty/views/3D/puzzles/TwistyTestBox.ts +0 -22
package/dist/esm/twisty/index.js
CHANGED
|
@@ -1,36 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
|
-
CSSSource,
|
|
3
|
-
ClassListManager,
|
|
4
2
|
Cube3D,
|
|
5
3
|
DEGREES_PER_RADIAN,
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
FreshListenerManager,
|
|
5
|
+
HintFaceletProp,
|
|
6
|
+
NO_VALUE,
|
|
8
7
|
PG3D,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
customElementsShim,
|
|
17
|
-
defaultCameraOrbitCoordinates,
|
|
18
|
-
experimentalShowRenderStats,
|
|
19
|
-
pixelRatio,
|
|
20
|
-
pyraminxLookAt,
|
|
21
|
-
twisty3DCanvasCSS,
|
|
22
|
-
twistyViewerWrapperCSS
|
|
23
|
-
} from "../chunk-APIIMJG6.js";
|
|
8
|
+
SimpleTwistyPropSource,
|
|
9
|
+
StaleDropper,
|
|
10
|
+
StickeringProp,
|
|
11
|
+
TwistyPropDerived,
|
|
12
|
+
TwistyPropSource,
|
|
13
|
+
from
|
|
14
|
+
} from "../chunk-GF76PWEV.js";
|
|
24
15
|
import {
|
|
25
16
|
countAnimatedLeaves,
|
|
26
17
|
countMoves
|
|
27
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-4IUYLRHT.js";
|
|
28
19
|
import {
|
|
29
20
|
cube3x3x3,
|
|
30
21
|
cubeAppearance,
|
|
31
22
|
customPGPuzzleLoader,
|
|
32
23
|
puzzles
|
|
33
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-R3HRHYIW.js";
|
|
34
25
|
import {
|
|
35
26
|
KPuzzle,
|
|
36
27
|
KPuzzleSVGWrapper,
|
|
@@ -39,7 +30,7 @@ import {
|
|
|
39
30
|
identityTransformation,
|
|
40
31
|
invertTransformation,
|
|
41
32
|
transformationForMove
|
|
42
|
-
} from "../chunk-
|
|
33
|
+
} from "../chunk-X6JHXPDX.js";
|
|
43
34
|
import {
|
|
44
35
|
Alg,
|
|
45
36
|
AlgBuilder,
|
|
@@ -52,16 +43,15 @@ import {
|
|
|
52
43
|
direct,
|
|
53
44
|
directedGenerator,
|
|
54
45
|
experimentalAppendMove
|
|
55
|
-
} from "../chunk-
|
|
46
|
+
} from "../chunk-EWRBHQFX.js";
|
|
56
47
|
import {
|
|
57
48
|
__privateAdd,
|
|
58
49
|
__privateGet,
|
|
59
50
|
__privateMethod,
|
|
60
|
-
__privateSet
|
|
61
|
-
__privateWrapper
|
|
51
|
+
__privateSet
|
|
62
52
|
} from "../chunk-WO2AXYFE.js";
|
|
63
53
|
|
|
64
|
-
// src/cubing/twisty/
|
|
54
|
+
// src/cubing/twisty/controllers/AnimationTypes.ts
|
|
65
55
|
var Direction;
|
|
66
56
|
(function(Direction2) {
|
|
67
57
|
Direction2[Direction2["Forwards"] = 1] = "Forwards";
|
|
@@ -77,52 +67,29 @@ var BoundaryType;
|
|
|
77
67
|
BoundaryType2["EntireTimeline"] = "entire-timeline";
|
|
78
68
|
})(BoundaryType || (BoundaryType = {}));
|
|
79
69
|
|
|
80
|
-
// src/cubing/twisty/
|
|
81
|
-
var
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (idx > __privateGet(this, _latestResolvedIdx)) {
|
|
91
|
-
__privateSet(this, _latestResolvedIdx, idx);
|
|
92
|
-
return {
|
|
93
|
-
fresh: true,
|
|
94
|
-
result
|
|
95
|
-
};
|
|
96
|
-
} else {
|
|
97
|
-
return { fresh: false };
|
|
70
|
+
// src/cubing/twisty/controllers/RenderScheduler.ts
|
|
71
|
+
var RenderScheduler = class {
|
|
72
|
+
constructor(callback) {
|
|
73
|
+
this.callback = callback;
|
|
74
|
+
this.animFrameID = null;
|
|
75
|
+
this.animFrame = this.animFrameWrapper.bind(this);
|
|
76
|
+
}
|
|
77
|
+
requestAnimFrame() {
|
|
78
|
+
if (!this.animFrameID) {
|
|
79
|
+
this.animFrameID = requestAnimationFrame(this.animFrame);
|
|
98
80
|
}
|
|
99
81
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
constructor() {
|
|
106
|
-
__privateAdd(this, _latestAssignedIdx2, 0);
|
|
107
|
-
__privateAdd(this, _latestResolvedIdx2, 0);
|
|
82
|
+
cancelAnimFrame() {
|
|
83
|
+
if (this.animFrameID) {
|
|
84
|
+
cancelAnimationFrame(this.animFrameID);
|
|
85
|
+
this.animFrameID = 0;
|
|
86
|
+
}
|
|
108
87
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const idx = ++__privateWrapper(this, _latestAssignedIdx2)._;
|
|
113
|
-
const result = await p;
|
|
114
|
-
if (idx > __privateGet(this, _latestResolvedIdx2)) {
|
|
115
|
-
__privateSet(this, _latestResolvedIdx2, idx);
|
|
116
|
-
resolve(result);
|
|
117
|
-
}
|
|
118
|
-
} catch (e) {
|
|
119
|
-
reject(e);
|
|
120
|
-
}
|
|
121
|
-
});
|
|
88
|
+
animFrameWrapper(timestamp) {
|
|
89
|
+
this.animFrameID = 0;
|
|
90
|
+
this.callback(timestamp);
|
|
122
91
|
}
|
|
123
92
|
};
|
|
124
|
-
_latestAssignedIdx2 = new WeakMap();
|
|
125
|
-
_latestResolvedIdx2 = new WeakMap();
|
|
126
93
|
|
|
127
94
|
// src/cubing/twisty/model/helpers.ts
|
|
128
95
|
function arrayEquals(a, b) {
|
|
@@ -386,12 +353,126 @@ var TwistyPlayerController = class {
|
|
|
386
353
|
}
|
|
387
354
|
};
|
|
388
355
|
|
|
389
|
-
// src/cubing/twisty/
|
|
356
|
+
// src/cubing/twisty/model/props/viewer/ControlPanelProp.ts
|
|
357
|
+
var controlsLocations = {
|
|
358
|
+
"bottom-row": true,
|
|
359
|
+
"none": true
|
|
360
|
+
};
|
|
361
|
+
var ControlPanelProp = class extends SimpleTwistyPropSource {
|
|
362
|
+
getDefaultValue() {
|
|
363
|
+
return "auto";
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
// src/cubing/twisty/views/ClassListManager.ts
|
|
368
|
+
var _currentClassName;
|
|
369
|
+
var ClassListManager = class {
|
|
370
|
+
constructor(elem, prefix, validSuffixes) {
|
|
371
|
+
this.elem = elem;
|
|
372
|
+
this.prefix = prefix;
|
|
373
|
+
this.validSuffixes = validSuffixes;
|
|
374
|
+
__privateAdd(this, _currentClassName, null);
|
|
375
|
+
}
|
|
376
|
+
clearValue() {
|
|
377
|
+
if (__privateGet(this, _currentClassName)) {
|
|
378
|
+
this.elem.contentWrapper.classList.remove(__privateGet(this, _currentClassName));
|
|
379
|
+
}
|
|
380
|
+
__privateSet(this, _currentClassName, null);
|
|
381
|
+
}
|
|
382
|
+
setValue(suffix) {
|
|
383
|
+
if (!this.validSuffixes.includes(suffix)) {
|
|
384
|
+
throw new Error(`Invalid suffix: ${suffix}`);
|
|
385
|
+
}
|
|
386
|
+
const newClassName = `${this.prefix}${suffix}`;
|
|
387
|
+
const changed = __privateGet(this, _currentClassName) !== newClassName;
|
|
388
|
+
if (changed) {
|
|
389
|
+
this.clearValue();
|
|
390
|
+
this.elem.contentWrapper.classList.add(newClassName);
|
|
391
|
+
__privateSet(this, _currentClassName, newClassName);
|
|
392
|
+
}
|
|
393
|
+
return changed;
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
_currentClassName = new WeakMap();
|
|
397
|
+
|
|
398
|
+
// src/cubing/twisty/views/node-custom-element-shims.ts
|
|
399
|
+
var HTMLElementStub = class {
|
|
400
|
+
};
|
|
401
|
+
var HTMLElementShim;
|
|
402
|
+
if (globalThis.HTMLElement) {
|
|
403
|
+
HTMLElementShim = HTMLElement;
|
|
404
|
+
} else {
|
|
405
|
+
HTMLElementShim = HTMLElementStub;
|
|
406
|
+
}
|
|
407
|
+
var CustomElementsStub = class {
|
|
408
|
+
define() {
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
var customElementsShim;
|
|
412
|
+
if (globalThis.customElements) {
|
|
413
|
+
customElementsShim = customElements;
|
|
414
|
+
} else {
|
|
415
|
+
customElementsShim = new CustomElementsStub();
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// src/cubing/twisty/views/ManagedCustomElement.ts
|
|
419
|
+
var CSSSource = class {
|
|
420
|
+
constructor(sourceText) {
|
|
421
|
+
this.sourceText = sourceText;
|
|
422
|
+
}
|
|
423
|
+
getAsString() {
|
|
424
|
+
return this.sourceText;
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
var _cssSourceMap;
|
|
428
|
+
var ManagedCustomElement = class extends HTMLElementShim {
|
|
429
|
+
constructor(options) {
|
|
430
|
+
super();
|
|
431
|
+
__privateAdd(this, _cssSourceMap, new Map());
|
|
432
|
+
this.shadow = this.attachShadow({ mode: options?.mode ?? "closed" });
|
|
433
|
+
this.contentWrapper = document.createElement("div");
|
|
434
|
+
this.contentWrapper.classList.add("wrapper");
|
|
435
|
+
this.shadow.appendChild(this.contentWrapper);
|
|
436
|
+
}
|
|
437
|
+
addCSS(cssSource) {
|
|
438
|
+
if (__privateGet(this, _cssSourceMap).get(cssSource)) {
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
const cssElem = document.createElement("style");
|
|
442
|
+
cssElem.textContent = cssSource.getAsString();
|
|
443
|
+
__privateGet(this, _cssSourceMap).set(cssSource, cssElem);
|
|
444
|
+
this.shadow.appendChild(cssElem);
|
|
445
|
+
}
|
|
446
|
+
removeCSS(cssSource) {
|
|
447
|
+
const cssElem = __privateGet(this, _cssSourceMap).get(cssSource);
|
|
448
|
+
if (!cssElem) {
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
this.shadow.removeChild(cssElem);
|
|
452
|
+
__privateGet(this, _cssSourceMap).delete(cssSource);
|
|
453
|
+
}
|
|
454
|
+
addElement(element) {
|
|
455
|
+
return this.contentWrapper.appendChild(element);
|
|
456
|
+
}
|
|
457
|
+
prependElement(element) {
|
|
458
|
+
this.contentWrapper.prepend(element);
|
|
459
|
+
}
|
|
460
|
+
removeElement(element) {
|
|
461
|
+
return this.contentWrapper.removeChild(element);
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
_cssSourceMap = new WeakMap();
|
|
465
|
+
customElementsShim.define("twisty-managed-custom-element", ManagedCustomElement);
|
|
466
|
+
|
|
467
|
+
// src/cubing/twisty/views/TwistyPlayer.css.ts
|
|
390
468
|
var twistyPlayerCSS = new CSSSource(`
|
|
391
469
|
:host {
|
|
392
470
|
width: 384px;
|
|
393
471
|
height: 256px;
|
|
394
472
|
display: grid;
|
|
473
|
+
|
|
474
|
+
-webkit-user-select: none;
|
|
475
|
+
user-select: none;
|
|
395
476
|
}
|
|
396
477
|
|
|
397
478
|
.wrapper {
|
|
@@ -455,291 +536,55 @@ twisty-scrubber {
|
|
|
455
536
|
}
|
|
456
537
|
`);
|
|
457
538
|
|
|
458
|
-
// src/cubing/vendor/p-lazy/p-lazy.ts
|
|
459
|
-
var PLazy = class extends Promise {
|
|
460
|
-
constructor(executor) {
|
|
461
|
-
super((resolve) => {
|
|
462
|
-
resolve();
|
|
463
|
-
});
|
|
464
|
-
this._executor = executor;
|
|
465
|
-
}
|
|
466
|
-
static from(function_) {
|
|
467
|
-
return new PLazy((resolve) => {
|
|
468
|
-
resolve(function_());
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
|
-
static resolve(value) {
|
|
472
|
-
return new PLazy((resolve) => {
|
|
473
|
-
resolve(value);
|
|
474
|
-
});
|
|
475
|
-
}
|
|
476
|
-
static reject(error) {
|
|
477
|
-
return new PLazy((_resolve, reject) => {
|
|
478
|
-
reject(error);
|
|
479
|
-
});
|
|
480
|
-
}
|
|
481
|
-
then(onFulfilled, onRejected) {
|
|
482
|
-
this._promise = this._promise || new Promise(this._executor);
|
|
483
|
-
return this._promise.then(onFulfilled, onRejected);
|
|
484
|
-
}
|
|
485
|
-
catch(onRejected) {
|
|
486
|
-
this._promise = this._promise || new Promise(this._executor);
|
|
487
|
-
return this._promise.catch(onRejected);
|
|
488
|
-
}
|
|
489
|
-
};
|
|
490
|
-
function from(function_) {
|
|
491
|
-
return new PLazy((resolve) => {
|
|
492
|
-
resolve(function_());
|
|
493
|
-
});
|
|
494
|
-
}
|
|
495
|
-
|
|
496
539
|
// src/cubing/twisty/heavy-code-imports/3d.ts
|
|
497
540
|
var cachedConstructorProxy = null;
|
|
498
541
|
async function proxy3D() {
|
|
499
|
-
return cachedConstructorProxy ?? (cachedConstructorProxy = import("../3d-
|
|
542
|
+
return cachedConstructorProxy ?? (cachedConstructorProxy = import("../3d-M7GBIT3X.js"));
|
|
500
543
|
}
|
|
501
544
|
var THREEJS = from(async () => (await proxy3D()).T3I);
|
|
502
545
|
|
|
503
|
-
// src/cubing/twisty/
|
|
504
|
-
var
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
return Array.from(__privateGet(this, _children).values());
|
|
524
|
-
}
|
|
525
|
-
addChild(child) {
|
|
526
|
-
__privateGet(this, _children).add(child);
|
|
527
|
-
}
|
|
528
|
-
removeChild(child) {
|
|
529
|
-
__privateGet(this, _children).delete(child);
|
|
530
|
-
}
|
|
531
|
-
markStale(sourceEvent) {
|
|
532
|
-
if (sourceEvent.detail.generation !== globalSourceGeneration) {
|
|
533
|
-
throw new Error("A TwistyProp was marked stale too late!");
|
|
534
|
-
}
|
|
535
|
-
if (this.lastSourceGeneration === sourceEvent.detail.generation) {
|
|
536
|
-
return;
|
|
537
|
-
}
|
|
538
|
-
this.lastSourceGeneration = sourceEvent.detail.generation;
|
|
539
|
-
for (const child of __privateGet(this, _children)) {
|
|
540
|
-
child.markStale(sourceEvent);
|
|
541
|
-
}
|
|
542
|
-
__privateMethod(this, _scheduleRawDispatch, scheduleRawDispatch_fn).call(this);
|
|
543
|
-
}
|
|
544
|
-
addRawListener(listener, options) {
|
|
545
|
-
__privateGet(this, _rawListeners).add(listener);
|
|
546
|
-
if (options?.initial) {
|
|
547
|
-
listener();
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
removeRawListener(listener) {
|
|
551
|
-
__privateGet(this, _rawListeners).delete(listener);
|
|
552
|
-
}
|
|
553
|
-
addFreshListener(listener) {
|
|
554
|
-
const staleDropper = new StaleDropper();
|
|
555
|
-
let lastResult = null;
|
|
556
|
-
const callback = async () => {
|
|
557
|
-
const result = await staleDropper.queue(this.get());
|
|
558
|
-
if (lastResult !== null && this.canReuse(lastResult, result)) {
|
|
559
|
-
return;
|
|
560
|
-
}
|
|
561
|
-
lastResult = result;
|
|
562
|
-
listener(result);
|
|
563
|
-
};
|
|
564
|
-
__privateGet(this, _freshListeners).set(listener, callback);
|
|
565
|
-
this.addRawListener(callback, { initial: true });
|
|
566
|
-
}
|
|
567
|
-
removeFreshListener(listener) {
|
|
568
|
-
this.removeRawListener(__privateGet(this, _freshListeners).get(listener));
|
|
569
|
-
__privateGet(this, _freshListeners).delete(listener);
|
|
570
|
-
}
|
|
571
|
-
};
|
|
572
|
-
_children = new WeakMap();
|
|
573
|
-
_rawListeners = new WeakMap();
|
|
574
|
-
_scheduleRawDispatch = new WeakSet();
|
|
575
|
-
scheduleRawDispatch_fn = function() {
|
|
576
|
-
if (!__privateGet(this, _rawDispatchPending)) {
|
|
577
|
-
__privateSet(this, _rawDispatchPending, true);
|
|
578
|
-
setTimeout(() => __privateMethod(this, _dispatchRawListeners, dispatchRawListeners_fn).call(this), 0);
|
|
579
|
-
}
|
|
580
|
-
};
|
|
581
|
-
_rawDispatchPending = new WeakMap();
|
|
582
|
-
_dispatchRawListeners = new WeakSet();
|
|
583
|
-
dispatchRawListeners_fn = function() {
|
|
584
|
-
if (!__privateGet(this, _rawDispatchPending)) {
|
|
585
|
-
throw new Error("Invalid dispatch state!");
|
|
586
|
-
}
|
|
587
|
-
for (const listener of __privateGet(this, _rawListeners)) {
|
|
588
|
-
listener();
|
|
589
|
-
}
|
|
590
|
-
__privateSet(this, _rawDispatchPending, false);
|
|
591
|
-
};
|
|
592
|
-
_freshListeners = new WeakMap();
|
|
593
|
-
var _value;
|
|
594
|
-
var TwistyPropSource = class extends TwistyPropParent {
|
|
595
|
-
constructor(initialValue) {
|
|
596
|
-
super();
|
|
597
|
-
__privateAdd(this, _value, void 0);
|
|
598
|
-
__privateSet(this, _value, from(() => this.getDefaultValue()));
|
|
599
|
-
if (initialValue) {
|
|
600
|
-
__privateSet(this, _value, this.deriveFromPromiseOrValue(initialValue, __privateGet(this, _value)));
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
set(input) {
|
|
604
|
-
__privateSet(this, _value, this.deriveFromPromiseOrValue(input, __privateGet(this, _value)));
|
|
605
|
-
const sourceEventDetail = {
|
|
606
|
-
sourceProp: this,
|
|
607
|
-
value: __privateGet(this, _value),
|
|
608
|
-
generation: ++globalSourceGeneration
|
|
609
|
-
};
|
|
610
|
-
this.markStale(new CustomEvent("stale", {
|
|
611
|
-
detail: sourceEventDetail
|
|
612
|
-
}));
|
|
613
|
-
}
|
|
614
|
-
async get() {
|
|
615
|
-
return __privateGet(this, _value);
|
|
616
|
-
}
|
|
617
|
-
async deriveFromPromiseOrValue(input, oldValuePromise) {
|
|
618
|
-
return this.derive(await input, oldValuePromise);
|
|
619
|
-
}
|
|
620
|
-
};
|
|
621
|
-
_value = new WeakMap();
|
|
622
|
-
var SimpleTwistyPropSource = class extends TwistyPropSource {
|
|
623
|
-
derive(input) {
|
|
624
|
-
return input;
|
|
625
|
-
}
|
|
626
|
-
};
|
|
627
|
-
var NO_VALUE = Symbol("no value");
|
|
628
|
-
var _parents, _cachedLastSuccessfulCalculation, _cachedLatestGenerationCalculation, _getParents, getParents_fn, _cacheDerive, cacheDerive_fn;
|
|
629
|
-
var TwistyPropDerived = class extends TwistyPropParent {
|
|
630
|
-
constructor(parents, userVisibleErrorTracker) {
|
|
631
|
-
super();
|
|
632
|
-
this.userVisibleErrorTracker = userVisibleErrorTracker;
|
|
633
|
-
__privateAdd(this, _getParents);
|
|
634
|
-
__privateAdd(this, _cacheDerive);
|
|
635
|
-
__privateAdd(this, _parents, void 0);
|
|
636
|
-
__privateAdd(this, _cachedLastSuccessfulCalculation, null);
|
|
637
|
-
__privateAdd(this, _cachedLatestGenerationCalculation, null);
|
|
638
|
-
__privateSet(this, _parents, parents);
|
|
639
|
-
for (const parent of Object.values(parents)) {
|
|
640
|
-
parent.addChild(this);
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
async get() {
|
|
644
|
-
const generation = this.lastSourceGeneration;
|
|
645
|
-
if (__privateGet(this, _cachedLatestGenerationCalculation)?.generation === generation) {
|
|
646
|
-
return __privateGet(this, _cachedLatestGenerationCalculation).output;
|
|
647
|
-
}
|
|
648
|
-
const latestGenerationCalculation = {
|
|
649
|
-
generation,
|
|
650
|
-
output: __privateMethod(this, _cacheDerive, cacheDerive_fn).call(this, __privateMethod(this, _getParents, getParents_fn).call(this), generation, __privateGet(this, _cachedLastSuccessfulCalculation))
|
|
651
|
-
};
|
|
652
|
-
__privateSet(this, _cachedLatestGenerationCalculation, latestGenerationCalculation);
|
|
653
|
-
this.userVisibleErrorTracker?.reset();
|
|
654
|
-
return latestGenerationCalculation.output;
|
|
655
|
-
}
|
|
656
|
-
};
|
|
657
|
-
_parents = new WeakMap();
|
|
658
|
-
_cachedLastSuccessfulCalculation = new WeakMap();
|
|
659
|
-
_cachedLatestGenerationCalculation = new WeakMap();
|
|
660
|
-
_getParents = new WeakSet();
|
|
661
|
-
getParents_fn = async function() {
|
|
662
|
-
const inputValuePromises = {};
|
|
663
|
-
for (const [key, parent] of Object.entries(__privateGet(this, _parents))) {
|
|
664
|
-
inputValuePromises[key] = parent.get();
|
|
665
|
-
}
|
|
666
|
-
const inputs = {};
|
|
667
|
-
for (const key in __privateGet(this, _parents)) {
|
|
668
|
-
inputs[key] = await inputValuePromises[key];
|
|
669
|
-
}
|
|
670
|
-
return inputs;
|
|
671
|
-
};
|
|
672
|
-
_cacheDerive = new WeakSet();
|
|
673
|
-
cacheDerive_fn = async function(inputsPromise, generation, cachedLatestGenerationCalculation = null) {
|
|
674
|
-
const inputs = await inputsPromise;
|
|
675
|
-
const cache = (output) => {
|
|
676
|
-
__privateSet(this, _cachedLastSuccessfulCalculation, {
|
|
677
|
-
inputs,
|
|
678
|
-
output: Promise.resolve(output),
|
|
679
|
-
generation
|
|
680
|
-
});
|
|
681
|
-
return output;
|
|
682
|
-
};
|
|
683
|
-
if (!cachedLatestGenerationCalculation) {
|
|
684
|
-
return cache(await this.derive(inputs));
|
|
685
|
-
}
|
|
686
|
-
const cachedInputs = cachedLatestGenerationCalculation.inputs;
|
|
687
|
-
for (const key in __privateGet(this, _parents)) {
|
|
688
|
-
const parent = __privateGet(this, _parents)[key];
|
|
689
|
-
if (!parent.canReuse(inputs[key], cachedInputs[key])) {
|
|
690
|
-
return cache(await this.derive(inputs));
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
return cachedLatestGenerationCalculation.output;
|
|
694
|
-
};
|
|
695
|
-
var _disconnectionFunctions;
|
|
696
|
-
var FreshListenerManager = class {
|
|
697
|
-
constructor() {
|
|
698
|
-
__privateAdd(this, _disconnectionFunctions, []);
|
|
699
|
-
}
|
|
700
|
-
addListener(prop, listener) {
|
|
701
|
-
let disconnected = false;
|
|
702
|
-
const wrappedListener = (value) => {
|
|
703
|
-
if (disconnected) {
|
|
704
|
-
return;
|
|
705
|
-
}
|
|
706
|
-
listener(value);
|
|
707
|
-
};
|
|
708
|
-
prop.addFreshListener(wrappedListener);
|
|
709
|
-
__privateGet(this, _disconnectionFunctions).push(() => {
|
|
710
|
-
prop.removeFreshListener(wrappedListener);
|
|
711
|
-
disconnected = true;
|
|
712
|
-
});
|
|
713
|
-
}
|
|
714
|
-
addMultiListener(props, listener) {
|
|
715
|
-
let disconnected = false;
|
|
716
|
-
const wrappedListener = async (_) => {
|
|
717
|
-
if (disconnected) {
|
|
718
|
-
return;
|
|
719
|
-
}
|
|
720
|
-
const promises = props.map((prop) => prop.get());
|
|
721
|
-
const values = await Promise.all(promises);
|
|
722
|
-
listener(values);
|
|
723
|
-
};
|
|
724
|
-
for (const prop of props) {
|
|
725
|
-
prop.addFreshListener(wrappedListener);
|
|
726
|
-
}
|
|
727
|
-
__privateGet(this, _disconnectionFunctions).push(() => {
|
|
728
|
-
for (const prop of props) {
|
|
729
|
-
prop.removeFreshListener(wrappedListener);
|
|
730
|
-
}
|
|
731
|
-
disconnected = true;
|
|
732
|
-
});
|
|
733
|
-
}
|
|
734
|
-
disconnect() {
|
|
735
|
-
for (const disconnectionFunction of __privateGet(this, _disconnectionFunctions)) {
|
|
736
|
-
disconnectionFunction();
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
};
|
|
740
|
-
_disconnectionFunctions = new WeakMap();
|
|
546
|
+
// src/cubing/twisty/views/TwistyViewerWrapper.css.ts
|
|
547
|
+
var twistyViewerWrapperCSS = new CSSSource(`
|
|
548
|
+
:host {
|
|
549
|
+
width: 384px;
|
|
550
|
+
height: 256px;
|
|
551
|
+
display: grid;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
.wrapper {
|
|
555
|
+
width: 100%;
|
|
556
|
+
height: 100%;
|
|
557
|
+
display: grid;
|
|
558
|
+
overflow: hidden;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
.wrapper > * {
|
|
562
|
+
width: 100%;
|
|
563
|
+
height: 100%;
|
|
564
|
+
overflow: hidden;
|
|
565
|
+
}
|
|
741
566
|
|
|
742
|
-
|
|
567
|
+
.wrapper.back-view-side-by-side {
|
|
568
|
+
grid-template-columns: 1fr 1fr;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
.wrapper.back-view-top-right {
|
|
572
|
+
grid-template-columns: 3fr 1fr;
|
|
573
|
+
grid-template-rows: 1fr 3fr;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
.wrapper.back-view-top-right > :nth-child(1) {
|
|
577
|
+
grid-row: 1 / 3;
|
|
578
|
+
grid-column: 1 / 3;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.wrapper.back-view-top-right > :nth-child(2) {
|
|
582
|
+
grid-row: 1 / 2;
|
|
583
|
+
grid-column: 2 / 3;
|
|
584
|
+
}
|
|
585
|
+
`);
|
|
586
|
+
|
|
587
|
+
// src/cubing/twisty/views/2D/Twisty2DPuzzle.css.ts
|
|
743
588
|
var twisty2DSVGCSS = new CSSSource(`
|
|
744
589
|
:host {
|
|
745
590
|
width: 384px;
|
|
@@ -922,6 +767,9 @@ _cachedScene = new WeakMap();
|
|
|
922
767
|
_currentTwisty2DPuzzleWrapper = new WeakMap();
|
|
923
768
|
customElementsShim.define("twisty-2d-scene-wrapper", Twisty2DSceneWrapper);
|
|
924
769
|
|
|
770
|
+
// src/cubing/twisty/views/3D/Twisty3DSceneWrapper.ts
|
|
771
|
+
import { Vector2 } from "three";
|
|
772
|
+
|
|
925
773
|
// src/cubing/twisty/views/3D/Twisty3DPuzzleWrapper.ts
|
|
926
774
|
var _freshListenerManager4, _cachedTwisty3DPuzzle;
|
|
927
775
|
var Twisty3DPuzzleWrapper = class {
|
|
@@ -952,6 +800,12 @@ var Twisty3DPuzzleWrapper = class {
|
|
|
952
800
|
});
|
|
953
801
|
this.scheduleRender();
|
|
954
802
|
});
|
|
803
|
+
__privateGet(this, _freshListenerManager4).addListener(this.model.foundationDisplayProp, async (foundationDisplay) => {
|
|
804
|
+
(await this.twisty3DPuzzle()).experimentalUpdateOptions({
|
|
805
|
+
showFoundation: foundationDisplay !== "none"
|
|
806
|
+
});
|
|
807
|
+
this.scheduleRender();
|
|
808
|
+
});
|
|
955
809
|
__privateGet(this, _freshListenerManager4).addListener(this.model.stickeringProp, async (stickering) => {
|
|
956
810
|
if ("setStickering" in await this.twisty3DPuzzle()) {
|
|
957
811
|
(await this.twisty3DPuzzle()).setStickering(stickering);
|
|
@@ -1015,10 +869,281 @@ var Twisty3DPuzzleWrapper = class {
|
|
|
1015
869
|
}
|
|
1016
870
|
})());
|
|
1017
871
|
}
|
|
872
|
+
async raycastMove(raycasterPromise, transformations) {
|
|
873
|
+
const puzzle = await this.twisty3DPuzzle();
|
|
874
|
+
if (!(puzzle instanceof PG3D)) {
|
|
875
|
+
console.info("not PG3D! skipping raycast");
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
const targets = puzzle.experimentalGetControlTargets();
|
|
879
|
+
const [raycaster] = await Promise.all([raycasterPromise]);
|
|
880
|
+
const intersects = raycaster.intersectObjects(targets);
|
|
881
|
+
if (intersects.length > 0) {
|
|
882
|
+
const closestMove = puzzle.getClosestMoveToAxis(intersects[0].point, transformations);
|
|
883
|
+
if (closestMove) {
|
|
884
|
+
this.model.experimentalAddMove(closestMove.move, {
|
|
885
|
+
coalesce: true,
|
|
886
|
+
mod: closestMove.order
|
|
887
|
+
});
|
|
888
|
+
} else {
|
|
889
|
+
console.info("Skipping move!");
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
}
|
|
1018
893
|
};
|
|
1019
894
|
_freshListenerManager4 = new WeakMap();
|
|
1020
895
|
_cachedTwisty3DPuzzle = new WeakMap();
|
|
1021
896
|
|
|
897
|
+
// src/cubing/vendor/three/examples/jsm/libs/stats.modified.module.ts
|
|
898
|
+
var performance2 = globalThis.performance;
|
|
899
|
+
var Stats = class {
|
|
900
|
+
constructor() {
|
|
901
|
+
this.mode = 0;
|
|
902
|
+
this.dom = document.createElement("div");
|
|
903
|
+
this.beginTime = (performance2 || Date).now();
|
|
904
|
+
this.prevTime = this.beginTime;
|
|
905
|
+
this.frames = 0;
|
|
906
|
+
this.fpsPanel = this.addPanel(new StatsPanel("FPS", "#0ff", "#002"));
|
|
907
|
+
this.msPanel = this.addPanel(new StatsPanel("MS", "#0f0", "#020"));
|
|
908
|
+
this.memPanel = performance2?.memory ? this.addPanel(new StatsPanel("MB", "#f08", "#201")) : null;
|
|
909
|
+
this.REVISION = 16;
|
|
910
|
+
this.dom.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000";
|
|
911
|
+
this.dom.addEventListener("click", (event) => {
|
|
912
|
+
event.preventDefault();
|
|
913
|
+
this.showPanel(++this.mode % this.dom.children.length);
|
|
914
|
+
}, false);
|
|
915
|
+
this.showPanel(0);
|
|
916
|
+
}
|
|
917
|
+
addPanel(panel) {
|
|
918
|
+
this.dom.appendChild(panel.dom);
|
|
919
|
+
return panel;
|
|
920
|
+
}
|
|
921
|
+
showPanel(id) {
|
|
922
|
+
for (let i = 0; i < this.dom.children.length; i++) {
|
|
923
|
+
this.dom.children[i].style.display = i === id ? "block" : "none";
|
|
924
|
+
}
|
|
925
|
+
this.mode = id;
|
|
926
|
+
}
|
|
927
|
+
begin() {
|
|
928
|
+
this.beginTime = (performance2 || Date).now();
|
|
929
|
+
}
|
|
930
|
+
end() {
|
|
931
|
+
this.frames++;
|
|
932
|
+
const time = (performance2 || Date).now();
|
|
933
|
+
this.msPanel.update(time - this.beginTime, 200);
|
|
934
|
+
if (time >= this.prevTime + 1e3) {
|
|
935
|
+
this.fpsPanel.update(this.frames * 1e3 / (time - this.prevTime), 100);
|
|
936
|
+
this.prevTime = time;
|
|
937
|
+
this.frames = 0;
|
|
938
|
+
if (this.memPanel) {
|
|
939
|
+
const memory = performance2.memory;
|
|
940
|
+
this.memPanel.update(memory.usedJSHeapSize / 1048576, memory.jsHeapSizeLimit / 1048576);
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
return time;
|
|
944
|
+
}
|
|
945
|
+
update() {
|
|
946
|
+
this.beginTime = this.end();
|
|
947
|
+
}
|
|
948
|
+
};
|
|
949
|
+
var PR = Math.round(globalThis?.window?.devicePixelRatio ?? 1);
|
|
950
|
+
var WIDTH = 80 * PR;
|
|
951
|
+
var HEIGHT = 48 * PR;
|
|
952
|
+
var TEXT_X = 3 * PR;
|
|
953
|
+
var TEXT_Y = 2 * PR;
|
|
954
|
+
var GRAPH_X = 3 * PR;
|
|
955
|
+
var GRAPH_Y = 15 * PR;
|
|
956
|
+
var GRAPH_WIDTH = 74 * PR;
|
|
957
|
+
var GRAPH_HEIGHT = 30 * PR;
|
|
958
|
+
var StatsPanel = class {
|
|
959
|
+
constructor(name, fg, bg) {
|
|
960
|
+
this.name = name;
|
|
961
|
+
this.fg = fg;
|
|
962
|
+
this.bg = bg;
|
|
963
|
+
this.min = Infinity;
|
|
964
|
+
this.max = 0;
|
|
965
|
+
this.dom = document.createElement("canvas");
|
|
966
|
+
this.context = this.dom.getContext("2d");
|
|
967
|
+
this.dom.width = WIDTH;
|
|
968
|
+
this.dom.height = HEIGHT;
|
|
969
|
+
this.dom.style.cssText = "width:80px;height:48px";
|
|
970
|
+
this.context.font = `bold ${9 * PR}px Helvetica,Arial,sans-serif`;
|
|
971
|
+
this.context.textBaseline = "top";
|
|
972
|
+
this.context.fillStyle = bg;
|
|
973
|
+
this.context.fillRect(0, 0, WIDTH, HEIGHT);
|
|
974
|
+
this.context.fillStyle = fg;
|
|
975
|
+
this.context.fillText(name, TEXT_X, TEXT_Y);
|
|
976
|
+
this.context.fillRect(GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT);
|
|
977
|
+
this.context.fillStyle = bg;
|
|
978
|
+
this.context.globalAlpha = 0.9;
|
|
979
|
+
this.context.fillRect(GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT);
|
|
980
|
+
}
|
|
981
|
+
update(value, maxValue) {
|
|
982
|
+
this.min = Math.min(this.min, value);
|
|
983
|
+
this.max = Math.max(this.max, value);
|
|
984
|
+
this.context.fillStyle = this.bg;
|
|
985
|
+
this.context.globalAlpha = 1;
|
|
986
|
+
this.context.fillRect(0, 0, WIDTH, GRAPH_Y);
|
|
987
|
+
this.context.fillStyle = this.fg;
|
|
988
|
+
this.context.fillText(Math.round(value) + " " + this.name + " (" + Math.round(this.min) + "-" + Math.round(this.max) + ")", TEXT_X, TEXT_Y);
|
|
989
|
+
this.context.drawImage(this.dom, GRAPH_X + PR, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT);
|
|
990
|
+
this.context.fillRect(GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, GRAPH_HEIGHT);
|
|
991
|
+
this.context.fillStyle = this.bg;
|
|
992
|
+
this.context.globalAlpha = 0.9;
|
|
993
|
+
this.context.fillRect(GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, Math.round((1 - value / maxValue) * GRAPH_HEIGHT));
|
|
994
|
+
}
|
|
995
|
+
};
|
|
996
|
+
|
|
997
|
+
// src/cubing/twisty/views/canvas.ts
|
|
998
|
+
var globalPixelRatioOverride = null;
|
|
999
|
+
function pixelRatio() {
|
|
1000
|
+
return globalPixelRatioOverride ?? (devicePixelRatio || 1);
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
// src/cubing/twisty/views/3D/Twisty3DVantage.css.ts
|
|
1004
|
+
var twisty3DVantageCSS = new CSSSource(`
|
|
1005
|
+
:host {
|
|
1006
|
+
width: 384px;
|
|
1007
|
+
height: 256px;
|
|
1008
|
+
display: grid;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
.wrapper {
|
|
1012
|
+
width: 100%;
|
|
1013
|
+
height: 100%;
|
|
1014
|
+
display: grid;
|
|
1015
|
+
overflow: hidden;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
/* TODO: This is due to stats hack. Replace with \`canvas\`. */
|
|
1019
|
+
.wrapper > canvas {
|
|
1020
|
+
max-width: 100%;
|
|
1021
|
+
max-height: 100%;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
.wrapper.invisible {
|
|
1025
|
+
opacity: 0;
|
|
1026
|
+
}
|
|
1027
|
+
`);
|
|
1028
|
+
|
|
1029
|
+
// src/cubing/twisty/views/3D/DragTracker.ts
|
|
1030
|
+
var MOVEMENT_EPSILON = 0.1;
|
|
1031
|
+
var _dragInfoMap, _lazyListenersRegistered, _registerLazyListeners, registerLazyListeners_fn, _clear, clear_fn, _trackDrag, trackDrag_fn;
|
|
1032
|
+
var DragTracker = class extends EventTarget {
|
|
1033
|
+
constructor(target) {
|
|
1034
|
+
super();
|
|
1035
|
+
this.target = target;
|
|
1036
|
+
__privateAdd(this, _registerLazyListeners);
|
|
1037
|
+
__privateAdd(this, _clear);
|
|
1038
|
+
__privateAdd(this, _trackDrag);
|
|
1039
|
+
__privateAdd(this, _dragInfoMap, new Map());
|
|
1040
|
+
__privateAdd(this, _lazyListenersRegistered, false);
|
|
1041
|
+
target.addEventListener("pointerdown", this.onPointerDown.bind(this));
|
|
1042
|
+
this.target.addEventListener("contextmenu", (e) => {
|
|
1043
|
+
if (e.buttons & 2) {
|
|
1044
|
+
e.preventDefault();
|
|
1045
|
+
}
|
|
1046
|
+
});
|
|
1047
|
+
this.target.addEventListener("touchmove", (e) => e.preventDefault());
|
|
1048
|
+
this.target.addEventListener("dblclick", (e) => e.preventDefault());
|
|
1049
|
+
}
|
|
1050
|
+
onPointerDown(e) {
|
|
1051
|
+
__privateMethod(this, _registerLazyListeners, registerLazyListeners_fn).call(this);
|
|
1052
|
+
const newDragInfo = {
|
|
1053
|
+
attachedInfo: {},
|
|
1054
|
+
hasMoved: false,
|
|
1055
|
+
lastClientX: e.clientX,
|
|
1056
|
+
lastClientY: e.clientY,
|
|
1057
|
+
lastTimeStamp: e.timeStamp
|
|
1058
|
+
};
|
|
1059
|
+
__privateGet(this, _dragInfoMap).set(e.pointerId, newDragInfo);
|
|
1060
|
+
this.target.setPointerCapture(e.pointerId);
|
|
1061
|
+
}
|
|
1062
|
+
onPointerMove(e) {
|
|
1063
|
+
const movementInfo = __privateMethod(this, _trackDrag, trackDrag_fn).call(this, e).movementInfo;
|
|
1064
|
+
if (movementInfo) {
|
|
1065
|
+
e.preventDefault();
|
|
1066
|
+
this.dispatchEvent(new CustomEvent("move", {
|
|
1067
|
+
detail: movementInfo
|
|
1068
|
+
}));
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
onPointerUp(e) {
|
|
1072
|
+
const trackDragResult = __privateMethod(this, _trackDrag, trackDrag_fn).call(this, e);
|
|
1073
|
+
const existing = __privateGet(this, _dragInfoMap).get(e.pointerId);
|
|
1074
|
+
__privateMethod(this, _clear, clear_fn).call(this, e);
|
|
1075
|
+
this.target.releasePointerCapture(e.pointerId);
|
|
1076
|
+
let event;
|
|
1077
|
+
if (trackDragResult.hasMoved) {
|
|
1078
|
+
event = new CustomEvent("up", {
|
|
1079
|
+
detail: { attachedInfo: existing.attachedInfo }
|
|
1080
|
+
});
|
|
1081
|
+
} else {
|
|
1082
|
+
const { altKey, ctrlKey, metaKey, shiftKey } = e;
|
|
1083
|
+
event = new CustomEvent("press", {
|
|
1084
|
+
detail: {
|
|
1085
|
+
normalizedX: e.offsetX / this.target.offsetWidth * 2 - 1,
|
|
1086
|
+
normalizedY: 1 - e.offsetY / this.target.offsetHeight * 2,
|
|
1087
|
+
rightClick: !!(e.button & 2),
|
|
1088
|
+
keys: {
|
|
1089
|
+
altKey,
|
|
1090
|
+
ctrlOrMetaKey: ctrlKey || metaKey,
|
|
1091
|
+
shiftKey
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
this.dispatchEvent(event);
|
|
1097
|
+
}
|
|
1098
|
+
};
|
|
1099
|
+
_dragInfoMap = new WeakMap();
|
|
1100
|
+
_lazyListenersRegistered = new WeakMap();
|
|
1101
|
+
_registerLazyListeners = new WeakSet();
|
|
1102
|
+
registerLazyListeners_fn = function() {
|
|
1103
|
+
if (__privateGet(this, _lazyListenersRegistered)) {
|
|
1104
|
+
return;
|
|
1105
|
+
}
|
|
1106
|
+
this.target.addEventListener("pointermove", this.onPointerMove.bind(this));
|
|
1107
|
+
this.target.addEventListener("pointerup", this.onPointerUp.bind(this));
|
|
1108
|
+
__privateSet(this, _lazyListenersRegistered, true);
|
|
1109
|
+
};
|
|
1110
|
+
_clear = new WeakSet();
|
|
1111
|
+
clear_fn = function(e) {
|
|
1112
|
+
__privateGet(this, _dragInfoMap).delete(e.pointerId);
|
|
1113
|
+
};
|
|
1114
|
+
_trackDrag = new WeakSet();
|
|
1115
|
+
trackDrag_fn = function(e) {
|
|
1116
|
+
const existing = __privateGet(this, _dragInfoMap).get(e.pointerId);
|
|
1117
|
+
if (!existing) {
|
|
1118
|
+
return { movementInfo: null, hasMoved: false };
|
|
1119
|
+
}
|
|
1120
|
+
let movementInfo;
|
|
1121
|
+
if ((e.movementX ?? 0) !== 0 || (e.movementY ?? 0) !== 0) {
|
|
1122
|
+
movementInfo = {
|
|
1123
|
+
attachedInfo: existing.attachedInfo,
|
|
1124
|
+
movementX: e.movementX,
|
|
1125
|
+
movementY: e.movementY,
|
|
1126
|
+
elapsedMs: e.timeStamp - existing.lastTimeStamp
|
|
1127
|
+
};
|
|
1128
|
+
} else {
|
|
1129
|
+
movementInfo = {
|
|
1130
|
+
attachedInfo: existing.attachedInfo,
|
|
1131
|
+
movementX: e.clientX - existing.lastClientX,
|
|
1132
|
+
movementY: e.clientY - existing.lastClientY,
|
|
1133
|
+
elapsedMs: e.timeStamp - existing.lastTimeStamp
|
|
1134
|
+
};
|
|
1135
|
+
}
|
|
1136
|
+
existing.lastClientX = e.clientX;
|
|
1137
|
+
existing.lastClientY = e.clientY;
|
|
1138
|
+
existing.lastTimeStamp = e.timeStamp;
|
|
1139
|
+
if (Math.abs(movementInfo.movementX) < MOVEMENT_EPSILON && Math.abs(movementInfo.movementY) < MOVEMENT_EPSILON) {
|
|
1140
|
+
return { movementInfo: null, hasMoved: existing.hasMoved };
|
|
1141
|
+
} else {
|
|
1142
|
+
existing.hasMoved = true;
|
|
1143
|
+
return { movementInfo, hasMoved: existing.hasMoved };
|
|
1144
|
+
}
|
|
1145
|
+
};
|
|
1146
|
+
|
|
1022
1147
|
// src/cubing/twisty/views/3D/RendererPool.ts
|
|
1023
1148
|
var renderers = [];
|
|
1024
1149
|
async function renderPooled(width, height, canvas, scene, camera) {
|
|
@@ -1045,10 +1170,9 @@ async function newRenderer() {
|
|
|
1045
1170
|
return renderer;
|
|
1046
1171
|
}
|
|
1047
1172
|
|
|
1048
|
-
// src/cubing/twisty/views/3D/
|
|
1173
|
+
// src/cubing/twisty/views/3D/TwistyOrbitControls.ts
|
|
1049
1174
|
import { Spherical } from "three";
|
|
1050
1175
|
var INERTIA_DEFAULT = true;
|
|
1051
|
-
var LATITUDE_LIMITS_DEFAULT = "auto";
|
|
1052
1176
|
var INERTIA_DURATION_MS = 500;
|
|
1053
1177
|
var INERTIA_TIMEOUT_MS = 50;
|
|
1054
1178
|
var VERTICAL_MOVEMENT_BASE_SCALE = 0.75;
|
|
@@ -1079,137 +1203,58 @@ var Inertia = class {
|
|
|
1079
1203
|
this.lastTimestamp = now;
|
|
1080
1204
|
}
|
|
1081
1205
|
};
|
|
1082
|
-
var
|
|
1083
|
-
constructor(model, mirror, canvas) {
|
|
1206
|
+
var TwistyOrbitControls = class {
|
|
1207
|
+
constructor(model, mirror, canvas, dragTracker) {
|
|
1084
1208
|
this.model = model;
|
|
1085
1209
|
this.mirror = mirror;
|
|
1086
1210
|
this.canvas = canvas;
|
|
1211
|
+
this.dragTracker = dragTracker;
|
|
1087
1212
|
this.experimentalInertia = INERTIA_DEFAULT;
|
|
1088
|
-
this.
|
|
1089
|
-
this.lastTouchClientX = 0;
|
|
1090
|
-
this.lastTouchClientY = 0;
|
|
1091
|
-
this.currentTouchID = null;
|
|
1092
|
-
this.onMoveBound = this.onMove.bind(this);
|
|
1093
|
-
this.onMouseMoveBound = this.onMouseMove.bind(this);
|
|
1094
|
-
this.onMouseEndBound = this.onMouseEnd.bind(this);
|
|
1095
|
-
this.onTouchMoveBound = this.onTouchMove.bind(this);
|
|
1096
|
-
this.onTouchEndBound = this.onTouchEnd.bind(this);
|
|
1097
|
-
this.lastTouchTimestamp = 0;
|
|
1098
|
-
this.lastTouchMoveMomentumX = 0;
|
|
1099
|
-
this.lastTouchMoveMomentumY = 0;
|
|
1100
|
-
this.lastMouseTimestamp = 0;
|
|
1101
|
-
this.lastMouseMoveMomentumX = 0;
|
|
1102
|
-
this.lastMouseMoveMomentumY = 0;
|
|
1213
|
+
this.onMovementBound = this.onMovement.bind(this);
|
|
1103
1214
|
this.experimentalHasBeenMoved = false;
|
|
1104
|
-
|
|
1105
|
-
|
|
1215
|
+
this.dragTracker.addEventListener("move", this.onMove.bind(this));
|
|
1216
|
+
this.dragTracker.addEventListener("up", this.onUp.bind(this));
|
|
1106
1217
|
}
|
|
1107
1218
|
temperMovement(f) {
|
|
1108
1219
|
return Math.sign(f) * Math.log(Math.abs(f * 10) + 1) / 6;
|
|
1109
1220
|
}
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
this.
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
this.onMouseEnd(e);
|
|
1119
|
-
return;
|
|
1120
|
-
}
|
|
1121
|
-
if (e.movementX === 0 && e.movementY === 0) {
|
|
1122
|
-
return;
|
|
1123
|
-
}
|
|
1124
|
-
const minDim = Math.min(this.canvas.offsetWidth, this.canvas.offsetHeight);
|
|
1125
|
-
const movementX = this.temperMovement(e.movementX / minDim);
|
|
1126
|
-
const movementY = this.temperMovement(e.movementY / minDim * VERTICAL_MOVEMENT_BASE_SCALE);
|
|
1127
|
-
this.onMove(movementX, movementY);
|
|
1128
|
-
const deltaMs = e.timeStamp - this.lastMouseTimestamp;
|
|
1129
|
-
if (deltaMs > 0) {
|
|
1130
|
-
this.lastMouseMoveMomentumX = movementX / deltaMs;
|
|
1131
|
-
this.lastMouseMoveMomentumY = movementY / deltaMs;
|
|
1132
|
-
this.lastMouseTimestamp = e.timeStamp;
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
onMouseEnd(e) {
|
|
1136
|
-
window.removeEventListener("mousemove", this.onMouseMoveBound);
|
|
1137
|
-
window.removeEventListener("mouseup", this.onMouseEndBound);
|
|
1138
|
-
this.onEnd(e);
|
|
1139
|
-
if (this.experimentalInertia) {
|
|
1140
|
-
new Inertia(this.lastMouseTimestamp, this.lastMouseMoveMomentumX, this.lastMouseMoveMomentumY, this.onMoveBound);
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
onTouchStart(e) {
|
|
1144
|
-
if (this.currentTouchID === null) {
|
|
1145
|
-
if (e.touches[0].clientX === 0 && e.touches[0].clientY === 0) {
|
|
1146
|
-
return;
|
|
1147
|
-
}
|
|
1148
|
-
this.currentTouchID = e.changedTouches[0].identifier;
|
|
1149
|
-
this.lastTouchClientX = e.touches[0].clientX;
|
|
1150
|
-
this.lastTouchClientY = e.touches[0].clientY;
|
|
1151
|
-
window.addEventListener("touchmove", this.onTouchMoveBound);
|
|
1152
|
-
window.addEventListener("touchend", this.onTouchEndBound);
|
|
1153
|
-
window.addEventListener("touchcancel", this.onTouchEndBound);
|
|
1154
|
-
this.onStart(e);
|
|
1155
|
-
this.lastTouchTimestamp = e.timeStamp;
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
onTouchMove(e) {
|
|
1159
|
-
for (let i = 0; i < e.changedTouches.length; i++) {
|
|
1160
|
-
const touch = e.changedTouches[i];
|
|
1161
|
-
if (touch.identifier === this.currentTouchID) {
|
|
1162
|
-
const minDim = Math.min(this.canvas.offsetWidth, this.canvas.offsetHeight);
|
|
1163
|
-
const movementX = this.temperMovement((touch.clientX - this.lastTouchClientX) / minDim);
|
|
1164
|
-
const movementY = this.temperMovement((touch.clientY - this.lastTouchClientY) / minDim * VERTICAL_MOVEMENT_BASE_SCALE);
|
|
1165
|
-
this.onMove(movementX, movementY);
|
|
1166
|
-
this.lastTouchClientX = touch.clientX;
|
|
1167
|
-
this.lastTouchClientY = touch.clientY;
|
|
1168
|
-
const deltaMs = e.timeStamp - this.lastTouchTimestamp;
|
|
1169
|
-
if (deltaMs > 0) {
|
|
1170
|
-
this.lastTouchMoveMomentumX = movementX / deltaMs;
|
|
1171
|
-
this.lastTouchMoveMomentumY = movementY / deltaMs;
|
|
1172
|
-
this.lastTouchTimestamp = e.timeStamp;
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
}
|
|
1177
|
-
onTouchEnd(e) {
|
|
1178
|
-
for (let i = 0; i < e.changedTouches.length; i++) {
|
|
1179
|
-
const touch = e.changedTouches[i];
|
|
1180
|
-
if (touch.identifier === this.currentTouchID) {
|
|
1181
|
-
this.currentTouchID = null;
|
|
1182
|
-
window.removeEventListener("touchmove", this.onTouchMoveBound);
|
|
1183
|
-
window.removeEventListener("touchend", this.onTouchEndBound);
|
|
1184
|
-
window.removeEventListener("touchcancel", this.onTouchEndBound);
|
|
1185
|
-
this.onEnd(e);
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
if (this.experimentalInertia) {
|
|
1189
|
-
new Inertia(this.lastTouchTimestamp, this.lastTouchMoveMomentumX, this.lastTouchMoveMomentumY, this.onMoveBound);
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
onStart(e) {
|
|
1193
|
-
e.preventDefault();
|
|
1221
|
+
onMove(e) {
|
|
1222
|
+
var _a;
|
|
1223
|
+
(_a = e.detail).attachedInfo ?? (_a.attachedInfo = {});
|
|
1224
|
+
const { temperedX, temperedY } = this.onMovement(e.detail.movementX, e.detail.movementY);
|
|
1225
|
+
const attachedInfo = e.detail.attachedInfo;
|
|
1226
|
+
attachedInfo.lastTemperedX = temperedX * 10;
|
|
1227
|
+
attachedInfo.lastTemperedY = temperedY * 10;
|
|
1228
|
+
attachedInfo.timestamp = e.timeStamp;
|
|
1194
1229
|
}
|
|
1195
|
-
|
|
1230
|
+
onMovement(movementX, movementY) {
|
|
1196
1231
|
const scale = this.mirror ? -1 : 1;
|
|
1232
|
+
const minDim = Math.min(this.canvas.offsetWidth, this.canvas.offsetHeight);
|
|
1233
|
+
const temperedX = this.temperMovement(movementX / minDim);
|
|
1234
|
+
const temperedY = this.temperMovement(movementY / minDim * VERTICAL_MOVEMENT_BASE_SCALE);
|
|
1197
1235
|
this.model.orbitCoordinatesRequestProp.set((async () => {
|
|
1198
1236
|
const prevCoords = await this.model.orbitCoordinatesProp.get();
|
|
1199
1237
|
const newCoords = {
|
|
1200
|
-
latitude: prevCoords.latitude + 2 *
|
|
1201
|
-
longitude: prevCoords.longitude - 2 *
|
|
1238
|
+
latitude: prevCoords.latitude + 2 * temperedY * DEGREES_PER_RADIAN * scale,
|
|
1239
|
+
longitude: prevCoords.longitude - 2 * temperedX * DEGREES_PER_RADIAN
|
|
1202
1240
|
};
|
|
1203
1241
|
return newCoords;
|
|
1204
1242
|
})());
|
|
1243
|
+
return { temperedX, temperedY };
|
|
1205
1244
|
}
|
|
1206
|
-
|
|
1245
|
+
onUp(e) {
|
|
1207
1246
|
e.preventDefault();
|
|
1247
|
+
if ("lastTemperedX" in e.detail.attachedInfo && "lastTemperedY" in e.detail.attachedInfo && "timestamp" in e.detail.attachedInfo && e.timeStamp - e.detail.attachedInfo.timestamp < 60) {
|
|
1248
|
+
new Inertia(e.timeStamp, e.detail.attachedInfo.lastTemperedX, e.detail.attachedInfo.lastTemperedY, this.onMovementBound);
|
|
1249
|
+
}
|
|
1208
1250
|
}
|
|
1209
1251
|
};
|
|
1210
1252
|
|
|
1211
1253
|
// src/cubing/twisty/views/3D/Twisty3DVantage.ts
|
|
1212
1254
|
var SHOW_STATS = false;
|
|
1255
|
+
function debugShowRenderStats(enable) {
|
|
1256
|
+
SHOW_STATS = enable;
|
|
1257
|
+
}
|
|
1213
1258
|
async function setCameraFromOrbitCoordinates(camera, orbitCoordinates, backView = false) {
|
|
1214
1259
|
const spherical = new (await THREEJS).Spherical(orbitCoordinates.distance, (90 - (backView ? -1 : 1) * orbitCoordinates.latitude) / DEGREES_PER_RADIAN, ((backView ? 180 : 0) + orbitCoordinates.longitude) / DEGREES_PER_RADIAN);
|
|
1215
1260
|
spherical.makeSafe();
|
|
@@ -1217,27 +1262,34 @@ async function setCameraFromOrbitCoordinates(camera, orbitCoordinates, backView
|
|
|
1217
1262
|
camera.lookAt(0, 0, 0);
|
|
1218
1263
|
}
|
|
1219
1264
|
var shareAllNewRenderers = null;
|
|
1220
|
-
function
|
|
1265
|
+
function experimentalForceNewRendererSharing(share) {
|
|
1221
1266
|
shareAllNewRenderers = share;
|
|
1222
1267
|
}
|
|
1223
|
-
var
|
|
1268
|
+
var dedicatedRenderersSoFar = 0;
|
|
1269
|
+
var DEFAULT_MAX_DEDICATED_RENDERERS = 2;
|
|
1224
1270
|
function shareRenderer() {
|
|
1225
1271
|
if (shareAllNewRenderers !== null) {
|
|
1272
|
+
if (!shareAllNewRenderers) {
|
|
1273
|
+
dedicatedRenderersSoFar++;
|
|
1274
|
+
}
|
|
1226
1275
|
return shareAllNewRenderers;
|
|
1227
1276
|
}
|
|
1228
|
-
if (
|
|
1229
|
-
|
|
1277
|
+
if (dedicatedRenderersSoFar < DEFAULT_MAX_DEDICATED_RENDERERS) {
|
|
1278
|
+
dedicatedRenderersSoFar++;
|
|
1230
1279
|
return false;
|
|
1280
|
+
} else {
|
|
1281
|
+
return true;
|
|
1231
1282
|
}
|
|
1232
|
-
return true;
|
|
1233
1283
|
}
|
|
1234
|
-
var _onResizeStaleDropper, _width, _height, _onResize, onResize_fn, _cachedRenderer, _cachedCanvas, _cachedCamera, _cachedOrbitControls,
|
|
1284
|
+
var _setupBasicPresses, setupBasicPresses_fn, _onResizeStaleDropper, _width, _height, _onResize, onResize_fn, _cachedRenderer, _cachedCanvas, _cachedDragTracker, _dragTracker, dragTracker_fn, _cachedCamera, _cachedOrbitControls, _disconnectionFunctions, _scheduler;
|
|
1235
1285
|
var Twisty3DVantage = class extends ManagedCustomElement {
|
|
1236
1286
|
constructor(model, scene, options) {
|
|
1237
1287
|
super();
|
|
1238
1288
|
this.model = model;
|
|
1239
1289
|
this.options = options;
|
|
1290
|
+
__privateAdd(this, _setupBasicPresses);
|
|
1240
1291
|
__privateAdd(this, _onResize);
|
|
1292
|
+
__privateAdd(this, _dragTracker);
|
|
1241
1293
|
this.scene = null;
|
|
1242
1294
|
this.stats = null;
|
|
1243
1295
|
this.rendererIsShared = shareRenderer();
|
|
@@ -1246,9 +1298,10 @@ var Twisty3DVantage = class extends ManagedCustomElement {
|
|
|
1246
1298
|
__privateAdd(this, _height, 0);
|
|
1247
1299
|
__privateAdd(this, _cachedRenderer, null);
|
|
1248
1300
|
__privateAdd(this, _cachedCanvas, null);
|
|
1301
|
+
__privateAdd(this, _cachedDragTracker, null);
|
|
1249
1302
|
__privateAdd(this, _cachedCamera, null);
|
|
1250
1303
|
__privateAdd(this, _cachedOrbitControls, null);
|
|
1251
|
-
__privateAdd(this,
|
|
1304
|
+
__privateAdd(this, _disconnectionFunctions, []);
|
|
1252
1305
|
__privateAdd(this, _scheduler, new RenderScheduler(this.render.bind(this)));
|
|
1253
1306
|
this.scene = scene ?? null;
|
|
1254
1307
|
if (SHOW_STATS) {
|
|
@@ -1258,27 +1311,42 @@ var Twisty3DVantage = class extends ManagedCustomElement {
|
|
|
1258
1311
|
}
|
|
1259
1312
|
}
|
|
1260
1313
|
async connectedCallback() {
|
|
1261
|
-
this.addCSS(
|
|
1262
|
-
this.addElement(await this.
|
|
1314
|
+
this.addCSS(twisty3DVantageCSS);
|
|
1315
|
+
this.addElement((await this.canvasInfo()).canvas);
|
|
1263
1316
|
__privateMethod(this, _onResize, onResize_fn).call(this);
|
|
1264
1317
|
const observer = new ResizeObserver(__privateMethod(this, _onResize, onResize_fn).bind(this));
|
|
1265
1318
|
observer.observe(this.contentWrapper);
|
|
1266
1319
|
this.orbitControls();
|
|
1320
|
+
__privateMethod(this, _setupBasicPresses, setupBasicPresses_fn).call(this);
|
|
1267
1321
|
this.scheduleRender();
|
|
1268
1322
|
}
|
|
1323
|
+
async clearCanvas() {
|
|
1324
|
+
if (this.rendererIsShared) {
|
|
1325
|
+
const canvasInfo = await this.canvasInfo();
|
|
1326
|
+
canvasInfo.context.clearRect(0, 0, canvasInfo.canvas.width, canvasInfo.canvas.height);
|
|
1327
|
+
} else {
|
|
1328
|
+
const renderer = await this.renderer();
|
|
1329
|
+
const context = renderer.getContext();
|
|
1330
|
+
context.clear(context.COLOR_BUFFER_BIT);
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1269
1333
|
async renderer() {
|
|
1270
1334
|
if (this.rendererIsShared) {
|
|
1271
1335
|
throw new Error("renderer expected to be shared.");
|
|
1272
1336
|
}
|
|
1273
1337
|
return __privateGet(this, _cachedRenderer) ?? __privateSet(this, _cachedRenderer, newRenderer());
|
|
1274
1338
|
}
|
|
1275
|
-
async
|
|
1339
|
+
async canvasInfo() {
|
|
1276
1340
|
return __privateGet(this, _cachedCanvas) ?? __privateSet(this, _cachedCanvas, (async () => {
|
|
1341
|
+
let canvas;
|
|
1277
1342
|
if (this.rendererIsShared) {
|
|
1278
|
-
|
|
1343
|
+
canvas = this.addElement(document.createElement("canvas"));
|
|
1344
|
+
} else {
|
|
1345
|
+
const renderer = await this.renderer();
|
|
1346
|
+
canvas = this.addElement(renderer.domElement);
|
|
1279
1347
|
}
|
|
1280
|
-
const
|
|
1281
|
-
return
|
|
1348
|
+
const context = canvas.getContext("2d");
|
|
1349
|
+
return { canvas, context };
|
|
1282
1350
|
})());
|
|
1283
1351
|
}
|
|
1284
1352
|
async camera() {
|
|
@@ -1291,7 +1359,7 @@ var Twisty3DVantage = class extends ManagedCustomElement {
|
|
|
1291
1359
|
}
|
|
1292
1360
|
async orbitControls() {
|
|
1293
1361
|
return __privateGet(this, _cachedOrbitControls) ?? __privateSet(this, _cachedOrbitControls, (async () => {
|
|
1294
|
-
const orbitControls = new
|
|
1362
|
+
const orbitControls = new TwistyOrbitControls(this.model, !!this.options?.backView, (await this.canvasInfo()).canvas, await __privateMethod(this, _dragTracker, dragTracker_fn).call(this));
|
|
1295
1363
|
if (this.model) {
|
|
1296
1364
|
this.addListener(this.model.orbitCoordinatesProp, async (orbitCoordinates) => {
|
|
1297
1365
|
const camera = await this.camera();
|
|
@@ -1304,15 +1372,15 @@ var Twisty3DVantage = class extends ManagedCustomElement {
|
|
|
1304
1372
|
}
|
|
1305
1373
|
addListener(prop, listener) {
|
|
1306
1374
|
prop.addFreshListener(listener);
|
|
1307
|
-
__privateGet(this,
|
|
1375
|
+
__privateGet(this, _disconnectionFunctions).push(() => {
|
|
1308
1376
|
prop.removeFreshListener(listener);
|
|
1309
1377
|
});
|
|
1310
1378
|
}
|
|
1311
1379
|
disconnect() {
|
|
1312
|
-
for (const fn of __privateGet(this,
|
|
1380
|
+
for (const fn of __privateGet(this, _disconnectionFunctions)) {
|
|
1313
1381
|
fn();
|
|
1314
1382
|
}
|
|
1315
|
-
__privateSet(this,
|
|
1383
|
+
__privateSet(this, _disconnectionFunctions, []);
|
|
1316
1384
|
}
|
|
1317
1385
|
async render() {
|
|
1318
1386
|
if (!this.scene) {
|
|
@@ -1322,10 +1390,10 @@ var Twisty3DVantage = class extends ManagedCustomElement {
|
|
|
1322
1390
|
const [scene, camera, canvas] = await Promise.all([
|
|
1323
1391
|
this.scene.scene(),
|
|
1324
1392
|
this.camera(),
|
|
1325
|
-
this.
|
|
1393
|
+
this.canvasInfo()
|
|
1326
1394
|
]);
|
|
1327
1395
|
if (this.rendererIsShared) {
|
|
1328
|
-
renderPooled(__privateGet(this, _width), __privateGet(this, _height), canvas, scene, camera);
|
|
1396
|
+
renderPooled(__privateGet(this, _width), __privateGet(this, _height), canvas.canvas, scene, camera);
|
|
1329
1397
|
} else {
|
|
1330
1398
|
(await this.renderer()).render(scene, camera);
|
|
1331
1399
|
}
|
|
@@ -1335,6 +1403,22 @@ var Twisty3DVantage = class extends ManagedCustomElement {
|
|
|
1335
1403
|
__privateGet(this, _scheduler).requestAnimFrame();
|
|
1336
1404
|
}
|
|
1337
1405
|
};
|
|
1406
|
+
_setupBasicPresses = new WeakSet();
|
|
1407
|
+
setupBasicPresses_fn = async function() {
|
|
1408
|
+
const dragTracker = await __privateMethod(this, _dragTracker, dragTracker_fn).call(this);
|
|
1409
|
+
dragTracker.addEventListener("press", async (e) => {
|
|
1410
|
+
const movePressInput = await this.model.movePressInputProp.get();
|
|
1411
|
+
if (movePressInput !== "basic") {
|
|
1412
|
+
return;
|
|
1413
|
+
}
|
|
1414
|
+
this.dispatchEvent(new CustomEvent("press", {
|
|
1415
|
+
detail: {
|
|
1416
|
+
pressInfo: e.detail,
|
|
1417
|
+
cameraPromise: this.camera()
|
|
1418
|
+
}
|
|
1419
|
+
}));
|
|
1420
|
+
});
|
|
1421
|
+
};
|
|
1338
1422
|
_onResizeStaleDropper = new WeakMap();
|
|
1339
1423
|
_width = new WeakMap();
|
|
1340
1424
|
_height = new WeakMap();
|
|
@@ -1355,24 +1439,33 @@ onResize_fn = async function() {
|
|
|
1355
1439
|
camera.aspect = w / h;
|
|
1356
1440
|
camera.setViewOffset(w, h - excess, off, yoff, w, h);
|
|
1357
1441
|
camera.updateProjectionMatrix();
|
|
1442
|
+
this.clearCanvas();
|
|
1358
1443
|
if (this.rendererIsShared) {
|
|
1359
|
-
const
|
|
1360
|
-
canvas.width = w * pixelRatio();
|
|
1361
|
-
canvas.height = h * pixelRatio();
|
|
1362
|
-
canvas.style.width = w.toString();
|
|
1363
|
-
canvas.style.height = w.toString();
|
|
1444
|
+
const canvasInfo = await this.canvasInfo();
|
|
1445
|
+
canvasInfo.canvas.width = w * pixelRatio();
|
|
1446
|
+
canvasInfo.canvas.height = h * pixelRatio();
|
|
1447
|
+
canvasInfo.canvas.style.width = w.toString();
|
|
1448
|
+
canvasInfo.canvas.style.height = w.toString();
|
|
1364
1449
|
} else {
|
|
1365
|
-
|
|
1450
|
+
const renderer = await this.renderer();
|
|
1451
|
+
renderer.setSize(w, h, true);
|
|
1366
1452
|
}
|
|
1367
1453
|
this.scheduleRender();
|
|
1368
1454
|
};
|
|
1369
1455
|
_cachedRenderer = new WeakMap();
|
|
1370
1456
|
_cachedCanvas = new WeakMap();
|
|
1457
|
+
_cachedDragTracker = new WeakMap();
|
|
1458
|
+
_dragTracker = new WeakSet();
|
|
1459
|
+
dragTracker_fn = async function() {
|
|
1460
|
+
return __privateGet(this, _cachedDragTracker) ?? __privateSet(this, _cachedDragTracker, (async () => {
|
|
1461
|
+
return new DragTracker((await this.canvasInfo()).canvas);
|
|
1462
|
+
})());
|
|
1463
|
+
};
|
|
1371
1464
|
_cachedCamera = new WeakMap();
|
|
1372
1465
|
_cachedOrbitControls = new WeakMap();
|
|
1373
|
-
|
|
1466
|
+
_disconnectionFunctions = new WeakMap();
|
|
1374
1467
|
_scheduler = new WeakMap();
|
|
1375
|
-
customElementsShim.define("twisty-3d-vantage
|
|
1468
|
+
customElementsShim.define("twisty-3d-vantage", Twisty3DVantage);
|
|
1376
1469
|
|
|
1377
1470
|
// src/cubing/twisty/views/3D/Twisty3DSceneWrapper.ts
|
|
1378
1471
|
var _backViewClassListManager, _freshListenerManager5, _backViewVantage, _cachedScene2, _vantages, _currentTwisty3DPuzzleWrapper, _twisty3DStaleDropper;
|
|
@@ -1428,10 +1521,32 @@ var Twisty3DSceneWrapper = class extends ManagedCustomElement {
|
|
|
1428
1521
|
onBackView(backView) {
|
|
1429
1522
|
this.setBackView(backView);
|
|
1430
1523
|
}
|
|
1524
|
+
async onPress(e) {
|
|
1525
|
+
const twisty3DPuzzleWrapper = __privateGet(this, _currentTwisty3DPuzzleWrapper);
|
|
1526
|
+
if (!twisty3DPuzzleWrapper) {
|
|
1527
|
+
console.info("no wrapper; skipping scene wrapper press!");
|
|
1528
|
+
return;
|
|
1529
|
+
}
|
|
1530
|
+
const raycasterPromise = (async () => {
|
|
1531
|
+
const [camera, three] = await Promise.all([
|
|
1532
|
+
e.detail.cameraPromise,
|
|
1533
|
+
THREEJS
|
|
1534
|
+
]);
|
|
1535
|
+
const raycaster = new three.Raycaster();
|
|
1536
|
+
const mouse = new Vector2(e.detail.pressInfo.normalizedX, e.detail.pressInfo.normalizedY);
|
|
1537
|
+
raycaster.setFromCamera(mouse, camera);
|
|
1538
|
+
return raycaster;
|
|
1539
|
+
})();
|
|
1540
|
+
twisty3DPuzzleWrapper.raycastMove(raycasterPromise, {
|
|
1541
|
+
invert: !e.detail.pressInfo.rightClick,
|
|
1542
|
+
depth: e.detail.pressInfo.keys.ctrlOrMetaKey ? "rotation" : e.detail.pressInfo.keys.shiftKey ? "secondSlice" : "none"
|
|
1543
|
+
});
|
|
1544
|
+
}
|
|
1431
1545
|
async scene() {
|
|
1432
1546
|
return __privateGet(this, _cachedScene2) ?? __privateSet(this, _cachedScene2, (async () => new (await THREEJS).Scene())());
|
|
1433
1547
|
}
|
|
1434
1548
|
addVantage(vantage) {
|
|
1549
|
+
vantage.addEventListener("press", this.onPress.bind(this));
|
|
1435
1550
|
__privateGet(this, _vantages).add(vantage);
|
|
1436
1551
|
this.contentWrapper.appendChild(vantage);
|
|
1437
1552
|
}
|
|
@@ -1476,7 +1591,7 @@ _currentTwisty3DPuzzleWrapper = new WeakMap();
|
|
|
1476
1591
|
_twisty3DStaleDropper = new WeakMap();
|
|
1477
1592
|
customElementsShim.define("twisty-3d-scene-wrapper", Twisty3DSceneWrapper);
|
|
1478
1593
|
|
|
1479
|
-
// src/cubing/twisty/
|
|
1594
|
+
// src/cubing/twisty/views/control-panel/TwistyButtonsV2.css.ts
|
|
1480
1595
|
var buttonGridCSS = new CSSSource(`
|
|
1481
1596
|
:host {
|
|
1482
1597
|
width: 384px;
|
|
@@ -1794,7 +1909,7 @@ var TwistyButtonV2 = class extends ManagedCustomElement {
|
|
|
1794
1909
|
_iconManager = new WeakMap();
|
|
1795
1910
|
customElementsShim.define("twisty-button-v2", TwistyButtonV2);
|
|
1796
1911
|
|
|
1797
|
-
// src/cubing/twisty/
|
|
1912
|
+
// src/cubing/twisty/views/control-panel/TwistyScrubber.css.ts
|
|
1798
1913
|
var twistyScrubberCSS = new CSSSource(`
|
|
1799
1914
|
:host {
|
|
1800
1915
|
width: 384px;
|
|
@@ -2059,21 +2174,12 @@ var BackgroundProp = class extends SimpleTwistyPropSource {
|
|
|
2059
2174
|
};
|
|
2060
2175
|
|
|
2061
2176
|
// src/cubing/twisty/model/props/viewer/BackViewProp.ts
|
|
2062
|
-
var
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
};
|
|
2067
|
-
|
|
2068
|
-
// src/cubing/twisty/model/props/viewer/ControlPanelProp.ts
|
|
2069
|
-
var ControlPanelProp = class extends SimpleTwistyPropSource {
|
|
2070
|
-
getDefaultValue() {
|
|
2071
|
-
return "auto";
|
|
2072
|
-
}
|
|
2177
|
+
var backViewLayouts = {
|
|
2178
|
+
"none": true,
|
|
2179
|
+
"side-by-side": true,
|
|
2180
|
+
"top-right": true
|
|
2073
2181
|
};
|
|
2074
|
-
|
|
2075
|
-
// src/cubing/twisty/model/props/puzzle/display/HintFaceletProp.ts
|
|
2076
|
-
var HintFaceletProp = class extends SimpleTwistyPropSource {
|
|
2182
|
+
var BackViewProp = class extends SimpleTwistyPropSource {
|
|
2077
2183
|
getDefaultValue() {
|
|
2078
2184
|
return "auto";
|
|
2079
2185
|
}
|
|
@@ -2186,13 +2292,6 @@ var SetupAnchorProp = class extends SimpleTwistyPropSource {
|
|
|
2186
2292
|
}
|
|
2187
2293
|
};
|
|
2188
2294
|
|
|
2189
|
-
// src/cubing/twisty/model/props/puzzle/display/StickeringProp.ts
|
|
2190
|
-
var StickeringProp = class extends SimpleTwistyPropSource {
|
|
2191
|
-
getDefaultValue() {
|
|
2192
|
-
return "full";
|
|
2193
|
-
}
|
|
2194
|
-
};
|
|
2195
|
-
|
|
2196
2295
|
// src/cubing/twisty/model/props/timeline/TempoScaleProp.ts
|
|
2197
2296
|
var TempoScaleProp = class extends TwistyPropSource {
|
|
2198
2297
|
getDefaultValue() {
|
|
@@ -2280,6 +2379,53 @@ var OrbitCoordinatesProp = class extends TwistyPropDerived {
|
|
|
2280
2379
|
}
|
|
2281
2380
|
}
|
|
2282
2381
|
};
|
|
2382
|
+
var centeredCameraOrbitCoordinates = {
|
|
2383
|
+
latitude: 31.717474411461005,
|
|
2384
|
+
longitude: 0,
|
|
2385
|
+
distance: 5.877852522924731
|
|
2386
|
+
};
|
|
2387
|
+
var cubeCube3DCameraOrbitCoordinates = {
|
|
2388
|
+
latitude: 35,
|
|
2389
|
+
longitude: 30,
|
|
2390
|
+
distance: 6
|
|
2391
|
+
};
|
|
2392
|
+
var cubePG3DCameraOrbitCoordinates = {
|
|
2393
|
+
latitude: 35,
|
|
2394
|
+
longitude: 30,
|
|
2395
|
+
distance: 6.25
|
|
2396
|
+
};
|
|
2397
|
+
var megaminxCameraOrbitCoordinates = {
|
|
2398
|
+
latitude: Math.atan(1 / 2) * DEGREES_PER_RADIAN,
|
|
2399
|
+
longitude: 0,
|
|
2400
|
+
distance: 6.7
|
|
2401
|
+
};
|
|
2402
|
+
var pyraminxCameraOrbitCoordinates = {
|
|
2403
|
+
latitude: 26.56505117707799,
|
|
2404
|
+
longitude: 0,
|
|
2405
|
+
distance: 6
|
|
2406
|
+
};
|
|
2407
|
+
function defaultCameraOrbitCoordinates(puzzleID, strategy) {
|
|
2408
|
+
if (puzzleID[1] === "x") {
|
|
2409
|
+
if (strategy === "Cube3D") {
|
|
2410
|
+
return cubeCube3DCameraOrbitCoordinates;
|
|
2411
|
+
} else {
|
|
2412
|
+
return cubePG3DCameraOrbitCoordinates;
|
|
2413
|
+
}
|
|
2414
|
+
} else {
|
|
2415
|
+
switch (puzzleID) {
|
|
2416
|
+
case "megaminx":
|
|
2417
|
+
case "gigaminx":
|
|
2418
|
+
return megaminxCameraOrbitCoordinates;
|
|
2419
|
+
case "pyraminx":
|
|
2420
|
+
case "master_tetraminx":
|
|
2421
|
+
return pyraminxCameraOrbitCoordinates;
|
|
2422
|
+
case "skewb":
|
|
2423
|
+
return cubePG3DCameraOrbitCoordinates;
|
|
2424
|
+
default:
|
|
2425
|
+
return centeredCameraOrbitCoordinates;
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
}
|
|
2283
2429
|
|
|
2284
2430
|
// src/cubing/twisty/model/props/puzzle/structure/PuzzleIDProp.ts
|
|
2285
2431
|
var PuzzleIDProp = class extends TwistyPropDerived {
|
|
@@ -2342,7 +2488,7 @@ var VisualizationStrategyProp = class extends TwistyPropDerived {
|
|
|
2342
2488
|
}
|
|
2343
2489
|
};
|
|
2344
2490
|
|
|
2345
|
-
// src/cubing/twisty/
|
|
2491
|
+
// src/cubing/twisty/controllers/indexer/AlgDuration.ts
|
|
2346
2492
|
function defaultDurationForAmount(amount) {
|
|
2347
2493
|
switch (Math.abs(amount)) {
|
|
2348
2494
|
case 0:
|
|
@@ -2390,7 +2536,7 @@ var AlgDuration = class extends TraversalUp {
|
|
|
2390
2536
|
}
|
|
2391
2537
|
};
|
|
2392
2538
|
|
|
2393
|
-
// src/cubing/twisty/
|
|
2539
|
+
// src/cubing/twisty/controllers/indexer/SimpleAlgIndexer.ts
|
|
2394
2540
|
var SimpleAlgIndexer = class {
|
|
2395
2541
|
constructor(puzzle, alg) {
|
|
2396
2542
|
this.puzzle = puzzle;
|
|
@@ -2436,7 +2582,7 @@ var SimpleAlgIndexer = class {
|
|
|
2436
2582
|
}
|
|
2437
2583
|
};
|
|
2438
2584
|
|
|
2439
|
-
// src/cubing/twisty/
|
|
2585
|
+
// src/cubing/twisty/controllers/indexer/simultaneous-moves/simul-moves.ts
|
|
2440
2586
|
var axisLookup = {
|
|
2441
2587
|
u: "y",
|
|
2442
2588
|
l: "x",
|
|
@@ -2566,7 +2712,7 @@ function simulMoves(a) {
|
|
|
2566
2712
|
return l;
|
|
2567
2713
|
}
|
|
2568
2714
|
|
|
2569
|
-
// src/cubing/twisty/
|
|
2715
|
+
// src/cubing/twisty/controllers/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.ts
|
|
2570
2716
|
var demos = {
|
|
2571
2717
|
"y' y' U' E D R2 r2 F2 B2 U E D' R2 L2' z2 S2 U U D D S2 F2' B2": [
|
|
2572
2718
|
{ animLeaf: new Move("y", -1), start: 0, end: 1e3 },
|
|
@@ -2757,7 +2903,7 @@ var SimultaneousMoveIndexerV2 = class {
|
|
|
2757
2903
|
}
|
|
2758
2904
|
};
|
|
2759
2905
|
|
|
2760
|
-
// src/cubing/twisty/
|
|
2906
|
+
// src/cubing/twisty/controllers/indexer/tree/chunkAlgs.ts
|
|
2761
2907
|
var MIN_CHUNKING_THRESHOLD = 16;
|
|
2762
2908
|
function chunkifyAlg(alg, chunkMaxLength) {
|
|
2763
2909
|
const mainAlgBuilder = new AlgBuilder();
|
|
@@ -2805,7 +2951,7 @@ var ChunkAlgs = class extends TraversalUp {
|
|
|
2805
2951
|
var chunkAlgsInstance = new ChunkAlgs();
|
|
2806
2952
|
var chunkAlgs = chunkAlgsInstance.traverseAlg.bind(chunkAlgsInstance);
|
|
2807
2953
|
|
|
2808
|
-
// src/cubing/twisty/
|
|
2954
|
+
// src/cubing/twisty/controllers/indexer/tree/AlgWalker.ts
|
|
2809
2955
|
var AlgPartDecoration = class {
|
|
2810
2956
|
constructor(_puz, moveCount, duration, forward, backward, children = []) {
|
|
2811
2957
|
this.moveCount = moveCount;
|
|
@@ -3042,7 +3188,7 @@ var AlgWalker = class extends TraversalDownUp {
|
|
|
3042
3188
|
}
|
|
3043
3189
|
};
|
|
3044
3190
|
|
|
3045
|
-
// src/cubing/twisty/
|
|
3191
|
+
// src/cubing/twisty/controllers/indexer/tree/TreeAlgIndexer.ts
|
|
3046
3192
|
var TreeAlgIndexer = class {
|
|
3047
3193
|
constructor(puzzle, alg) {
|
|
3048
3194
|
this.puzzle = puzzle;
|
|
@@ -3437,6 +3583,30 @@ var CatchUpMoveProp = class extends SimpleTwistyPropSource {
|
|
|
3437
3583
|
}
|
|
3438
3584
|
};
|
|
3439
3585
|
|
|
3586
|
+
// src/cubing/twisty/model/props/puzzle/state/NaiveMoveCountProp.ts
|
|
3587
|
+
var NaiveMoveCountProp = class extends TwistyPropDerived {
|
|
3588
|
+
derive(inputs) {
|
|
3589
|
+
if (inputs.alg.issues.errors.length > 0) {
|
|
3590
|
+
return null;
|
|
3591
|
+
}
|
|
3592
|
+
return countMoves(inputs.alg.alg);
|
|
3593
|
+
}
|
|
3594
|
+
};
|
|
3595
|
+
|
|
3596
|
+
// src/cubing/twisty/model/props/puzzle/state/MovePressInputProp.ts
|
|
3597
|
+
var MovePressInputProp = class extends SimpleTwistyPropSource {
|
|
3598
|
+
getDefaultValue() {
|
|
3599
|
+
return "auto";
|
|
3600
|
+
}
|
|
3601
|
+
};
|
|
3602
|
+
|
|
3603
|
+
// src/cubing/twisty/model/props/puzzle/display/FoundationDisplayProp.ts
|
|
3604
|
+
var FoundationDisplayProp = class extends SimpleTwistyPropSource {
|
|
3605
|
+
getDefaultValue() {
|
|
3606
|
+
return "auto";
|
|
3607
|
+
}
|
|
3608
|
+
};
|
|
3609
|
+
|
|
3440
3610
|
// src/cubing/twisty/model/TwistyPlayerModel.ts
|
|
3441
3611
|
var TwistyPlayerModel = class {
|
|
3442
3612
|
constructor() {
|
|
@@ -3446,11 +3616,13 @@ var TwistyPlayerModel = class {
|
|
|
3446
3616
|
this.backViewProp = new BackViewProp();
|
|
3447
3617
|
this.controlPanelProp = new ControlPanelProp();
|
|
3448
3618
|
this.catchUpMoveProp = new CatchUpMoveProp();
|
|
3619
|
+
this.foundationDisplayProp = new FoundationDisplayProp();
|
|
3449
3620
|
this.foundationStickerSpriteURL = new URLProp();
|
|
3450
3621
|
this.hintFaceletProp = new HintFaceletProp();
|
|
3451
3622
|
this.hintStickerSpriteURL = new URLProp();
|
|
3452
3623
|
this.indexerConstructorRequestProp = new IndexerConstructorRequestProp();
|
|
3453
3624
|
this.latitudeLimitProp = new LatitudeLimitProp();
|
|
3625
|
+
this.movePressInputProp = new MovePressInputProp();
|
|
3454
3626
|
this.orbitCoordinatesRequestProp = new OrbitCoordinatesRequestProp();
|
|
3455
3627
|
this.playingInfoProp = new PlayingInfoProp();
|
|
3456
3628
|
this.puzzleDescriptionRequestProp = new PGPuzzleDescriptionStringProp();
|
|
@@ -3492,6 +3664,7 @@ var TwistyPlayerModel = class {
|
|
|
3492
3664
|
visualizationStrategy: this.visualizationStrategyProp,
|
|
3493
3665
|
indexerConstructorRequest: this.indexerConstructorRequestProp
|
|
3494
3666
|
});
|
|
3667
|
+
this.moveCountProp = new NaiveMoveCountProp({ alg: this.puzzleAlgProp });
|
|
3495
3668
|
this.orbitCoordinatesProp = new OrbitCoordinatesProp({
|
|
3496
3669
|
orbitCoordinatesRequest: this.orbitCoordinatesRequestProp,
|
|
3497
3670
|
latitudeLimit: this.latitudeLimitProp,
|
|
@@ -3550,11 +3723,12 @@ var TwistyPlayerModel = class {
|
|
|
3550
3723
|
}
|
|
3551
3724
|
async twizzleLink() {
|
|
3552
3725
|
const url = new URL("https://alpha.twizzle.net/edit/");
|
|
3553
|
-
const [puzzle, alg, setup, anchor] = await Promise.all([
|
|
3726
|
+
const [puzzle, alg, setup, anchor, experimentalStickering] = await Promise.all([
|
|
3554
3727
|
this.puzzleIDProp.get(),
|
|
3555
3728
|
this.algProp.get(),
|
|
3556
3729
|
this.setupProp.get(),
|
|
3557
|
-
this.setupAnchorProp.get()
|
|
3730
|
+
this.setupAnchorProp.get(),
|
|
3731
|
+
this.stickeringProp.get()
|
|
3558
3732
|
]);
|
|
3559
3733
|
if (!alg.alg.experimentalIsEmpty()) {
|
|
3560
3734
|
url.searchParams.set("alg", alg.alg.toString());
|
|
@@ -3565,11 +3739,30 @@ var TwistyPlayerModel = class {
|
|
|
3565
3739
|
if (anchor !== "start") {
|
|
3566
3740
|
url.searchParams.set("setup-anchor", anchor);
|
|
3567
3741
|
}
|
|
3742
|
+
if (experimentalStickering !== "full") {
|
|
3743
|
+
url.searchParams.set("experimental-stickering", experimentalStickering);
|
|
3744
|
+
}
|
|
3568
3745
|
if (puzzle !== "3x3x3") {
|
|
3569
3746
|
url.searchParams.set("puzzle", puzzle);
|
|
3570
3747
|
}
|
|
3571
3748
|
return url.toString();
|
|
3572
3749
|
}
|
|
3750
|
+
experimentalAddMove(flexibleMove, options = {}) {
|
|
3751
|
+
const move = typeof flexibleMove === "string" ? new Move(flexibleMove) : flexibleMove;
|
|
3752
|
+
(async () => {
|
|
3753
|
+
const alg = (await this.algProp.get()).alg;
|
|
3754
|
+
const newAlg = experimentalAppendMove(alg, move, {
|
|
3755
|
+
coalesce: options?.coalesce,
|
|
3756
|
+
mod: options?.mod
|
|
3757
|
+
});
|
|
3758
|
+
this.algProp.set(newAlg);
|
|
3759
|
+
this.timestampRequestProp.set("end");
|
|
3760
|
+
this.catchUpMoveProp.set({
|
|
3761
|
+
move,
|
|
3762
|
+
amount: 0
|
|
3763
|
+
});
|
|
3764
|
+
})();
|
|
3765
|
+
}
|
|
3573
3766
|
};
|
|
3574
3767
|
|
|
3575
3768
|
// src/cubing/twisty/views/TwistyPlayerSettable.ts
|
|
@@ -3646,13 +3839,13 @@ var TwistyPlayerSettable = class extends ManagedCustomElement {
|
|
|
3646
3839
|
this.experimentalModel.controlPanelProp.set(newControlPanel);
|
|
3647
3840
|
}
|
|
3648
3841
|
get controlPanel() {
|
|
3649
|
-
throw
|
|
3842
|
+
throw err("controlPanel");
|
|
3650
3843
|
}
|
|
3651
3844
|
set visualization(visualizationFormat) {
|
|
3652
3845
|
this.experimentalModel.visualizationFormatProp.set(visualizationFormat);
|
|
3653
3846
|
}
|
|
3654
3847
|
get visualization() {
|
|
3655
|
-
throw
|
|
3848
|
+
throw err("visualization");
|
|
3656
3849
|
}
|
|
3657
3850
|
set viewerLink(viewerLinkPage) {
|
|
3658
3851
|
this.experimentalModel.viewerLinkProp.set(viewerLinkPage);
|
|
@@ -3660,29 +3853,35 @@ var TwistyPlayerSettable = class extends ManagedCustomElement {
|
|
|
3660
3853
|
get viewerLink() {
|
|
3661
3854
|
throw err("viewerLink");
|
|
3662
3855
|
}
|
|
3856
|
+
set experimentalMovePressInput(movePressInput) {
|
|
3857
|
+
this.experimentalModel.movePressInputProp.set(movePressInput);
|
|
3858
|
+
}
|
|
3859
|
+
get experimentalMovePressInput() {
|
|
3860
|
+
throw err("experimentalMovePressInput");
|
|
3861
|
+
}
|
|
3663
3862
|
set cameraLatitude(latitude) {
|
|
3664
3863
|
this.experimentalModel.orbitCoordinatesRequestProp.set({ latitude });
|
|
3665
3864
|
}
|
|
3666
3865
|
get cameraLatitude() {
|
|
3667
|
-
throw
|
|
3866
|
+
throw err("cameraLatitude");
|
|
3668
3867
|
}
|
|
3669
3868
|
set cameraLongitude(longitude) {
|
|
3670
3869
|
this.experimentalModel.orbitCoordinatesRequestProp.set({ longitude });
|
|
3671
3870
|
}
|
|
3672
3871
|
get cameraLongitude() {
|
|
3673
|
-
throw
|
|
3872
|
+
throw err("cameraLongitude");
|
|
3674
3873
|
}
|
|
3675
3874
|
set cameraDistance(distance) {
|
|
3676
3875
|
this.experimentalModel.orbitCoordinatesRequestProp.set({ distance });
|
|
3677
3876
|
}
|
|
3678
3877
|
get cameraDistance() {
|
|
3679
|
-
throw
|
|
3878
|
+
throw err("cameraDistance");
|
|
3680
3879
|
}
|
|
3681
3880
|
set cameraLatitudeLimit(latitudeLimit) {
|
|
3682
3881
|
this.experimentalModel.latitudeLimitProp.set(latitudeLimit);
|
|
3683
3882
|
}
|
|
3684
3883
|
get cameraLatitudeLimit() {
|
|
3685
|
-
throw
|
|
3884
|
+
throw err("cameraLatitudeLimit");
|
|
3686
3885
|
}
|
|
3687
3886
|
set indexer(indexer) {
|
|
3688
3887
|
this.experimentalModel.indexerConstructorRequestProp.set(indexer);
|
|
@@ -3741,6 +3940,7 @@ var twistyPlayerAttributeMap = {
|
|
|
3741
3940
|
"control-panel": "controlPanel",
|
|
3742
3941
|
"back-view": "backView",
|
|
3743
3942
|
"viewer-link": "viewerLink",
|
|
3943
|
+
"experimental-move-press-input": "experimentalMovePressInput",
|
|
3744
3944
|
"camera-latitude": "cameraLatitude",
|
|
3745
3945
|
"camera-longitude": "cameraLongitude",
|
|
3746
3946
|
"camera-distance": "cameraDistance",
|
|
@@ -3813,7 +4013,7 @@ var TwistyPlayer = class extends TwistyPlayerSettable {
|
|
|
3813
4013
|
if (wrapper instanceof Twisty3DSceneWrapper) {
|
|
3814
4014
|
const vantages = wrapper.experimentalVantages();
|
|
3815
4015
|
for (const vantage of vantages) {
|
|
3816
|
-
canvases.push(await vantage.
|
|
4016
|
+
canvases.push((await vantage.canvasInfo()).canvas);
|
|
3817
4017
|
}
|
|
3818
4018
|
}
|
|
3819
4019
|
return canvases;
|
|
@@ -3842,19 +4042,7 @@ var TwistyPlayer = class extends TwistyPlayerSettable {
|
|
|
3842
4042
|
this.controller.togglePlay(play);
|
|
3843
4043
|
}
|
|
3844
4044
|
experimentalAddMove(flexibleMove, options = {}) {
|
|
3845
|
-
|
|
3846
|
-
(async () => {
|
|
3847
|
-
const alg = (await this.experimentalModel.algProp.get()).alg;
|
|
3848
|
-
const newAlg = experimentalAppendMove(alg, move, {
|
|
3849
|
-
coalesce: options?.coalesce
|
|
3850
|
-
});
|
|
3851
|
-
this.experimentalModel.algProp.set(newAlg);
|
|
3852
|
-
this.experimentalModel.timestampRequestProp.set("end");
|
|
3853
|
-
this.experimentalModel.catchUpMoveProp.set({
|
|
3854
|
-
move,
|
|
3855
|
-
amount: 0
|
|
3856
|
-
});
|
|
3857
|
-
})();
|
|
4045
|
+
this.experimentalModel.experimentalAddMove(flexibleMove, options);
|
|
3858
4046
|
}
|
|
3859
4047
|
static get observedAttributes() {
|
|
3860
4048
|
return Object.keys(twistyPlayerAttributeMap);
|
|
@@ -4510,6 +4698,7 @@ var TwistyAlgEditor = class extends ManagedCustomElement {
|
|
|
4510
4698
|
]));
|
|
4511
4699
|
__privateAdd(this, _twistyPlayer, null);
|
|
4512
4700
|
__privateAdd(this, _twistyPlayerProp, void 0);
|
|
4701
|
+
this.debugNeverRequestTimestamp = false;
|
|
4513
4702
|
__privateAdd(this, _onInputHasFired, false);
|
|
4514
4703
|
__privateAdd(this, _highlightedLeaf, null);
|
|
4515
4704
|
__privateGet(this, _carbonCopy).classList.add("carbon-copy");
|
|
@@ -4657,7 +4846,9 @@ var TwistyAlgEditor = class extends ManagedCustomElement {
|
|
|
4657
4846
|
console.log("invalid where");
|
|
4658
4847
|
throw new Error("Invalid where!");
|
|
4659
4848
|
}
|
|
4660
|
-
|
|
4849
|
+
if (!this.debugNeverRequestTimestamp) {
|
|
4850
|
+
twistyPlayer.experimentalModel.timestampRequestProp.set(newTimestamp);
|
|
4851
|
+
}
|
|
4661
4852
|
});
|
|
4662
4853
|
twistyPlayer.experimentalModel.currentLeavesSimplifiedProp.addFreshListener(async (currentLeavesSimplified) => {
|
|
4663
4854
|
const indexer = await twistyPlayer.experimentalModel.indexerProp.get();
|
|
@@ -4724,1826 +4915,18 @@ padSuffix_fn = function(s) {
|
|
|
4724
4915
|
};
|
|
4725
4916
|
_highlightedLeaf = new WeakMap();
|
|
4726
4917
|
customElementsShim.define("twisty-alg-editor", TwistyAlgEditor);
|
|
4727
|
-
|
|
4728
|
-
// src/cubing/twisty/old/dom/TwistyPlayer.ts
|
|
4729
|
-
import { Vector3 as Vector32 } from "three";
|
|
4730
|
-
|
|
4731
|
-
// src/cubing/twisty/old/animation/cursor/AlgCursor.ts
|
|
4732
|
-
var AlgCursor = class {
|
|
4733
|
-
constructor(timeline, def, alg, startStateAlg, indexerConstructor) {
|
|
4734
|
-
this.timeline = timeline;
|
|
4735
|
-
this.def = def;
|
|
4736
|
-
this.alg = alg;
|
|
4737
|
-
this.positionListeners = new Set();
|
|
4738
|
-
this.indexerConstructor = TreeAlgIndexer;
|
|
4739
|
-
this.ksolvePuzzle = new KPuzzleWrapper(def);
|
|
4740
|
-
if (indexerConstructor) {
|
|
4741
|
-
this.indexerConstructor = indexerConstructor;
|
|
4742
|
-
}
|
|
4743
|
-
this.instantiateIndexer(alg);
|
|
4744
|
-
this.startState = startStateAlg ? this.algToState(startStateAlg) : this.ksolvePuzzle.startState();
|
|
4745
|
-
timeline.addTimestampListener(this);
|
|
4746
|
-
}
|
|
4747
|
-
setStartState(startState) {
|
|
4748
|
-
this.startState = startState;
|
|
4749
|
-
this.dispatchPositionForTimestamp(this.timeline.timestamp);
|
|
4750
|
-
}
|
|
4751
|
-
experimentalSetIndexer(indexerConstructor) {
|
|
4752
|
-
this.indexerConstructor = indexerConstructor;
|
|
4753
|
-
this.instantiateIndexer(this.alg);
|
|
4754
|
-
this.timeline.onCursorChange(this);
|
|
4755
|
-
this.dispatchPositionForTimestamp(this.timeline.timestamp);
|
|
4756
|
-
}
|
|
4757
|
-
instantiateIndexer(alg) {
|
|
4758
|
-
this.indexer = new this.indexerConstructor(this.ksolvePuzzle, alg);
|
|
4759
|
-
}
|
|
4760
|
-
algToState(s) {
|
|
4761
|
-
const kpuzzle = new KPuzzle(this.def);
|
|
4762
|
-
kpuzzle.applyAlg(s);
|
|
4763
|
-
return this.ksolvePuzzle.combine(this.def.startPieces, kpuzzle.state);
|
|
4764
|
-
}
|
|
4765
|
-
timeRange() {
|
|
4766
|
-
return {
|
|
4767
|
-
start: 0,
|
|
4768
|
-
end: this.indexer.algDuration()
|
|
4769
|
-
};
|
|
4770
|
-
}
|
|
4771
|
-
experimentalTimestampForStartOfLastMove() {
|
|
4772
|
-
const numMoves = this.indexer.numAnimatedLeaves();
|
|
4773
|
-
if (numMoves > 0) {
|
|
4774
|
-
return this.indexer.indexToMoveStartTimestamp(numMoves - 1);
|
|
4775
|
-
}
|
|
4776
|
-
return 0;
|
|
4777
|
-
}
|
|
4778
|
-
addPositionListener(positionListener) {
|
|
4779
|
-
this.positionListeners.add(positionListener);
|
|
4780
|
-
this.dispatchPositionForTimestamp(this.timeline.timestamp, [
|
|
4781
|
-
positionListener
|
|
4782
|
-
]);
|
|
4783
|
-
}
|
|
4784
|
-
removePositionListener(positionListener) {
|
|
4785
|
-
this.positionListeners.delete(positionListener);
|
|
4786
|
-
}
|
|
4787
|
-
onTimelineTimestampChange(timestamp) {
|
|
4788
|
-
this.dispatchPositionForTimestamp(timestamp);
|
|
4789
|
-
}
|
|
4790
|
-
dispatchPositionForTimestamp(timestamp, listeners = this.positionListeners) {
|
|
4791
|
-
let position;
|
|
4792
|
-
if (this.indexer.timestampToPosition) {
|
|
4793
|
-
position = this.indexer.timestampToPosition(timestamp, this.startState);
|
|
4794
|
-
} else {
|
|
4795
|
-
const idx = this.indexer.timestampToIndex(timestamp);
|
|
4796
|
-
const state = this.indexer.stateAtIndex(idx, this.startState);
|
|
4797
|
-
position = {
|
|
4798
|
-
state,
|
|
4799
|
-
movesInProgress: []
|
|
4800
|
-
};
|
|
4801
|
-
if (this.indexer.numAnimatedLeaves() > 0) {
|
|
4802
|
-
const move = this.indexer.getAnimLeaf(idx)?.as(Move);
|
|
4803
|
-
if (!move) {
|
|
4804
|
-
return;
|
|
4805
|
-
}
|
|
4806
|
-
const fraction = (timestamp - this.indexer.indexToMoveStartTimestamp(idx)) / this.indexer.moveDuration(idx);
|
|
4807
|
-
if (fraction === 1) {
|
|
4808
|
-
position.state = this.ksolvePuzzle.combine(state, this.ksolvePuzzle.stateFromMove(move));
|
|
4809
|
-
} else if (fraction > 0) {
|
|
4810
|
-
if (move) {
|
|
4811
|
-
position.movesInProgress.push({
|
|
4812
|
-
move,
|
|
4813
|
-
direction: Direction.Forwards,
|
|
4814
|
-
fraction
|
|
4815
|
-
});
|
|
4816
|
-
}
|
|
4817
|
-
}
|
|
4818
|
-
}
|
|
4819
|
-
}
|
|
4820
|
-
for (const listener of listeners) {
|
|
4821
|
-
listener.onPositionChange(position);
|
|
4822
|
-
}
|
|
4823
|
-
}
|
|
4824
|
-
onTimeRangeChange(_timeRange) {
|
|
4825
|
-
}
|
|
4826
|
-
setAlg(alg, indexerConstructor) {
|
|
4827
|
-
indexerConstructor ?? (indexerConstructor = this.indexerConstructor);
|
|
4828
|
-
if (alg.isIdentical(this.alg) && this.indexerConstructor === indexerConstructor) {
|
|
4829
|
-
return;
|
|
4830
|
-
}
|
|
4831
|
-
this.indexerConstructor = indexerConstructor;
|
|
4832
|
-
this.alg = alg;
|
|
4833
|
-
this.instantiateIndexer(alg);
|
|
4834
|
-
this.timeline.onCursorChange(this);
|
|
4835
|
-
this.dispatchPositionForTimestamp(this.timeline.timestamp);
|
|
4836
|
-
}
|
|
4837
|
-
moveBoundary(timestamp, direction) {
|
|
4838
|
-
if (this.indexer.numAnimatedLeaves() === 0) {
|
|
4839
|
-
return null;
|
|
4840
|
-
}
|
|
4841
|
-
const offsetHack = directionScalar(direction) * 1e-3;
|
|
4842
|
-
const idx = this.indexer.timestampToIndex(timestamp + offsetHack);
|
|
4843
|
-
const moveStart = this.indexer.indexToMoveStartTimestamp(idx);
|
|
4844
|
-
if (direction === Direction.Backwards) {
|
|
4845
|
-
return timestamp >= moveStart ? moveStart : null;
|
|
4846
|
-
} else {
|
|
4847
|
-
const moveEnd = moveStart + this.indexer.moveDuration(idx);
|
|
4848
|
-
return timestamp <= moveEnd ? moveEnd : null;
|
|
4849
|
-
}
|
|
4850
|
-
}
|
|
4851
|
-
setPuzzle(def, alg = this.alg, startStateAlg) {
|
|
4852
|
-
this.ksolvePuzzle = new KPuzzleWrapper(def);
|
|
4853
|
-
this.def = def;
|
|
4854
|
-
this.indexer = new this.indexerConstructor(this.ksolvePuzzle, alg);
|
|
4855
|
-
if (alg !== this.alg) {
|
|
4856
|
-
this.timeline.onCursorChange(this);
|
|
4857
|
-
}
|
|
4858
|
-
this.setStartState(startStateAlg ? this.algToState(startStateAlg) : this.ksolvePuzzle.startState());
|
|
4859
|
-
this.alg = alg;
|
|
4860
|
-
}
|
|
4861
|
-
experimentalTimestampFromIndex(index) {
|
|
4862
|
-
return this.indexer.indexToMoveStartTimestamp(index);
|
|
4863
|
-
}
|
|
4864
|
-
experimentalIndexFromTimestamp(timestamp) {
|
|
4865
|
-
return this.indexer.timestampToIndex(timestamp);
|
|
4866
|
-
}
|
|
4867
|
-
experimentalLeafAtIndex(index) {
|
|
4868
|
-
return this.indexer.getAnimLeaf(index);
|
|
4869
|
-
}
|
|
4870
|
-
};
|
|
4871
|
-
|
|
4872
|
-
// src/cubing/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexer.ts
|
|
4873
|
-
var demos2 = {
|
|
4874
|
-
"y' y' U' E D R2 r2 F2 B2 U E D' R2 L2' z2 S2 U U D D S2 F2' B2": [
|
|
4875
|
-
{ animLeaf: new Move("y", -1), start: 0, end: 1e3 },
|
|
4876
|
-
{ animLeaf: new Move("y", -1), start: 1e3, end: 2e3 },
|
|
4877
|
-
{ animLeaf: new Move("U", -1), start: 1e3, end: 1600 },
|
|
4878
|
-
{ animLeaf: new Move("E", 1), start: 1200, end: 1800 },
|
|
4879
|
-
{ animLeaf: new Move("D"), start: 1400, end: 2e3 },
|
|
4880
|
-
{ animLeaf: new Move("R", 2), start: 2e3, end: 3500 },
|
|
4881
|
-
{ animLeaf: new Move("r", 2), start: 2e3, end: 3500 },
|
|
4882
|
-
{ animLeaf: new Move("F", 2), start: 3500, end: 4200 },
|
|
4883
|
-
{ animLeaf: new Move("B", 2), start: 3800, end: 4500 },
|
|
4884
|
-
{ animLeaf: new Move("U", 1), start: 4500, end: 5500 },
|
|
4885
|
-
{ animLeaf: new Move("E", 1), start: 4500, end: 5500 },
|
|
4886
|
-
{ animLeaf: new Move("D", -1), start: 4500, end: 5500 },
|
|
4887
|
-
{ animLeaf: new Move("R", 2), start: 5500, end: 6500 },
|
|
4888
|
-
{ animLeaf: new Move("L", -2), start: 5500, end: 6500 },
|
|
4889
|
-
{ animLeaf: new Move("z", 2), start: 5500, end: 6500 },
|
|
4890
|
-
{ animLeaf: new Move("S", 2), start: 6500, end: 7500 },
|
|
4891
|
-
{ animLeaf: new Move("U"), start: 7500, end: 8e3 },
|
|
4892
|
-
{ animLeaf: new Move("U"), start: 8e3, end: 8500 },
|
|
4893
|
-
{ animLeaf: new Move("D"), start: 7750, end: 8250 },
|
|
4894
|
-
{ animLeaf: new Move("D"), start: 8250, end: 8750 },
|
|
4895
|
-
{ animLeaf: new Move("S", 2), start: 8750, end: 9250 },
|
|
4896
|
-
{ animLeaf: new Move("F", -2), start: 8750, end: 1e4 },
|
|
4897
|
-
{ animLeaf: new Move("B", 2), start: 8750, end: 1e4 }
|
|
4898
|
-
],
|
|
4899
|
-
"M' R' U' D' M R": [
|
|
4900
|
-
{ animLeaf: new Move("M", -1), start: 0, end: 1e3 },
|
|
4901
|
-
{ animLeaf: new Move("R", -1), start: 0, end: 1e3 },
|
|
4902
|
-
{ animLeaf: new Move("U", -1), start: 1e3, end: 2e3 },
|
|
4903
|
-
{ animLeaf: new Move("D", -1), start: 1e3, end: 2e3 },
|
|
4904
|
-
{ animLeaf: new Move("M"), start: 2e3, end: 3e3 },
|
|
4905
|
-
{ animLeaf: new Move("R"), start: 2e3, end: 3e3 }
|
|
4906
|
-
],
|
|
4907
|
-
"U' E' r E r2' E r U E": [
|
|
4908
|
-
{ animLeaf: new Move("U", -1), start: 0, end: 1e3 },
|
|
4909
|
-
{ animLeaf: new Move("E", -1), start: 0, end: 1e3 },
|
|
4910
|
-
{ animLeaf: new Move("r"), start: 1e3, end: 2500 },
|
|
4911
|
-
{ animLeaf: new Move("E"), start: 2500, end: 3500 },
|
|
4912
|
-
{ animLeaf: new Move("r", -2), start: 3500, end: 5e3 },
|
|
4913
|
-
{ animLeaf: new Move("E"), start: 5e3, end: 6e3 },
|
|
4914
|
-
{ animLeaf: new Move("r"), start: 6e3, end: 7e3 },
|
|
4915
|
-
{ animLeaf: new Move("U"), start: 7e3, end: 8e3 },
|
|
4916
|
-
{ animLeaf: new Move("E"), start: 7e3, end: 8e3 }
|
|
4917
|
-
]
|
|
4918
|
-
};
|
|
4919
|
-
var SimultaneousMoveIndexer = class {
|
|
4920
|
-
constructor(puzzle, alg) {
|
|
4921
|
-
this.puzzle = puzzle;
|
|
4922
|
-
this.animLeaves = demos2[alg.toString()] ?? simulMoves(alg);
|
|
4923
|
-
}
|
|
4924
|
-
getAnimLeaf(index) {
|
|
4925
|
-
return this.animLeaves[Math.min(index, this.animLeaves.length - 1)]?.animLeaf ?? null;
|
|
4926
|
-
}
|
|
4927
|
-
getAnimLeafWithRange(index) {
|
|
4928
|
-
return this.animLeaves[Math.min(index, this.animLeaves.length - 1)];
|
|
4929
|
-
}
|
|
4930
|
-
indexToMoveStartTimestamp(index) {
|
|
4931
|
-
let start = 0;
|
|
4932
|
-
if (this.animLeaves.length > 0) {
|
|
4933
|
-
start = this.animLeaves[Math.min(index, this.animLeaves.length - 1)].start;
|
|
4934
|
-
}
|
|
4935
|
-
return start;
|
|
4936
|
-
}
|
|
4937
|
-
timestampToIndex(timestamp) {
|
|
4938
|
-
let i = 0;
|
|
4939
|
-
for (i = 0; i < this.animLeaves.length; i++) {
|
|
4940
|
-
if (this.animLeaves[i].start >= timestamp) {
|
|
4941
|
-
return Math.max(0, i - 1);
|
|
4942
|
-
}
|
|
4943
|
-
}
|
|
4944
|
-
return Math.max(0, i - 1);
|
|
4945
|
-
}
|
|
4946
|
-
timestampToPosition(timestamp, startTransformation) {
|
|
4947
|
-
const position = {
|
|
4948
|
-
state: startTransformation ?? this.puzzle.identity(),
|
|
4949
|
-
movesInProgress: []
|
|
4950
|
-
};
|
|
4951
|
-
for (const leafWithRange of this.animLeaves) {
|
|
4952
|
-
if (leafWithRange.end <= timestamp) {
|
|
4953
|
-
const move = leafWithRange.animLeaf.as(Move);
|
|
4954
|
-
if (move !== null) {
|
|
4955
|
-
position.state = this.puzzle.combine(position.state, this.puzzle.stateFromMove(move));
|
|
4956
|
-
}
|
|
4957
|
-
} else if (leafWithRange.start < timestamp && timestamp < leafWithRange.end) {
|
|
4958
|
-
const move = leafWithRange.animLeaf.as(Move);
|
|
4959
|
-
if (move !== null) {
|
|
4960
|
-
position.movesInProgress.push({
|
|
4961
|
-
move,
|
|
4962
|
-
direction: Direction.Forwards,
|
|
4963
|
-
fraction: (timestamp - leafWithRange.start) / (leafWithRange.end - leafWithRange.start)
|
|
4964
|
-
});
|
|
4965
|
-
}
|
|
4966
|
-
} else if (timestamp < leafWithRange.start) {
|
|
4967
|
-
continue;
|
|
4968
|
-
}
|
|
4969
|
-
}
|
|
4970
|
-
return position;
|
|
4971
|
-
}
|
|
4972
|
-
stateAtIndex(index, startTransformation) {
|
|
4973
|
-
let state = startTransformation ?? this.puzzle.startState();
|
|
4974
|
-
for (let i = 0; i < this.animLeaves.length && i < index; i++) {
|
|
4975
|
-
const leafWithRange = this.animLeaves[i];
|
|
4976
|
-
const move = leafWithRange.animLeaf.as(Move);
|
|
4977
|
-
if (move !== null) {
|
|
4978
|
-
state = this.puzzle.combine(state, this.puzzle.stateFromMove(move));
|
|
4979
|
-
}
|
|
4980
|
-
}
|
|
4981
|
-
return state;
|
|
4982
|
-
}
|
|
4983
|
-
transformAtIndex(index) {
|
|
4984
|
-
let state = this.puzzle.identity();
|
|
4985
|
-
for (const leafWithRange of this.animLeaves.slice(0, index)) {
|
|
4986
|
-
const move = leafWithRange.animLeaf.as(Move);
|
|
4987
|
-
if (move !== null) {
|
|
4988
|
-
state = this.puzzle.combine(state, this.puzzle.stateFromMove(move));
|
|
4989
|
-
}
|
|
4990
|
-
}
|
|
4991
|
-
return state;
|
|
4992
|
-
}
|
|
4993
|
-
algDuration() {
|
|
4994
|
-
let max = 0;
|
|
4995
|
-
for (const leafWithRange of this.animLeaves) {
|
|
4996
|
-
max = Math.max(max, leafWithRange.end);
|
|
4997
|
-
}
|
|
4998
|
-
return max;
|
|
4999
|
-
}
|
|
5000
|
-
numAnimatedLeaves() {
|
|
5001
|
-
return this.animLeaves.length;
|
|
5002
|
-
}
|
|
5003
|
-
moveDuration(index) {
|
|
5004
|
-
const move = this.getAnimLeafWithRange(index);
|
|
5005
|
-
return move.end - move.start;
|
|
5006
|
-
}
|
|
5007
|
-
};
|
|
5008
|
-
|
|
5009
|
-
// src/cubing/twisty/old/animation/Timeline.ts
|
|
5010
|
-
var PAUSE_ON_JUMP = true;
|
|
5011
|
-
var TimelineAction;
|
|
5012
|
-
(function(TimelineAction2) {
|
|
5013
|
-
TimelineAction2["StartingToPlay"] = "StartingToPlay";
|
|
5014
|
-
TimelineAction2["Pausing"] = "Pausing";
|
|
5015
|
-
TimelineAction2["Jumping"] = "Jumping";
|
|
5016
|
-
})(TimelineAction || (TimelineAction = {}));
|
|
5017
|
-
var TimestampLocationType;
|
|
5018
|
-
(function(TimestampLocationType2) {
|
|
5019
|
-
TimestampLocationType2["StartOfTimeline"] = "Start";
|
|
5020
|
-
TimestampLocationType2["EndOfTimeline"] = "End";
|
|
5021
|
-
TimestampLocationType2["StartOfMove"] = "StartOfMove";
|
|
5022
|
-
TimestampLocationType2["EndOfMove"] = "EndOfMove";
|
|
5023
|
-
TimestampLocationType2["MiddleOfMove"] = "MiddleOfMove";
|
|
5024
|
-
TimestampLocationType2["BetweenMoves"] = "BetweenMoves";
|
|
5025
|
-
})(TimestampLocationType || (TimestampLocationType = {}));
|
|
5026
|
-
function getNow() {
|
|
5027
|
-
return Math.round(performance.now());
|
|
5028
|
-
}
|
|
5029
|
-
var Timeline = class {
|
|
5030
|
-
constructor() {
|
|
5031
|
-
this.animating = false;
|
|
5032
|
-
this.tempoScale = 1;
|
|
5033
|
-
this.cursors = new Set();
|
|
5034
|
-
this.timestampListeners = new Set();
|
|
5035
|
-
this.actionListeners = new Set();
|
|
5036
|
-
this.timestamp = 0;
|
|
5037
|
-
this.lastAnimFrameNow = 0;
|
|
5038
|
-
this.direction = Direction.Forwards;
|
|
5039
|
-
this.boundaryType = BoundaryType.EntireTimeline;
|
|
5040
|
-
const animFrame = (_now) => {
|
|
5041
|
-
if (this.animating) {
|
|
5042
|
-
const now = getNow();
|
|
5043
|
-
this.timestamp = this.timestamp + this.tempoScale * directionScalar(this.direction) * (now - this.lastAnimFrameNow);
|
|
5044
|
-
this.lastAnimFrameNow = now;
|
|
5045
|
-
const atOrPastBoundary = this.direction === Direction.Backwards ? this.timestamp <= this.cachedNextBoundary : this.timestamp >= this.cachedNextBoundary;
|
|
5046
|
-
if (atOrPastBoundary) {
|
|
5047
|
-
this.timestamp = this.cachedNextBoundary;
|
|
5048
|
-
if (this.animating) {
|
|
5049
|
-
this.animating = false;
|
|
5050
|
-
this.dispatchAction(TimelineAction.Pausing);
|
|
5051
|
-
}
|
|
5052
|
-
}
|
|
5053
|
-
}
|
|
5054
|
-
if (this.timestamp !== this.lastAnimFrameTimestamp) {
|
|
5055
|
-
this.dispatchTimestamp();
|
|
5056
|
-
this.lastAnimFrameTimestamp = this.timestamp;
|
|
5057
|
-
}
|
|
5058
|
-
if (this.animating) {
|
|
5059
|
-
this.scheduler.requestAnimFrame();
|
|
5060
|
-
}
|
|
5061
|
-
};
|
|
5062
|
-
this.scheduler = new RenderScheduler(animFrame);
|
|
5063
|
-
}
|
|
5064
|
-
addCursor(cursor) {
|
|
5065
|
-
this.cursors.add(cursor);
|
|
5066
|
-
this.dispatchTimeRange();
|
|
5067
|
-
}
|
|
5068
|
-
removeCursor(cursor) {
|
|
5069
|
-
this.cursors.delete(cursor);
|
|
5070
|
-
this.clampTimestampToRange();
|
|
5071
|
-
this.dispatchTimeRange();
|
|
5072
|
-
}
|
|
5073
|
-
clampTimestampToRange() {
|
|
5074
|
-
const timeRange = this.timeRange();
|
|
5075
|
-
if (this.timestamp < timeRange.start) {
|
|
5076
|
-
this.setTimestamp(timeRange.start);
|
|
5077
|
-
}
|
|
5078
|
-
if (this.timestamp > timeRange.end) {
|
|
5079
|
-
this.setTimestamp(timeRange.end);
|
|
5080
|
-
}
|
|
5081
|
-
}
|
|
5082
|
-
onCursorChange(_cursor) {
|
|
5083
|
-
if (this.timestamp > this.maxTimestamp()) {
|
|
5084
|
-
this.timestamp = this.maxTimestamp();
|
|
5085
|
-
}
|
|
5086
|
-
this.dispatchTimeRange();
|
|
5087
|
-
}
|
|
5088
|
-
timeRange() {
|
|
5089
|
-
let start = 0;
|
|
5090
|
-
let end = 0;
|
|
5091
|
-
for (const cursor of this.cursors) {
|
|
5092
|
-
const cursorTimeRange = cursor.timeRange();
|
|
5093
|
-
start = Math.min(start, cursorTimeRange.start);
|
|
5094
|
-
end = Math.max(end, cursorTimeRange.end);
|
|
5095
|
-
}
|
|
5096
|
-
return { start, end };
|
|
5097
|
-
}
|
|
5098
|
-
minTimestamp() {
|
|
5099
|
-
return this.timeRange().start;
|
|
5100
|
-
}
|
|
5101
|
-
maxTimestamp() {
|
|
5102
|
-
return this.timeRange().end;
|
|
5103
|
-
}
|
|
5104
|
-
dispatchTimeRange() {
|
|
5105
|
-
const timeRange = this.timeRange();
|
|
5106
|
-
for (const listener of this.cursors) {
|
|
5107
|
-
listener.onTimeRangeChange(timeRange);
|
|
5108
|
-
}
|
|
5109
|
-
for (const listener of this.timestampListeners) {
|
|
5110
|
-
listener.onTimeRangeChange(timeRange);
|
|
5111
|
-
}
|
|
5112
|
-
}
|
|
5113
|
-
dispatchTimestamp() {
|
|
5114
|
-
for (const listener of this.cursors) {
|
|
5115
|
-
listener.onTimelineTimestampChange(this.timestamp);
|
|
5116
|
-
}
|
|
5117
|
-
for (const listener of this.timestampListeners) {
|
|
5118
|
-
listener.onTimelineTimestampChange(this.timestamp);
|
|
5119
|
-
}
|
|
5120
|
-
}
|
|
5121
|
-
addTimestampListener(timestampListener) {
|
|
5122
|
-
this.timestampListeners.add(timestampListener);
|
|
5123
|
-
}
|
|
5124
|
-
removeTimestampListener(timestampListener) {
|
|
5125
|
-
this.timestampListeners.delete(timestampListener);
|
|
5126
|
-
}
|
|
5127
|
-
addActionListener(actionListener) {
|
|
5128
|
-
this.actionListeners.add(actionListener);
|
|
5129
|
-
}
|
|
5130
|
-
removeActionListener(actionListener) {
|
|
5131
|
-
this.actionListeners.delete(actionListener);
|
|
5132
|
-
}
|
|
5133
|
-
play() {
|
|
5134
|
-
this.experimentalPlay(Direction.Forwards, BoundaryType.EntireTimeline);
|
|
5135
|
-
}
|
|
5136
|
-
experimentalPlay(direction, boundaryType = BoundaryType.EntireTimeline) {
|
|
5137
|
-
this.direction = direction;
|
|
5138
|
-
this.boundaryType = boundaryType;
|
|
5139
|
-
const nextBoundary = this.nextBoundary(this.timestamp, direction, this.boundaryType);
|
|
5140
|
-
if (nextBoundary === null) {
|
|
5141
|
-
return;
|
|
5142
|
-
}
|
|
5143
|
-
this.cachedNextBoundary = nextBoundary;
|
|
5144
|
-
if (!this.animating) {
|
|
5145
|
-
this.animating = true;
|
|
5146
|
-
this.lastAnimFrameNow = getNow();
|
|
5147
|
-
this.dispatchAction(TimelineAction.StartingToPlay);
|
|
5148
|
-
this.scheduler.requestAnimFrame();
|
|
5149
|
-
}
|
|
5150
|
-
}
|
|
5151
|
-
nextBoundary(timestamp, direction, boundaryType = BoundaryType.EntireTimeline) {
|
|
5152
|
-
switch (boundaryType) {
|
|
5153
|
-
case BoundaryType.EntireTimeline: {
|
|
5154
|
-
switch (direction) {
|
|
5155
|
-
case Direction.Backwards:
|
|
5156
|
-
return timestamp <= this.minTimestamp() ? null : this.minTimestamp();
|
|
5157
|
-
case Direction.Forwards:
|
|
5158
|
-
return timestamp >= this.maxTimestamp() ? null : this.maxTimestamp();
|
|
5159
|
-
default:
|
|
5160
|
-
throw new Error("invalid direction");
|
|
5161
|
-
}
|
|
5162
|
-
}
|
|
5163
|
-
case BoundaryType.Move: {
|
|
5164
|
-
let result = null;
|
|
5165
|
-
for (const cursor of this.cursors) {
|
|
5166
|
-
const boundaryTimestamp = cursor.moveBoundary(timestamp, direction);
|
|
5167
|
-
if (boundaryTimestamp !== null) {
|
|
5168
|
-
switch (direction) {
|
|
5169
|
-
case Direction.Backwards: {
|
|
5170
|
-
result = Math.min(result ?? boundaryTimestamp, boundaryTimestamp);
|
|
5171
|
-
break;
|
|
5172
|
-
}
|
|
5173
|
-
case Direction.Forwards: {
|
|
5174
|
-
result = Math.max(result ?? boundaryTimestamp, boundaryTimestamp);
|
|
5175
|
-
break;
|
|
5176
|
-
}
|
|
5177
|
-
default:
|
|
5178
|
-
throw new Error("invalid direction");
|
|
5179
|
-
}
|
|
5180
|
-
}
|
|
5181
|
-
}
|
|
5182
|
-
return result;
|
|
5183
|
-
}
|
|
5184
|
-
default:
|
|
5185
|
-
throw new Error("invalid boundary type");
|
|
5186
|
-
}
|
|
5187
|
-
}
|
|
5188
|
-
pause() {
|
|
5189
|
-
if (this.animating) {
|
|
5190
|
-
this.animating = false;
|
|
5191
|
-
this.dispatchAction(TimelineAction.Pausing);
|
|
5192
|
-
this.scheduler.requestAnimFrame();
|
|
5193
|
-
}
|
|
5194
|
-
}
|
|
5195
|
-
playPause() {
|
|
5196
|
-
if (this.animating) {
|
|
5197
|
-
this.pause();
|
|
5198
|
-
} else {
|
|
5199
|
-
if (this.timestamp >= this.maxTimestamp()) {
|
|
5200
|
-
this.timestamp = 0;
|
|
5201
|
-
}
|
|
5202
|
-
this.experimentalPlay(Direction.Forwards, BoundaryType.EntireTimeline);
|
|
5203
|
-
}
|
|
5204
|
-
}
|
|
5205
|
-
setTimestamp(timestamp) {
|
|
5206
|
-
const oldTimestamp = this.timestamp;
|
|
5207
|
-
this.timestamp = timestamp;
|
|
5208
|
-
this.lastAnimFrameNow = getNow();
|
|
5209
|
-
if (oldTimestamp !== timestamp) {
|
|
5210
|
-
this.dispatchAction(TimelineAction.Jumping);
|
|
5211
|
-
this.scheduler.requestAnimFrame();
|
|
5212
|
-
}
|
|
5213
|
-
if (PAUSE_ON_JUMP) {
|
|
5214
|
-
this.animating = false;
|
|
5215
|
-
this.dispatchAction(TimelineAction.Pausing);
|
|
5216
|
-
}
|
|
5217
|
-
}
|
|
5218
|
-
jumpToStart() {
|
|
5219
|
-
this.setTimestamp(this.minTimestamp());
|
|
5220
|
-
}
|
|
5221
|
-
jumpToEnd() {
|
|
5222
|
-
this.setTimestamp(this.maxTimestamp());
|
|
5223
|
-
}
|
|
5224
|
-
experimentalJumpToLastMove() {
|
|
5225
|
-
let max = 0;
|
|
5226
|
-
for (const cursor of this.cursors) {
|
|
5227
|
-
max = Math.max(max, cursor.experimentalTimestampForStartOfLastMove() ?? 0);
|
|
5228
|
-
}
|
|
5229
|
-
this.setTimestamp(max);
|
|
5230
|
-
}
|
|
5231
|
-
dispatchAction(event) {
|
|
5232
|
-
let locationType = TimestampLocationType.MiddleOfMove;
|
|
5233
|
-
switch (this.timestamp) {
|
|
5234
|
-
case this.minTimestamp():
|
|
5235
|
-
locationType = TimestampLocationType.StartOfTimeline;
|
|
5236
|
-
break;
|
|
5237
|
-
case this.maxTimestamp():
|
|
5238
|
-
locationType = TimestampLocationType.EndOfTimeline;
|
|
5239
|
-
break;
|
|
5240
|
-
}
|
|
5241
|
-
const actionEvent = {
|
|
5242
|
-
action: event,
|
|
5243
|
-
locationType
|
|
5244
|
-
};
|
|
5245
|
-
for (const listener of this.actionListeners) {
|
|
5246
|
-
listener.onTimelineAction(actionEvent);
|
|
5247
|
-
}
|
|
5248
|
-
}
|
|
5249
|
-
};
|
|
5250
|
-
|
|
5251
|
-
// src/cubing/twisty/old/dom/controls/buttons.ts
|
|
5252
|
-
var TwistyControlButton = class extends ManagedCustomElement {
|
|
5253
|
-
constructor(timeline, timelineCommand, options) {
|
|
5254
|
-
super();
|
|
5255
|
-
this.currentIconName = null;
|
|
5256
|
-
this.button = document.createElement("button");
|
|
5257
|
-
this.fullscreenElement = null;
|
|
5258
|
-
this.visitTwizzleLinkCallback = null;
|
|
5259
|
-
this.fullscreenElement = options?.fullscreenElement ?? null;
|
|
5260
|
-
this.visitTwizzleLinkCallback = options?.visitTwizzleLinkCallback ?? null;
|
|
5261
|
-
if (!timeline) {
|
|
5262
|
-
console.warn("Must have timeline!");
|
|
5263
|
-
}
|
|
5264
|
-
this.timeline = timeline;
|
|
5265
|
-
if (!timelineCommand) {
|
|
5266
|
-
console.warn("Must have timelineCommand!");
|
|
5267
|
-
}
|
|
5268
|
-
this.timelineCommand = timelineCommand;
|
|
5269
|
-
this.addCSS(buttonCSS);
|
|
5270
|
-
this.setIcon(this.initialIcon());
|
|
5271
|
-
this.setHoverTitle(this.initialHoverTitle());
|
|
5272
|
-
this.addElement(this.button);
|
|
5273
|
-
this.addEventListener("click", this.onPress.bind(this));
|
|
5274
|
-
switch (this.timelineCommand) {
|
|
5275
|
-
case "fullscreen":
|
|
5276
|
-
if (!document.fullscreenEnabled) {
|
|
5277
|
-
this.button.disabled = true;
|
|
5278
|
-
}
|
|
5279
|
-
break;
|
|
5280
|
-
case "jump-to-start":
|
|
5281
|
-
case "play-step-backwards":
|
|
5282
|
-
this.button.disabled = true;
|
|
5283
|
-
break;
|
|
5284
|
-
}
|
|
5285
|
-
if (this.timeline) {
|
|
5286
|
-
this.timeline.addActionListener(this);
|
|
5287
|
-
switch (this.timelineCommand) {
|
|
5288
|
-
case "play-pause":
|
|
5289
|
-
case "play-step-backwards":
|
|
5290
|
-
case "play-step":
|
|
5291
|
-
this.timeline.addTimestampListener(this);
|
|
5292
|
-
break;
|
|
5293
|
-
}
|
|
5294
|
-
this.autoSetTimelineBasedDisabled();
|
|
5295
|
-
}
|
|
5296
|
-
}
|
|
5297
|
-
autoSetTimelineBasedDisabled() {
|
|
5298
|
-
switch (this.timelineCommand) {
|
|
5299
|
-
case "jump-to-start":
|
|
5300
|
-
case "play-pause":
|
|
5301
|
-
case "play-step-backwards":
|
|
5302
|
-
case "play-step":
|
|
5303
|
-
case "jump-to-end": {
|
|
5304
|
-
const timeRange = this.timeline.timeRange();
|
|
5305
|
-
if (timeRange.start === timeRange.end) {
|
|
5306
|
-
this.button.disabled = true;
|
|
5307
|
-
return;
|
|
5308
|
-
}
|
|
5309
|
-
switch (this.timelineCommand) {
|
|
5310
|
-
case "jump-to-start":
|
|
5311
|
-
case "play-step-backwards":
|
|
5312
|
-
this.button.disabled = this.timeline.timestamp < this.timeline.maxTimestamp();
|
|
5313
|
-
break;
|
|
5314
|
-
case "jump-to-end":
|
|
5315
|
-
case "play-step":
|
|
5316
|
-
this.button.disabled = this.timeline.timestamp > this.timeline.minTimestamp();
|
|
5317
|
-
break;
|
|
5318
|
-
default:
|
|
5319
|
-
this.button.disabled = false;
|
|
5320
|
-
}
|
|
5321
|
-
break;
|
|
5322
|
-
}
|
|
5323
|
-
}
|
|
5324
|
-
}
|
|
5325
|
-
setIcon(buttonIconName) {
|
|
5326
|
-
if (this.currentIconName === buttonIconName) {
|
|
5327
|
-
return;
|
|
5328
|
-
}
|
|
5329
|
-
if (this.currentIconName) {
|
|
5330
|
-
this.button.classList.remove(`svg-${this.currentIconName}`);
|
|
5331
|
-
}
|
|
5332
|
-
this.button.classList.add(`svg-${buttonIconName}`);
|
|
5333
|
-
this.currentIconName = buttonIconName;
|
|
5334
|
-
}
|
|
5335
|
-
initialIcon() {
|
|
5336
|
-
const map = {
|
|
5337
|
-
"jump-to-start": "skip-to-start",
|
|
5338
|
-
"play-pause": "play",
|
|
5339
|
-
"play-step": "step-forward",
|
|
5340
|
-
"play-step-backwards": "step-backward",
|
|
5341
|
-
"jump-to-end": "skip-to-end",
|
|
5342
|
-
"fullscreen": "enter-fullscreen",
|
|
5343
|
-
"twizzle-link": "twizzle-tw"
|
|
5344
|
-
};
|
|
5345
|
-
return map[this.timelineCommand];
|
|
5346
|
-
}
|
|
5347
|
-
initialHoverTitle() {
|
|
5348
|
-
const map = {
|
|
5349
|
-
"jump-to-start": "Restart",
|
|
5350
|
-
"play-pause": "Play",
|
|
5351
|
-
"play-step": "Step forward",
|
|
5352
|
-
"play-step-backwards": "Step backward",
|
|
5353
|
-
"jump-to-end": "Skip to End",
|
|
5354
|
-
"fullscreen": "Enter fullscreen",
|
|
5355
|
-
"twizzle-link": "View at Twizzle"
|
|
5356
|
-
};
|
|
5357
|
-
return map[this.timelineCommand];
|
|
5358
|
-
}
|
|
5359
|
-
setHoverTitle(title) {
|
|
5360
|
-
this.button.title = title;
|
|
5361
|
-
}
|
|
5362
|
-
onPress() {
|
|
5363
|
-
switch (this.timelineCommand) {
|
|
5364
|
-
case "fullscreen":
|
|
5365
|
-
if (document.fullscreenElement === this.fullscreenElement) {
|
|
5366
|
-
document.exitFullscreen();
|
|
5367
|
-
} else {
|
|
5368
|
-
this.setIcon("exit-fullscreen");
|
|
5369
|
-
this.fullscreenElement.requestFullscreen().then(() => {
|
|
5370
|
-
const onFullscreen = () => {
|
|
5371
|
-
if (document.fullscreenElement !== this.fullscreenElement) {
|
|
5372
|
-
this.setIcon("enter-fullscreen");
|
|
5373
|
-
window.removeEventListener("fullscreenchange", onFullscreen);
|
|
5374
|
-
}
|
|
5375
|
-
};
|
|
5376
|
-
window.addEventListener("fullscreenchange", onFullscreen);
|
|
5377
|
-
});
|
|
5378
|
-
}
|
|
5379
|
-
break;
|
|
5380
|
-
case "jump-to-start":
|
|
5381
|
-
this.timeline.setTimestamp(0);
|
|
5382
|
-
break;
|
|
5383
|
-
case "jump-to-end":
|
|
5384
|
-
this.timeline.jumpToEnd();
|
|
5385
|
-
break;
|
|
5386
|
-
case "play-pause":
|
|
5387
|
-
this.timeline.playPause();
|
|
5388
|
-
break;
|
|
5389
|
-
case "play-step":
|
|
5390
|
-
this.timeline.experimentalPlay(Direction.Forwards, BoundaryType.Move);
|
|
5391
|
-
break;
|
|
5392
|
-
case "play-step-backwards":
|
|
5393
|
-
this.timeline.experimentalPlay(Direction.Backwards, BoundaryType.Move);
|
|
5394
|
-
break;
|
|
5395
|
-
case "twizzle-link":
|
|
5396
|
-
if (this.visitTwizzleLinkCallback) {
|
|
5397
|
-
this.visitTwizzleLinkCallback();
|
|
5398
|
-
}
|
|
5399
|
-
break;
|
|
5400
|
-
}
|
|
5401
|
-
}
|
|
5402
|
-
onTimelineAction(actionEvent) {
|
|
5403
|
-
switch (this.timelineCommand) {
|
|
5404
|
-
case "jump-to-start":
|
|
5405
|
-
this.button.disabled = actionEvent.locationType === TimestampLocationType.StartOfTimeline && actionEvent.action !== TimelineAction.StartingToPlay;
|
|
5406
|
-
break;
|
|
5407
|
-
case "jump-to-end":
|
|
5408
|
-
this.button.disabled = actionEvent.locationType === TimestampLocationType.EndOfTimeline && actionEvent.action !== TimelineAction.StartingToPlay;
|
|
5409
|
-
break;
|
|
5410
|
-
case "play-pause":
|
|
5411
|
-
switch (actionEvent.action) {
|
|
5412
|
-
case TimelineAction.Pausing:
|
|
5413
|
-
this.setIcon("play");
|
|
5414
|
-
this.setHoverTitle("Play");
|
|
5415
|
-
break;
|
|
5416
|
-
case TimelineAction.StartingToPlay:
|
|
5417
|
-
this.setIcon("pause");
|
|
5418
|
-
this.setHoverTitle("Pause");
|
|
5419
|
-
break;
|
|
5420
|
-
}
|
|
5421
|
-
break;
|
|
5422
|
-
case "play-step":
|
|
5423
|
-
this.button.disabled = actionEvent.locationType === TimestampLocationType.EndOfTimeline && actionEvent.action !== TimelineAction.StartingToPlay;
|
|
5424
|
-
break;
|
|
5425
|
-
case "play-step-backwards":
|
|
5426
|
-
this.button.disabled = actionEvent.locationType === TimestampLocationType.StartOfTimeline && actionEvent.action !== TimelineAction.StartingToPlay;
|
|
5427
|
-
break;
|
|
5428
|
-
}
|
|
5429
|
-
}
|
|
5430
|
-
onTimelineTimestampChange(_timestamp) {
|
|
5431
|
-
}
|
|
5432
|
-
onTimeRangeChange(_timeRange) {
|
|
5433
|
-
this.autoSetTimelineBasedDisabled();
|
|
5434
|
-
}
|
|
5435
|
-
};
|
|
5436
|
-
customElementsShim.define("twisty-control-button", TwistyControlButton);
|
|
5437
|
-
var _viewerLinkClassListManager;
|
|
5438
|
-
var TwistyControlButtonPanel = class extends ManagedCustomElement {
|
|
5439
|
-
constructor(timeline, options) {
|
|
5440
|
-
super();
|
|
5441
|
-
__privateAdd(this, _viewerLinkClassListManager, new ClassListManager(this, "viewer-link-", ["none", "twizzle"]));
|
|
5442
|
-
this.addCSS(buttonGridCSS);
|
|
5443
|
-
__privateGet(this, _viewerLinkClassListManager).setValue(options?.viewerLink ?? "none");
|
|
5444
|
-
this.addElement(new TwistyControlButton(timeline, "fullscreen", {
|
|
5445
|
-
fullscreenElement: options?.fullscreenElement
|
|
5446
|
-
}));
|
|
5447
|
-
this.addElement(new TwistyControlButton(timeline, "jump-to-start"));
|
|
5448
|
-
this.addElement(new TwistyControlButton(timeline, "play-step-backwards"));
|
|
5449
|
-
this.addElement(new TwistyControlButton(timeline, "play-pause"));
|
|
5450
|
-
this.addElement(new TwistyControlButton(timeline, "play-step"));
|
|
5451
|
-
this.addElement(new TwistyControlButton(timeline, "jump-to-end"));
|
|
5452
|
-
this.addElement(new TwistyControlButton(timeline, "twizzle-link", {
|
|
5453
|
-
visitTwizzleLinkCallback: options?.viewerLinkCallback
|
|
5454
|
-
})).classList.add("twizzle-link-button");
|
|
5455
|
-
}
|
|
5456
|
-
setViewerLink(viewerLink) {
|
|
5457
|
-
__privateGet(this, _viewerLinkClassListManager).setValue(viewerLink);
|
|
5458
|
-
}
|
|
5459
|
-
};
|
|
5460
|
-
_viewerLinkClassListManager = new WeakMap();
|
|
5461
|
-
customElementsShim.define("twisty-control-button-panel", TwistyControlButtonPanel);
|
|
5462
|
-
|
|
5463
|
-
// src/cubing/twisty/old/dom/controls/TwistyScrubber.ts
|
|
5464
|
-
var TwistyScrubber = class extends ManagedCustomElement {
|
|
5465
|
-
constructor(timeline) {
|
|
5466
|
-
super();
|
|
5467
|
-
this.range = document.createElement("input");
|
|
5468
|
-
this.timeline = timeline;
|
|
5469
|
-
this.addCSS(twistyScrubberCSS);
|
|
5470
|
-
this.timeline?.addTimestampListener(this);
|
|
5471
|
-
this.range.type = "range";
|
|
5472
|
-
this.range.step = 1 .toString();
|
|
5473
|
-
this.range.min = this.timeline?.minTimestamp().toString();
|
|
5474
|
-
this.range.max = this.timeline?.maxTimestamp().toString();
|
|
5475
|
-
this.range.value = this.timeline?.timestamp.toString();
|
|
5476
|
-
this.range.addEventListener("input", this.onInput.bind(this));
|
|
5477
|
-
this.addElement(this.range);
|
|
5478
|
-
}
|
|
5479
|
-
onTimelineTimestampChange(timestamp) {
|
|
5480
|
-
this.range.value = timestamp.toString();
|
|
5481
|
-
}
|
|
5482
|
-
onTimeRangeChange(timeRange) {
|
|
5483
|
-
this.range.min = timeRange.start.toString();
|
|
5484
|
-
this.range.max = timeRange.end.toString();
|
|
5485
|
-
}
|
|
5486
|
-
onInput() {
|
|
5487
|
-
this.timeline.setTimestamp(parseInt(this.range.value, 10));
|
|
5488
|
-
}
|
|
5489
|
-
};
|
|
5490
|
-
customElementsShim.define("twisty-scrubber", TwistyScrubber);
|
|
5491
|
-
|
|
5492
|
-
// src/cubing/twisty/old/dom/viewers/Twisty2DSVG.ts
|
|
5493
|
-
var _cachedPosition2;
|
|
5494
|
-
var Twisty2DSVG = class extends ManagedCustomElement {
|
|
5495
|
-
constructor(cursor, def, svgSource, options, puzzleLoader) {
|
|
5496
|
-
super();
|
|
5497
|
-
this.svgSource = svgSource;
|
|
5498
|
-
this.options = options;
|
|
5499
|
-
this.puzzleLoader = puzzleLoader;
|
|
5500
|
-
this.scheduler = new RenderScheduler(this.render.bind(this));
|
|
5501
|
-
__privateAdd(this, _cachedPosition2, null);
|
|
5502
|
-
this.addCSS(twisty2DSVGCSS);
|
|
5503
|
-
this.definition = def;
|
|
5504
|
-
this.resetSVG();
|
|
5505
|
-
cursor?.addPositionListener(this);
|
|
5506
|
-
if (this.options?.experimentalStickering) {
|
|
5507
|
-
this.experimentalSetStickering(this.options.experimentalStickering);
|
|
5508
|
-
}
|
|
5509
|
-
}
|
|
5510
|
-
onPositionChange(position) {
|
|
5511
|
-
if (position.movesInProgress.length > 0) {
|
|
5512
|
-
const move = position.movesInProgress[0].move;
|
|
5513
|
-
const def = this.definition;
|
|
5514
|
-
let partialMove = move;
|
|
5515
|
-
if (position.movesInProgress[0].direction === Direction.Backwards) {
|
|
5516
|
-
partialMove = move.invert();
|
|
5517
|
-
}
|
|
5518
|
-
const newState = combineTransformations(def, position.state, transformationForMove(def, partialMove));
|
|
5519
|
-
this.svg.draw(this.definition, position.state, newState, position.movesInProgress[0].fraction);
|
|
5520
|
-
} else {
|
|
5521
|
-
this.svg.draw(this.definition, position.state);
|
|
5522
|
-
__privateSet(this, _cachedPosition2, position);
|
|
5523
|
-
}
|
|
5524
|
-
}
|
|
5525
|
-
scheduleRender() {
|
|
5526
|
-
this.scheduler.requestAnimFrame();
|
|
5527
|
-
}
|
|
5528
|
-
experimentalSetStickering(stickering) {
|
|
5529
|
-
(async () => {
|
|
5530
|
-
if (!this.puzzleLoader?.appearance) {
|
|
5531
|
-
return;
|
|
5532
|
-
}
|
|
5533
|
-
const appearance = await this.puzzleLoader.appearance(stickering);
|
|
5534
|
-
this.resetSVG(appearance);
|
|
5535
|
-
})();
|
|
5536
|
-
}
|
|
5537
|
-
resetSVG(appearance) {
|
|
5538
|
-
if (this.svg) {
|
|
5539
|
-
this.removeElement(this.svg.element);
|
|
5540
|
-
}
|
|
5541
|
-
if (!this.definition) {
|
|
5542
|
-
return;
|
|
5543
|
-
}
|
|
5544
|
-
this.svg = new KPuzzleSVGWrapper(this.definition, this.svgSource, appearance);
|
|
5545
|
-
this.addElement(this.svg.element);
|
|
5546
|
-
if (__privateGet(this, _cachedPosition2)) {
|
|
5547
|
-
this.onPositionChange(__privateGet(this, _cachedPosition2));
|
|
5548
|
-
}
|
|
5549
|
-
}
|
|
5550
|
-
render() {
|
|
5551
|
-
}
|
|
5552
|
-
};
|
|
5553
|
-
_cachedPosition2 = new WeakMap();
|
|
5554
|
-
customElementsShim.define("twisty-2d-svg", Twisty2DSVG);
|
|
5555
|
-
|
|
5556
|
-
// src/cubing/twisty/old/dom/TwistyPlayer.ts
|
|
5557
|
-
function is3DVisualization(visualizationFormat) {
|
|
5558
|
-
return ["3D", "PG3D"].includes(visualizationFormat);
|
|
5559
|
-
}
|
|
5560
|
-
var indexerMap = {
|
|
5561
|
-
simple: SimpleAlgIndexer,
|
|
5562
|
-
tree: TreeAlgIndexer,
|
|
5563
|
-
simultaneous: SimultaneousMoveIndexer
|
|
5564
|
-
};
|
|
5565
|
-
var _config, _connected, _legacyExperimentalPG3DViewConfig, _experimentalStartStateOverride, _hackyPendingFinalMoveCoalesce, _viewerWrapper, _controlsClassListManager, _experimentalInvalidInitialAlgCallback, _initialized, _setCursorStartState, setCursorStartState_fn, _cursorStartAlg, cursorStartAlg_fn, _orbitControls, orbitControls_fn, _backOrbitControls, backOrbitControls_fn, _lookAt, lookAt_fn, _cursorIndexerName, _indexerConstructor, indexerConstructor_fn, _pendingPuzzleUpdates, _renderMode, _clearRenderMode, clearRenderMode_fn, _setRenderMode2D, setRenderMode2D_fn, _setTwisty2DSVG, setTwisty2DSVG_fn, _setRenderMode3D, setRenderMode3D_fn, _setTwisty3D, setTwisty3D_fn, _setCursor, setCursor_fn, _getPG3DAppearance, getPG3DAppearance_fn, _createBackViewer, createBackViewer_fn, _removeBackViewerElem, removeBackViewerElem_fn, _hackyCoalescePending, hackyCoalescePending_fn;
|
|
5566
|
-
var TwistyPlayerV1 = class extends ManagedCustomElement {
|
|
5567
|
-
constructor(initialConfig = {}, legacyExperimentalPG3DViewConfig = null, experimentalInvalidInitialAlgCallback = () => {
|
|
5568
|
-
}) {
|
|
5569
|
-
super();
|
|
5570
|
-
__privateAdd(this, _setCursorStartState);
|
|
5571
|
-
__privateAdd(this, _cursorStartAlg);
|
|
5572
|
-
__privateAdd(this, _orbitControls);
|
|
5573
|
-
__privateAdd(this, _backOrbitControls);
|
|
5574
|
-
__privateAdd(this, _lookAt);
|
|
5575
|
-
__privateAdd(this, _indexerConstructor);
|
|
5576
|
-
__privateAdd(this, _clearRenderMode);
|
|
5577
|
-
__privateAdd(this, _setRenderMode2D);
|
|
5578
|
-
__privateAdd(this, _setTwisty2DSVG);
|
|
5579
|
-
__privateAdd(this, _setRenderMode3D);
|
|
5580
|
-
__privateAdd(this, _setTwisty3D);
|
|
5581
|
-
__privateAdd(this, _setCursor);
|
|
5582
|
-
__privateAdd(this, _getPG3DAppearance);
|
|
5583
|
-
__privateAdd(this, _createBackViewer);
|
|
5584
|
-
__privateAdd(this, _removeBackViewerElem);
|
|
5585
|
-
__privateAdd(this, _hackyCoalescePending);
|
|
5586
|
-
__privateAdd(this, _config, void 0);
|
|
5587
|
-
this.scene = null;
|
|
5588
|
-
this.twisty3D = null;
|
|
5589
|
-
__privateAdd(this, _connected, false);
|
|
5590
|
-
__privateAdd(this, _legacyExperimentalPG3DViewConfig, null);
|
|
5591
|
-
this.legacyExperimentalPG3D = null;
|
|
5592
|
-
__privateAdd(this, _experimentalStartStateOverride, null);
|
|
5593
|
-
this.viewerElems = [];
|
|
5594
|
-
this.controlElems = [];
|
|
5595
|
-
__privateAdd(this, _hackyPendingFinalMoveCoalesce, false);
|
|
5596
|
-
__privateAdd(this, _viewerWrapper, void 0);
|
|
5597
|
-
this.legacyExperimentalCoalesceModFunc = (_move) => 0;
|
|
5598
|
-
__privateAdd(this, _controlsClassListManager, new ClassListManager(this, "controls-", ["none", "bottom-row"]));
|
|
5599
|
-
__privateAdd(this, _experimentalInvalidInitialAlgCallback, void 0);
|
|
5600
|
-
__privateAdd(this, _initialized, false);
|
|
5601
|
-
__privateAdd(this, _cursorIndexerName, "tree");
|
|
5602
|
-
__privateAdd(this, _pendingPuzzleUpdates, []);
|
|
5603
|
-
__privateAdd(this, _renderMode, null);
|
|
5604
|
-
this.addCSS(twistyPlayerCSS);
|
|
5605
|
-
__privateSet(this, _config, new TwistyPlayerConfig(this, initialConfig));
|
|
5606
|
-
__privateSet(this, _experimentalInvalidInitialAlgCallback, experimentalInvalidInitialAlgCallback);
|
|
5607
|
-
this.timeline = new Timeline();
|
|
5608
|
-
this.timeline.addActionListener(this);
|
|
5609
|
-
this.contentWrapper.classList.add("checkered");
|
|
5610
|
-
__privateSet(this, _legacyExperimentalPG3DViewConfig, legacyExperimentalPG3DViewConfig);
|
|
5611
|
-
}
|
|
5612
|
-
set alg(newAlg) {
|
|
5613
|
-
if (typeof newAlg === "string") {
|
|
5614
|
-
newAlg = Alg.fromString(newAlg);
|
|
5615
|
-
}
|
|
5616
|
-
__privateGet(this, _config).attributes["alg"].setValue(newAlg);
|
|
5617
|
-
this.cursor?.setAlg(newAlg, __privateMethod(this, _indexerConstructor, indexerConstructor_fn).call(this));
|
|
5618
|
-
__privateMethod(this, _setCursorStartState, setCursorStartState_fn).call(this);
|
|
5619
|
-
this.dispatchEvent(new CustomEvent("experimental-alg-update", { detail: { alg: this.alg } }));
|
|
5620
|
-
}
|
|
5621
|
-
get alg() {
|
|
5622
|
-
return __privateGet(this, _config).attributes["alg"].value;
|
|
5623
|
-
}
|
|
5624
|
-
set experimentalSetupAlg(newAlg) {
|
|
5625
|
-
if (typeof newAlg === "string") {
|
|
5626
|
-
console.warn("`experimentalSetupAlg` for a `TwistyPlayer` was set using a string. It should be set using a `Sequence`!");
|
|
5627
|
-
newAlg = new Alg(newAlg);
|
|
5628
|
-
}
|
|
5629
|
-
__privateGet(this, _config).attributes["experimental-setup-alg"].setValue(newAlg);
|
|
5630
|
-
__privateMethod(this, _setCursorStartState, setCursorStartState_fn).call(this);
|
|
5631
|
-
}
|
|
5632
|
-
get experimentalSetupAlg() {
|
|
5633
|
-
return __privateGet(this, _config).attributes["experimental-setup-alg"].value;
|
|
5634
|
-
}
|
|
5635
|
-
set experimentalSetupAnchor(setupToLocation) {
|
|
5636
|
-
__privateGet(this, _config).attributes["experimental-setup-anchor"].setValue(setupToLocation);
|
|
5637
|
-
__privateMethod(this, _setCursorStartState, setCursorStartState_fn).call(this);
|
|
5638
|
-
}
|
|
5639
|
-
get experimentalSetupAnchor() {
|
|
5640
|
-
return __privateGet(this, _config).attributes["experimental-setup-anchor"].value;
|
|
5641
|
-
}
|
|
5642
|
-
set puzzle(puzzle) {
|
|
5643
|
-
if (__privateGet(this, _config).attributes["puzzle"].setValue(puzzle)) {
|
|
5644
|
-
this.updatePuzzleDOM();
|
|
5645
|
-
}
|
|
5646
|
-
}
|
|
5647
|
-
get puzzle() {
|
|
5648
|
-
return __privateGet(this, _config).attributes["puzzle"].value;
|
|
5649
|
-
}
|
|
5650
|
-
set visualization(visualization) {
|
|
5651
|
-
if (__privateGet(this, _config).attributes["visualization"].setValue(visualization)) {
|
|
5652
|
-
this.updatePuzzleDOM();
|
|
5653
|
-
}
|
|
5654
|
-
}
|
|
5655
|
-
get visualization() {
|
|
5656
|
-
return __privateGet(this, _config).attributes["visualization"].value;
|
|
5657
|
-
}
|
|
5658
|
-
set hintFacelets(hintFacelets) {
|
|
5659
|
-
if (__privateGet(this, _config).attributes["hint-facelets"].setValue(hintFacelets)) {
|
|
5660
|
-
if (this.twisty3D instanceof Cube3D) {
|
|
5661
|
-
this.twisty3D.experimentalUpdateOptions({ hintFacelets });
|
|
5662
|
-
}
|
|
5663
|
-
}
|
|
5664
|
-
}
|
|
5665
|
-
get hintFacelets() {
|
|
5666
|
-
return __privateGet(this, _config).attributes["hint-facelets"].value;
|
|
5667
|
-
}
|
|
5668
|
-
set experimentalStickering(experimentalStickering) {
|
|
5669
|
-
if (__privateGet(this, _config).attributes["experimental-stickering"].setValue(experimentalStickering)) {
|
|
5670
|
-
const twisty3D = this.twisty3D;
|
|
5671
|
-
if (twisty3D instanceof Cube3D) {
|
|
5672
|
-
twisty3D.experimentalUpdateOptions({
|
|
5673
|
-
experimentalStickering
|
|
5674
|
-
});
|
|
5675
|
-
}
|
|
5676
|
-
if (twisty3D instanceof PG3D) {
|
|
5677
|
-
(async () => {
|
|
5678
|
-
const appearance = await __privateMethod(this, _getPG3DAppearance, getPG3DAppearance_fn).call(this);
|
|
5679
|
-
twisty3D.experimentalSetAppearance(appearance);
|
|
5680
|
-
})();
|
|
5681
|
-
}
|
|
5682
|
-
if (this.viewerElems[0] instanceof Twisty2DSVG) {
|
|
5683
|
-
this.viewerElems[0].experimentalSetStickering(this.experimentalStickering);
|
|
5684
|
-
}
|
|
5685
|
-
}
|
|
5686
|
-
}
|
|
5687
|
-
get experimentalStickering() {
|
|
5688
|
-
return __privateGet(this, _config).attributes["experimental-stickering"].value;
|
|
5689
|
-
}
|
|
5690
|
-
set background(background) {
|
|
5691
|
-
if (__privateGet(this, _config).attributes["background"].setValue(background)) {
|
|
5692
|
-
this.contentWrapper.classList.toggle("checkered", background === "checkered");
|
|
5693
|
-
}
|
|
5694
|
-
}
|
|
5695
|
-
get background() {
|
|
5696
|
-
return __privateGet(this, _config).attributes["background"].value;
|
|
5697
|
-
}
|
|
5698
|
-
set controlPanel(controlPanel) {
|
|
5699
|
-
__privateGet(this, _config).attributes["control-panel"].setValue(controlPanel);
|
|
5700
|
-
__privateGet(this, _controlsClassListManager).setValue(controlPanel);
|
|
5701
|
-
}
|
|
5702
|
-
get controlPanel() {
|
|
5703
|
-
return __privateGet(this, _config).attributes["control-panel"].value;
|
|
5704
|
-
}
|
|
5705
|
-
set controls(controls) {
|
|
5706
|
-
this.controlPanel = controls;
|
|
5707
|
-
}
|
|
5708
|
-
get controls() {
|
|
5709
|
-
return this.controlPanel;
|
|
5710
|
-
}
|
|
5711
|
-
set backView(backView) {
|
|
5712
|
-
__privateGet(this, _config).attributes["back-view"].setValue(backView);
|
|
5713
|
-
if (backView !== "none" && this.viewerElems.length === 1) {
|
|
5714
|
-
__privateMethod(this, _createBackViewer, createBackViewer_fn).call(this);
|
|
5715
|
-
}
|
|
5716
|
-
if (backView === "none" && this.viewerElems.length > 1) {
|
|
5717
|
-
__privateMethod(this, _removeBackViewerElem, removeBackViewerElem_fn).call(this);
|
|
5718
|
-
}
|
|
5719
|
-
if (__privateGet(this, _viewerWrapper) && __privateGet(this, _viewerWrapper).setBackView(backView)) {
|
|
5720
|
-
for (const viewer of this.viewerElems) {
|
|
5721
|
-
viewer.makeInvisibleUntilRender();
|
|
5722
|
-
}
|
|
5723
|
-
}
|
|
5724
|
-
}
|
|
5725
|
-
get backView() {
|
|
5726
|
-
return __privateGet(this, _config).attributes["back-view"].value;
|
|
5727
|
-
}
|
|
5728
|
-
set experimentalCameraLatitude(latitude) {
|
|
5729
|
-
__privateGet(this, _config).attributes["experimental-camera-latitude"].setValue(latitude);
|
|
5730
|
-
const orbitControls = __privateMethod(this, _orbitControls, orbitControls_fn).call(this);
|
|
5731
|
-
if (orbitControls && latitude !== null) {
|
|
5732
|
-
orbitControls.latitude = latitude;
|
|
5733
|
-
this.viewerElems[0].scheduleRender();
|
|
5734
|
-
this.viewerElems[1]?.scheduleRender();
|
|
5735
|
-
}
|
|
5736
|
-
}
|
|
5737
|
-
get experimentalCameraLatitude() {
|
|
5738
|
-
if (__privateGet(this, _config).attributes["experimental-camera-latitude"].value !== null) {
|
|
5739
|
-
return __privateGet(this, _config).attributes["experimental-camera-latitude"].value;
|
|
5740
|
-
}
|
|
5741
|
-
return __privateMethod(this, _orbitControls, orbitControls_fn).call(this)?.latitude ?? null;
|
|
5742
|
-
}
|
|
5743
|
-
set experimentalCameraLongitude(longitude) {
|
|
5744
|
-
__privateGet(this, _config).attributes["experimental-camera-longitude"].setValue(longitude);
|
|
5745
|
-
const orbitControls = __privateMethod(this, _orbitControls, orbitControls_fn).call(this);
|
|
5746
|
-
if (orbitControls && longitude !== null) {
|
|
5747
|
-
orbitControls.longitude = longitude;
|
|
5748
|
-
this.viewerElems[0].scheduleRender();
|
|
5749
|
-
this.viewerElems[1]?.scheduleRender();
|
|
5750
|
-
}
|
|
5751
|
-
}
|
|
5752
|
-
get experimentalCameraLongitude() {
|
|
5753
|
-
if (__privateGet(this, _config).attributes["experimental-camera-longitude"].value !== null) {
|
|
5754
|
-
return __privateGet(this, _config).attributes["experimental-camera-longitude"].value;
|
|
5755
|
-
}
|
|
5756
|
-
return __privateMethod(this, _orbitControls, orbitControls_fn).call(this)?.longitude ?? null;
|
|
5757
|
-
}
|
|
5758
|
-
set experimentalCameraLatitudeLimits(latitudeLimits) {
|
|
5759
|
-
__privateGet(this, _config).attributes["experimental-camera-latitude-limits"].setValue(latitudeLimits);
|
|
5760
|
-
const orbitControls = __privateMethod(this, _orbitControls, orbitControls_fn).call(this);
|
|
5761
|
-
console.log({ orbitControls });
|
|
5762
|
-
if (orbitControls) {
|
|
5763
|
-
orbitControls.experimentalLatitudeLimits = latitudeLimits;
|
|
5764
|
-
}
|
|
5765
|
-
const backOrbitControls = __privateMethod(this, _backOrbitControls, backOrbitControls_fn).call(this);
|
|
5766
|
-
if (backOrbitControls) {
|
|
5767
|
-
backOrbitControls.experimentalLatitudeLimits = latitudeLimits;
|
|
5768
|
-
}
|
|
5769
|
-
}
|
|
5770
|
-
get experimentalCameraLatitudeLimits() {
|
|
5771
|
-
return __privateGet(this, _config).attributes["experimental-camera-latitude-limits"].value;
|
|
5772
|
-
}
|
|
5773
|
-
set viewerLink(viewerLinkPage) {
|
|
5774
|
-
__privateGet(this, _config).attributes["viewer-link"].setValue(viewerLinkPage);
|
|
5775
|
-
const maybePanel = this.controlElems[1];
|
|
5776
|
-
if (maybePanel?.setViewerLink) {
|
|
5777
|
-
maybePanel.setViewerLink(viewerLinkPage);
|
|
5778
|
-
}
|
|
5779
|
-
}
|
|
5780
|
-
get viewerLink() {
|
|
5781
|
-
return __privateGet(this, _config).attributes["viewer-link"].value;
|
|
5782
|
-
}
|
|
5783
|
-
experimentalSetCameraOrbitCoordinates(coords) {
|
|
5784
|
-
this.experimentalCameraLatitude = coords.latitude;
|
|
5785
|
-
this.experimentalCameraLongitude = coords.longitude;
|
|
5786
|
-
const orbitControls = __privateMethod(this, _orbitControls, orbitControls_fn).call(this);
|
|
5787
|
-
if (orbitControls) {
|
|
5788
|
-
orbitControls.distance = coords.distance;
|
|
5789
|
-
}
|
|
5790
|
-
}
|
|
5791
|
-
experimentalDerivedCameraOrbitCoordinates() {
|
|
5792
|
-
const defaultCoordinatesForPuzzle = defaultCameraOrbitCoordinates(this.puzzle, this.twisty3D instanceof PG3D ? "PG3D" : "Cube3D");
|
|
5793
|
-
return {
|
|
5794
|
-
latitude: this.experimentalCameraLatitude ?? defaultCoordinatesForPuzzle.latitude,
|
|
5795
|
-
longitude: this.experimentalCameraLongitude ?? defaultCoordinatesForPuzzle.longitude,
|
|
5796
|
-
distance: defaultCoordinatesForPuzzle.distance
|
|
5797
|
-
};
|
|
5798
|
-
}
|
|
5799
|
-
static get observedAttributes() {
|
|
5800
|
-
return TwistyPlayerConfig.observedAttributes;
|
|
5801
|
-
}
|
|
5802
|
-
attributeChangedCallback(attributeName, oldValue, newValue) {
|
|
5803
|
-
__privateGet(this, _config).attributeChangedCallback(attributeName, oldValue, newValue);
|
|
5804
|
-
}
|
|
5805
|
-
experimentalSetStartStateOverride(state) {
|
|
5806
|
-
__privateSet(this, _experimentalStartStateOverride, state);
|
|
5807
|
-
__privateMethod(this, _setCursorStartState, setCursorStartState_fn).call(this);
|
|
5808
|
-
}
|
|
5809
|
-
experimentalSetCursorIndexer(cursorName) {
|
|
5810
|
-
if (__privateGet(this, _cursorIndexerName) === cursorName) {
|
|
5811
|
-
return;
|
|
5812
|
-
}
|
|
5813
|
-
__privateSet(this, _cursorIndexerName, cursorName);
|
|
5814
|
-
this.cursor?.experimentalSetIndexer(__privateMethod(this, _indexerConstructor, indexerConstructor_fn).call(this));
|
|
5815
|
-
}
|
|
5816
|
-
connectedCallback() {
|
|
5817
|
-
this.contentWrapper.classList.toggle("checkered", this.background === "checkered");
|
|
5818
|
-
const setBackView = this.backView && is3DVisualization(this.visualization);
|
|
5819
|
-
const backView = setBackView ? this.backView : "none";
|
|
5820
|
-
__privateSet(this, _viewerWrapper, new TwistyViewerWrapper({
|
|
5821
|
-
backView
|
|
5822
|
-
}));
|
|
5823
|
-
this.addElement(__privateGet(this, _viewerWrapper));
|
|
5824
|
-
const scrubber = new TwistyScrubber(this.timeline);
|
|
5825
|
-
const controlButtonGrid = new TwistyControlButtonPanel(this.timeline, {
|
|
5826
|
-
fullscreenElement: this,
|
|
5827
|
-
viewerLinkCallback: this.visitTwizzleLink.bind(this),
|
|
5828
|
-
viewerLink: this.viewerLink
|
|
5829
|
-
});
|
|
5830
|
-
this.controlElems = [scrubber, controlButtonGrid];
|
|
5831
|
-
__privateGet(this, _controlsClassListManager).setValue(this.controlPanel);
|
|
5832
|
-
this.addElement(this.controlElems[0]);
|
|
5833
|
-
this.addElement(this.controlElems[1]);
|
|
5834
|
-
__privateSet(this, _connected, true);
|
|
5835
|
-
this.updatePuzzleDOM(true).then(() => {
|
|
5836
|
-
if (!__privateGet(this, _initialized)) {
|
|
5837
|
-
__privateSet(this, _initialized, true);
|
|
5838
|
-
this.dispatchEvent(new CustomEvent("initialized"));
|
|
5839
|
-
}
|
|
5840
|
-
});
|
|
5841
|
-
}
|
|
5842
|
-
get initialized() {
|
|
5843
|
-
return __privateGet(this, _initialized);
|
|
5844
|
-
}
|
|
5845
|
-
twizzleLink() {
|
|
5846
|
-
const url = new URL("https://alpha.twizzle.net/edit/");
|
|
5847
|
-
if (!this.alg.experimentalIsEmpty()) {
|
|
5848
|
-
url.searchParams.set("alg", this.alg.toString());
|
|
5849
|
-
}
|
|
5850
|
-
if (!this.experimentalSetupAlg.experimentalIsEmpty()) {
|
|
5851
|
-
url.searchParams.set("experimental-setup-alg", this.experimentalSetupAlg.toString());
|
|
5852
|
-
}
|
|
5853
|
-
if (this.experimentalSetupAnchor !== "start") {
|
|
5854
|
-
url.searchParams.set("experimental-setup-anchor", this.experimentalSetupAnchor);
|
|
5855
|
-
}
|
|
5856
|
-
if (this.experimentalStickering !== "full") {
|
|
5857
|
-
url.searchParams.set("experimental-stickering", this.experimentalStickering);
|
|
5858
|
-
}
|
|
5859
|
-
if (this.puzzle !== "3x3x3") {
|
|
5860
|
-
url.searchParams.set("puzzle", this.puzzle);
|
|
5861
|
-
}
|
|
5862
|
-
return url.toString();
|
|
5863
|
-
}
|
|
5864
|
-
visitTwizzleLink() {
|
|
5865
|
-
const a = document.createElement("a");
|
|
5866
|
-
a.href = this.twizzleLink();
|
|
5867
|
-
a.target = "_blank";
|
|
5868
|
-
a.click();
|
|
5869
|
-
}
|
|
5870
|
-
async updatePuzzleDOM(initial = false) {
|
|
5871
|
-
if (!__privateGet(this, _connected)) {
|
|
5872
|
-
return;
|
|
5873
|
-
}
|
|
5874
|
-
let puzzleLoader;
|
|
5875
|
-
if (this.puzzle === "custom") {
|
|
5876
|
-
puzzleLoader = {
|
|
5877
|
-
id: "custom",
|
|
5878
|
-
fullName: "Custom (PG3D)",
|
|
5879
|
-
def: () => Promise.resolve(__privateGet(this, _legacyExperimentalPG3DViewConfig).def),
|
|
5880
|
-
svg: () => {
|
|
5881
|
-
throw "unimplemented";
|
|
5882
|
-
}
|
|
5883
|
-
};
|
|
5884
|
-
} else {
|
|
5885
|
-
puzzleLoader = puzzles[this.puzzle];
|
|
5886
|
-
}
|
|
5887
|
-
for (const pendingPuzzleUpdate2 of __privateGet(this, _pendingPuzzleUpdates)) {
|
|
5888
|
-
pendingPuzzleUpdate2.cancelled = true;
|
|
5889
|
-
}
|
|
5890
|
-
__privateSet(this, _pendingPuzzleUpdates, []);
|
|
5891
|
-
const pendingPuzzleUpdate = { cancelled: false };
|
|
5892
|
-
__privateGet(this, _pendingPuzzleUpdates).push(pendingPuzzleUpdate);
|
|
5893
|
-
const def = await puzzleLoader.def();
|
|
5894
|
-
if (pendingPuzzleUpdate.cancelled) {
|
|
5895
|
-
return;
|
|
5896
|
-
}
|
|
5897
|
-
let cursor;
|
|
5898
|
-
try {
|
|
5899
|
-
cursor = new AlgCursor(this.timeline, def, this.alg, __privateMethod(this, _cursorStartAlg, cursorStartAlg_fn).call(this), __privateMethod(this, _indexerConstructor, indexerConstructor_fn).call(this));
|
|
5900
|
-
__privateMethod(this, _setCursor, setCursor_fn).call(this, cursor);
|
|
5901
|
-
} catch (e) {
|
|
5902
|
-
if (initial) {
|
|
5903
|
-
__privateGet(this, _experimentalInvalidInitialAlgCallback).call(this, this.alg);
|
|
5904
|
-
}
|
|
5905
|
-
cursor = new AlgCursor(this.timeline, def, new Alg(), new Alg(), __privateMethod(this, _indexerConstructor, indexerConstructor_fn).call(this));
|
|
5906
|
-
__privateMethod(this, _setCursor, setCursor_fn).call(this, cursor);
|
|
5907
|
-
}
|
|
5908
|
-
if (initial && this.experimentalSetupAlg.experimentalIsEmpty() && this.experimentalSetupAnchor !== "end") {
|
|
5909
|
-
this.timeline.jumpToEnd();
|
|
5910
|
-
}
|
|
5911
|
-
switch (this.visualization) {
|
|
5912
|
-
case "2D":
|
|
5913
|
-
case "experimental-2D-LL":
|
|
5914
|
-
{
|
|
5915
|
-
const options = {};
|
|
5916
|
-
if (this.experimentalStickering) {
|
|
5917
|
-
options.experimentalStickering = this.experimentalStickering;
|
|
5918
|
-
}
|
|
5919
|
-
__privateMethod(this, _setRenderMode2D, setRenderMode2D_fn).call(this);
|
|
5920
|
-
const svgPromiseFn = this.visualization === "2D" ? puzzleLoader.svg : puzzleLoader.llSVG ?? puzzleLoader.svg;
|
|
5921
|
-
const mainViewer = new Twisty2DSVG(cursor, def, await svgPromiseFn(), options, puzzleLoader);
|
|
5922
|
-
if (!pendingPuzzleUpdate.cancelled) {
|
|
5923
|
-
__privateMethod(this, _setTwisty2DSVG, setTwisty2DSVG_fn).call(this, mainViewer);
|
|
5924
|
-
}
|
|
5925
|
-
}
|
|
5926
|
-
break;
|
|
5927
|
-
case "3D":
|
|
5928
|
-
case "PG3D":
|
|
5929
|
-
{
|
|
5930
|
-
__privateMethod(this, _setRenderMode3D, setRenderMode3D_fn).call(this);
|
|
5931
|
-
const scene = this.scene;
|
|
5932
|
-
let twisty3D;
|
|
5933
|
-
if (this.visualization === "3D" && this.puzzle === "3x3x3") {
|
|
5934
|
-
twisty3D = new Cube3D(def, cursor, scene.scheduleRender.bind(scene), {
|
|
5935
|
-
hintFacelets: this.hintFacelets,
|
|
5936
|
-
experimentalStickering: this.experimentalStickering
|
|
5937
|
-
});
|
|
5938
|
-
} else {
|
|
5939
|
-
let def2;
|
|
5940
|
-
let stickerDat;
|
|
5941
|
-
const pgGetter = puzzleLoader.pg;
|
|
5942
|
-
if (this.puzzle === "custom") {
|
|
5943
|
-
def2 = __privateGet(this, _legacyExperimentalPG3DViewConfig).def;
|
|
5944
|
-
stickerDat = __privateGet(this, _legacyExperimentalPG3DViewConfig).stickerDat;
|
|
5945
|
-
} else if (pgGetter) {
|
|
5946
|
-
const pg = await pgGetter();
|
|
5947
|
-
if (pendingPuzzleUpdate.cancelled) {
|
|
5948
|
-
return;
|
|
5949
|
-
}
|
|
5950
|
-
def2 = pg.writekpuzzle(true);
|
|
5951
|
-
stickerDat = pg.get3d();
|
|
5952
|
-
} else {
|
|
5953
|
-
throw "Unimplemented!";
|
|
5954
|
-
}
|
|
5955
|
-
const options = {};
|
|
5956
|
-
const heightMap = {
|
|
5957
|
-
megaminx: 1.5,
|
|
5958
|
-
pyraminx: 1.75
|
|
5959
|
-
};
|
|
5960
|
-
const hintStickerHeightScale = __privateGet(this, _legacyExperimentalPG3DViewConfig)?.hintStickerHeightScale ?? heightMap[this.puzzle] ?? 1;
|
|
5961
|
-
const pg3d = new PG3D(cursor, scene.scheduleRender.bind(scene), def2, stickerDat, __privateGet(this, _legacyExperimentalPG3DViewConfig)?.showFoundation ?? true, __privateGet(this, _legacyExperimentalPG3DViewConfig)?.hintStickers ?? this.hintFacelets === "floating", hintStickerHeightScale, options);
|
|
5962
|
-
(async () => {
|
|
5963
|
-
const appearance = await __privateMethod(this, _getPG3DAppearance, getPG3DAppearance_fn).call(this);
|
|
5964
|
-
if (appearance) {
|
|
5965
|
-
pg3d.experimentalSetAppearance(appearance);
|
|
5966
|
-
}
|
|
5967
|
-
})();
|
|
5968
|
-
this.legacyExperimentalPG3D = pg3d;
|
|
5969
|
-
twisty3D = pg3d;
|
|
5970
|
-
}
|
|
5971
|
-
__privateMethod(this, _setTwisty3D, setTwisty3D_fn).call(this, twisty3D);
|
|
5972
|
-
}
|
|
5973
|
-
break;
|
|
5974
|
-
}
|
|
5975
|
-
}
|
|
5976
|
-
async setCustomPuzzleGeometry(legacyExperimentalPG3DViewConfig) {
|
|
5977
|
-
this.puzzle = "custom";
|
|
5978
|
-
__privateSet(this, _legacyExperimentalPG3DViewConfig, legacyExperimentalPG3DViewConfig);
|
|
5979
|
-
await this.updatePuzzleDOM();
|
|
5980
|
-
}
|
|
5981
|
-
experimentalAddMove(move, coalesce = false, coalesceDelayed = false) {
|
|
5982
|
-
if (__privateGet(this, _hackyPendingFinalMoveCoalesce)) {
|
|
5983
|
-
__privateMethod(this, _hackyCoalescePending, hackyCoalescePending_fn).call(this);
|
|
5984
|
-
}
|
|
5985
|
-
const oldNumMoves = countMoves(this.alg);
|
|
5986
|
-
const newAlg = experimentalAppendMove(this.alg, move, {
|
|
5987
|
-
coalesce: coalesce && !coalesceDelayed,
|
|
5988
|
-
mod: this.legacyExperimentalCoalesceModFunc(move)
|
|
5989
|
-
});
|
|
5990
|
-
if (coalesce && coalesceDelayed) {
|
|
5991
|
-
__privateSet(this, _hackyPendingFinalMoveCoalesce, true);
|
|
5992
|
-
}
|
|
5993
|
-
this.alg = newAlg;
|
|
5994
|
-
if (oldNumMoves <= countMoves(newAlg)) {
|
|
5995
|
-
this.timeline.experimentalJumpToLastMove();
|
|
5996
|
-
} else {
|
|
5997
|
-
this.timeline.jumpToEnd();
|
|
5998
|
-
}
|
|
5999
|
-
this.timeline.play();
|
|
6000
|
-
}
|
|
6001
|
-
onTimelineAction(actionEvent) {
|
|
6002
|
-
if (actionEvent.action === TimelineAction.Pausing && actionEvent.locationType === TimestampLocationType.EndOfTimeline && __privateGet(this, _hackyPendingFinalMoveCoalesce)) {
|
|
6003
|
-
__privateMethod(this, _hackyCoalescePending, hackyCoalescePending_fn).call(this);
|
|
6004
|
-
this.timeline.jumpToEnd();
|
|
6005
|
-
}
|
|
6006
|
-
}
|
|
6007
|
-
fullscreen() {
|
|
6008
|
-
this.requestFullscreen();
|
|
6009
|
-
}
|
|
6010
|
-
};
|
|
6011
|
-
_config = new WeakMap();
|
|
6012
|
-
_connected = new WeakMap();
|
|
6013
|
-
_legacyExperimentalPG3DViewConfig = new WeakMap();
|
|
6014
|
-
_experimentalStartStateOverride = new WeakMap();
|
|
6015
|
-
_hackyPendingFinalMoveCoalesce = new WeakMap();
|
|
6016
|
-
_viewerWrapper = new WeakMap();
|
|
6017
|
-
_controlsClassListManager = new WeakMap();
|
|
6018
|
-
_experimentalInvalidInitialAlgCallback = new WeakMap();
|
|
6019
|
-
_initialized = new WeakMap();
|
|
6020
|
-
_setCursorStartState = new WeakSet();
|
|
6021
|
-
setCursorStartState_fn = function() {
|
|
6022
|
-
if (this.cursor) {
|
|
6023
|
-
this.cursor.setStartState(__privateGet(this, _experimentalStartStateOverride) ?? this.cursor.algToState(__privateMethod(this, _cursorStartAlg, cursorStartAlg_fn).call(this)));
|
|
6024
|
-
}
|
|
6025
|
-
};
|
|
6026
|
-
_cursorStartAlg = new WeakSet();
|
|
6027
|
-
cursorStartAlg_fn = function() {
|
|
6028
|
-
let startAlg = this.experimentalSetupAlg;
|
|
6029
|
-
if (this.experimentalSetupAnchor === "end") {
|
|
6030
|
-
startAlg = startAlg.concat(this.alg.invert());
|
|
6031
|
-
}
|
|
6032
|
-
return startAlg;
|
|
6033
|
-
};
|
|
6034
|
-
_orbitControls = new WeakSet();
|
|
6035
|
-
orbitControls_fn = function() {
|
|
6036
|
-
if (!["3D", "PG3D"].includes(__privateGet(this, _config).attributes["visualization"].value)) {
|
|
6037
|
-
return null;
|
|
6038
|
-
}
|
|
6039
|
-
return this.viewerElems[0]?.orbitControls ?? null;
|
|
6040
|
-
};
|
|
6041
|
-
_backOrbitControls = new WeakSet();
|
|
6042
|
-
backOrbitControls_fn = function() {
|
|
6043
|
-
if (!["3D", "PG3D"].includes(__privateGet(this, _config).attributes["visualization"].value)) {
|
|
6044
|
-
return null;
|
|
6045
|
-
}
|
|
6046
|
-
return this.viewerElems[1]?.orbitControls ?? null;
|
|
6047
|
-
};
|
|
6048
|
-
_lookAt = new WeakSet();
|
|
6049
|
-
lookAt_fn = function() {
|
|
6050
|
-
switch (this.puzzle) {
|
|
6051
|
-
case "pyraminx":
|
|
6052
|
-
case "master_tetraminx":
|
|
6053
|
-
return pyraminxLookAt;
|
|
6054
|
-
default:
|
|
6055
|
-
return new Vector32(0, 0, 0);
|
|
6056
|
-
}
|
|
6057
|
-
};
|
|
6058
|
-
_cursorIndexerName = new WeakMap();
|
|
6059
|
-
_indexerConstructor = new WeakSet();
|
|
6060
|
-
indexerConstructor_fn = function() {
|
|
6061
|
-
return indexerMap[__privateGet(this, _cursorIndexerName)];
|
|
6062
|
-
};
|
|
6063
|
-
_pendingPuzzleUpdates = new WeakMap();
|
|
6064
|
-
_renderMode = new WeakMap();
|
|
6065
|
-
_clearRenderMode = new WeakSet();
|
|
6066
|
-
clearRenderMode_fn = function() {
|
|
6067
|
-
switch (__privateGet(this, _renderMode)) {
|
|
6068
|
-
case "3D":
|
|
6069
|
-
this.scene = null;
|
|
6070
|
-
this.twisty3D = null;
|
|
6071
|
-
this.legacyExperimentalPG3D = null;
|
|
6072
|
-
this.viewerElems = [];
|
|
6073
|
-
__privateGet(this, _viewerWrapper).clear();
|
|
6074
|
-
break;
|
|
6075
|
-
case "2D":
|
|
6076
|
-
this.viewerElems = [];
|
|
6077
|
-
__privateGet(this, _viewerWrapper).clear();
|
|
6078
|
-
break;
|
|
6079
|
-
}
|
|
6080
|
-
__privateSet(this, _renderMode, null);
|
|
6081
|
-
};
|
|
6082
|
-
_setRenderMode2D = new WeakSet();
|
|
6083
|
-
setRenderMode2D_fn = function() {
|
|
6084
|
-
if (__privateGet(this, _renderMode) === "2D") {
|
|
6085
|
-
return;
|
|
6086
|
-
}
|
|
6087
|
-
__privateMethod(this, _clearRenderMode, clearRenderMode_fn).call(this);
|
|
6088
|
-
__privateSet(this, _renderMode, "2D");
|
|
6089
|
-
};
|
|
6090
|
-
_setTwisty2DSVG = new WeakSet();
|
|
6091
|
-
setTwisty2DSVG_fn = function(twisty2DSVG) {
|
|
6092
|
-
__privateMethod(this, _setRenderMode2D, setRenderMode2D_fn).call(this);
|
|
6093
|
-
__privateGet(this, _viewerWrapper).clear();
|
|
6094
|
-
__privateGet(this, _viewerWrapper).addElement(twisty2DSVG);
|
|
6095
|
-
this.viewerElems.push(twisty2DSVG);
|
|
6096
|
-
};
|
|
6097
|
-
_setRenderMode3D = new WeakSet();
|
|
6098
|
-
setRenderMode3D_fn = function() {
|
|
6099
|
-
if (__privateGet(this, _renderMode) === "3D") {
|
|
6100
|
-
return;
|
|
6101
|
-
}
|
|
6102
|
-
__privateMethod(this, _clearRenderMode, clearRenderMode_fn).call(this);
|
|
6103
|
-
this.scene = new Twisty3DScene();
|
|
6104
|
-
const mainViewer = new Twisty3DCanvas(this.scene, {
|
|
6105
|
-
orbitCoordinates: this.experimentalDerivedCameraOrbitCoordinates()
|
|
6106
|
-
});
|
|
6107
|
-
mainViewer.orbitControls.experimentalLatitudeLimits = this.experimentalCameraLatitudeLimits;
|
|
6108
|
-
this.viewerElems.push(mainViewer);
|
|
6109
|
-
__privateGet(this, _viewerWrapper).addElement(mainViewer);
|
|
6110
|
-
if (this.backView !== "none") {
|
|
6111
|
-
__privateMethod(this, _createBackViewer, createBackViewer_fn).call(this);
|
|
6112
|
-
}
|
|
6113
|
-
__privateSet(this, _renderMode, "3D");
|
|
6114
|
-
};
|
|
6115
|
-
_setTwisty3D = new WeakSet();
|
|
6116
|
-
setTwisty3D_fn = function(twisty3D) {
|
|
6117
|
-
if (this.twisty3D) {
|
|
6118
|
-
this.scene.removeTwisty3DPuzzle(this.twisty3D);
|
|
6119
|
-
if (this.twisty3D instanceof PG3D) {
|
|
6120
|
-
this.twisty3D.dispose();
|
|
6121
|
-
}
|
|
6122
|
-
this.twisty3D = null;
|
|
6123
|
-
}
|
|
6124
|
-
this.twisty3D = twisty3D;
|
|
6125
|
-
this.scene.addTwisty3DPuzzle(twisty3D);
|
|
6126
|
-
const orbitControls = __privateMethod(this, _orbitControls, orbitControls_fn).call(this);
|
|
6127
|
-
if (orbitControls) {
|
|
6128
|
-
orbitControls.lookAt(__privateMethod(this, _lookAt, lookAt_fn).call(this));
|
|
6129
|
-
}
|
|
6130
|
-
};
|
|
6131
|
-
_setCursor = new WeakSet();
|
|
6132
|
-
setCursor_fn = function(cursor) {
|
|
6133
|
-
const oldCursor = this.cursor;
|
|
6134
|
-
this.cursor = cursor;
|
|
6135
|
-
try {
|
|
6136
|
-
this.cursor.setAlg(this.alg, __privateMethod(this, _indexerConstructor, indexerConstructor_fn).call(this));
|
|
6137
|
-
__privateMethod(this, _setCursorStartState, setCursorStartState_fn).call(this);
|
|
6138
|
-
} catch (e) {
|
|
6139
|
-
this.cursor.setAlg(new Alg(), __privateMethod(this, _indexerConstructor, indexerConstructor_fn).call(this));
|
|
6140
|
-
this.cursor.setStartState(this.cursor.algToState(new Alg()));
|
|
6141
|
-
__privateGet(this, _experimentalInvalidInitialAlgCallback).call(this, this.alg);
|
|
6142
|
-
}
|
|
6143
|
-
__privateMethod(this, _setCursorStartState, setCursorStartState_fn).call(this);
|
|
6144
|
-
this.timeline.addCursor(cursor);
|
|
6145
|
-
if (oldCursor) {
|
|
6146
|
-
this.timeline.removeCursor(oldCursor);
|
|
6147
|
-
this.timeline.removeTimestampListener(oldCursor);
|
|
6148
|
-
}
|
|
6149
|
-
this.experimentalSetCursorIndexer(__privateGet(this, _cursorIndexerName));
|
|
6150
|
-
};
|
|
6151
|
-
_getPG3DAppearance = new WeakSet();
|
|
6152
|
-
getPG3DAppearance_fn = async function() {
|
|
6153
|
-
const puzzleLoader = puzzles[this.puzzle];
|
|
6154
|
-
if (puzzleLoader?.appearance) {
|
|
6155
|
-
return puzzleLoader.appearance(this.experimentalStickering ?? "full");
|
|
6156
|
-
}
|
|
6157
|
-
return null;
|
|
6158
|
-
};
|
|
6159
|
-
_createBackViewer = new WeakSet();
|
|
6160
|
-
createBackViewer_fn = function() {
|
|
6161
|
-
if (!is3DVisualization(this.visualization)) {
|
|
6162
|
-
throw new Error("Back viewer requires a 3D visualization");
|
|
6163
|
-
}
|
|
6164
|
-
const backViewer = new Twisty3DCanvas(this.scene, {
|
|
6165
|
-
orbitCoordinates: this.experimentalDerivedCameraOrbitCoordinates(),
|
|
6166
|
-
negateCameraPosition: true
|
|
6167
|
-
});
|
|
6168
|
-
backViewer.orbitControls.experimentalLatitudeLimits = this.experimentalCameraLatitudeLimits;
|
|
6169
|
-
this.viewerElems.push(backViewer);
|
|
6170
|
-
this.viewerElems[0].setMirror(backViewer);
|
|
6171
|
-
__privateGet(this, _viewerWrapper).addElement(backViewer);
|
|
6172
|
-
};
|
|
6173
|
-
_removeBackViewerElem = new WeakSet();
|
|
6174
|
-
removeBackViewerElem_fn = function() {
|
|
6175
|
-
if (this.viewerElems.length !== 2) {
|
|
6176
|
-
throw new Error("Tried to remove non-existent back view!");
|
|
6177
|
-
}
|
|
6178
|
-
__privateGet(this, _viewerWrapper).removeElement(this.viewerElems.pop());
|
|
6179
|
-
};
|
|
6180
|
-
_hackyCoalescePending = new WeakSet();
|
|
6181
|
-
hackyCoalescePending_fn = function() {
|
|
6182
|
-
const units = Array.from(this.alg.units());
|
|
6183
|
-
const length = units.length;
|
|
6184
|
-
const pending = __privateGet(this, _hackyPendingFinalMoveCoalesce);
|
|
6185
|
-
__privateSet(this, _hackyPendingFinalMoveCoalesce, false);
|
|
6186
|
-
if (pending && length > 1 && units[length - 1].is(Move)) {
|
|
6187
|
-
const finalMove = units[length - 1];
|
|
6188
|
-
const newAlg = experimentalAppendMove(new Alg(units.slice(0, length - 1)), finalMove, {
|
|
6189
|
-
coalesce: true,
|
|
6190
|
-
mod: this.legacyExperimentalCoalesceModFunc(finalMove)
|
|
6191
|
-
});
|
|
6192
|
-
this.alg = newAlg;
|
|
6193
|
-
}
|
|
6194
|
-
};
|
|
6195
|
-
customElementsShim.define("twisty-player-v1", TwistyPlayerV1);
|
|
6196
|
-
|
|
6197
|
-
// src/cubing/twisty/old/dom/TwistyAlgViewerV1.css.ts
|
|
6198
|
-
var twistyAlgViewerCSS2 = new CSSSource(`
|
|
6199
|
-
:host {
|
|
6200
|
-
display: inline-grid;
|
|
6201
|
-
}
|
|
6202
|
-
|
|
6203
|
-
a:not(:hover) {
|
|
6204
|
-
color: inherit;
|
|
6205
|
-
text-decoration: none;
|
|
6206
|
-
}
|
|
6207
|
-
|
|
6208
|
-
twisty-alg-leaf-elem.twisty-alg-comment {
|
|
6209
|
-
color: rgba(0, 0, 0, 0.4);
|
|
6210
|
-
}
|
|
6211
|
-
|
|
6212
|
-
.wrapper.current-move {
|
|
6213
|
-
background: rgba(66, 133, 244, 0.3);
|
|
6214
|
-
margin-left: -0.1em;
|
|
6215
|
-
margin-right: -0.1em;
|
|
6216
|
-
padding-left: 0.1em;
|
|
6217
|
-
padding-right: 0.1em;
|
|
6218
|
-
border-radius: 0.1em;
|
|
6219
|
-
}
|
|
6220
|
-
`);
|
|
6221
|
-
|
|
6222
|
-
// src/cubing/twisty/old/dom/TwistyAlgViewerV1.ts
|
|
6223
|
-
var DEFAULT_OFFSET_MS2 = 250;
|
|
6224
|
-
var TwistyAlgLeafElemV1 = class extends ManagedCustomElement {
|
|
6225
|
-
constructor(className, text, dataDown, algOrUnit, offsetIntoMove, clickable) {
|
|
6226
|
-
super({ mode: "open" });
|
|
6227
|
-
this.algOrUnit = algOrUnit;
|
|
6228
|
-
this.classList.add(className);
|
|
6229
|
-
this.addCSS(twistyAlgViewerCSS2);
|
|
6230
|
-
if (clickable) {
|
|
6231
|
-
const anchor = this.contentWrapper.appendChild(document.createElement("a"));
|
|
6232
|
-
anchor.href = "#";
|
|
6233
|
-
anchor.textContent = text;
|
|
6234
|
-
anchor.addEventListener("click", (e) => {
|
|
6235
|
-
e.preventDefault();
|
|
6236
|
-
dataDown.twistyAlgViewer.jumpToIndex(dataDown.earliestMoveIndex, offsetIntoMove);
|
|
6237
|
-
});
|
|
6238
|
-
} else {
|
|
6239
|
-
this.contentWrapper.appendChild(document.createElement("span")).textContent = text;
|
|
6240
|
-
}
|
|
6241
|
-
}
|
|
6242
|
-
pathToIndex(_index) {
|
|
6243
|
-
return [];
|
|
6244
|
-
}
|
|
6245
|
-
setCurrentMove(current) {
|
|
6246
|
-
this.contentWrapper.classList.toggle("current-move", current);
|
|
6247
|
-
}
|
|
6248
|
-
};
|
|
6249
|
-
customElementsShim.define("twisty-alg-leaf-elem-v1", TwistyAlgLeafElemV1);
|
|
6250
|
-
var TwistyAlgWrapperElemV1 = class extends HTMLElementShim {
|
|
6251
|
-
constructor(className, algOrUnit) {
|
|
6252
|
-
super();
|
|
6253
|
-
this.algOrUnit = algOrUnit;
|
|
6254
|
-
this.queue = [];
|
|
6255
|
-
this.classList.add(className);
|
|
6256
|
-
}
|
|
6257
|
-
addString(str) {
|
|
6258
|
-
this.queue.push(document.createTextNode(str));
|
|
6259
|
-
}
|
|
6260
|
-
addElem(dataUp) {
|
|
6261
|
-
this.queue.push(dataUp.element);
|
|
6262
|
-
return dataUp.moveCount;
|
|
6263
|
-
}
|
|
6264
|
-
flushQueue(direction = IterationDirection.Forwards) {
|
|
6265
|
-
for (const node of maybeReverseList2(this.queue, direction)) {
|
|
6266
|
-
this.append(node);
|
|
6267
|
-
}
|
|
6268
|
-
this.queue = [];
|
|
6269
|
-
}
|
|
6270
|
-
pathToIndex(_index) {
|
|
6271
|
-
return [];
|
|
6272
|
-
}
|
|
6273
|
-
};
|
|
6274
|
-
customElementsShim.define("twisty-alg-wrapper-elem-v1", TwistyAlgWrapperElemV1);
|
|
6275
|
-
function oppositeDirection2(direction) {
|
|
6276
|
-
return direction === IterationDirection.Forwards ? IterationDirection.Backwards : IterationDirection.Forwards;
|
|
6277
|
-
}
|
|
6278
|
-
function updateDirectionByAmount2(currentDirection, amount) {
|
|
6279
|
-
return amount < 0 ? oppositeDirection2(currentDirection) : currentDirection;
|
|
6280
|
-
}
|
|
6281
|
-
function maybeReverseList2(l, direction) {
|
|
6282
|
-
if (direction === IterationDirection.Forwards) {
|
|
6283
|
-
return l;
|
|
6284
|
-
}
|
|
6285
|
-
const copy = Array.from(l);
|
|
6286
|
-
copy.reverse();
|
|
6287
|
-
return copy;
|
|
6288
|
-
}
|
|
6289
|
-
var AlgToDOMTree2 = class extends TraversalDownUp {
|
|
6290
|
-
traverseAlg(alg, dataDown) {
|
|
6291
|
-
let moveCount = 0;
|
|
6292
|
-
const element = new TwistyAlgWrapperElemV1("twisty-alg-alg", alg);
|
|
6293
|
-
let first = true;
|
|
6294
|
-
for (const unit of direct(alg.units(), dataDown.direction)) {
|
|
6295
|
-
if (!first) {
|
|
6296
|
-
element.addString(" ");
|
|
6297
|
-
}
|
|
6298
|
-
first = false;
|
|
6299
|
-
moveCount += element.addElem(this.traverseUnit(unit, {
|
|
6300
|
-
earliestMoveIndex: dataDown.earliestMoveIndex + moveCount,
|
|
6301
|
-
twistyAlgViewer: dataDown.twistyAlgViewer,
|
|
6302
|
-
direction: dataDown.direction
|
|
6303
|
-
}));
|
|
6304
|
-
}
|
|
6305
|
-
element.flushQueue(dataDown.direction);
|
|
6306
|
-
return {
|
|
6307
|
-
moveCount,
|
|
6308
|
-
element
|
|
6309
|
-
};
|
|
6310
|
-
}
|
|
6311
|
-
traverseGrouping(grouping, dataDown) {
|
|
6312
|
-
const square1Tuple = grouping.experimentalAsSquare1Tuple();
|
|
6313
|
-
const direction = updateDirectionByAmount2(dataDown.direction, grouping.amount);
|
|
6314
|
-
let moveCount = 0;
|
|
6315
|
-
const element = new TwistyAlgWrapperElemV1("twisty-alg-grouping", grouping);
|
|
6316
|
-
element.addString("(");
|
|
6317
|
-
if (square1Tuple) {
|
|
6318
|
-
moveCount += element.addElem({
|
|
6319
|
-
moveCount: 1,
|
|
6320
|
-
element: new TwistyAlgLeafElemV1("twisty-alg-move", square1Tuple[0].amount.toString(), dataDown, square1Tuple[0], true, true)
|
|
6321
|
-
});
|
|
6322
|
-
element.addString(", ");
|
|
6323
|
-
moveCount += element.addElem({
|
|
6324
|
-
moveCount: 1,
|
|
6325
|
-
element: new TwistyAlgLeafElemV1("twisty-alg-move", square1Tuple[1].amount.toString(), dataDown, square1Tuple[1], true, true)
|
|
6326
|
-
});
|
|
6327
|
-
} else {
|
|
6328
|
-
moveCount += element.addElem(this.traverseAlg(grouping.alg, {
|
|
6329
|
-
earliestMoveIndex: dataDown.earliestMoveIndex + moveCount,
|
|
6330
|
-
twistyAlgViewer: dataDown.twistyAlgViewer,
|
|
6331
|
-
direction
|
|
6332
|
-
}));
|
|
6333
|
-
}
|
|
6334
|
-
element.addString(")" + grouping.experimentalRepetitionSuffix);
|
|
6335
|
-
element.flushQueue();
|
|
6336
|
-
return {
|
|
6337
|
-
moveCount: moveCount * Math.abs(grouping.amount),
|
|
6338
|
-
element
|
|
6339
|
-
};
|
|
6340
|
-
}
|
|
6341
|
-
traverseMove(move, dataDown) {
|
|
6342
|
-
const element = new TwistyAlgLeafElemV1("twisty-alg-move", move.toString(), dataDown, move, true, true);
|
|
6343
|
-
dataDown.twistyAlgViewer.highlighter.addMove(move.startCharIndex, element);
|
|
6344
|
-
return {
|
|
6345
|
-
moveCount: 1,
|
|
6346
|
-
element
|
|
6347
|
-
};
|
|
6348
|
-
}
|
|
6349
|
-
traverseCommutator(commutator, dataDown) {
|
|
6350
|
-
let moveCount = 0;
|
|
6351
|
-
const element = new TwistyAlgWrapperElemV1("twisty-alg-commutator", commutator);
|
|
6352
|
-
element.addString("[");
|
|
6353
|
-
element.flushQueue();
|
|
6354
|
-
const [first, second] = maybeReverseList2([commutator.A, commutator.B], dataDown.direction);
|
|
6355
|
-
moveCount += element.addElem(this.traverseAlg(first, {
|
|
6356
|
-
earliestMoveIndex: dataDown.earliestMoveIndex + moveCount,
|
|
6357
|
-
twistyAlgViewer: dataDown.twistyAlgViewer,
|
|
6358
|
-
direction: dataDown.direction
|
|
6359
|
-
}));
|
|
6360
|
-
element.addString(", ");
|
|
6361
|
-
moveCount += element.addElem(this.traverseAlg(second, {
|
|
6362
|
-
earliestMoveIndex: dataDown.earliestMoveIndex + moveCount,
|
|
6363
|
-
twistyAlgViewer: dataDown.twistyAlgViewer,
|
|
6364
|
-
direction: dataDown.direction
|
|
6365
|
-
}));
|
|
6366
|
-
element.flushQueue(dataDown.direction);
|
|
6367
|
-
element.addString("]");
|
|
6368
|
-
element.flushQueue();
|
|
6369
|
-
return {
|
|
6370
|
-
moveCount: moveCount * 2,
|
|
6371
|
-
element
|
|
6372
|
-
};
|
|
6373
|
-
}
|
|
6374
|
-
traverseConjugate(conjugate, dataDown) {
|
|
6375
|
-
let moveCount = 0;
|
|
6376
|
-
const element = new TwistyAlgWrapperElemV1("twisty-alg-conjugate", conjugate);
|
|
6377
|
-
element.addString("[");
|
|
6378
|
-
const aLen = element.addElem(this.traverseAlg(conjugate.A, {
|
|
6379
|
-
earliestMoveIndex: dataDown.earliestMoveIndex + moveCount,
|
|
6380
|
-
twistyAlgViewer: dataDown.twistyAlgViewer,
|
|
6381
|
-
direction: dataDown.direction
|
|
6382
|
-
}));
|
|
6383
|
-
moveCount += aLen;
|
|
6384
|
-
element.addString(": ");
|
|
6385
|
-
moveCount += element.addElem(this.traverseAlg(conjugate.B, {
|
|
6386
|
-
earliestMoveIndex: dataDown.earliestMoveIndex + moveCount,
|
|
6387
|
-
twistyAlgViewer: dataDown.twistyAlgViewer,
|
|
6388
|
-
direction: dataDown.direction
|
|
6389
|
-
}));
|
|
6390
|
-
element.addString("]");
|
|
6391
|
-
element.flushQueue();
|
|
6392
|
-
return {
|
|
6393
|
-
moveCount: moveCount + aLen,
|
|
6394
|
-
element
|
|
6395
|
-
};
|
|
6396
|
-
}
|
|
6397
|
-
traversePause(pause, dataDown) {
|
|
6398
|
-
return {
|
|
6399
|
-
moveCount: 1,
|
|
6400
|
-
element: new TwistyAlgLeafElemV1("twisty-alg-pause", ".", dataDown, pause, true, true)
|
|
6401
|
-
};
|
|
6402
|
-
}
|
|
6403
|
-
traverseNewline(newline, _dataDown) {
|
|
6404
|
-
const element = new TwistyAlgWrapperElemV1("twisty-alg-newline", newline);
|
|
6405
|
-
element.append(document.createElement("br"));
|
|
6406
|
-
return {
|
|
6407
|
-
moveCount: 0,
|
|
6408
|
-
element
|
|
6409
|
-
};
|
|
6410
|
-
}
|
|
6411
|
-
traverseLineComment(lineComment, dataDown) {
|
|
6412
|
-
return {
|
|
6413
|
-
moveCount: 0,
|
|
6414
|
-
element: new TwistyAlgLeafElemV1("twisty-alg-line-comment", `//${lineComment.text}`, dataDown, lineComment, false, false)
|
|
6415
|
-
};
|
|
6416
|
-
}
|
|
6417
|
-
};
|
|
6418
|
-
var algToDOMTreeInstance2 = new AlgToDOMTree2();
|
|
6419
|
-
var algToDOMTree2 = algToDOMTreeInstance2.traverseAlg.bind(algToDOMTreeInstance2);
|
|
6420
|
-
var MoveHighlighter2 = class {
|
|
6421
|
-
constructor() {
|
|
6422
|
-
this.moveCharIndexMap = new Map();
|
|
6423
|
-
this.currentElem = null;
|
|
6424
|
-
}
|
|
6425
|
-
addMove(charIndex, elem) {
|
|
6426
|
-
this.moveCharIndexMap.set(charIndex, elem);
|
|
6427
|
-
}
|
|
6428
|
-
set(move) {
|
|
6429
|
-
const newElem = move ? this.moveCharIndexMap.get(move.startCharIndex) ?? null : null;
|
|
6430
|
-
if (this.currentElem === newElem) {
|
|
6431
|
-
return;
|
|
6432
|
-
}
|
|
6433
|
-
this.currentElem?.classList.remove("twisty-alg-current-move");
|
|
6434
|
-
this.currentElem?.setCurrentMove(false);
|
|
6435
|
-
newElem?.classList.add("twisty-alg-current-move");
|
|
6436
|
-
newElem?.setCurrentMove(true);
|
|
6437
|
-
this.currentElem = newElem;
|
|
6438
|
-
}
|
|
6439
|
-
};
|
|
6440
|
-
var _domTree2;
|
|
6441
|
-
var TwistyAlgViewerV1 = class extends HTMLElementShim {
|
|
6442
|
-
constructor(options) {
|
|
6443
|
-
super();
|
|
6444
|
-
this.highlighter = new MoveHighlighter2();
|
|
6445
|
-
__privateAdd(this, _domTree2, void 0);
|
|
6446
|
-
this.twistyPlayer = null;
|
|
6447
|
-
this.lastClickTimestamp = null;
|
|
6448
|
-
if (options?.twistyPlayer) {
|
|
6449
|
-
this.setTwistyPlayer(options?.twistyPlayer);
|
|
6450
|
-
}
|
|
6451
|
-
}
|
|
6452
|
-
connectedCallback() {
|
|
6453
|
-
}
|
|
6454
|
-
setAlg(alg) {
|
|
6455
|
-
__privateSet(this, _domTree2, algToDOMTree2(alg, {
|
|
6456
|
-
earliestMoveIndex: 0,
|
|
6457
|
-
twistyAlgViewer: this,
|
|
6458
|
-
direction: IterationDirection.Forwards
|
|
6459
|
-
}).element);
|
|
6460
|
-
this.textContent = "";
|
|
6461
|
-
this.appendChild(__privateGet(this, _domTree2));
|
|
6462
|
-
}
|
|
6463
|
-
setTwistyPlayer(twistyPlayer) {
|
|
6464
|
-
if (this.twistyPlayer) {
|
|
6465
|
-
console.warn("twisty-player reassignment is not supported");
|
|
6466
|
-
return;
|
|
6467
|
-
}
|
|
6468
|
-
this.twistyPlayer = twistyPlayer;
|
|
6469
|
-
this.twistyPlayer.addEventListener("experimental-alg-update", (e) => {
|
|
6470
|
-
this.setAlg(e.detail.alg);
|
|
6471
|
-
});
|
|
6472
|
-
const sourceAlg = this.twistyPlayer.alg;
|
|
6473
|
-
const parsedAlg = "charIndex" in sourceAlg ? sourceAlg : Alg.fromString(sourceAlg.toString());
|
|
6474
|
-
this.setAlg(parsedAlg);
|
|
6475
|
-
(async () => {
|
|
6476
|
-
const wrapper = new KPuzzleWrapper(await puzzles[twistyPlayer.puzzle].def());
|
|
6477
|
-
const indexer = new TreeAlgIndexer(wrapper, parsedAlg);
|
|
6478
|
-
twistyPlayer.timeline.addTimestampListener({
|
|
6479
|
-
onTimelineTimestampChange: (timestamp) => {
|
|
6480
|
-
this.highlighter.set(indexer.getAnimLeaf(indexer.timestampToIndex(timestamp)));
|
|
6481
|
-
},
|
|
6482
|
-
onTimeRangeChange(_timeRange) {
|
|
6483
|
-
}
|
|
6484
|
-
});
|
|
6485
|
-
})();
|
|
6486
|
-
twistyPlayer.timeline.addTimestampListener({
|
|
6487
|
-
onTimelineTimestampChange: (timestamp) => {
|
|
6488
|
-
if (timestamp !== this.lastClickTimestamp) {
|
|
6489
|
-
this.lastClickTimestamp = null;
|
|
6490
|
-
}
|
|
6491
|
-
const index = this.twistyPlayer?.cursor?.experimentalIndexFromTimestamp(timestamp) ?? null;
|
|
6492
|
-
if (index !== null) {
|
|
6493
|
-
}
|
|
6494
|
-
},
|
|
6495
|
-
onTimeRangeChange: (_timeRange) => {
|
|
6496
|
-
}
|
|
6497
|
-
});
|
|
6498
|
-
}
|
|
6499
|
-
jumpToIndex(index, offsetIntoMove) {
|
|
6500
|
-
if (this.twistyPlayer && this.twistyPlayer.cursor) {
|
|
6501
|
-
const offset = offsetIntoMove ? DEFAULT_OFFSET_MS2 : 0;
|
|
6502
|
-
const timestamp = (this.twistyPlayer.cursor.experimentalTimestampFromIndex(index) ?? -offset) + offset;
|
|
6503
|
-
this.twistyPlayer?.timeline.setTimestamp(timestamp);
|
|
6504
|
-
if (this.lastClickTimestamp === timestamp) {
|
|
6505
|
-
this.twistyPlayer.timeline.play();
|
|
6506
|
-
this.lastClickTimestamp = null;
|
|
6507
|
-
} else {
|
|
6508
|
-
this.lastClickTimestamp = timestamp;
|
|
6509
|
-
}
|
|
6510
|
-
}
|
|
6511
|
-
}
|
|
6512
|
-
attributeChangedCallback(attributeName, _oldValue, newValue) {
|
|
6513
|
-
if (attributeName === "for") {
|
|
6514
|
-
const elem = document.getElementById(newValue);
|
|
6515
|
-
if (!elem) {
|
|
6516
|
-
console.warn("for= elem does not exist");
|
|
6517
|
-
return;
|
|
6518
|
-
}
|
|
6519
|
-
if (!(elem instanceof TwistyPlayerV1)) {
|
|
6520
|
-
console.warn("for= elem is not a twisty-player");
|
|
6521
|
-
return;
|
|
6522
|
-
}
|
|
6523
|
-
this.setTwistyPlayer(elem);
|
|
6524
|
-
}
|
|
6525
|
-
}
|
|
6526
|
-
static get observedAttributes() {
|
|
6527
|
-
return ["for"];
|
|
6528
|
-
}
|
|
6529
|
-
};
|
|
6530
|
-
_domTree2 = new WeakMap();
|
|
6531
|
-
customElementsShim.define("twisty-alg-viewer-v1", TwistyAlgViewerV1);
|
|
6532
4918
|
export {
|
|
6533
4919
|
Cube3D,
|
|
6534
4920
|
NO_VALUE as EXPERIMENTAL_PROP_NO_VALUE,
|
|
6535
4921
|
KPuzzleWrapper as KSolvePuzzle,
|
|
6536
4922
|
PG3D,
|
|
6537
4923
|
SimpleAlgIndexer,
|
|
6538
|
-
TimestampLocationType,
|
|
6539
4924
|
TreeAlgIndexer,
|
|
6540
|
-
Twisty3DCanvas,
|
|
6541
4925
|
TwistyAlgEditor,
|
|
6542
4926
|
TwistyAlgViewer,
|
|
6543
|
-
TwistyAlgViewerV1,
|
|
6544
4927
|
TwistyPlayer,
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
4928
|
+
backViewLayouts,
|
|
4929
|
+
debugShowRenderStats as experimentalDebugShowRenderStats,
|
|
4930
|
+
experimentalForceNewRendererSharing
|
|
6548
4931
|
};
|
|
6549
4932
|
//# sourceMappingURL=index.js.map
|