cubing 0.20.2 → 0.21.0-pre12
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 +6 -9
- package/dist/.DS_Store +0 -0
- package/dist/bin/puzzle-geometry-bin.js +1124 -1128
- package/dist/bin/puzzle-geometry-bin.js.map +3 -3
- package/dist/bundle-global/cubing.bundle-global.js +3978 -3587
- package/dist/esm/.DS_Store +0 -0
- package/dist/esm/{2x2x2.kpuzzle.json_-ZLJSYD5K.js → 2x2x2.kpuzzle.json-JOGUSQ4N.js} +3 -3
- package/dist/esm/{2x2x2.kpuzzle.json_-ZLJSYD5K.js.map → 2x2x2.kpuzzle.json-JOGUSQ4N.js.map} +1 -1
- package/dist/esm/{2x2x2.kpuzzle.svg-BNXPAM3A.js → 2x2x2.kpuzzle.svg-CQF2FTV7.js} +2 -2
- package/dist/esm/{2x2x2.kpuzzle.svg-BNXPAM3A.js.map → 2x2x2.kpuzzle.svg-CQF2FTV7.js.map} +0 -0
- package/dist/esm/3d-JZD3V366.js +39 -0
- package/dist/esm/3d-JZD3V366.js.map +7 -0
- package/dist/esm/{3x3x3-ll.kpuzzle.svg-EC42JHOH.js → 3x3x3-ll.kpuzzle.svg-53CBPG5O.js} +2 -2
- package/dist/esm/{3x3x3-ll.kpuzzle.svg-EC42JHOH.js.map → 3x3x3-ll.kpuzzle.svg-53CBPG5O.js.map} +0 -0
- package/dist/esm/{3x3x3.kpuzzle.svg-DUKG2WHC.js → 3x3x3.kpuzzle.svg-ERSSH66P.js} +2 -2
- package/dist/esm/{3x3x3.kpuzzle.svg-DUKG2WHC.js.map → 3x3x3.kpuzzle.svg-ERSSH66P.js.map} +0 -0
- package/dist/esm/alg/index.js +2 -2
- package/dist/esm/bluetooth/index.js +13 -11
- package/dist/esm/bluetooth/index.js.map +2 -2
- package/dist/esm/chunk-5DN4DAAX.js +2512 -0
- package/dist/esm/chunk-5DN4DAAX.js.map +7 -0
- package/dist/esm/{chunk-KKSDHNLH.js → chunk-7GADUDIG.js} +49 -71
- package/dist/esm/chunk-7GADUDIG.js.map +7 -0
- package/dist/esm/{chunk-YNB7QLBF.js → chunk-BU5PUJK3.js} +9 -10
- package/dist/esm/chunk-BU5PUJK3.js.map +7 -0
- package/dist/esm/chunk-CQS6JZ7G.js +762 -0
- package/dist/esm/chunk-CQS6JZ7G.js.map +7 -0
- package/dist/esm/{chunk-2GRKPQQL.js → chunk-RE7MIN5R.js} +2 -2
- package/dist/esm/{chunk-2GRKPQQL.js.map → chunk-RE7MIN5R.js.map} +0 -0
- package/dist/esm/{chunk-WJ7AVUI7.js → chunk-WO2AXYFE.js} +12 -1
- package/dist/esm/{chunk-WJ7AVUI7.js.map → chunk-WO2AXYFE.js.map} +0 -0
- package/dist/esm/{chunk-CWVB5RRW.js → chunk-YV3RT5PX.js} +625 -1282
- package/dist/esm/chunk-YV3RT5PX.js.map +7 -0
- package/dist/esm/{clock.kpuzzle.json_-PXORG6YF.js → clock.kpuzzle.json-EKWRMHJM.js} +3 -3
- package/dist/esm/{clock.kpuzzle.json_-PXORG6YF.js.map → clock.kpuzzle.json-EKWRMHJM.js.map} +1 -1
- package/dist/esm/{clock.kpuzzle.svg-E52B5OQV.js → clock.kpuzzle.svg-B7TMN3SY.js} +2 -2
- package/dist/esm/{clock.kpuzzle.svg-E52B5OQV.js.map → clock.kpuzzle.svg-B7TMN3SY.js.map} +0 -0
- package/dist/esm/esm-test-worker.js +2 -2
- package/dist/esm/esm-test-worker.js.map +1 -1
- package/dist/esm/kpuzzle/index.js +5 -3
- package/dist/esm/{node-SIGYKAZG.js → node-BSAQKO3G.js} +2 -2
- package/dist/esm/{node-SIGYKAZG.js.map → node-BSAQKO3G.js.map} +0 -0
- package/dist/esm/{node-BHGOVUN3.js → node-WEHVBEKP.js} +2 -2
- package/dist/esm/{node-BHGOVUN3.js.map → node-WEHVBEKP.js.map} +0 -0
- package/dist/esm/notation/index.js +3 -3
- package/dist/esm/protocol/index.js +3 -3
- package/dist/esm/puzzle-geometry/index.js +1085 -1179
- package/dist/esm/puzzle-geometry/index.js.map +3 -3
- package/dist/esm/puzzles/index.js +10 -4
- package/dist/esm/{pyraminx.kpuzzle.svg-QKUJX37T.js → pyraminx.kpuzzle.svg-QBBMZVDY.js} +2 -2
- package/dist/esm/{pyraminx.kpuzzle.svg-QKUJX37T.js.map → pyraminx.kpuzzle.svg-QBBMZVDY.js.map} +0 -0
- package/dist/esm/scramble/index.js +5 -4
- package/dist/esm/search/index.js +7 -4
- package/dist/esm/{sq1-hyperorbit.kpuzzle.json_-7KW5LSXC.js → sq1-hyperorbit.kpuzzle.json-N3FGCPML.js} +3 -3
- package/dist/esm/{sq1-hyperorbit.kpuzzle.json_-7KW5LSXC.js.map → sq1-hyperorbit.kpuzzle.json-N3FGCPML.js.map} +1 -1
- package/dist/esm/{sq1-hyperorbit.kpuzzle.svg-7Y7N37NN.js → sq1-hyperorbit.kpuzzle.svg-ID57EER7.js} +2 -2
- package/dist/esm/{sq1-hyperorbit.kpuzzle.svg-7Y7N37NN.js.map → sq1-hyperorbit.kpuzzle.svg-ID57EER7.js.map} +0 -0
- package/dist/esm/stream/index.js +3 -3
- package/dist/esm/stream/index.js.map +2 -2
- package/dist/esm/twisty/index.js +4442 -3214
- package/dist/esm/twisty/index.js.map +3 -3
- package/dist/esm/worker-inside-generated-string-KDZOUGJF.js +2831 -0
- package/dist/esm/worker-inside-generated-string-KDZOUGJF.js.map +7 -0
- package/dist/types/alg/Alg.d.ts +88 -0
- package/dist/types/alg/Alg.d.ts.map +1 -1
- package/dist/types/alg/Alg.spec.d.ts +2 -0
- package/dist/types/alg/Alg.spec.d.ts.map +1 -0
- package/dist/types/alg/common.d.ts.map +1 -1
- package/dist/types/alg/operation.spec.d.ts +2 -0
- package/dist/types/alg/operation.spec.d.ts.map +1 -0
- package/dist/types/alg/parse.spec.d.ts +2 -0
- package/dist/types/alg/parse.spec.d.ts.map +1 -0
- package/dist/types/alg/test/alg-comparison.d.ts.map +1 -1
- package/dist/types/alg/test/alg.spec.d.ts +2 -0
- package/dist/types/alg/test/alg.spec.d.ts.map +1 -0
- package/dist/types/alg/units/leaves/LineComment.spec.d.ts +2 -0
- package/dist/types/alg/units/leaves/LineComment.spec.d.ts.map +1 -0
- package/dist/types/alg/units/leaves/Move.spec.d.ts +2 -0
- package/dist/types/alg/units/leaves/Move.spec.d.ts.map +1 -0
- package/dist/types/alg/url.spec.d.ts +2 -0
- package/dist/types/alg/url.spec.d.ts.map +1 -0
- package/dist/types/bluetooth/smart-puzzle/bluetooth-puzzle.d.ts +1 -1
- package/dist/types/bluetooth/smart-puzzle/bluetooth-puzzle.d.ts.map +1 -1
- package/dist/types/bluetooth/smart-puzzle/giiker.spec.d.ts +5 -0
- package/dist/types/bluetooth/smart-puzzle/giiker.spec.d.ts.map +1 -0
- package/dist/types/kpuzzle/3x3x3/3x3x3.kpuzzle.json.d.ts +3 -0
- package/dist/types/kpuzzle/3x3x3/3x3x3.kpuzzle.json.d.ts.map +1 -0
- package/dist/types/kpuzzle/3x3x3/3x3x3.kpuzzle.json.spec.d.ts +2 -0
- package/dist/types/kpuzzle/3x3x3/3x3x3.kpuzzle.json.spec.d.ts.map +1 -0
- package/dist/types/kpuzzle/canon.spec.d.ts +2 -0
- package/dist/types/kpuzzle/canon.spec.d.ts.map +1 -0
- package/dist/types/kpuzzle/index.d.ts +1 -0
- package/dist/types/kpuzzle/index.d.ts.map +1 -1
- package/dist/types/kpuzzle/kpuzzle.spec.d.ts +2 -0
- package/dist/types/kpuzzle/kpuzzle.spec.d.ts.map +1 -0
- package/dist/types/kpuzzle/prunetable.spec.d.ts +2 -0
- package/dist/types/kpuzzle/prunetable.spec.d.ts.map +1 -0
- package/dist/types/kpuzzle/svg.d.ts.map +1 -1
- package/dist/types/kpuzzle/transformations.spec.d.ts +2 -0
- package/dist/types/kpuzzle/transformations.spec.d.ts.map +1 -0
- package/dist/types/protocol/binary/binary3x3x3.spec.d.ts +2 -0
- package/dist/types/protocol/binary/binary3x3x3.spec.d.ts.map +1 -0
- package/dist/types/protocol/binary/hex.spec.d.ts +2 -0
- package/dist/types/protocol/binary/hex.spec.d.ts.map +1 -0
- package/dist/types/protocol/binary/orbit-indexing.spec.d.ts +2 -0
- package/dist/types/protocol/binary/orbit-indexing.spec.d.ts.map +1 -0
- package/dist/types/puzzle-geometry/Options.d.ts +45 -1
- package/dist/types/puzzle-geometry/Options.d.ts.map +1 -1
- package/dist/types/puzzle-geometry/PGPuzzles.spec.d.ts +2 -0
- package/dist/types/puzzle-geometry/PGPuzzles.spec.d.ts.map +1 -0
- package/dist/types/puzzle-geometry/PermOriSet.d.ts +39 -39
- package/dist/types/puzzle-geometry/PermOriSet.d.ts.map +1 -1
- package/dist/types/puzzle-geometry/PuzzleGeometry.d.ts +118 -110
- package/dist/types/puzzle-geometry/PuzzleGeometry.d.ts.map +1 -1
- package/dist/types/puzzle-geometry/Quat.d.ts +0 -11
- package/dist/types/puzzle-geometry/Quat.d.ts.map +1 -1
- package/dist/types/puzzle-geometry/Quat.spec.d.ts +2 -0
- package/dist/types/puzzle-geometry/Quat.spec.d.ts.map +1 -0
- package/dist/types/puzzle-geometry/SchreierSims.d.ts.map +1 -1
- package/dist/types/puzzle-geometry/index.d.ts +2 -4
- package/dist/types/puzzle-geometry/index.d.ts.map +1 -1
- package/dist/types/puzzle-geometry/interfaces.d.ts +1 -21
- package/dist/types/puzzle-geometry/interfaces.d.ts.map +1 -1
- package/dist/types/puzzle-geometry/orientcenters.spec.d.ts +2 -0
- package/dist/types/puzzle-geometry/orientcenters.spec.d.ts.map +1 -0
- package/dist/types/puzzles/async/async-pg3d.d.ts.map +1 -1
- package/dist/types/puzzles/customPGPuzzleLoader.d.ts +12 -0
- package/dist/types/puzzles/customPGPuzzleLoader.d.ts.map +1 -0
- package/dist/types/puzzles/implementations/2x2x2/{2x2x2.kpuzzle.json_.d.ts → 2x2x2.kpuzzle.json.d.ts} +1 -1
- package/dist/types/puzzles/implementations/2x2x2/2x2x2.kpuzzle.json.d.ts.map +1 -0
- package/dist/types/puzzles/implementations/3x3x3/index.d.ts.map +1 -1
- package/dist/types/puzzles/implementations/clock/{clock.kpuzzle.json_.d.ts → clock.kpuzzle.json.d.ts} +1 -1
- package/dist/types/puzzles/implementations/clock/clock.kpuzzle.json.d.ts.map +1 -0
- package/dist/types/puzzles/implementations/fto/index.d.ts +2 -2
- package/dist/types/puzzles/implementations/fto/index.d.ts.map +1 -1
- package/dist/types/puzzles/implementations/pyraminx/{pyraminx.kpuzzle.json_.d.ts → pyraminx.kpuzzle.json.d.ts} +1 -1
- package/dist/types/puzzles/implementations/pyraminx/pyraminx.kpuzzle.json.d.ts.map +1 -0
- package/dist/types/puzzles/implementations/square1/index.d.ts.map +1 -1
- package/dist/types/puzzles/implementations/square1/{sq1-hyperorbit.kpuzzle.json_.d.ts → sq1-hyperorbit.kpuzzle.json.d.ts} +1 -1
- package/dist/types/puzzles/implementations/square1/sq1-hyperorbit.kpuzzle.json.d.ts.map +1 -0
- package/dist/types/puzzles/index.d.ts +4 -2
- package/dist/types/puzzles/index.d.ts.map +1 -1
- package/dist/types/puzzles/stickerings/appearance.d.ts +9 -9
- package/dist/types/puzzles/stickerings/appearance.d.ts.map +1 -1
- package/dist/types/puzzles/stickerings/cube-stickerings.d.ts.map +1 -1
- package/dist/types/puzzles/stickerings/fto-stickerings.d.ts.map +1 -1
- package/dist/types/puzzles/stickerings/global-custom-stickering-hack.d.ts +3 -0
- package/dist/types/puzzles/stickerings/global-custom-stickering-hack.d.ts.map +1 -0
- package/dist/types/search/index.d.ts +1 -1
- package/dist/types/search/index.d.ts.map +1 -1
- package/dist/types/search/inside/api.d.ts +2 -1
- package/dist/types/search/inside/api.d.ts.map +1 -1
- package/dist/types/search/inside/api.spec.d.ts +2 -0
- package/dist/types/search/inside/api.spec.d.ts.map +1 -0
- package/dist/types/search/inside/solve/parseSGS.d.ts.map +1 -1
- package/dist/types/search/inside/solve/puzzles/3x3x3/filter.d.ts.map +1 -1
- package/dist/types/search/inside/solve/puzzles/3x3x3/index.d.ts.map +1 -1
- package/dist/types/search/inside/solve/puzzles/megaminx.sgs.json.d.ts.map +1 -1
- package/dist/types/search/inside/solve/puzzles/sgs-defs.spec.d.ts +2 -0
- package/dist/types/search/inside/solve/puzzles/sgs-defs.spec.d.ts.map +1 -0
- package/dist/types/search/inside/solve/puzzles/skewb.sgs.json.d.ts.map +1 -1
- package/dist/types/search/inside/solve/tremble.d.ts.map +1 -1
- package/dist/types/search/inside/solve/vendor/cstimer/src/js/lib/mathlib.d.ts +4 -31
- package/dist/types/search/inside/solve/vendor/cstimer/src/js/lib/mathlib.d.ts.map +1 -1
- package/dist/types/search/inside/solve/vendor/cstimer/src/js/scramble/scramble_444.d.ts.map +1 -1
- package/dist/types/search/inside/solve/vendor/min2phase/gwt.d.ts +3 -0
- package/dist/types/search/inside/solve/vendor/min2phase/gwt.d.ts.map +1 -0
- package/dist/types/search/inside/solve/vendor/random-uint-below/get-random-values.d.ts.map +1 -1
- package/dist/types/search/inside/solve/vendor/random-uint-below/random-int.d.ts.map +1 -1
- package/dist/types/search/inside/solve/vendor/sq12phase/scramble_sq1.d.ts.map +1 -1
- package/dist/types/search/instantiator.d.ts.map +1 -1
- package/dist/types/search/outside.d.ts +4 -2
- package/dist/types/search/outside.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/stream/twizzle/TwizzleStream.d.ts +9 -8
- package/dist/types/stream/twizzle/TwizzleStream.d.ts.map +1 -1
- package/dist/types/stream/websocket-proxy.d.ts +1 -1
- package/dist/types/stream/websocket-proxy.d.ts.map +1 -1
- package/dist/types/twisty/controllers/TwistyAnimationController.d.ts +34 -0
- package/dist/types/twisty/controllers/TwistyAnimationController.d.ts.map +1 -0
- package/dist/types/twisty/controllers/TwistyPlayerController.d.ts +16 -0
- package/dist/types/twisty/controllers/TwistyPlayerController.d.ts.map +1 -0
- package/dist/types/twisty/heavy-code-imports/3d.d.ts +3 -0
- package/dist/types/twisty/heavy-code-imports/3d.d.ts.map +1 -0
- package/dist/types/twisty/heavy-code-imports/dynamic-entries/3d.d.ts +12 -0
- package/dist/types/twisty/heavy-code-imports/dynamic-entries/3d.d.ts.map +1 -0
- package/dist/types/twisty/index.d.ts +20 -15
- package/dist/types/twisty/index.d.ts.map +1 -1
- package/dist/types/twisty/model/PromiseFreshener.d.ts +14 -0
- package/dist/types/twisty/model/PromiseFreshener.d.ts.map +1 -0
- package/dist/types/twisty/model/TwistyPlayerModel.d.ts +84 -0
- package/dist/types/twisty/model/TwistyPlayerModel.d.ts.map +1 -0
- package/dist/types/twisty/model/UserVisibleErrorTracker.d.ts +11 -0
- package/dist/types/twisty/model/UserVisibleErrorTracker.d.ts.map +1 -0
- package/dist/types/twisty/model/helpers.d.ts +5 -0
- package/dist/types/twisty/model/helpers.d.ts.map +1 -0
- package/dist/types/twisty/model/props/TwistyProp.d.ts +60 -0
- package/dist/types/twisty/model/props/TwistyProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/TwistyProp.spec.d.ts +5 -0
- package/dist/types/twisty/model/props/TwistyProp.spec.d.ts.map +1 -0
- package/dist/types/twisty/model/props/TwistyPropDebugger.d.ts +28 -0
- package/dist/types/twisty/model/props/TwistyPropDebugger.d.ts.map +1 -0
- package/dist/types/twisty/model/props/general/URLProp.d.ts +6 -0
- package/dist/types/twisty/model/props/general/URLProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/puzzle/display/HintFaceletProp.d.ts +7 -0
- package/dist/types/twisty/model/props/puzzle/display/HintFaceletProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/puzzle/display/SpriteProp.d.ts +10 -0
- package/dist/types/twisty/model/props/puzzle/display/SpriteProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/puzzle/display/StickeringProp.d.ts +6 -0
- package/dist/types/twisty/model/props/puzzle/display/StickeringProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/puzzle/state/AlgProp.d.ts +27 -0
- package/dist/types/twisty/model/props/puzzle/state/AlgProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/puzzle/state/AlgTransformationProp.d.ts +14 -0
- package/dist/types/twisty/model/props/puzzle/state/AlgTransformationProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/puzzle/state/AnchoredStartProp.d.ts +15 -0
- package/dist/types/twisty/model/props/puzzle/state/AnchoredStartProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesProp.d.ts +12 -0
- package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesSimplified.d.ts +17 -0
- package/dist/types/twisty/model/props/puzzle/state/CurrentLeavesSimplified.d.ts.map +1 -0
- package/dist/types/twisty/model/props/puzzle/state/CurrentTransformationProp.d.ts +15 -0
- package/dist/types/twisty/model/props/puzzle/state/CurrentTransformationProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorProp.d.ts +17 -0
- package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorRequestProp.d.ts +12 -0
- package/dist/types/twisty/model/props/puzzle/state/IndexerConstructorRequestProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/puzzle/state/IndexerProp.d.ts +15 -0
- package/dist/types/twisty/model/props/puzzle/state/IndexerProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/puzzle/state/LegacyPositionProp.d.ts +12 -0
- package/dist/types/twisty/model/props/puzzle/state/LegacyPositionProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/puzzle/state/PuzzleAlgProp.d.ts +13 -0
- package/dist/types/twisty/model/props/puzzle/state/PuzzleAlgProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/puzzle/state/SetupAnchorProp.d.ts +6 -0
- package/dist/types/twisty/model/props/puzzle/state/SetupAnchorProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/puzzle/structure/PuzzleDefProp.d.ts +11 -0
- package/dist/types/twisty/model/props/puzzle/structure/PuzzleDefProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/puzzle/structure/PuzzleDescriptionProp.d.ts +6 -0
- package/dist/types/twisty/model/props/puzzle/structure/PuzzleDescriptionProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDProp.d.ts +11 -0
- package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.d.ts +6 -0
- package/dist/types/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/puzzle/structure/PuzzleLoaderProp.d.ts +13 -0
- package/dist/types/twisty/model/props/puzzle/structure/PuzzleLoaderProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/timeline/CoarseTimelineInfoProp.d.ts +25 -0
- package/dist/types/twisty/model/props/timeline/CoarseTimelineInfoProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/timeline/DetailedTimelineInfoProp.d.ts +23 -0
- package/dist/types/twisty/model/props/timeline/DetailedTimelineInfoProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/timeline/PlayingInfoProp.d.ts +15 -0
- package/dist/types/twisty/model/props/timeline/PlayingInfoProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/timeline/TempoScaleProp.d.ts +6 -0
- package/dist/types/twisty/model/props/timeline/TempoScaleProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/timeline/TimestampRequestProp.d.ts +16 -0
- package/dist/types/twisty/model/props/timeline/TimestampRequestProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/viewer/BackViewProp.d.ts +7 -0
- package/dist/types/twisty/model/props/viewer/BackViewProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/viewer/BackgroundProp.d.ts +7 -0
- package/dist/types/twisty/model/props/viewer/BackgroundProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/viewer/ButtonAppearanceProp.d.ts +22 -0
- package/dist/types/twisty/model/props/viewer/ButtonAppearanceProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/viewer/ControlPanelProp.d.ts +7 -0
- package/dist/types/twisty/model/props/viewer/ControlPanelProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/viewer/LatitudeLimit.d.ts +6 -0
- package/dist/types/twisty/model/props/viewer/LatitudeLimit.d.ts.map +1 -0
- package/dist/types/twisty/model/props/viewer/OrbitCoordinatesProp.d.ts +16 -0
- package/dist/types/twisty/model/props/viewer/OrbitCoordinatesProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/viewer/OrbitCoordinatesRequestProp.d.ts +15 -0
- package/dist/types/twisty/model/props/viewer/OrbitCoordinatesRequestProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/viewer/TimeRangeProp.d.ts +11 -0
- package/dist/types/twisty/model/props/viewer/TimeRangeProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/viewer/ViewerLinkProp.d.ts +7 -0
- package/dist/types/twisty/model/props/viewer/ViewerLinkProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/viewer/VisualizationProp.d.ts +7 -0
- package/dist/types/twisty/model/props/viewer/VisualizationProp.d.ts.map +1 -0
- package/dist/types/twisty/model/props/viewer/VisualizationStrategyProp.d.ts +13 -0
- package/dist/types/twisty/model/props/viewer/VisualizationStrategyProp.d.ts.map +1 -0
- package/dist/types/twisty/{animation → old/animation}/RenderScheduler.d.ts +3 -0
- package/dist/types/twisty/old/animation/RenderScheduler.d.ts.map +1 -0
- package/dist/types/twisty/{animation → old/animation}/Timeline.d.ts +0 -0
- package/dist/types/twisty/old/animation/Timeline.d.ts.map +1 -0
- package/dist/types/twisty/{animation → old/animation}/cursor/AlgCursor.d.ts +4 -4
- package/dist/types/twisty/old/animation/cursor/AlgCursor.d.ts.map +1 -0
- package/dist/types/twisty/{animation → old/animation}/cursor/CursorTypes.d.ts +4 -4
- package/dist/types/twisty/old/animation/cursor/CursorTypes.d.ts.map +1 -0
- package/dist/types/twisty/{animation → old/animation}/easing.d.ts +0 -0
- package/dist/types/twisty/old/animation/easing.d.ts.map +1 -0
- package/dist/types/twisty/{animation → old/animation}/indexer/AlgDuration.d.ts +1 -1
- package/dist/types/twisty/old/animation/indexer/AlgDuration.d.ts.map +1 -0
- package/dist/types/twisty/old/animation/indexer/AlgIndexer.d.ts +36 -0
- package/dist/types/twisty/old/animation/indexer/AlgIndexer.d.ts.map +1 -0
- package/dist/types/twisty/{animation → old/animation}/indexer/SimpleAlgIndexer.d.ts +3 -3
- package/dist/types/twisty/old/animation/indexer/SimpleAlgIndexer.d.ts.map +1 -0
- package/dist/types/twisty/{animation → old/animation}/indexer/simultaneous-moves/SimultaneousMoveIndexer.d.ts +6 -5
- package/dist/types/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexer.d.ts.map +1 -0
- package/dist/types/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.d.ts +22 -0
- package/dist/types/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.d.ts.map +1 -0
- package/dist/types/twisty/old/animation/indexer/simultaneous-moves/simul-moves.d.ts +26 -0
- package/dist/types/twisty/old/animation/indexer/simultaneous-moves/simul-moves.d.ts.map +1 -0
- package/dist/types/twisty/{animation → old/animation}/indexer/tree/AlgWalker.d.ts +2 -2
- package/dist/types/twisty/old/animation/indexer/tree/AlgWalker.d.ts.map +1 -0
- package/dist/types/twisty/{animation → old/animation}/indexer/tree/TreeAlgIndexer.d.ts +3 -3
- package/dist/types/twisty/old/animation/indexer/tree/TreeAlgIndexer.d.ts.map +1 -0
- package/dist/types/twisty/old/animation/indexer/tree/chunkAlgs.d.ts +3 -0
- package/dist/types/twisty/old/animation/indexer/tree/chunkAlgs.d.ts.map +1 -0
- package/dist/types/twisty/{animation → old/animation}/stream/timeline-move-calculation-draft.d.ts +1 -1
- package/dist/types/twisty/old/animation/stream/timeline-move-calculation-draft.d.ts.map +1 -0
- package/dist/types/twisty/{dom/TwistyAlgViewer.css_.d.ts → old/dom/TwistyAlgViewerV1.css.d.ts} +1 -1
- package/dist/types/twisty/old/dom/TwistyAlgViewerV1.css.d.ts.map +1 -0
- package/dist/types/twisty/old/dom/TwistyAlgViewerV1.d.ts +52 -0
- package/dist/types/twisty/old/dom/TwistyAlgViewerV1.d.ts.map +1 -0
- package/dist/types/twisty/{dom/TwistyPlayer.css_.d.ts → old/dom/TwistyPlayer.css.d.ts} +1 -1
- package/dist/types/twisty/old/dom/TwistyPlayer.css.d.ts.map +1 -0
- package/dist/types/twisty/{dom → old/dom}/TwistyPlayer.d.ts +8 -8
- package/dist/types/twisty/old/dom/TwistyPlayer.d.ts.map +1 -0
- package/dist/types/twisty/old/dom/TwistyPlayer.spec.d.ts +5 -0
- package/dist/types/twisty/old/dom/TwistyPlayer.spec.d.ts.map +1 -0
- package/dist/types/twisty/{dom → old/dom}/TwistyPlayerConfig.d.ts +10 -5
- package/dist/types/twisty/old/dom/TwistyPlayerConfig.d.ts.map +1 -0
- package/dist/types/twisty/old/dom/controls/TwistyControlElement.d.ts +2 -0
- package/dist/types/twisty/old/dom/controls/TwistyControlElement.d.ts.map +1 -0
- package/dist/types/twisty/{dom/controls/TwistyScrubber.css_.d.ts → old/dom/controls/TwistyScrubber.css.d.ts} +1 -1
- package/dist/types/twisty/old/dom/controls/TwistyScrubber.css.d.ts.map +1 -0
- package/dist/types/twisty/{dom → old/dom}/controls/TwistyScrubber.d.ts +1 -1
- package/dist/types/twisty/old/dom/controls/TwistyScrubber.d.ts.map +1 -0
- package/dist/types/twisty/{dom/controls/buttons.css_.d.ts → old/dom/controls/buttons.css.d.ts} +1 -1
- package/dist/types/twisty/old/dom/controls/buttons.css.d.ts.map +1 -0
- package/dist/types/twisty/{dom → old/dom}/controls/buttons.d.ts +1 -1
- package/dist/types/twisty/old/dom/controls/buttons.d.ts.map +1 -0
- package/dist/types/twisty/old/dom/controls/buttons.spec.d.ts +5 -0
- package/dist/types/twisty/old/dom/controls/buttons.spec.d.ts.map +1 -0
- package/dist/types/twisty/{dom → old/dom}/element/ClassListManager.d.ts +0 -0
- package/dist/types/twisty/old/dom/element/ClassListManager.d.ts.map +1 -0
- package/dist/types/twisty/{dom → old/dom}/element/ElementConfig.d.ts +1 -1
- package/dist/types/twisty/old/dom/element/ElementConfig.d.ts.map +1 -0
- package/dist/types/twisty/{dom → old/dom}/element/ManagedCustomElement.d.ts +0 -0
- package/dist/types/twisty/old/dom/element/ManagedCustomElement.d.ts.map +1 -0
- package/dist/types/twisty/{dom → old/dom}/element/node-custom-element-shims.d.ts +0 -0
- package/dist/types/twisty/old/dom/element/node-custom-element-shims.d.ts.map +1 -0
- package/dist/types/twisty/{dom/stream/TwistyStreamSource.css_.d.ts → old/dom/stream/TwistyStreamSource.css.d.ts} +1 -1
- package/dist/types/twisty/old/dom/stream/TwistyStreamSource.css.d.ts.map +1 -0
- package/dist/types/twisty/{dom → old/dom}/stream/TwistyStreamSource.d.ts +0 -0
- package/dist/types/twisty/old/dom/stream/TwistyStreamSource.d.ts.map +1 -0
- package/dist/types/twisty/{dom → old/dom}/viewers/Twisty2DSVG.d.ts +2 -2
- package/dist/types/twisty/old/dom/viewers/Twisty2DSVG.d.ts.map +1 -0
- package/dist/types/twisty/{dom/viewers/Twisty2DSVGView.css_.d.ts → old/dom/viewers/Twisty2DSVGView.css.d.ts} +1 -1
- package/dist/types/twisty/old/dom/viewers/Twisty2DSVGView.css.d.ts.map +1 -0
- package/dist/types/twisty/{dom/viewers/Twisty3DCanvas.css_.d.ts → old/dom/viewers/Twisty3DCanvas.css.d.ts} +1 -1
- package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.css.d.ts.map +1 -0
- package/dist/types/twisty/{dom → old/dom}/viewers/Twisty3DCanvas.d.ts +1 -2
- package/dist/types/twisty/old/dom/viewers/Twisty3DCanvas.d.ts.map +1 -0
- package/dist/types/twisty/{dom → old/dom}/viewers/TwistyOrbitControls.d.ts +0 -0
- package/dist/types/twisty/old/dom/viewers/TwistyOrbitControls.d.ts.map +1 -0
- package/dist/types/twisty/old/dom/viewers/TwistyViewerElement.d.ts +4 -0
- package/dist/types/twisty/old/dom/viewers/TwistyViewerElement.d.ts.map +1 -0
- package/dist/types/twisty/{dom/viewers/TwistyViewerWrapper.css_.d.ts → old/dom/viewers/TwistyViewerWrapper.css.d.ts} +1 -1
- package/dist/types/twisty/old/dom/viewers/TwistyViewerWrapper.css.d.ts.map +1 -0
- package/dist/types/twisty/{dom → old/dom}/viewers/TwistyViewerWrapper.d.ts +0 -0
- package/dist/types/twisty/old/dom/viewers/TwistyViewerWrapper.d.ts.map +1 -0
- package/dist/types/twisty/old/dom/viewers/canvas.d.ts +3 -0
- package/dist/types/twisty/old/dom/viewers/canvas.d.ts.map +1 -0
- package/dist/types/twisty/views/2D/Twisty2DPuzzle.d.ts +29 -0
- package/dist/types/twisty/views/2D/Twisty2DPuzzle.d.ts.map +1 -0
- package/dist/types/twisty/views/2D/Twisty2DPuzzleWrapper.d.ts +16 -0
- package/dist/types/twisty/views/2D/Twisty2DPuzzleWrapper.d.ts.map +1 -0
- package/dist/types/twisty/views/2D/Twisty2DSceneWrapper.d.ts +20 -0
- package/dist/types/twisty/views/2D/Twisty2DSceneWrapper.d.ts.map +1 -0
- package/dist/types/twisty/views/3D/RendererPool.d.ts +4 -0
- package/dist/types/twisty/views/3D/RendererPool.d.ts.map +1 -0
- package/dist/types/twisty/{3D → views/3D}/TAU.d.ts +0 -0
- package/dist/types/twisty/views/3D/TAU.d.ts.map +1 -0
- package/dist/types/twisty/views/3D/Twisty3DPuzzleWrapper.d.ts +17 -0
- package/dist/types/twisty/views/3D/Twisty3DPuzzleWrapper.d.ts.map +1 -0
- package/dist/types/twisty/{3D → views/3D}/Twisty3DRenderTarget.d.ts +0 -0
- package/dist/types/twisty/views/3D/Twisty3DRenderTarget.d.ts.map +1 -0
- package/dist/types/twisty/{3D → views/3D}/Twisty3DScene.d.ts +0 -0
- package/dist/types/twisty/views/3D/Twisty3DScene.d.ts.map +1 -0
- package/dist/types/twisty/views/3D/Twisty3DSceneWrapper.d.ts +28 -0
- package/dist/types/twisty/views/3D/Twisty3DSceneWrapper.d.ts.map +1 -0
- package/dist/types/twisty/views/3D/Twisty3DVantage.d.ts +32 -0
- package/dist/types/twisty/views/3D/Twisty3DVantage.d.ts.map +1 -0
- package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.d.ts +41 -0
- package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.d.ts.map +1 -0
- package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.spec.d.ts +5 -0
- package/dist/types/twisty/views/3D/TwistyOrbitControlsV2.spec.d.ts.map +1 -0
- package/dist/types/twisty/{3D → views/3D}/puzzles/Cube3D.d.ts +11 -7
- package/dist/types/twisty/views/3D/puzzles/Cube3D.d.ts.map +1 -0
- package/dist/types/twisty/{3D → views/3D}/puzzles/KPuzzleWrapper.d.ts +2 -2
- package/dist/types/twisty/views/3D/puzzles/KPuzzleWrapper.d.ts.map +1 -0
- package/dist/types/twisty/views/3D/puzzles/PG3D.d.ts +57 -0
- package/dist/types/twisty/views/3D/puzzles/PG3D.d.ts.map +1 -0
- package/dist/types/twisty/{3D → views/3D}/puzzles/Twisty3DPuzzle.d.ts +1 -1
- package/dist/types/twisty/views/3D/puzzles/Twisty3DPuzzle.d.ts.map +1 -0
- package/dist/types/twisty/{3D → views/3D}/puzzles/TwistyTestBox.d.ts +2 -2
- package/dist/types/twisty/views/3D/puzzles/TwistyTestBox.d.ts.map +1 -0
- package/dist/types/twisty/views/TwistyAlgEditor/LeafTokens.d.ts +18 -0
- package/dist/types/twisty/views/TwistyAlgEditor/LeafTokens.d.ts.map +1 -0
- package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.css.d.ts +3 -0
- package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.css.d.ts.map +1 -0
- package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.d.ts +40 -0
- package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.d.ts.map +1 -0
- package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.spec.d.ts +5 -0
- package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.spec.d.ts.map +1 -0
- package/dist/types/twisty/views/TwistyAlgEditor/model.d.ts +61 -0
- package/dist/types/twisty/views/TwistyAlgEditor/model.d.ts.map +1 -0
- package/dist/types/twisty/views/TwistyAlgViewer.css.d.ts +3 -0
- package/dist/types/twisty/views/TwistyAlgViewer.css.d.ts.map +1 -0
- package/dist/types/twisty/{dom → views}/TwistyAlgViewer.d.ts +6 -6
- package/dist/types/twisty/views/TwistyAlgViewer.d.ts.map +1 -0
- package/dist/types/twisty/views/TwistyPlayer.d.ts +97 -0
- package/dist/types/twisty/views/TwistyPlayer.d.ts.map +1 -0
- package/dist/types/twisty/views/TwistyPlayerSettable.d.ts +71 -0
- package/dist/types/twisty/views/TwistyPlayerSettable.d.ts.map +1 -0
- package/dist/types/twisty/views/control-panel/TwistyButtonsV2.d.ts +33 -0
- package/dist/types/twisty/views/control-panel/TwistyButtonsV2.d.ts.map +1 -0
- package/dist/types/twisty/views/control-panel/TwistyScrubberV2.d.ts +14 -0
- package/dist/types/twisty/views/control-panel/TwistyScrubberV2.d.ts.map +1 -0
- package/dist/types/twisty/views/control-panel/webkit-fullscreen.d.ts +15 -0
- package/dist/types/twisty/views/control-panel/webkit-fullscreen.d.ts.map +1 -0
- package/dist/types/twisty/views/document.d.ts +2 -0
- package/dist/types/twisty/views/document.d.ts.map +1 -0
- package/dist/types/twisty/views/screenshot.d.ts +12 -0
- package/dist/types/twisty/views/screenshot.d.ts.map +1 -0
- package/dist/types/vendor/p-lazy/p-lazy.d.ts +10 -0
- package/dist/types/vendor/p-lazy/p-lazy.d.ts.map +1 -0
- package/dist/types/vendor/three/examples/jsm/libs/stats.modified.module.d.ts +33 -0
- package/dist/types/vendor/three/examples/jsm/libs/stats.modified.module.d.ts.map +1 -0
- package/docs/.DS_Store +0 -0
- package/docs/cubing/.DS_Store +0 -0
- package/docs/cubing/alg/index.html +37 -23
- package/docs/cubing/index.html +56 -252
- package/docs/cubing/scramble/index.html +122 -0
- package/docs/cubing/twisty/index.html +329 -0
- package/docs/main.css +15 -3
- package/package.json +83 -57
- package/src/cubing/.DS_Store +0 -0
- package/src/cubing/alg/.DS_Store +0 -0
- package/src/cubing/alg/Alg.ts +89 -0
- package/src/cubing/alg/common.ts +4 -2
- package/src/cubing/alg/iteration.ts +1 -1
- package/src/cubing/alg/parse.ts +2 -0
- package/src/cubing/alg/test/alg-comparison.ts +1 -0
- package/src/cubing/alg/units/.DS_Store +0 -0
- package/src/cubing/alg/units/Unit.ts +0 -3
- package/src/cubing/alg/units/containers/Commutator.ts +1 -1
- package/src/cubing/alg/units/leaves/Move.ts +4 -4
- package/src/cubing/bluetooth/.DS_Store +0 -0
- package/src/cubing/bluetooth/connect/index.ts +1 -1
- package/src/cubing/bluetooth/smart-puzzle/Heykube.ts +1 -1
- package/src/cubing/bluetooth/smart-puzzle/bluetooth-puzzle.ts +1 -1
- package/src/cubing/bluetooth/smart-puzzle/gan.ts +5 -5
- package/src/cubing/bluetooth/smart-puzzle/giiker.ts +2 -2
- package/src/cubing/bluetooth/smart-puzzle/gocube.ts +5 -5
- package/src/cubing/bluetooth/smart-robot/GanRobot.ts +5 -5
- package/src/cubing/bluetooth/smart-timer/GanTimer.ts +2 -2
- package/src/cubing/kpuzzle/.DS_Store +0 -0
- package/src/cubing/kpuzzle/3x3x3/3x3x3.kpuzzle.json.spec.ts +40 -0
- package/src/cubing/{puzzles/implementations/3x3x3/3x3x3.kpuzzle.json_.ts → kpuzzle/3x3x3/3x3x3.kpuzzle.json.ts} +11 -6
- package/src/cubing/kpuzzle/canon.spec.ts +6 -11
- package/src/cubing/kpuzzle/canonicalize.ts +1 -1
- package/src/cubing/kpuzzle/definition_types.ts +0 -3
- package/src/cubing/kpuzzle/index.ts +1 -0
- package/src/cubing/kpuzzle/prunetable.spec.ts +2 -4
- package/src/cubing/kpuzzle/puzzle-orientation.ts +1 -1
- package/src/cubing/kpuzzle/svg.ts +4 -9
- package/src/cubing/kpuzzle/transformations.ts +1 -1
- package/src/cubing/protocol/binary/binary3x3x3.spec.ts +5 -2
- package/src/cubing/protocol/binary/hex.ts +4 -4
- package/src/cubing/protocol/binary/orbit-indexing.ts +2 -2
- package/src/cubing/protocol/binary/puzzle-orientation.ts +2 -2
- package/src/cubing/puzzle-geometry/Options.ts +151 -22
- package/src/cubing/puzzle-geometry/PGPuzzles.spec.ts +24 -28
- package/src/cubing/puzzle-geometry/PermOriSet.ts +99 -98
- package/src/cubing/puzzle-geometry/PlatonicGenerator.ts +1 -1
- package/src/cubing/puzzle-geometry/PuzzleGeometry.ts +836 -867
- package/src/cubing/puzzle-geometry/Quat.ts +1 -68
- package/src/cubing/puzzle-geometry/SchreierSims.ts +2 -13
- package/src/cubing/puzzle-geometry/index.ts +2 -11
- package/src/cubing/puzzle-geometry/interfaces.ts +1 -27
- package/src/cubing/puzzle-geometry/orientcenters.spec.ts +24 -30
- package/src/cubing/puzzles/.DS_Store +0 -0
- package/src/cubing/puzzles/PuzzleLoader.ts +1 -1
- package/src/cubing/puzzles/async/async-pg3d.ts +5 -8
- package/src/cubing/puzzles/customPGPuzzleLoader.ts +60 -0
- package/src/cubing/puzzles/implementations/.DS_Store +0 -0
- package/src/cubing/puzzles/implementations/2x2x2/{2x2x2.kpuzzle.json_.ts → 2x2x2.kpuzzle.json.ts} +0 -0
- package/src/cubing/puzzles/implementations/2x2x2/index.ts +1 -1
- package/src/cubing/puzzles/implementations/3x3x3/index.ts +2 -3
- package/src/cubing/puzzles/implementations/clock/{clock.kpuzzle.json_.ts → clock.kpuzzle.json.ts} +0 -0
- package/src/cubing/puzzles/implementations/clock/index.ts +1 -1
- package/src/cubing/puzzles/implementations/fto/index.ts +19 -11
- package/src/cubing/puzzles/implementations/pyraminx/{pyraminx.kpuzzle.json_.ts → pyraminx.kpuzzle.json.ts} +0 -0
- package/src/cubing/puzzles/implementations/square1/index.ts +1 -2
- package/src/cubing/puzzles/implementations/square1/{sq1-hyperorbit.kpuzzle.json_.ts → sq1-hyperorbit.kpuzzle.json.ts} +0 -0
- package/src/cubing/puzzles/index.ts +30 -20
- package/src/cubing/puzzles/stickerings/appearance.ts +10 -9
- package/src/cubing/puzzles/stickerings/cube-stickerings.ts +8 -0
- package/src/cubing/puzzles/stickerings/fto-stickerings.ts +9 -0
- package/src/cubing/puzzles/stickerings/global-custom-stickering-hack.ts +61 -0
- package/src/cubing/search/.DS_Store +0 -0
- package/src/cubing/search/.gitignore +1 -2
- package/src/cubing/search/esm-test-worker.js +1 -1
- package/src/cubing/search/index.ts +1 -0
- package/src/cubing/search/inside/api.spec.ts +1 -0
- package/src/cubing/search/inside/api.ts +6 -1
- package/src/cubing/search/inside/solve/parseSGS.ts +7 -11
- package/src/cubing/search/inside/solve/puzzles/2x2x2.ts +3 -3
- package/src/cubing/search/inside/solve/puzzles/3x3x3/filter.ts +0 -6
- package/src/cubing/search/inside/solve/puzzles/3x3x3/index.ts +0 -2
- package/src/cubing/search/inside/solve/puzzles/FTO.sgs +264 -0
- package/src/cubing/search/inside/solve/puzzles/megaminx.sgs.json.ts +4 -6
- package/src/cubing/search/inside/solve/puzzles/skewb.sgs.json.ts +4 -6
- package/src/cubing/search/inside/solve/tremble.ts +6 -9
- package/src/cubing/search/inside/solve/vendor/cstimer/src/js/lib/mathlib.ts +20 -822
- package/src/cubing/search/inside/solve/vendor/cstimer/src/js/scramble/scramble_444.ts +177 -252
- package/src/cubing/search/inside/solve/vendor/min2phase/gwt.js +62 -222
- package/src/cubing/search/inside/solve/vendor/random-uint-below/get-random-values.ts +4 -5
- package/src/cubing/search/inside/solve/vendor/random-uint-below/random-int.ts +9 -11
- package/src/cubing/search/inside/solve/vendor/sq12phase/scramble_sq1.js +13 -582
- package/src/cubing/search/instantiator.ts +11 -7
- package/src/cubing/search/outside.ts +8 -2
- package/src/cubing/search/worker-inside-generated-string.js +1 -1
- package/src/cubing/stream/.DS_Store +0 -0
- package/src/cubing/stream/process/ReorientedStream.ts +1 -1
- package/src/cubing/stream/twizzle/TwizzleStream.ts +11 -8
- package/src/cubing/stream/websocket-proxy.ts +1 -3
- package/src/cubing/twisty/.DS_Store +0 -0
- package/src/cubing/twisty/controllers/TwistyAnimationController.ts +248 -0
- package/src/cubing/twisty/controllers/TwistyPlayerController.ts +38 -0
- package/src/cubing/twisty/heavy-code-imports/3d.ts +18 -0
- package/src/cubing/twisty/heavy-code-imports/dynamic-entries/3d.ts +41 -0
- package/src/cubing/twisty/index.ts +24 -17
- package/src/cubing/twisty/model/.DS_Store +0 -0
- package/src/cubing/twisty/model/PromiseFreshener.ts +49 -0
- package/src/cubing/twisty/model/TwistyPlayerModel.ts +222 -0
- package/src/cubing/twisty/model/UserVisibleErrorTracker.ts +22 -0
- package/src/cubing/twisty/model/helpers.ts +47 -0
- package/src/cubing/{search/vendor → twisty/model/props}/.DS_Store +0 -0
- package/src/cubing/twisty/model/props/TwistyProp.spec.ts +38 -0
- package/src/cubing/twisty/model/props/TwistyProp.ts +366 -0
- package/src/cubing/twisty/model/props/TwistyPropDebugger.ts +370 -0
- package/src/cubing/twisty/model/props/general/URLProp.ts +14 -0
- package/src/cubing/{solve → twisty/model/props/puzzle}/.DS_Store +0 -0
- package/src/cubing/twisty/model/props/puzzle/display/HintFaceletProp.ts +10 -0
- package/src/cubing/twisty/model/props/puzzle/display/SpriteProp.ts +43 -0
- package/src/cubing/twisty/model/props/puzzle/display/StickeringProp.ts +8 -0
- package/src/cubing/twisty/model/props/puzzle/state/AlgProp.ts +91 -0
- package/src/cubing/twisty/model/props/puzzle/state/AlgTransformationProp.ts +28 -0
- package/src/cubing/twisty/model/props/puzzle/state/AnchoredStartProp.ts +44 -0
- package/src/cubing/twisty/model/props/puzzle/state/CurrentLeavesProp.ts +91 -0
- package/src/cubing/twisty/model/props/puzzle/state/CurrentLeavesSimplified.ts +48 -0
- package/src/cubing/twisty/model/props/puzzle/state/CurrentTransformationProp.ts +46 -0
- package/src/cubing/twisty/model/props/puzzle/state/IndexerConstructorProp.ts +46 -0
- package/src/cubing/twisty/model/props/puzzle/state/IndexerConstructorRequestProp.ts +15 -0
- package/src/cubing/twisty/model/props/puzzle/state/IndexerProp.ts +24 -0
- package/src/cubing/twisty/model/props/puzzle/state/LegacyPositionProp.ts +22 -0
- package/src/cubing/twisty/model/props/puzzle/state/PuzzleAlgProp.ts +28 -0
- package/src/cubing/twisty/model/props/puzzle/state/SetupAnchorProp.ts +8 -0
- package/src/cubing/twisty/model/props/puzzle/structure/PuzzleDefProp.ts +14 -0
- package/src/cubing/twisty/model/props/puzzle/structure/PuzzleDescriptionProp.ts +14 -0
- package/src/cubing/twisty/model/props/puzzle/structure/PuzzleIDProp.ts +12 -0
- package/src/cubing/twisty/model/props/puzzle/structure/PuzzleIDRequestProp.ts +17 -0
- package/src/cubing/twisty/model/props/puzzle/structure/PuzzleLoaderProp.ts +38 -0
- package/src/cubing/twisty/model/props/timeline/CoarseTimelineInfoProp.ts +45 -0
- package/src/cubing/twisty/model/props/timeline/DetailedTimelineInfoProp.ts +76 -0
- package/src/cubing/twisty/model/props/timeline/PlayingInfoProp.ts +51 -0
- package/src/cubing/twisty/model/props/timeline/TempoScaleProp.ts +13 -0
- package/src/cubing/twisty/model/props/timeline/TimestampRequestProp.ts +38 -0
- package/src/cubing/twisty/model/props/viewer/BackViewProp.ts +10 -0
- package/src/cubing/twisty/model/props/viewer/BackgroundProp.ts +10 -0
- package/src/cubing/twisty/model/props/viewer/ButtonAppearanceProp.ts +86 -0
- package/src/cubing/twisty/model/props/viewer/ControlPanelProp.ts +10 -0
- package/src/cubing/twisty/model/props/viewer/LatitudeLimit.ts +11 -0
- package/src/cubing/twisty/model/props/viewer/OrbitCoordinatesProp.ts +56 -0
- package/src/cubing/twisty/model/props/viewer/OrbitCoordinatesRequestProp.ts +69 -0
- package/src/cubing/twisty/model/props/viewer/TimeRangeProp.ts +15 -0
- package/src/cubing/twisty/model/props/viewer/ViewerLinkProp.ts +10 -0
- package/src/cubing/twisty/model/props/viewer/VisualizationProp.ts +10 -0
- package/src/cubing/twisty/model/props/viewer/VisualizationStrategyProp.ts +45 -0
- package/src/cubing/twisty/old/.DS_Store +0 -0
- package/src/cubing/twisty/old/animation/.DS_Store +0 -0
- package/src/cubing/twisty/{animation → old/animation}/RenderScheduler.ts +5 -0
- package/src/cubing/twisty/{animation → old/animation}/Timeline.ts +0 -0
- package/src/cubing/twisty/{animation → old/animation}/cursor/AlgCursor.ts +15 -8
- package/src/cubing/twisty/{animation → old/animation}/cursor/CursorTypes.ts +4 -4
- package/src/cubing/twisty/{animation → old/animation}/easing.ts +0 -0
- package/src/cubing/{search/inside → twisty/old/animation/indexer}/.DS_Store +0 -0
- package/src/cubing/twisty/{animation → old/animation}/indexer/AlgDuration.ts +1 -1
- package/src/cubing/twisty/old/animation/indexer/AlgIndexer.ts +86 -0
- package/src/cubing/twisty/{animation → old/animation}/indexer/SimpleAlgIndexer.ts +9 -6
- package/src/cubing/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexer.ts +181 -0
- package/src/cubing/twisty/old/animation/indexer/simultaneous-moves/SimultaneousMoveIndexerV2.ts +243 -0
- package/src/cubing/twisty/{animation → old/animation}/indexer/simultaneous-moves/simul-moves.ts +46 -34
- package/src/cubing/twisty/{animation → old/animation}/indexer/tree/AlgWalker.ts +6 -3
- package/src/cubing/twisty/{animation → old/animation}/indexer/tree/TreeAlgIndexer.ts +8 -5
- package/src/cubing/twisty/{animation → old/animation}/indexer/tree/chunkAlgs.ts +2 -2
- package/src/cubing/twisty/{animation → old/animation}/stream/timeline-move-calculation-draft.spec.ts.TODO +0 -0
- package/src/cubing/twisty/{animation → old/animation}/stream/timeline-move-calculation-draft.ts +2 -2
- package/src/cubing/twisty/old/dom/.DS_Store +0 -0
- package/src/cubing/twisty/{dom/TwistyAlgViewer.css_.ts → old/dom/TwistyAlgViewerV1.css.ts} +0 -0
- package/src/cubing/twisty/{dom/TwistyAlgViewer.ts → old/dom/TwistyAlgViewerV1.ts} +43 -36
- package/src/cubing/twisty/{dom/TwistyPlayer.css_.ts → old/dom/TwistyPlayer.css.ts} +28 -1
- package/src/cubing/twisty/{dom → old/dom}/TwistyPlayer.spec.ts +5 -6
- package/src/cubing/twisty/{dom → old/dom}/TwistyPlayer.ts +36 -43
- package/src/cubing/twisty/{dom → old/dom}/TwistyPlayerConfig.ts +27 -10
- package/src/cubing/twisty/{dom/controls/TwistyControlElement.ts.ts → old/dom/controls/TwistyControlElement.ts} +0 -0
- package/src/cubing/twisty/{dom/controls/TwistyScrubber.css_.ts → old/dom/controls/TwistyScrubber.css.ts} +0 -0
- package/src/cubing/twisty/{dom → old/dom}/controls/TwistyScrubber.ts +3 -3
- package/src/cubing/twisty/{dom/controls/buttons.css_.ts → old/dom/controls/buttons.css.ts} +14 -1
- package/src/cubing/twisty/{dom → old/dom}/controls/buttons.spec.ts +1 -1
- package/src/cubing/twisty/{dom → old/dom}/controls/buttons.ts +15 -15
- package/src/cubing/twisty/{dom → old/dom}/element/ClassListManager.ts +0 -0
- package/src/cubing/twisty/{dom → old/dom}/element/ElementConfig.ts +1 -1
- package/src/cubing/twisty/{dom → old/dom}/element/ManagedCustomElement.ts +0 -0
- package/src/cubing/twisty/{dom → old/dom}/element/node-custom-element-shims.ts +0 -0
- package/src/cubing/twisty/{dom/stream/TwistyStreamSource.css_.ts → old/dom/stream/TwistyStreamSource.css.ts} +0 -0
- package/src/cubing/twisty/{dom → old/dom}/stream/TwistyStreamSource.ts +8 -8
- package/src/cubing/twisty/{dom → old/dom}/viewers/Twisty2DSVG.ts +7 -9
- package/src/cubing/twisty/{dom/viewers/Twisty2DSVGView.css_.ts → old/dom/viewers/Twisty2DSVGView.css.ts} +0 -0
- package/src/cubing/twisty/{dom/viewers/Twisty3DCanvas.css_.ts → old/dom/viewers/Twisty3DCanvas.css.ts} +0 -0
- package/src/cubing/twisty/{dom → old/dom}/viewers/Twisty3DCanvas.ts +5 -12
- package/src/cubing/twisty/{dom → old/dom}/viewers/TwistyOrbitControls.ts +53 -20
- package/src/cubing/twisty/{dom → old/dom}/viewers/TwistyViewerElement.ts +1 -1
- package/src/cubing/twisty/{dom/viewers/TwistyViewerWrapper.css_.ts → old/dom/viewers/TwistyViewerWrapper.css.ts} +0 -0
- package/src/cubing/twisty/{dom → old/dom}/viewers/TwistyViewerWrapper.ts +1 -1
- package/src/cubing/twisty/old/dom/viewers/canvas.ts +9 -0
- package/src/cubing/twisty/views/.DS_Store +0 -0
- package/src/cubing/twisty/views/2D/Twisty2DPuzzle.ts +150 -0
- package/src/cubing/twisty/views/2D/Twisty2DPuzzleWrapper.ts +52 -0
- package/src/cubing/twisty/views/2D/Twisty2DSceneWrapper.ts +77 -0
- package/src/cubing/twisty/views/3D/RendererPool.ts +53 -0
- package/src/cubing/twisty/{3D → views/3D}/TAU.ts +0 -0
- package/src/cubing/twisty/views/3D/Twisty3DPuzzleWrapper.ts +168 -0
- package/src/cubing/twisty/{3D → views/3D}/Twisty3DRenderTarget.ts +0 -0
- package/src/cubing/twisty/{3D → views/3D}/Twisty3DScene.ts +0 -0
- package/src/cubing/twisty/views/3D/Twisty3DSceneWrapper.ts +144 -0
- package/src/cubing/twisty/views/3D/Twisty3DVantage.ts +244 -0
- package/src/cubing/twisty/views/3D/TwistyOrbitControlsV2.spec.ts +209 -0
- package/src/cubing/twisty/views/3D/TwistyOrbitControlsV2.ts +270 -0
- package/src/cubing/twisty/{3D → views/3D}/puzzles/Cube3D.ts +36 -15
- package/src/cubing/twisty/{3D → views/3D}/puzzles/KPuzzleWrapper.ts +4 -5
- package/src/cubing/twisty/views/3D/puzzles/PG3D.ts +988 -0
- package/src/cubing/twisty/views/3D/puzzles/Twisty3DPuzzle.ts +6 -0
- package/src/cubing/twisty/{3D → views/3D}/puzzles/TwistyTestBox.ts +2 -2
- package/src/cubing/twisty/views/TwistyAlgEditor/LeafTokens.ts +116 -0
- package/src/cubing/twisty/{dom/TwistyAlgEditor.css_.ts → views/TwistyAlgEditor/TwistyAlgEditor.css.ts} +3 -1
- package/src/cubing/twisty/{dom → views/TwistyAlgEditor}/TwistyAlgEditor.spec.ts +7 -6
- package/src/cubing/twisty/views/TwistyAlgEditor/TwistyAlgEditor.ts +360 -0
- package/src/cubing/twisty/views/TwistyAlgEditor/model.ts +179 -0
- package/src/cubing/twisty/views/TwistyAlgViewer.css.ts +25 -0
- package/src/cubing/twisty/views/TwistyAlgViewer.ts +502 -0
- package/src/cubing/twisty/views/TwistyPlayer.ts +327 -0
- package/src/cubing/twisty/views/TwistyPlayerSettable.ts +111 -0
- package/src/cubing/twisty/views/control-panel/TwistyButtonsV2.ts +159 -0
- package/src/cubing/twisty/views/control-panel/TwistyScrubberV2.ts +145 -0
- package/src/cubing/twisty/views/control-panel/webkit-fullscreen.ts +44 -0
- package/src/cubing/twisty/views/document.ts +4 -0
- package/src/cubing/twisty/views/screenshot.ts +90 -0
- package/src/cubing/vendor/.DS_Store +0 -0
- package/src/cubing/vendor/p-lazy/license +9 -0
- package/src/cubing/vendor/p-lazy/p-lazy.ts +52 -0
- package/src/cubing/vendor/p-lazy/readme.md +54 -0
- package/src/cubing/vendor/three/examples/jsm/libs/stats.modified.module.ts +179 -0
- package/dist/esm/chunk-CWVB5RRW.js.map +0 -7
- package/dist/esm/chunk-KKSDHNLH.js.map +0 -7
- package/dist/esm/chunk-YNB7QLBF.js.map +0 -7
- package/dist/esm/worker-inside-generated-string-LT4NV55Q.js +0 -2826
- package/dist/esm/worker-inside-generated-string-LT4NV55Q.js.map +0 -7
- package/dist/types/puzzles/implementations/2x2x2/2x2x2.kpuzzle.json_.d.ts.map +0 -1
- package/dist/types/puzzles/implementations/3x3x3/3x3x3.kpuzzle.json_.d.ts +0 -3
- package/dist/types/puzzles/implementations/3x3x3/3x3x3.kpuzzle.json_.d.ts.map +0 -1
- package/dist/types/puzzles/implementations/clock/clock.kpuzzle.json_.d.ts.map +0 -1
- package/dist/types/puzzles/implementations/pyraminx/pyraminx.kpuzzle.json_.d.ts.map +0 -1
- package/dist/types/puzzles/implementations/square1/sq1-hyperorbit.kpuzzle.json_.d.ts.map +0 -1
- package/dist/types/search/inside/solve/vendor/cstimer/src/js/lgarron-additions-for-typescript/shim-lib.d.ts +0 -3
- package/dist/types/search/inside/solve/vendor/cstimer/src/js/lgarron-additions-for-typescript/shim-lib.d.ts.map +0 -1
- package/dist/types/twisty/3D/TAU.d.ts.map +0 -1
- package/dist/types/twisty/3D/Twisty3DRenderTarget.d.ts.map +0 -1
- package/dist/types/twisty/3D/Twisty3DScene.d.ts.map +0 -1
- package/dist/types/twisty/3D/puzzles/Cube3D.d.ts.map +0 -1
- package/dist/types/twisty/3D/puzzles/KPuzzleWrapper.d.ts.map +0 -1
- package/dist/types/twisty/3D/puzzles/PG3D.d.ts +0 -51
- package/dist/types/twisty/3D/puzzles/PG3D.d.ts.map +0 -1
- package/dist/types/twisty/3D/puzzles/Twisty3DPuzzle.d.ts.map +0 -1
- package/dist/types/twisty/3D/puzzles/TwistyTestBox.d.ts.map +0 -1
- package/dist/types/twisty/animation/RenderScheduler.d.ts.map +0 -1
- package/dist/types/twisty/animation/Timeline.d.ts.map +0 -1
- package/dist/types/twisty/animation/cursor/AlgCursor.d.ts.map +0 -1
- package/dist/types/twisty/animation/cursor/CursorTypes.d.ts.map +0 -1
- package/dist/types/twisty/animation/easing.d.ts.map +0 -1
- package/dist/types/twisty/animation/indexer/AlgDuration.d.ts.map +0 -1
- package/dist/types/twisty/animation/indexer/AlgIndexer.d.ts +0 -15
- package/dist/types/twisty/animation/indexer/AlgIndexer.d.ts.map +0 -1
- package/dist/types/twisty/animation/indexer/SimpleAlgIndexer.d.ts.map +0 -1
- package/dist/types/twisty/animation/indexer/simultaneous-moves/SimultaneousMoveIndexer.d.ts.map +0 -1
- package/dist/types/twisty/animation/indexer/simultaneous-moves/simul-moves.d.ts +0 -25
- package/dist/types/twisty/animation/indexer/simultaneous-moves/simul-moves.d.ts.map +0 -1
- package/dist/types/twisty/animation/indexer/tree/AlgWalker.d.ts.map +0 -1
- package/dist/types/twisty/animation/indexer/tree/TreeAlgIndexer.d.ts.map +0 -1
- package/dist/types/twisty/animation/indexer/tree/chunkAlgs.d.ts +0 -3
- package/dist/types/twisty/animation/indexer/tree/chunkAlgs.d.ts.map +0 -1
- package/dist/types/twisty/animation/stream/timeline-move-calculation-draft.d.ts.map +0 -1
- package/dist/types/twisty/dom/TwistyAlgEditor.css_.d.ts +0 -3
- package/dist/types/twisty/dom/TwistyAlgEditor.css_.d.ts.map +0 -1
- package/dist/types/twisty/dom/TwistyAlgEditor.d.ts +0 -27
- package/dist/types/twisty/dom/TwistyAlgEditor.d.ts.map +0 -1
- package/dist/types/twisty/dom/TwistyAlgEditorStartCharSearch.d.ts +0 -26
- package/dist/types/twisty/dom/TwistyAlgEditorStartCharSearch.d.ts.map +0 -1
- package/dist/types/twisty/dom/TwistyAlgViewer.css_.d.ts.map +0 -1
- package/dist/types/twisty/dom/TwistyAlgViewer.d.ts.map +0 -1
- package/dist/types/twisty/dom/TwistyPlayer.css_.d.ts.map +0 -1
- package/dist/types/twisty/dom/TwistyPlayer.d.ts.map +0 -1
- package/dist/types/twisty/dom/TwistyPlayerConfig.d.ts.map +0 -1
- package/dist/types/twisty/dom/controls/TwistyControlElement.ts.d.ts +0 -2
- package/dist/types/twisty/dom/controls/TwistyControlElement.ts.d.ts.map +0 -1
- package/dist/types/twisty/dom/controls/TwistyScrubber.css_.d.ts.map +0 -1
- package/dist/types/twisty/dom/controls/TwistyScrubber.d.ts.map +0 -1
- package/dist/types/twisty/dom/controls/buttons.css_.d.ts.map +0 -1
- package/dist/types/twisty/dom/controls/buttons.d.ts.map +0 -1
- package/dist/types/twisty/dom/element/ClassListManager.d.ts.map +0 -1
- package/dist/types/twisty/dom/element/ElementConfig.d.ts.map +0 -1
- package/dist/types/twisty/dom/element/ManagedCustomElement.d.ts.map +0 -1
- package/dist/types/twisty/dom/element/node-custom-element-shims.d.ts.map +0 -1
- package/dist/types/twisty/dom/stream/TwistyStreamSource.css_.d.ts.map +0 -1
- package/dist/types/twisty/dom/stream/TwistyStreamSource.d.ts.map +0 -1
- package/dist/types/twisty/dom/viewers/Twisty2DSVG.d.ts.map +0 -1
- package/dist/types/twisty/dom/viewers/Twisty2DSVGView.css_.d.ts.map +0 -1
- package/dist/types/twisty/dom/viewers/Twisty3DCanvas.css_.d.ts.map +0 -1
- package/dist/types/twisty/dom/viewers/Twisty3DCanvas.d.ts.map +0 -1
- package/dist/types/twisty/dom/viewers/TwistyOrbitControls.d.ts.map +0 -1
- package/dist/types/twisty/dom/viewers/TwistyViewerElement.d.ts +0 -4
- package/dist/types/twisty/dom/viewers/TwistyViewerElement.d.ts.map +0 -1
- package/dist/types/twisty/dom/viewers/TwistyViewerWrapper.css_.d.ts.map +0 -1
- package/dist/types/twisty/dom/viewers/TwistyViewerWrapper.d.ts.map +0 -1
- package/dist/types/twisty/dom/viewers/canvas.d.ts +0 -2
- package/dist/types/twisty/dom/viewers/canvas.d.ts.map +0 -1
- package/dist/types/vendor/three/examples/jsm/libs/stats.module.d.ts +0 -2
- package/dist/types/vendor/three/examples/jsm/libs/stats.module.d.ts.map +0 -1
- package/dist/types/vendor/three/examples/jsm/libs/stats.module.wrapped.d.ts +0 -21
- package/dist/types/vendor/three/examples/jsm/libs/stats.module.wrapped.d.ts.map +0 -1
- package/src/cubing/protocol/.DS_Store +0 -0
- package/src/cubing/puzzle-geometry/.DS_Store +0 -0
- package/src/cubing/search/inside/solve/.DS_Store +0 -0
- package/src/cubing/search/inside/solve/puzzles/.DS_Store +0 -0
- package/src/cubing/search/inside/solve/puzzles/3x3x3/.DS_Store +0 -0
- package/src/cubing/search/inside/solve/vendor/.DS_Store +0 -0
- package/src/cubing/search/inside/solve/vendor/cstimer/.DS_Store +0 -0
- package/src/cubing/search/inside/solve/vendor/cstimer/src/.DS_Store +0 -0
- package/src/cubing/search/inside/solve/vendor/cstimer/src/js/.DS_Store +0 -0
- package/src/cubing/search/inside/solve/vendor/cstimer/src/js/lgarron-additions-for-typescript/.DS_Store +0 -0
- package/src/cubing/search/inside/solve/vendor/cstimer/src/js/lgarron-additions-for-typescript/shim-lib.ts +0 -13
- package/src/cubing/search/inside/solve/vendor/cstimer/src/js/lib/.DS_Store +0 -0
- package/src/cubing/search/inside/solve/vendor/cstimer/src/js/scramble/.DS_Store +0 -0
- package/src/cubing/search/inside/solve/vendor/sgs/.DS_Store +0 -0
- package/src/cubing/search/inside/solve/vendor/sgs/src/.DS_Store +0 -0
- package/src/cubing/search/inside/solve/vendor/sgs/src/test/.DS_Store +0 -0
- package/src/cubing/search/vendor/comlink-everywhere/.DS_Store +0 -0
- package/src/cubing/twisty/3D/puzzles/PG3D.ts +0 -600
- package/src/cubing/twisty/3D/puzzles/Twisty3DPuzzle.ts +0 -9
- package/src/cubing/twisty/3D/puzzles/mkbhd.svg +0 -5
- package/src/cubing/twisty/animation/indexer/AlgIndexer.ts +0 -25
- package/src/cubing/twisty/animation/indexer/simultaneous-moves/SimultaneousMoveIndexer.ts +0 -168
- package/src/cubing/twisty/dom/TwistyAlgEditor.ts +0 -373
- package/src/cubing/twisty/dom/TwistyAlgEditorStartCharSearch.ts +0 -138
- package/src/cubing/twisty/dom/viewers/canvas.ts +0 -4
- package/src/cubing/twisty/views/3D/.DS_Store +0 -0
- package/src/cubing/vendor/three/.DS_Store +0 -0
- package/src/cubing/vendor/three/examples/jsm/libs/stats.module.ts +0 -2
- package/src/cubing/vendor/three/examples/jsm/libs/stats.module.wrapped.d.ts +0 -24
- package/src/cubing/vendor/three/examples/jsm/libs/stats.module.wrapped.js +0 -178
|
@@ -0,0 +1,2512 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getFaceletAppearance,
|
|
3
|
+
puzzles
|
|
4
|
+
} from "./chunk-CQS6JZ7G.js";
|
|
5
|
+
import {
|
|
6
|
+
areTransformationsEquivalent,
|
|
7
|
+
transformationForQuantumMove
|
|
8
|
+
} from "./chunk-YV3RT5PX.js";
|
|
9
|
+
import {
|
|
10
|
+
Alg
|
|
11
|
+
} from "./chunk-BU5PUJK3.js";
|
|
12
|
+
import {
|
|
13
|
+
__privateAdd,
|
|
14
|
+
__privateGet,
|
|
15
|
+
__privateMethod,
|
|
16
|
+
__privateSet
|
|
17
|
+
} from "./chunk-WO2AXYFE.js";
|
|
18
|
+
|
|
19
|
+
// src/cubing/twisty/views/3D/puzzles/Cube3D.ts
|
|
20
|
+
import {
|
|
21
|
+
BackSide,
|
|
22
|
+
BoxGeometry,
|
|
23
|
+
BufferAttribute,
|
|
24
|
+
BufferGeometry,
|
|
25
|
+
DoubleSide,
|
|
26
|
+
Euler,
|
|
27
|
+
Group,
|
|
28
|
+
Matrix4,
|
|
29
|
+
Mesh,
|
|
30
|
+
MeshBasicMaterial,
|
|
31
|
+
Object3D,
|
|
32
|
+
Quaternion,
|
|
33
|
+
TextureLoader,
|
|
34
|
+
Vector2,
|
|
35
|
+
Vector3 as Vector32
|
|
36
|
+
} from "three";
|
|
37
|
+
|
|
38
|
+
// src/cubing/twisty/old/animation/easing.ts
|
|
39
|
+
function smootherStep(x) {
|
|
40
|
+
return x * x * x * (10 - x * (15 - 6 * x));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// src/cubing/twisty/old/dom/TwistyPlayerConfig.ts
|
|
44
|
+
import { Vector3 } from "three";
|
|
45
|
+
|
|
46
|
+
// src/cubing/twisty/views/3D/TAU.ts
|
|
47
|
+
var TAU = Math.PI * 2;
|
|
48
|
+
var DEGREES_PER_RADIAN = 360 / TAU;
|
|
49
|
+
|
|
50
|
+
// src/cubing/twisty/old/dom/element/ElementConfig.ts
|
|
51
|
+
var AlgAttribute = class {
|
|
52
|
+
constructor(initialValue) {
|
|
53
|
+
if (initialValue) {
|
|
54
|
+
if (typeof initialValue === "string") {
|
|
55
|
+
this.setString(initialValue);
|
|
56
|
+
} else {
|
|
57
|
+
this.setValue(initialValue);
|
|
58
|
+
}
|
|
59
|
+
} else {
|
|
60
|
+
this.setValue(this.defaultValue());
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
setString(str) {
|
|
64
|
+
if (this.string === str) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
this.string = str;
|
|
68
|
+
this.value = this.toValue(str);
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
setValue(val) {
|
|
72
|
+
const str = this.toString(val);
|
|
73
|
+
if (this.string === str) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
this.string = str;
|
|
77
|
+
this.value = val;
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
defaultValue() {
|
|
81
|
+
return new Alg([]);
|
|
82
|
+
}
|
|
83
|
+
toValue(s) {
|
|
84
|
+
return Alg.fromString(s);
|
|
85
|
+
}
|
|
86
|
+
toString(val) {
|
|
87
|
+
return val.toString();
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
var StringEnumAttribute = class {
|
|
91
|
+
constructor(enumVal, initialValue) {
|
|
92
|
+
this.enumVal = enumVal;
|
|
93
|
+
this.setString(initialValue ?? this.defaultValue());
|
|
94
|
+
}
|
|
95
|
+
setString(str) {
|
|
96
|
+
if (this.string === str) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
if (!(str in this.enumVal)) {
|
|
100
|
+
throw new Error(`Invalid string for attribute!: ${str}`);
|
|
101
|
+
}
|
|
102
|
+
this.string = str;
|
|
103
|
+
this.value = this.toValue(str);
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
setValue(val) {
|
|
107
|
+
return this.setString(val);
|
|
108
|
+
}
|
|
109
|
+
defaultValue() {
|
|
110
|
+
return Object.keys(this.enumVal)[0];
|
|
111
|
+
}
|
|
112
|
+
toValue(s) {
|
|
113
|
+
return s;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
var _defaultValue, _clampValue, clampValue_fn;
|
|
117
|
+
var RangedFloatAttribute = class {
|
|
118
|
+
constructor(defaultValue, minValue, maxValue, initialValue) {
|
|
119
|
+
this.minValue = minValue;
|
|
120
|
+
this.maxValue = maxValue;
|
|
121
|
+
__privateAdd(this, _clampValue);
|
|
122
|
+
__privateAdd(this, _defaultValue, void 0);
|
|
123
|
+
__privateSet(this, _defaultValue, defaultValue === null ? null : __privateMethod(this, _clampValue, clampValue_fn).call(this, defaultValue));
|
|
124
|
+
this.setValue(initialValue ?? this.defaultValue());
|
|
125
|
+
}
|
|
126
|
+
setString(str) {
|
|
127
|
+
return this.setValue(str === "" ? null : this.toValue(str));
|
|
128
|
+
}
|
|
129
|
+
setValue(val) {
|
|
130
|
+
const str = this.toString(val);
|
|
131
|
+
if (this.string === str) {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
this.string = str;
|
|
135
|
+
this.value = val;
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
defaultValue() {
|
|
139
|
+
return __privateGet(this, _defaultValue);
|
|
140
|
+
}
|
|
141
|
+
toValue(s) {
|
|
142
|
+
return parseFloat(s);
|
|
143
|
+
}
|
|
144
|
+
toString(v) {
|
|
145
|
+
return v === null ? "" : v.toString();
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
_defaultValue = new WeakMap();
|
|
149
|
+
_clampValue = new WeakSet();
|
|
150
|
+
clampValue_fn = function(val) {
|
|
151
|
+
return Math.max(Math.min(val, this.maxValue), this.minValue);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// src/cubing/twisty/old/dom/element/ClassListManager.ts
|
|
155
|
+
var _currentClassName;
|
|
156
|
+
var ClassListManager = class {
|
|
157
|
+
constructor(elem, prefix, validSuffixes) {
|
|
158
|
+
this.elem = elem;
|
|
159
|
+
this.prefix = prefix;
|
|
160
|
+
this.validSuffixes = validSuffixes;
|
|
161
|
+
__privateAdd(this, _currentClassName, null);
|
|
162
|
+
}
|
|
163
|
+
clearValue() {
|
|
164
|
+
if (__privateGet(this, _currentClassName)) {
|
|
165
|
+
this.elem.contentWrapper.classList.remove(__privateGet(this, _currentClassName));
|
|
166
|
+
}
|
|
167
|
+
__privateSet(this, _currentClassName, null);
|
|
168
|
+
}
|
|
169
|
+
setValue(suffix) {
|
|
170
|
+
if (!this.validSuffixes.includes(suffix)) {
|
|
171
|
+
throw new Error(`Invalid suffix: ${suffix}`);
|
|
172
|
+
}
|
|
173
|
+
const newClassName = `${this.prefix}${suffix}`;
|
|
174
|
+
const changed = __privateGet(this, _currentClassName) !== newClassName;
|
|
175
|
+
if (changed) {
|
|
176
|
+
this.clearValue();
|
|
177
|
+
this.elem.contentWrapper.classList.add(newClassName);
|
|
178
|
+
__privateSet(this, _currentClassName, newClassName);
|
|
179
|
+
}
|
|
180
|
+
return changed;
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
_currentClassName = new WeakMap();
|
|
184
|
+
|
|
185
|
+
// src/cubing/twisty/old/dom/element/node-custom-element-shims.ts
|
|
186
|
+
var HTMLElementStub = class {
|
|
187
|
+
};
|
|
188
|
+
var HTMLElementShim;
|
|
189
|
+
if (typeof HTMLElement !== "undefined") {
|
|
190
|
+
HTMLElementShim = HTMLElement;
|
|
191
|
+
} else {
|
|
192
|
+
HTMLElementShim = HTMLElementStub;
|
|
193
|
+
}
|
|
194
|
+
var CustomElementsStub = class {
|
|
195
|
+
define() {
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
var customElementsShim;
|
|
199
|
+
if (typeof customElements !== "undefined") {
|
|
200
|
+
customElementsShim = customElements;
|
|
201
|
+
} else {
|
|
202
|
+
customElementsShim = new CustomElementsStub();
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// src/cubing/twisty/old/dom/element/ManagedCustomElement.ts
|
|
206
|
+
var CSSSource = class {
|
|
207
|
+
constructor(sourceText) {
|
|
208
|
+
this.sourceText = sourceText;
|
|
209
|
+
}
|
|
210
|
+
getAsString() {
|
|
211
|
+
return this.sourceText;
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
var _cssSourceMap;
|
|
215
|
+
var ManagedCustomElement = class extends HTMLElementShim {
|
|
216
|
+
constructor(options) {
|
|
217
|
+
super();
|
|
218
|
+
__privateAdd(this, _cssSourceMap, new Map());
|
|
219
|
+
this.shadow = this.attachShadow({ mode: options?.mode ?? "closed" });
|
|
220
|
+
this.contentWrapper = document.createElement("div");
|
|
221
|
+
this.contentWrapper.classList.add("wrapper");
|
|
222
|
+
this.shadow.appendChild(this.contentWrapper);
|
|
223
|
+
}
|
|
224
|
+
addCSS(cssSource) {
|
|
225
|
+
if (__privateGet(this, _cssSourceMap).get(cssSource)) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const cssElem = document.createElement("style");
|
|
229
|
+
cssElem.textContent = cssSource.getAsString();
|
|
230
|
+
__privateGet(this, _cssSourceMap).set(cssSource, cssElem);
|
|
231
|
+
this.shadow.appendChild(cssElem);
|
|
232
|
+
}
|
|
233
|
+
removeCSS(cssSource) {
|
|
234
|
+
const cssElem = __privateGet(this, _cssSourceMap).get(cssSource);
|
|
235
|
+
if (!cssElem) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
this.shadow.removeChild(cssElem);
|
|
239
|
+
__privateGet(this, _cssSourceMap).delete(cssSource);
|
|
240
|
+
}
|
|
241
|
+
addElement(element) {
|
|
242
|
+
return this.contentWrapper.appendChild(element);
|
|
243
|
+
}
|
|
244
|
+
prependElement(element) {
|
|
245
|
+
this.contentWrapper.prepend(element);
|
|
246
|
+
}
|
|
247
|
+
removeElement(element) {
|
|
248
|
+
return this.contentWrapper.removeChild(element);
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
_cssSourceMap = new WeakMap();
|
|
252
|
+
customElementsShim.define("twisty-managed-custom-element", ManagedCustomElement);
|
|
253
|
+
|
|
254
|
+
// src/cubing/twisty/old/dom/viewers/TwistyViewerWrapper.css.ts
|
|
255
|
+
var twistyViewerWrapperCSS = new CSSSource(`
|
|
256
|
+
:host {
|
|
257
|
+
width: 384px;
|
|
258
|
+
height: 256px;
|
|
259
|
+
display: grid;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.wrapper {
|
|
263
|
+
width: 100%;
|
|
264
|
+
height: 100%;
|
|
265
|
+
display: grid;
|
|
266
|
+
overflow: hidden;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.wrapper > * {
|
|
270
|
+
width: 100%;
|
|
271
|
+
height: 100%;
|
|
272
|
+
overflow: hidden;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.wrapper.back-view-side-by-side {
|
|
276
|
+
grid-template-columns: 1fr 1fr;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.wrapper.back-view-top-right {
|
|
280
|
+
grid-template-columns: 3fr 1fr;
|
|
281
|
+
grid-template-rows: 1fr 3fr;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.wrapper.back-view-top-right > :nth-child(1) {
|
|
285
|
+
grid-row: 1 / 3;
|
|
286
|
+
grid-column: 1 / 3;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.wrapper.back-view-top-right > :nth-child(2) {
|
|
290
|
+
grid-row: 1 / 2;
|
|
291
|
+
grid-column: 2 / 3;
|
|
292
|
+
}
|
|
293
|
+
`);
|
|
294
|
+
|
|
295
|
+
// src/cubing/twisty/old/dom/viewers/TwistyViewerWrapper.ts
|
|
296
|
+
var backViewLayouts = {
|
|
297
|
+
"none": true,
|
|
298
|
+
"side-by-side": true,
|
|
299
|
+
"top-right": true
|
|
300
|
+
};
|
|
301
|
+
var _backViewClassListManager;
|
|
302
|
+
var TwistyViewerWrapper = class extends ManagedCustomElement {
|
|
303
|
+
constructor(config = {}) {
|
|
304
|
+
super();
|
|
305
|
+
__privateAdd(this, _backViewClassListManager, new ClassListManager(this, "back-view-", [
|
|
306
|
+
"none",
|
|
307
|
+
"side-by-side",
|
|
308
|
+
"top-right"
|
|
309
|
+
]));
|
|
310
|
+
this.addCSS(twistyViewerWrapperCSS);
|
|
311
|
+
if (config.backView && config.backView in backViewLayouts) {
|
|
312
|
+
__privateGet(this, _backViewClassListManager).setValue(config.backView);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
setBackView(backView) {
|
|
316
|
+
return __privateGet(this, _backViewClassListManager).setValue(backView);
|
|
317
|
+
}
|
|
318
|
+
clear() {
|
|
319
|
+
this.contentWrapper.innerHTML = "";
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
_backViewClassListManager = new WeakMap();
|
|
323
|
+
customElementsShim.define("twisty-viewer-wrapper", TwistyViewerWrapper);
|
|
324
|
+
|
|
325
|
+
// src/cubing/twisty/old/dom/TwistyPlayerConfig.ts
|
|
326
|
+
var centeredCameraOrbitCoordinates = {
|
|
327
|
+
latitude: 31.717474411461005,
|
|
328
|
+
longitude: 0,
|
|
329
|
+
distance: 5.877852522924731
|
|
330
|
+
};
|
|
331
|
+
var cubeCube3DCameraOrbitCoordinates = {
|
|
332
|
+
latitude: 35,
|
|
333
|
+
longitude: 30,
|
|
334
|
+
distance: 6
|
|
335
|
+
};
|
|
336
|
+
var cubePG3DCameraOrbitCoordinates = {
|
|
337
|
+
latitude: 35,
|
|
338
|
+
longitude: 30,
|
|
339
|
+
distance: 6.25
|
|
340
|
+
};
|
|
341
|
+
var megaminxCameraOrbitCoordinates = {
|
|
342
|
+
latitude: Math.atan(1 / 2) * DEGREES_PER_RADIAN,
|
|
343
|
+
longitude: 0,
|
|
344
|
+
distance: 6.7
|
|
345
|
+
};
|
|
346
|
+
var pyraminxCameraOrbitCoordinates = {
|
|
347
|
+
latitude: 26.56505117707799,
|
|
348
|
+
longitude: 0,
|
|
349
|
+
distance: 6
|
|
350
|
+
};
|
|
351
|
+
var pyraminxLookAt = new Vector3(0, 1 / 6, 0);
|
|
352
|
+
function defaultCameraOrbitCoordinates(puzzleID, strategy) {
|
|
353
|
+
if (puzzleID[1] === "x") {
|
|
354
|
+
if (strategy === "Cube3D") {
|
|
355
|
+
return cubeCube3DCameraOrbitCoordinates;
|
|
356
|
+
} else {
|
|
357
|
+
return cubePG3DCameraOrbitCoordinates;
|
|
358
|
+
}
|
|
359
|
+
} else {
|
|
360
|
+
switch (puzzleID) {
|
|
361
|
+
case "megaminx":
|
|
362
|
+
case "gigaminx":
|
|
363
|
+
return megaminxCameraOrbitCoordinates;
|
|
364
|
+
case "pyraminx":
|
|
365
|
+
case "master_tetraminx":
|
|
366
|
+
return pyraminxCameraOrbitCoordinates;
|
|
367
|
+
case "skewb":
|
|
368
|
+
return cubePG3DCameraOrbitCoordinates;
|
|
369
|
+
default:
|
|
370
|
+
return centeredCameraOrbitCoordinates;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
var setupToLocations = {
|
|
375
|
+
start: true,
|
|
376
|
+
end: true
|
|
377
|
+
};
|
|
378
|
+
var visualizationFormats = {
|
|
379
|
+
"3D": true,
|
|
380
|
+
"2D": true,
|
|
381
|
+
"experimental-2D-LL": true,
|
|
382
|
+
"PG3D": true
|
|
383
|
+
};
|
|
384
|
+
var backgroundThemes = {
|
|
385
|
+
checkered: true,
|
|
386
|
+
none: true
|
|
387
|
+
};
|
|
388
|
+
var hintFaceletStyles = {
|
|
389
|
+
floating: true,
|
|
390
|
+
none: true
|
|
391
|
+
};
|
|
392
|
+
var experimentalStickerings = {
|
|
393
|
+
"full": true,
|
|
394
|
+
"centers-only": true,
|
|
395
|
+
"PLL": true,
|
|
396
|
+
"CLS": true,
|
|
397
|
+
"OLL": true,
|
|
398
|
+
"COLL": true,
|
|
399
|
+
"OCLL": true,
|
|
400
|
+
"CLL": true,
|
|
401
|
+
"ELL": true,
|
|
402
|
+
"ELS": true,
|
|
403
|
+
"LL": true,
|
|
404
|
+
"F2L": true,
|
|
405
|
+
"ZBLL": true,
|
|
406
|
+
"ZBLS": true,
|
|
407
|
+
"WVLS": true,
|
|
408
|
+
"VLS": true,
|
|
409
|
+
"LS": true,
|
|
410
|
+
"EO": true,
|
|
411
|
+
"CMLL": true,
|
|
412
|
+
"L6E": true,
|
|
413
|
+
"L6EO": true,
|
|
414
|
+
"Daisy": true,
|
|
415
|
+
"Cross": true,
|
|
416
|
+
"2x2x2": true,
|
|
417
|
+
"2x2x3": true,
|
|
418
|
+
"Void Cube": true,
|
|
419
|
+
"invisible": true,
|
|
420
|
+
"picture": true,
|
|
421
|
+
"experimental-centers-U": true,
|
|
422
|
+
"experimental-centers-U-D": true,
|
|
423
|
+
"experimental-centers-U-L-D": true,
|
|
424
|
+
"experimental-centers-U-L-B-D": true,
|
|
425
|
+
"experimental-centers": true,
|
|
426
|
+
"experimental-fto-fc": true,
|
|
427
|
+
"experimental-fto-f2t": true,
|
|
428
|
+
"experimental-fto-sc": true,
|
|
429
|
+
"experimental-fto-l2c": true,
|
|
430
|
+
"experimental-fto-lbt": true,
|
|
431
|
+
"experimental-fto-l3t": true,
|
|
432
|
+
"experimental-global-custom-1": true,
|
|
433
|
+
"experimental-global-custom-2": true
|
|
434
|
+
};
|
|
435
|
+
var controlsLocations = {
|
|
436
|
+
"bottom-row": true,
|
|
437
|
+
"none": true
|
|
438
|
+
};
|
|
439
|
+
var puzzleIDs = {
|
|
440
|
+
"3x3x3": true,
|
|
441
|
+
"custom": true,
|
|
442
|
+
"2x2x2": true,
|
|
443
|
+
"4x4x4": true,
|
|
444
|
+
"5x5x5": true,
|
|
445
|
+
"6x6x6": true,
|
|
446
|
+
"7x7x7": true,
|
|
447
|
+
"40x40x40": true,
|
|
448
|
+
"megaminx": true,
|
|
449
|
+
"pyraminx": true,
|
|
450
|
+
"square1": true,
|
|
451
|
+
"clock": true,
|
|
452
|
+
"skewb": true,
|
|
453
|
+
"fto": true,
|
|
454
|
+
"gigaminx": true,
|
|
455
|
+
"master_tetraminx": true
|
|
456
|
+
};
|
|
457
|
+
var viewerLinkPages = {
|
|
458
|
+
twizzle: true,
|
|
459
|
+
none: true
|
|
460
|
+
};
|
|
461
|
+
var cameraLatitudeLimits = {
|
|
462
|
+
auto: true,
|
|
463
|
+
none: true
|
|
464
|
+
};
|
|
465
|
+
var twistyPlayerAttributeMap = {
|
|
466
|
+
"alg": "alg",
|
|
467
|
+
"experimental-setup-alg": "experimentalSetupAlg",
|
|
468
|
+
"experimental-setup-anchor": "experimentalSetupAnchor",
|
|
469
|
+
"puzzle": "puzzle",
|
|
470
|
+
"visualization": "visualization",
|
|
471
|
+
"hint-facelets": "hintFacelets",
|
|
472
|
+
"experimental-stickering": "experimentalStickering",
|
|
473
|
+
"background": "background",
|
|
474
|
+
"control-panel": "controlPanel",
|
|
475
|
+
"back-view": "backView",
|
|
476
|
+
"experimental-camera-latitude": "experimentalCameraLatitude",
|
|
477
|
+
"experimental-camera-longitude": "experimentalCameraLongitude",
|
|
478
|
+
"experimental-camera-latitude-limits": "experimentalCameraLatitudeLimits",
|
|
479
|
+
"viewer-link": "viewerLink"
|
|
480
|
+
};
|
|
481
|
+
var TwistyPlayerConfig = class {
|
|
482
|
+
constructor(twistyPlayer, initialValues) {
|
|
483
|
+
this.twistyPlayer = twistyPlayer;
|
|
484
|
+
this.attributes = {
|
|
485
|
+
"alg": new AlgAttribute(initialValues.alg),
|
|
486
|
+
"experimental-setup-alg": new AlgAttribute(initialValues.experimentalSetupAlg),
|
|
487
|
+
"experimental-setup-anchor": new StringEnumAttribute(setupToLocations, initialValues.experimentalSetupAnchor),
|
|
488
|
+
"puzzle": new StringEnumAttribute(puzzleIDs, initialValues.puzzle),
|
|
489
|
+
"visualization": new StringEnumAttribute(visualizationFormats, initialValues.visualization),
|
|
490
|
+
"hint-facelets": new StringEnumAttribute(hintFaceletStyles, initialValues.hintFacelets),
|
|
491
|
+
"experimental-stickering": new StringEnumAttribute(experimentalStickerings, initialValues.experimentalStickering),
|
|
492
|
+
"background": new StringEnumAttribute(backgroundThemes, initialValues.background),
|
|
493
|
+
"control-panel": new StringEnumAttribute(controlsLocations, initialValues.controlPanel),
|
|
494
|
+
"back-view": new StringEnumAttribute(backViewLayouts, initialValues["backView"]),
|
|
495
|
+
"experimental-camera-latitude": new RangedFloatAttribute(null, -90, 90, initialValues["experimentalCameraLatitude"]),
|
|
496
|
+
"experimental-camera-longitude": new RangedFloatAttribute(null, -180, 180, initialValues["experimentalCameraLongitude"]),
|
|
497
|
+
"experimental-camera-latitude-limits": new StringEnumAttribute(cameraLatitudeLimits, initialValues["experimentalCameraLatitudeLimits"]),
|
|
498
|
+
"viewer-link": new StringEnumAttribute(viewerLinkPages, initialValues.viewerLink)
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
static get observedAttributes() {
|
|
502
|
+
return Object.keys(twistyPlayerAttributeMap);
|
|
503
|
+
}
|
|
504
|
+
attributeChangedCallback(attributeName, oldValue, newValue) {
|
|
505
|
+
const managedAttribute = this.attributes[attributeName];
|
|
506
|
+
if (managedAttribute) {
|
|
507
|
+
if (oldValue !== null && managedAttribute.string !== oldValue) {
|
|
508
|
+
console.warn("Attribute out of sync!", attributeName, managedAttribute.string, oldValue);
|
|
509
|
+
}
|
|
510
|
+
managedAttribute.setString(newValue);
|
|
511
|
+
const propertyName = twistyPlayerAttributeMap[attributeName];
|
|
512
|
+
this.twistyPlayer[propertyName] = managedAttribute.value;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
// src/cubing/twisty/views/3D/puzzles/Cube3D.ts
|
|
518
|
+
var svgLoader = new TextureLoader();
|
|
519
|
+
var ignoredMaterial = new MeshBasicMaterial({
|
|
520
|
+
color: 4473924,
|
|
521
|
+
side: DoubleSide
|
|
522
|
+
});
|
|
523
|
+
var ignoredMaterialHint = new MeshBasicMaterial({
|
|
524
|
+
color: 13421772,
|
|
525
|
+
side: BackSide,
|
|
526
|
+
transparent: true,
|
|
527
|
+
opacity: 0.75
|
|
528
|
+
});
|
|
529
|
+
var invisibleMaterial = new MeshBasicMaterial({
|
|
530
|
+
visible: false
|
|
531
|
+
});
|
|
532
|
+
var orientedMaterial = new MeshBasicMaterial({
|
|
533
|
+
color: 16746751
|
|
534
|
+
});
|
|
535
|
+
var orientedMaterialHint = new MeshBasicMaterial({
|
|
536
|
+
color: 16746751,
|
|
537
|
+
side: BackSide,
|
|
538
|
+
transparent: true,
|
|
539
|
+
opacity: 0.5
|
|
540
|
+
});
|
|
541
|
+
var AxisInfo = class {
|
|
542
|
+
constructor(vector, fromZ, color, dimColor, hintOpacityScale, options) {
|
|
543
|
+
this.vector = vector;
|
|
544
|
+
this.fromZ = fromZ;
|
|
545
|
+
this.color = color;
|
|
546
|
+
this.dimColor = dimColor;
|
|
547
|
+
this.hintOpacityScale = hintOpacityScale;
|
|
548
|
+
this.stickerMaterial = {
|
|
549
|
+
regular: new MeshBasicMaterial({
|
|
550
|
+
color,
|
|
551
|
+
side: DoubleSide
|
|
552
|
+
}),
|
|
553
|
+
dim: new MeshBasicMaterial({
|
|
554
|
+
color: dimColor,
|
|
555
|
+
side: DoubleSide
|
|
556
|
+
}),
|
|
557
|
+
oriented: orientedMaterial,
|
|
558
|
+
ignored: ignoredMaterial,
|
|
559
|
+
invisible: invisibleMaterial
|
|
560
|
+
};
|
|
561
|
+
this.hintStickerMaterial = {
|
|
562
|
+
regular: new MeshBasicMaterial({
|
|
563
|
+
color: options?.hintColor ?? color,
|
|
564
|
+
side: BackSide,
|
|
565
|
+
transparent: true,
|
|
566
|
+
opacity: 0.5 * hintOpacityScale
|
|
567
|
+
}),
|
|
568
|
+
dim: new MeshBasicMaterial({
|
|
569
|
+
color: options?.hintDimColor ?? color,
|
|
570
|
+
side: BackSide,
|
|
571
|
+
transparent: true,
|
|
572
|
+
opacity: 0.5 * hintOpacityScale
|
|
573
|
+
}),
|
|
574
|
+
oriented: orientedMaterialHint,
|
|
575
|
+
ignored: ignoredMaterialHint,
|
|
576
|
+
invisible: invisibleMaterial
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
};
|
|
580
|
+
var axesInfo = [
|
|
581
|
+
new AxisInfo(new Vector32(0, 1, 0), new Euler(-TAU / 4, 0, 0), 16777215, 14540253, 1.25),
|
|
582
|
+
new AxisInfo(new Vector32(-1, 0, 0), new Euler(0, -TAU / 4, 0), 16746496, 8930304, 1),
|
|
583
|
+
new AxisInfo(new Vector32(0, 0, 1), new Euler(0, 0, 0), 65280, 34816, 1),
|
|
584
|
+
new AxisInfo(new Vector32(1, 0, 0), new Euler(0, TAU / 4, 0), 16711680, 6684672, 1),
|
|
585
|
+
new AxisInfo(new Vector32(0, 0, -1), new Euler(0, TAU / 2, 0), 255, 136, 0.75, { hintColor: 17663, hintDimColor: 8840 }),
|
|
586
|
+
new AxisInfo(new Vector32(0, -1, 0), new Euler(TAU / 4, 0, 0), 16776960, 8947712, 1.25)
|
|
587
|
+
];
|
|
588
|
+
var face = {
|
|
589
|
+
U: 0,
|
|
590
|
+
L: 1,
|
|
591
|
+
F: 2,
|
|
592
|
+
R: 3,
|
|
593
|
+
B: 4,
|
|
594
|
+
D: 5
|
|
595
|
+
};
|
|
596
|
+
var familyToAxis = {
|
|
597
|
+
U: face.U,
|
|
598
|
+
u: face.U,
|
|
599
|
+
Uw: face.U,
|
|
600
|
+
Uv: face.U,
|
|
601
|
+
y: face.U,
|
|
602
|
+
L: face.L,
|
|
603
|
+
l: face.L,
|
|
604
|
+
Lw: face.L,
|
|
605
|
+
Lv: face.L,
|
|
606
|
+
M: face.L,
|
|
607
|
+
F: face.F,
|
|
608
|
+
f: face.F,
|
|
609
|
+
Fw: face.F,
|
|
610
|
+
Fv: face.F,
|
|
611
|
+
S: face.F,
|
|
612
|
+
z: face.F,
|
|
613
|
+
R: face.R,
|
|
614
|
+
r: face.R,
|
|
615
|
+
Rw: face.R,
|
|
616
|
+
Rv: face.R,
|
|
617
|
+
x: face.R,
|
|
618
|
+
B: face.B,
|
|
619
|
+
b: face.B,
|
|
620
|
+
Bw: face.B,
|
|
621
|
+
Bv: face.B,
|
|
622
|
+
D: face.D,
|
|
623
|
+
d: face.D,
|
|
624
|
+
Dw: face.D,
|
|
625
|
+
Dv: face.D,
|
|
626
|
+
E: face.D
|
|
627
|
+
};
|
|
628
|
+
var cubieDimensions = {
|
|
629
|
+
stickerWidth: 0.85,
|
|
630
|
+
stickerElevation: 0.503,
|
|
631
|
+
foundationWidth: 1,
|
|
632
|
+
hintStickerElevation: 1.45
|
|
633
|
+
};
|
|
634
|
+
var EXPERIMENTAL_PICTURE_CUBE_HINT_ELEVATION = 2;
|
|
635
|
+
var cube3DOptionsDefaults = {
|
|
636
|
+
showMainStickers: true,
|
|
637
|
+
hintFacelets: "floating",
|
|
638
|
+
showFoundation: true,
|
|
639
|
+
experimentalStickering: "full",
|
|
640
|
+
foundationSprite: null,
|
|
641
|
+
hintSprite: null
|
|
642
|
+
};
|
|
643
|
+
var blackMesh = new MeshBasicMaterial({
|
|
644
|
+
color: 0,
|
|
645
|
+
opacity: 1,
|
|
646
|
+
transparent: true
|
|
647
|
+
});
|
|
648
|
+
var blackTranslucentMesh = new MeshBasicMaterial({
|
|
649
|
+
color: 0,
|
|
650
|
+
opacity: 0.3,
|
|
651
|
+
transparent: true
|
|
652
|
+
});
|
|
653
|
+
var CubieDef = class {
|
|
654
|
+
constructor(orbit, stickerFaceNames, q) {
|
|
655
|
+
this.orbit = orbit;
|
|
656
|
+
const individualStickerFaceNames = typeof stickerFaceNames === "string" ? stickerFaceNames.split("") : stickerFaceNames;
|
|
657
|
+
this.stickerFaces = individualStickerFaceNames.map((s) => face[s]);
|
|
658
|
+
this.matrix = new Matrix4();
|
|
659
|
+
this.matrix.setPosition(firstPiecePosition[orbit]);
|
|
660
|
+
this.matrix.premultiply(new Matrix4().makeRotationFromQuaternion(q));
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
function t(v, t4) {
|
|
664
|
+
return new Quaternion().setFromAxisAngle(v, TAU * t4 / 4);
|
|
665
|
+
}
|
|
666
|
+
var r = {
|
|
667
|
+
O: new Vector32(0, 0, 0),
|
|
668
|
+
U: new Vector32(0, -1, 0),
|
|
669
|
+
L: new Vector32(1, 0, 0),
|
|
670
|
+
F: new Vector32(0, 0, -1),
|
|
671
|
+
R: new Vector32(-1, 0, 0),
|
|
672
|
+
B: new Vector32(0, 0, 1),
|
|
673
|
+
D: new Vector32(0, 1, 0)
|
|
674
|
+
};
|
|
675
|
+
var firstPiecePosition = {
|
|
676
|
+
EDGES: new Vector32(0, 1, 1),
|
|
677
|
+
CORNERS: new Vector32(1, 1, 1),
|
|
678
|
+
CENTERS: new Vector32(0, 1, 0)
|
|
679
|
+
};
|
|
680
|
+
var orientationRotation = {
|
|
681
|
+
EDGES: [0, 1].map((i) => new Matrix4().makeRotationAxis(firstPiecePosition.EDGES.clone().normalize(), -i * TAU / 2)),
|
|
682
|
+
CORNERS: [0, 1, 2].map((i) => new Matrix4().makeRotationAxis(firstPiecePosition.CORNERS.clone().normalize(), -i * TAU / 3)),
|
|
683
|
+
CENTERS: [0, 1, 2, 3].map((i) => new Matrix4().makeRotationAxis(firstPiecePosition.CENTERS.clone().normalize(), -i * TAU / 4))
|
|
684
|
+
};
|
|
685
|
+
var cubieStickerOrder = [face.U, face.F, face.R];
|
|
686
|
+
var pieceDefs = {
|
|
687
|
+
EDGES: [
|
|
688
|
+
new CubieDef("EDGES", "UF", t(r.O, 0)),
|
|
689
|
+
new CubieDef("EDGES", "UR", t(r.U, 3)),
|
|
690
|
+
new CubieDef("EDGES", "UB", t(r.U, 2)),
|
|
691
|
+
new CubieDef("EDGES", "UL", t(r.U, 1)),
|
|
692
|
+
new CubieDef("EDGES", "DF", t(r.F, 2)),
|
|
693
|
+
new CubieDef("EDGES", "DR", t(r.F, 2).premultiply(t(r.D, 1))),
|
|
694
|
+
new CubieDef("EDGES", "DB", t(r.F, 2).premultiply(t(r.D, 2))),
|
|
695
|
+
new CubieDef("EDGES", "DL", t(r.F, 2).premultiply(t(r.D, 3))),
|
|
696
|
+
new CubieDef("EDGES", "FR", t(r.U, 3).premultiply(t(r.R, 3))),
|
|
697
|
+
new CubieDef("EDGES", "FL", t(r.U, 1).premultiply(t(r.R, 3))),
|
|
698
|
+
new CubieDef("EDGES", "BR", t(r.U, 3).premultiply(t(r.R, 1))),
|
|
699
|
+
new CubieDef("EDGES", "BL", t(r.U, 1).premultiply(t(r.R, 1)))
|
|
700
|
+
],
|
|
701
|
+
CORNERS: [
|
|
702
|
+
new CubieDef("CORNERS", "UFR", t(r.O, 0)),
|
|
703
|
+
new CubieDef("CORNERS", "URB", t(r.U, 3)),
|
|
704
|
+
new CubieDef("CORNERS", "UBL", t(r.U, 2)),
|
|
705
|
+
new CubieDef("CORNERS", "ULF", t(r.U, 1)),
|
|
706
|
+
new CubieDef("CORNERS", "DRF", t(r.F, 2).premultiply(t(r.D, 1))),
|
|
707
|
+
new CubieDef("CORNERS", "DFL", t(r.F, 2).premultiply(t(r.D, 0))),
|
|
708
|
+
new CubieDef("CORNERS", "DLB", t(r.F, 2).premultiply(t(r.D, 3))),
|
|
709
|
+
new CubieDef("CORNERS", "DBR", t(r.F, 2).premultiply(t(r.D, 2)))
|
|
710
|
+
],
|
|
711
|
+
CENTERS: [
|
|
712
|
+
new CubieDef("CENTERS", "U", t(r.O, 0)),
|
|
713
|
+
new CubieDef("CENTERS", "L", t(r.R, 3).premultiply(t(r.U, 1))),
|
|
714
|
+
new CubieDef("CENTERS", "F", t(r.R, 3)),
|
|
715
|
+
new CubieDef("CENTERS", "R", t(r.R, 3).premultiply(t(r.D, 1))),
|
|
716
|
+
new CubieDef("CENTERS", "B", t(r.R, 3).premultiply(t(r.D, 2))),
|
|
717
|
+
new CubieDef("CENTERS", "D", t(r.R, 2))
|
|
718
|
+
]
|
|
719
|
+
};
|
|
720
|
+
var CUBE_SCALE = 1 / 3;
|
|
721
|
+
var pictureStickerCoords = {
|
|
722
|
+
EDGES: [
|
|
723
|
+
[
|
|
724
|
+
[0, 4, 6],
|
|
725
|
+
[0, 4, 5]
|
|
726
|
+
],
|
|
727
|
+
[
|
|
728
|
+
[3, 5, 7],
|
|
729
|
+
[0, 7, 5]
|
|
730
|
+
],
|
|
731
|
+
[
|
|
732
|
+
[2, 4, 8],
|
|
733
|
+
[0, 10, 5]
|
|
734
|
+
],
|
|
735
|
+
[
|
|
736
|
+
[1, 3, 7],
|
|
737
|
+
[0, 1, 5]
|
|
738
|
+
],
|
|
739
|
+
[
|
|
740
|
+
[2, 4, 2],
|
|
741
|
+
[2, 4, 3]
|
|
742
|
+
],
|
|
743
|
+
[
|
|
744
|
+
[3, 5, 1],
|
|
745
|
+
[2, 7, 3]
|
|
746
|
+
],
|
|
747
|
+
[
|
|
748
|
+
[0, 4, 0],
|
|
749
|
+
[2, 10, 3]
|
|
750
|
+
],
|
|
751
|
+
[
|
|
752
|
+
[1, 3, 1],
|
|
753
|
+
[2, 1, 3]
|
|
754
|
+
],
|
|
755
|
+
[
|
|
756
|
+
[3, 5, 4],
|
|
757
|
+
[3, 6, 4]
|
|
758
|
+
],
|
|
759
|
+
[
|
|
760
|
+
[1, 3, 4],
|
|
761
|
+
[1, 2, 4]
|
|
762
|
+
],
|
|
763
|
+
[
|
|
764
|
+
[1, 9, 4],
|
|
765
|
+
[1, 8, 4]
|
|
766
|
+
],
|
|
767
|
+
[
|
|
768
|
+
[3, 11, 4],
|
|
769
|
+
[3, 0, 4]
|
|
770
|
+
]
|
|
771
|
+
],
|
|
772
|
+
CORNERS: [
|
|
773
|
+
[
|
|
774
|
+
[0, 5, 6],
|
|
775
|
+
[0, 5, 5],
|
|
776
|
+
[0, 6, 5]
|
|
777
|
+
],
|
|
778
|
+
[
|
|
779
|
+
[3, 5, 8],
|
|
780
|
+
[0, 8, 5],
|
|
781
|
+
[0, 9, 5]
|
|
782
|
+
],
|
|
783
|
+
[
|
|
784
|
+
[2, 3, 8],
|
|
785
|
+
[0, 11, 5],
|
|
786
|
+
[0, 0, 5]
|
|
787
|
+
],
|
|
788
|
+
[
|
|
789
|
+
[1, 3, 6],
|
|
790
|
+
[0, 2, 5],
|
|
791
|
+
[0, 3, 5]
|
|
792
|
+
],
|
|
793
|
+
[
|
|
794
|
+
[3, 5, 2],
|
|
795
|
+
[2, 6, 3],
|
|
796
|
+
[2, 5, 3]
|
|
797
|
+
],
|
|
798
|
+
[
|
|
799
|
+
[2, 3, 2],
|
|
800
|
+
[2, 3, 3],
|
|
801
|
+
[2, 2, 3]
|
|
802
|
+
],
|
|
803
|
+
[
|
|
804
|
+
[1, 3, 0],
|
|
805
|
+
[2, 0, 3],
|
|
806
|
+
[2, 11, 3]
|
|
807
|
+
],
|
|
808
|
+
[
|
|
809
|
+
[0, 5, 0],
|
|
810
|
+
[2, 9, 3],
|
|
811
|
+
[2, 8, 3]
|
|
812
|
+
]
|
|
813
|
+
],
|
|
814
|
+
CENTERS: [
|
|
815
|
+
[[0, 4, 7]],
|
|
816
|
+
[[0, 1, 4]],
|
|
817
|
+
[[0, 4, 4]],
|
|
818
|
+
[[0, 7, 4]],
|
|
819
|
+
[[0, 10, 4]],
|
|
820
|
+
[[0, 4, 1]]
|
|
821
|
+
]
|
|
822
|
+
};
|
|
823
|
+
var sharedCubieFoundationGeometryCache = null;
|
|
824
|
+
function sharedCubieFoundationGeometry() {
|
|
825
|
+
return sharedCubieFoundationGeometryCache ?? (sharedCubieFoundationGeometryCache = new BoxGeometry(cubieDimensions.foundationWidth, cubieDimensions.foundationWidth, cubieDimensions.foundationWidth));
|
|
826
|
+
}
|
|
827
|
+
function newStickerGeometry() {
|
|
828
|
+
const r2 = new BufferGeometry();
|
|
829
|
+
const half = 0.5 * cubieDimensions.stickerWidth;
|
|
830
|
+
r2.setAttribute("position", new BufferAttribute(new Float32Array([
|
|
831
|
+
half,
|
|
832
|
+
half,
|
|
833
|
+
0,
|
|
834
|
+
-half,
|
|
835
|
+
half,
|
|
836
|
+
0,
|
|
837
|
+
half,
|
|
838
|
+
-half,
|
|
839
|
+
0,
|
|
840
|
+
-half,
|
|
841
|
+
half,
|
|
842
|
+
0,
|
|
843
|
+
-half,
|
|
844
|
+
-half,
|
|
845
|
+
0,
|
|
846
|
+
half,
|
|
847
|
+
-half,
|
|
848
|
+
0
|
|
849
|
+
]), 3));
|
|
850
|
+
r2.setAttribute("uv", new BufferAttribute(new Float32Array([
|
|
851
|
+
1,
|
|
852
|
+
1,
|
|
853
|
+
0,
|
|
854
|
+
1,
|
|
855
|
+
1,
|
|
856
|
+
0,
|
|
857
|
+
0,
|
|
858
|
+
1,
|
|
859
|
+
0,
|
|
860
|
+
0,
|
|
861
|
+
1,
|
|
862
|
+
0,
|
|
863
|
+
0,
|
|
864
|
+
1,
|
|
865
|
+
0,
|
|
866
|
+
0,
|
|
867
|
+
1,
|
|
868
|
+
1,
|
|
869
|
+
0,
|
|
870
|
+
0,
|
|
871
|
+
1,
|
|
872
|
+
0,
|
|
873
|
+
1,
|
|
874
|
+
1
|
|
875
|
+
]), 2));
|
|
876
|
+
return r2;
|
|
877
|
+
}
|
|
878
|
+
var sharedStickerGeometryCache = null;
|
|
879
|
+
function sharedStickerGeometry() {
|
|
880
|
+
return sharedStickerGeometryCache ?? (sharedStickerGeometryCache = newStickerGeometry());
|
|
881
|
+
}
|
|
882
|
+
var Cube3D = class extends Object3D {
|
|
883
|
+
constructor(def, cursor, scheduleRenderCallback, options = {}) {
|
|
884
|
+
super();
|
|
885
|
+
this.def = def;
|
|
886
|
+
this.scheduleRenderCallback = scheduleRenderCallback;
|
|
887
|
+
this.pieces = {};
|
|
888
|
+
this.experimentalHintStickerMeshes = [];
|
|
889
|
+
this.experimentalFoundationMeshes = [];
|
|
890
|
+
this.sprite = new Promise((resolve) => {
|
|
891
|
+
this.setSpriteURL = (url) => {
|
|
892
|
+
svgLoader.load(url, resolve);
|
|
893
|
+
};
|
|
894
|
+
});
|
|
895
|
+
this.hintSprite = new Promise((resolve) => {
|
|
896
|
+
this.setHintSpriteURL = (url) => {
|
|
897
|
+
svgLoader.load(url, resolve);
|
|
898
|
+
};
|
|
899
|
+
});
|
|
900
|
+
this.options = { ...cube3DOptionsDefaults };
|
|
901
|
+
Object.assign(this.options, options);
|
|
902
|
+
if (this.def.name !== "3x3x3") {
|
|
903
|
+
throw new Error(`Invalid puzzle for this Cube3D implementation: ${this.def.name}`);
|
|
904
|
+
}
|
|
905
|
+
if (options.foundationSprite) {
|
|
906
|
+
this.setSprite(options.foundationSprite);
|
|
907
|
+
}
|
|
908
|
+
if (options.hintSprite) {
|
|
909
|
+
this.setHintSprite(options.hintSprite);
|
|
910
|
+
}
|
|
911
|
+
this.kpuzzleFaceletInfo = {};
|
|
912
|
+
for (const orbit in pieceDefs) {
|
|
913
|
+
const orbitFaceletInfo = [];
|
|
914
|
+
this.kpuzzleFaceletInfo[orbit] = orbitFaceletInfo;
|
|
915
|
+
this.pieces[orbit] = pieceDefs[orbit].map(this.createCubie.bind(this, orbit, orbitFaceletInfo));
|
|
916
|
+
}
|
|
917
|
+
this.scale.set(CUBE_SCALE, CUBE_SCALE, CUBE_SCALE);
|
|
918
|
+
if (this.options.experimentalStickering) {
|
|
919
|
+
this.setStickering(this.options.experimentalStickering);
|
|
920
|
+
}
|
|
921
|
+
cursor?.addPositionListener(this);
|
|
922
|
+
}
|
|
923
|
+
setSprite(texture) {
|
|
924
|
+
this.sprite = texture;
|
|
925
|
+
}
|
|
926
|
+
setHintSprite(texture) {
|
|
927
|
+
this.hintSprite = texture;
|
|
928
|
+
}
|
|
929
|
+
experimentalSetStickerSpriteURL(stickerSpriteURL) {
|
|
930
|
+
this.setSpriteURL(stickerSpriteURL);
|
|
931
|
+
}
|
|
932
|
+
experimentalSetHintStickerSpriteURL(hintStickerSpriteURL) {
|
|
933
|
+
this.setHintSpriteURL(hintStickerSpriteURL);
|
|
934
|
+
}
|
|
935
|
+
setStickering(stickering) {
|
|
936
|
+
(async () => {
|
|
937
|
+
const appearance = await puzzles["3x3x3"].appearance(stickering ?? "full");
|
|
938
|
+
this.setAppearance(appearance ?? await puzzles["3x3x3"].appearance("full"));
|
|
939
|
+
})();
|
|
940
|
+
}
|
|
941
|
+
setAppearance(appearance) {
|
|
942
|
+
for (const [orbitName, orbitAppearance] of Object.entries(appearance.orbits)) {
|
|
943
|
+
for (let pieceIdx = 0; pieceIdx < orbitAppearance.pieces.length; pieceIdx++) {
|
|
944
|
+
const pieceAppearance = orbitAppearance.pieces[pieceIdx];
|
|
945
|
+
if (pieceAppearance) {
|
|
946
|
+
const pieceInfo = this.kpuzzleFaceletInfo[orbitName][pieceIdx];
|
|
947
|
+
for (let faceletIdx = 0; faceletIdx < pieceInfo.length; faceletIdx++) {
|
|
948
|
+
const faceletAppearance = pieceAppearance.facelets[faceletIdx];
|
|
949
|
+
if (faceletAppearance) {
|
|
950
|
+
const faceletInfo = pieceInfo[faceletIdx];
|
|
951
|
+
const appearance2 = typeof faceletAppearance === "string" ? faceletAppearance : faceletAppearance?.appearance;
|
|
952
|
+
faceletInfo.facelet.material = axesInfo[faceletInfo.faceIdx].stickerMaterial[appearance2];
|
|
953
|
+
const hintAppearance = typeof faceletAppearance === "string" ? appearance2 : faceletAppearance.hintAppearance ?? appearance2;
|
|
954
|
+
if (faceletInfo.hintFacelet) {
|
|
955
|
+
faceletInfo.hintFacelet.material = axesInfo[faceletInfo.faceIdx].hintStickerMaterial[hintAppearance];
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
if (this.scheduleRenderCallback) {
|
|
963
|
+
this.scheduleRenderCallback();
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
experimentalUpdateOptions(options) {
|
|
967
|
+
if ("showMainStickers" in options) {
|
|
968
|
+
throw new Error("Unimplemented");
|
|
969
|
+
}
|
|
970
|
+
const showFoundation = options.showFoundation;
|
|
971
|
+
if (typeof showFoundation !== "undefined" && this.options.showFoundation !== showFoundation) {
|
|
972
|
+
this.options.showFoundation = showFoundation;
|
|
973
|
+
for (const foundation of this.experimentalFoundationMeshes) {
|
|
974
|
+
foundation.visible = showFoundation;
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
const hintFacelets = options.hintFacelets;
|
|
978
|
+
if (typeof hintFacelets !== "undefined" && this.options.hintFacelets !== hintFacelets && hintFaceletStyles[hintFacelets]) {
|
|
979
|
+
this.options.hintFacelets = hintFacelets;
|
|
980
|
+
for (const hintSticker of this.experimentalHintStickerMeshes) {
|
|
981
|
+
hintSticker.visible = hintFacelets === "floating";
|
|
982
|
+
}
|
|
983
|
+
this.scheduleRenderCallback();
|
|
984
|
+
}
|
|
985
|
+
const experimentalStickering = options.experimentalStickering;
|
|
986
|
+
if (typeof experimentalStickering !== "undefined" && this.options.experimentalStickering !== experimentalStickering && experimentalStickerings[experimentalStickering]) {
|
|
987
|
+
this.options.experimentalStickering = experimentalStickering;
|
|
988
|
+
this.setStickering(experimentalStickering);
|
|
989
|
+
this.scheduleRenderCallback();
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
onPositionChange(p) {
|
|
993
|
+
const reid333 = p.state;
|
|
994
|
+
for (const orbit in pieceDefs) {
|
|
995
|
+
const pieces = pieceDefs[orbit];
|
|
996
|
+
for (let i = 0; i < pieces.length; i++) {
|
|
997
|
+
const j = reid333[orbit].permutation[i];
|
|
998
|
+
this.pieces[orbit][j].matrix.copy(pieceDefs[orbit][i].matrix);
|
|
999
|
+
this.pieces[orbit][j].matrix.multiply(orientationRotation[orbit][reid333[orbit].orientation[i]]);
|
|
1000
|
+
}
|
|
1001
|
+
for (const moveProgress of p.movesInProgress) {
|
|
1002
|
+
const move = moveProgress.move;
|
|
1003
|
+
const turnNormal = axesInfo[familyToAxis[move.family]].vector;
|
|
1004
|
+
const moveMatrix = new Matrix4().makeRotationAxis(turnNormal, -this.ease(moveProgress.fraction) * moveProgress.direction * move.amount * TAU / 4);
|
|
1005
|
+
for (let i = 0; i < pieces.length; i++) {
|
|
1006
|
+
const k = this.def.moves[move.family][orbit].permutation[i];
|
|
1007
|
+
if (i !== k || this.def.moves[move.family][orbit].orientation[i] !== 0) {
|
|
1008
|
+
const j = reid333[orbit].permutation[i];
|
|
1009
|
+
this.pieces[orbit][j].matrix.premultiply(moveMatrix);
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
this.scheduleRenderCallback();
|
|
1015
|
+
}
|
|
1016
|
+
createCubie(orbit, orbitFacelets, piece, orbitPieceIdx) {
|
|
1017
|
+
const cubieFaceletInfo = [];
|
|
1018
|
+
orbitFacelets.push(cubieFaceletInfo);
|
|
1019
|
+
const cubie = new Group();
|
|
1020
|
+
if (this.options.showFoundation) {
|
|
1021
|
+
const foundation = this.createCubieFoundation();
|
|
1022
|
+
cubie.add(foundation);
|
|
1023
|
+
this.experimentalFoundationMeshes.push(foundation);
|
|
1024
|
+
}
|
|
1025
|
+
for (let i = 0; i < piece.stickerFaces.length; i++) {
|
|
1026
|
+
const sticker = this.createSticker(axesInfo[cubieStickerOrder[i]], axesInfo[piece.stickerFaces[i]], false);
|
|
1027
|
+
const faceletInfo = {
|
|
1028
|
+
faceIdx: piece.stickerFaces[i],
|
|
1029
|
+
facelet: sticker
|
|
1030
|
+
};
|
|
1031
|
+
cubie.add(sticker);
|
|
1032
|
+
if (this.options.hintFacelets === "floating") {
|
|
1033
|
+
const hintSticker = this.createSticker(axesInfo[cubieStickerOrder[i]], axesInfo[piece.stickerFaces[i]], true);
|
|
1034
|
+
cubie.add(hintSticker);
|
|
1035
|
+
faceletInfo.hintFacelet = hintSticker;
|
|
1036
|
+
this.experimentalHintStickerMeshes.push(hintSticker);
|
|
1037
|
+
}
|
|
1038
|
+
if (this.options.experimentalStickering === "picture" && pictureStickerCoords[orbit] && pictureStickerCoords[orbit][orbitPieceIdx] && pictureStickerCoords[orbit][orbitPieceIdx][i]) {
|
|
1039
|
+
const [rotate, offsetX, offsetY] = pictureStickerCoords[orbit][orbitPieceIdx][i];
|
|
1040
|
+
(async () => {
|
|
1041
|
+
const addImageSticker = async (hint) => {
|
|
1042
|
+
const texture = await (hint ? this.hintSprite : this.sprite);
|
|
1043
|
+
const mesh = this.createSticker(axesInfo[cubieStickerOrder[i]], axesInfo[piece.stickerFaces[i]], hint);
|
|
1044
|
+
mesh.material = new MeshBasicMaterial({
|
|
1045
|
+
map: texture,
|
|
1046
|
+
side: hint ? BackSide : DoubleSide,
|
|
1047
|
+
transparent: true
|
|
1048
|
+
});
|
|
1049
|
+
const x1 = offsetX / 12;
|
|
1050
|
+
const x2 = (offsetX + 1) / 12;
|
|
1051
|
+
const y1 = offsetY / 9;
|
|
1052
|
+
const y2 = (offsetY + 1) / 9;
|
|
1053
|
+
let v1 = new Vector2(x1, y1);
|
|
1054
|
+
let v2 = new Vector2(x1, y2);
|
|
1055
|
+
let v3 = new Vector2(x2, y2);
|
|
1056
|
+
let v4 = new Vector2(x2, y1);
|
|
1057
|
+
switch (rotate) {
|
|
1058
|
+
case 1:
|
|
1059
|
+
[v1, v2, v3, v4] = [v2, v3, v4, v1];
|
|
1060
|
+
break;
|
|
1061
|
+
case 2:
|
|
1062
|
+
[v1, v2, v3, v4] = [v3, v4, v1, v2];
|
|
1063
|
+
break;
|
|
1064
|
+
case 3:
|
|
1065
|
+
[v1, v2, v3, v4] = [v4, v1, v2, v3];
|
|
1066
|
+
break;
|
|
1067
|
+
}
|
|
1068
|
+
mesh.geometry.setAttribute("uv", new BufferAttribute(new Float32Array([
|
|
1069
|
+
v3.x,
|
|
1070
|
+
v3.y,
|
|
1071
|
+
v2.x,
|
|
1072
|
+
v2.y,
|
|
1073
|
+
v4.x,
|
|
1074
|
+
v4.y,
|
|
1075
|
+
v2.x,
|
|
1076
|
+
v2.y,
|
|
1077
|
+
v1.x,
|
|
1078
|
+
v1.y,
|
|
1079
|
+
v4.x,
|
|
1080
|
+
v4.y
|
|
1081
|
+
]), 2));
|
|
1082
|
+
cubie.add(mesh);
|
|
1083
|
+
};
|
|
1084
|
+
addImageSticker(true);
|
|
1085
|
+
addImageSticker(false);
|
|
1086
|
+
})();
|
|
1087
|
+
}
|
|
1088
|
+
cubieFaceletInfo.push(faceletInfo);
|
|
1089
|
+
}
|
|
1090
|
+
cubie.matrix.copy(piece.matrix);
|
|
1091
|
+
cubie.matrixAutoUpdate = false;
|
|
1092
|
+
this.add(cubie);
|
|
1093
|
+
return cubie;
|
|
1094
|
+
}
|
|
1095
|
+
createCubieFoundation() {
|
|
1096
|
+
const box = sharedCubieFoundationGeometry();
|
|
1097
|
+
return new Mesh(box, this.options.experimentalStickering === "picture" ? blackMesh : blackTranslucentMesh);
|
|
1098
|
+
}
|
|
1099
|
+
createSticker(posAxisInfo, materialAxisInfo, isHint) {
|
|
1100
|
+
const geo = this.options.experimentalStickering === "picture" ? newStickerGeometry() : sharedStickerGeometry();
|
|
1101
|
+
const stickerMesh = new Mesh(geo, isHint ? materialAxisInfo.hintStickerMaterial.regular : materialAxisInfo.stickerMaterial.regular);
|
|
1102
|
+
stickerMesh.setRotationFromEuler(posAxisInfo.fromZ);
|
|
1103
|
+
stickerMesh.position.copy(posAxisInfo.vector);
|
|
1104
|
+
stickerMesh.position.multiplyScalar(isHint ? this.options.experimentalStickering === "picture" ? EXPERIMENTAL_PICTURE_CUBE_HINT_ELEVATION : cubieDimensions.hintStickerElevation : cubieDimensions.stickerElevation);
|
|
1105
|
+
return stickerMesh;
|
|
1106
|
+
}
|
|
1107
|
+
experimentalSetFoundationOpacity(opacity) {
|
|
1108
|
+
this.experimentalFoundationMeshes[0].material.opacity = opacity;
|
|
1109
|
+
}
|
|
1110
|
+
experimentalSetStickerWidth(width) {
|
|
1111
|
+
for (const orbitInfo of Object.values(this.kpuzzleFaceletInfo)) {
|
|
1112
|
+
for (const pieceInfo of orbitInfo) {
|
|
1113
|
+
for (const faceletInfo of pieceInfo) {
|
|
1114
|
+
faceletInfo.facelet.scale.setScalar(width / cubieDimensions.stickerWidth);
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
experimentalSetCenterStickerWidth(width) {
|
|
1120
|
+
for (const orbitInfo of [this.kpuzzleFaceletInfo["CENTERS"]]) {
|
|
1121
|
+
for (const pieceInfo of orbitInfo) {
|
|
1122
|
+
for (const faceletInfo of pieceInfo) {
|
|
1123
|
+
faceletInfo.facelet.scale.setScalar(width / cubieDimensions.stickerWidth);
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
ease(fraction) {
|
|
1129
|
+
return smootherStep(fraction);
|
|
1130
|
+
}
|
|
1131
|
+
};
|
|
1132
|
+
|
|
1133
|
+
// src/cubing/twisty/views/3D/puzzles/PG3D.ts
|
|
1134
|
+
import {
|
|
1135
|
+
BufferAttribute as BufferAttribute2,
|
|
1136
|
+
BufferGeometry as BufferGeometry2,
|
|
1137
|
+
Color,
|
|
1138
|
+
DoubleSide as DoubleSide2,
|
|
1139
|
+
Euler as Euler2,
|
|
1140
|
+
FrontSide,
|
|
1141
|
+
Group as Group2,
|
|
1142
|
+
Mesh as Mesh2,
|
|
1143
|
+
MeshBasicMaterial as MeshBasicMaterial2,
|
|
1144
|
+
Object3D as Object3D2,
|
|
1145
|
+
Vector3 as Vector33
|
|
1146
|
+
} from "three";
|
|
1147
|
+
var foundationMaterial = new MeshBasicMaterial2({
|
|
1148
|
+
side: DoubleSide2,
|
|
1149
|
+
color: 0
|
|
1150
|
+
});
|
|
1151
|
+
var invisMaterial = new MeshBasicMaterial2({
|
|
1152
|
+
visible: false
|
|
1153
|
+
});
|
|
1154
|
+
var basicStickerMaterial = new MeshBasicMaterial2({
|
|
1155
|
+
vertexColors: true
|
|
1156
|
+
});
|
|
1157
|
+
function dist(coords, a, b) {
|
|
1158
|
+
return Math.hypot(coords[3 * a] - coords[3 * b], coords[3 * a + 1] - coords[3 * b + 1], coords[3 * a + 2] - coords[3 * b + 2]);
|
|
1159
|
+
}
|
|
1160
|
+
function triarea(coords, a, b, c) {
|
|
1161
|
+
const ab = dist(coords, a, b);
|
|
1162
|
+
const bc = dist(coords, b, c);
|
|
1163
|
+
const ac = dist(coords, a, c);
|
|
1164
|
+
const p = (ab + bc + ac) / 2;
|
|
1165
|
+
return Math.sqrt(p * (p - ab) * (p - bc) * (p - ac));
|
|
1166
|
+
}
|
|
1167
|
+
function polyarea(coords) {
|
|
1168
|
+
let sum = 0;
|
|
1169
|
+
for (let i = 2; 3 * i < coords.length; i++) {
|
|
1170
|
+
sum += triarea(coords, 0, 1, i);
|
|
1171
|
+
}
|
|
1172
|
+
return sum;
|
|
1173
|
+
}
|
|
1174
|
+
function normalize(r2) {
|
|
1175
|
+
const m = Math.hypot(r2[0], r2[1], r2[2]);
|
|
1176
|
+
r2[0] /= m;
|
|
1177
|
+
r2[1] /= m;
|
|
1178
|
+
r2[2] /= m;
|
|
1179
|
+
return r2;
|
|
1180
|
+
}
|
|
1181
|
+
function cross(a, b) {
|
|
1182
|
+
const r2 = new Array(3);
|
|
1183
|
+
r2[0] = a[1] * b[2] - a[2] * b[1];
|
|
1184
|
+
r2[1] = a[2] * b[0] - a[0] * b[2];
|
|
1185
|
+
r2[2] = a[0] * b[1] - a[1] * b[0];
|
|
1186
|
+
return r2;
|
|
1187
|
+
}
|
|
1188
|
+
function normal(c) {
|
|
1189
|
+
const a = [c[3] - c[0], c[4] - c[1], c[5] - c[2]];
|
|
1190
|
+
const b = [c[6] - c[3], c[7] - c[4], c[8] - c[5]];
|
|
1191
|
+
const r2 = cross(a, b);
|
|
1192
|
+
return normalize(r2);
|
|
1193
|
+
}
|
|
1194
|
+
function trimEdges(face2, tr) {
|
|
1195
|
+
const r2 = [];
|
|
1196
|
+
const A = new Array(3);
|
|
1197
|
+
const B = new Array(3);
|
|
1198
|
+
for (let iter = 1; iter < 10; iter++) {
|
|
1199
|
+
for (let i = 0; i < face2.length; i += 3) {
|
|
1200
|
+
const pi = (i + face2.length - 3) % face2.length;
|
|
1201
|
+
const ni = (i + 3) % face2.length;
|
|
1202
|
+
for (let k = 0; k < 3; k++) {
|
|
1203
|
+
A[k] = face2[pi + k] - face2[i + k];
|
|
1204
|
+
B[k] = face2[ni + k] - face2[i + k];
|
|
1205
|
+
}
|
|
1206
|
+
const alen = Math.hypot(A[0], A[1], A[2]);
|
|
1207
|
+
const blen = Math.hypot(B[0], B[1], B[2]);
|
|
1208
|
+
for (let k = 0; k < 3; k++) {
|
|
1209
|
+
A[k] /= alen;
|
|
1210
|
+
B[k] /= blen;
|
|
1211
|
+
}
|
|
1212
|
+
const d = A[0] * B[0] + A[1] * B[1] + A[2] * B[2];
|
|
1213
|
+
const m = tr / Math.sqrt(1 - d * d);
|
|
1214
|
+
for (let k = 0; k < 3; k++) {
|
|
1215
|
+
r2[i + k] = face2[i + k] + (A[k] + B[k]) * m;
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
let good = true;
|
|
1219
|
+
for (let i = 0; good && i < r2.length; i += 3) {
|
|
1220
|
+
const ni = (i + 3) % face2.length;
|
|
1221
|
+
let t2 = 0;
|
|
1222
|
+
for (let k = 0; k < 3; k++) {
|
|
1223
|
+
const a = face2[ni + k] - face2[i + k];
|
|
1224
|
+
const b = r2[ni + k] - r2[i + k];
|
|
1225
|
+
t2 += a * b;
|
|
1226
|
+
}
|
|
1227
|
+
if (t2 <= 0) {
|
|
1228
|
+
good = false;
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
if (good) {
|
|
1232
|
+
return r2;
|
|
1233
|
+
}
|
|
1234
|
+
tr /= 2;
|
|
1235
|
+
}
|
|
1236
|
+
return face2;
|
|
1237
|
+
}
|
|
1238
|
+
var Filler = class {
|
|
1239
|
+
constructor(sz, tm) {
|
|
1240
|
+
this.sz = sz;
|
|
1241
|
+
this.tm = tm;
|
|
1242
|
+
this.vertices = new Float32Array(9 * sz);
|
|
1243
|
+
this.uvs = void 0;
|
|
1244
|
+
this.colors = new Uint8Array(18 * sz);
|
|
1245
|
+
this.ind = new Uint8Array(sz);
|
|
1246
|
+
this.pos = 0;
|
|
1247
|
+
this.ipos = 0;
|
|
1248
|
+
}
|
|
1249
|
+
add(pt, i, c) {
|
|
1250
|
+
this.vertices[this.pos] = pt[3 * i + 0];
|
|
1251
|
+
this.vertices[this.pos + 1] = pt[3 * i + 1];
|
|
1252
|
+
this.vertices[this.pos + 2] = pt[3 * i + 2];
|
|
1253
|
+
this.colors[this.pos] = c >> 16;
|
|
1254
|
+
this.colors[this.pos + 1] = c >> 8 & 255;
|
|
1255
|
+
this.colors[this.pos + 2] = c & 255;
|
|
1256
|
+
this.pos += 3;
|
|
1257
|
+
}
|
|
1258
|
+
addUncolored(pt, i) {
|
|
1259
|
+
this.vertices[this.pos] = pt[3 * i + 0];
|
|
1260
|
+
this.vertices[this.pos + 1] = pt[3 * i + 1];
|
|
1261
|
+
this.vertices[this.pos + 2] = pt[3 * i + 2];
|
|
1262
|
+
this.pos += 3;
|
|
1263
|
+
}
|
|
1264
|
+
setind(i) {
|
|
1265
|
+
this.ind[this.ipos++] = i;
|
|
1266
|
+
}
|
|
1267
|
+
makePoly(coords, color, ind) {
|
|
1268
|
+
const ncoords = coords;
|
|
1269
|
+
for (let g = 1; 3 * (g + 1) < ncoords.length; g++) {
|
|
1270
|
+
this.add(ncoords, 0, color);
|
|
1271
|
+
this.add(ncoords, g, color);
|
|
1272
|
+
this.add(ncoords, g + 1, color);
|
|
1273
|
+
this.setind(ind);
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
setAttributes(geo) {
|
|
1277
|
+
geo.setAttribute("position", new BufferAttribute2(this.vertices, 3));
|
|
1278
|
+
const sa2 = this.colors.subarray(0, 9 * this.sz);
|
|
1279
|
+
geo.setAttribute("color", new BufferAttribute2(sa2, 3, true));
|
|
1280
|
+
}
|
|
1281
|
+
makeGroups(geo) {
|
|
1282
|
+
geo.clearGroups();
|
|
1283
|
+
for (let i = 0; i < this.ipos; ) {
|
|
1284
|
+
const si = i++;
|
|
1285
|
+
const iv = this.ind[si];
|
|
1286
|
+
while (this.ind[i] === iv) {
|
|
1287
|
+
i++;
|
|
1288
|
+
}
|
|
1289
|
+
geo.addGroup(3 * si, 3 * (i - si), iv);
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
saveOriginalColors() {
|
|
1293
|
+
this.colors.copyWithin(this.pos, 0, this.pos);
|
|
1294
|
+
}
|
|
1295
|
+
};
|
|
1296
|
+
var StickerDef = class {
|
|
1297
|
+
constructor(filler, stickerDat, trim, options) {
|
|
1298
|
+
this.texturePtr = void 0;
|
|
1299
|
+
this.twistVal = -1;
|
|
1300
|
+
this.isDup = !!stickerDat.isDup;
|
|
1301
|
+
this.faceNum = stickerDat.face;
|
|
1302
|
+
this.stickerStart = filler.ipos;
|
|
1303
|
+
const sdColor = new Color(stickerDat.color).getHex();
|
|
1304
|
+
this.origColor = sdColor;
|
|
1305
|
+
this.origColorAppearance = sdColor;
|
|
1306
|
+
if (options?.appearance) {
|
|
1307
|
+
this.setAppearance(filler, options.appearance);
|
|
1308
|
+
}
|
|
1309
|
+
this.faceColor = sdColor;
|
|
1310
|
+
const coords = this.stickerCoords(stickerDat.coords, trim);
|
|
1311
|
+
filler.makePoly(coords, this.faceColor, this.isDup ? 4 : 0);
|
|
1312
|
+
this.stickerEnd = filler.ipos;
|
|
1313
|
+
}
|
|
1314
|
+
stickerCoords(coords, trim) {
|
|
1315
|
+
return trimEdges(coords.slice(), trim);
|
|
1316
|
+
}
|
|
1317
|
+
hintCoords(coords, hintStickerHeightScale, trim, normal2) {
|
|
1318
|
+
coords = this.stickerCoords(coords, trim);
|
|
1319
|
+
normal2 = normal2.slice();
|
|
1320
|
+
for (let i = 0; i < 3; i++) {
|
|
1321
|
+
normal2[i] *= 0.5 * hintStickerHeightScale;
|
|
1322
|
+
}
|
|
1323
|
+
const hCoords = new Array(coords.length);
|
|
1324
|
+
for (let i = 0; 3 * i < coords.length; i++) {
|
|
1325
|
+
const j = coords.length / 3 - 1 - i;
|
|
1326
|
+
hCoords[3 * i] = coords[3 * j] + normal2[0];
|
|
1327
|
+
hCoords[3 * i + 1] = coords[3 * j + 1] + normal2[1];
|
|
1328
|
+
hCoords[3 * i + 2] = coords[3 * j + 2] + normal2[2];
|
|
1329
|
+
}
|
|
1330
|
+
return hCoords;
|
|
1331
|
+
}
|
|
1332
|
+
foundationCoords(coords) {
|
|
1333
|
+
const ncoords = coords.slice();
|
|
1334
|
+
for (let i = 0; i < coords.length; i++) {
|
|
1335
|
+
ncoords[i] = coords[i] * 0.999;
|
|
1336
|
+
}
|
|
1337
|
+
return ncoords;
|
|
1338
|
+
}
|
|
1339
|
+
addHint(filler, stickerDat, hintStickers, hintStickerHeightScale, trim, normal2) {
|
|
1340
|
+
this.hintStart = filler.ipos;
|
|
1341
|
+
const coords = this.hintCoords(stickerDat.coords, hintStickerHeightScale, trim, normal2);
|
|
1342
|
+
filler.makePoly(coords, this.faceColor, hintStickers && !this.isDup ? 2 : 4);
|
|
1343
|
+
this.hintEnd = filler.ipos;
|
|
1344
|
+
}
|
|
1345
|
+
addFoundation(filler, stickerDat, black) {
|
|
1346
|
+
this.foundationStart = filler.ipos;
|
|
1347
|
+
const coords = this.foundationCoords(stickerDat.coords);
|
|
1348
|
+
filler.makePoly(coords, black, this.isDup ? 4 : 6);
|
|
1349
|
+
this.foundationEnd = filler.ipos;
|
|
1350
|
+
}
|
|
1351
|
+
setHintStickers(filler, hintStickers) {
|
|
1352
|
+
const indv = this.isDup || !hintStickers ? 4 : 2;
|
|
1353
|
+
for (let i = this.hintStart; i < this.hintEnd; i++) {
|
|
1354
|
+
filler.ind[i] = indv | filler.ind[i] & 1;
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
setAppearance(filler, faceletMeshAppearance) {
|
|
1358
|
+
let c = 0;
|
|
1359
|
+
switch (faceletMeshAppearance) {
|
|
1360
|
+
case "regular":
|
|
1361
|
+
c = this.origColor;
|
|
1362
|
+
break;
|
|
1363
|
+
case "dim":
|
|
1364
|
+
if (this.origColor === 16777215) {
|
|
1365
|
+
c = 14540253;
|
|
1366
|
+
} else {
|
|
1367
|
+
c = new Color(this.origColor).multiplyScalar(0.5).getHex();
|
|
1368
|
+
}
|
|
1369
|
+
break;
|
|
1370
|
+
case "oriented":
|
|
1371
|
+
c = 16746751;
|
|
1372
|
+
break;
|
|
1373
|
+
case "ignored":
|
|
1374
|
+
c = 4473924;
|
|
1375
|
+
break;
|
|
1376
|
+
case "invisible":
|
|
1377
|
+
c = this.origColor;
|
|
1378
|
+
}
|
|
1379
|
+
this.origColorAppearance = c;
|
|
1380
|
+
for (let i = 9 * this.stickerStart; i < 9 * this.stickerEnd; i += 3) {
|
|
1381
|
+
filler.colors[filler.pos + i] = c >> 16;
|
|
1382
|
+
filler.colors[filler.pos + i + 1] = c >> 8 & 255;
|
|
1383
|
+
filler.colors[filler.pos + i + 2] = c & 255;
|
|
1384
|
+
}
|
|
1385
|
+
for (let i = 9 * this.hintStart; i < 9 * this.hintEnd; i += 3) {
|
|
1386
|
+
filler.colors[filler.pos + i] = c >> 16;
|
|
1387
|
+
filler.colors[filler.pos + i + 1] = c >> 8 & 255;
|
|
1388
|
+
filler.colors[filler.pos + i + 2] = c & 255;
|
|
1389
|
+
}
|
|
1390
|
+
this.setHintStickers(filler, faceletMeshAppearance !== "invisible" && !this.isDup);
|
|
1391
|
+
}
|
|
1392
|
+
addUVs(filler) {
|
|
1393
|
+
const uvs = filler.uvs;
|
|
1394
|
+
const vert = filler.vertices;
|
|
1395
|
+
const coords = new Array(3);
|
|
1396
|
+
for (let i = 3 * this.stickerStart; i < 3 * this.stickerEnd; i++) {
|
|
1397
|
+
coords[0] = vert[3 * i];
|
|
1398
|
+
coords[1] = vert[3 * i + 1];
|
|
1399
|
+
coords[2] = vert[3 * i + 2];
|
|
1400
|
+
const uv = filler.tm.getuv(this.faceNum, coords);
|
|
1401
|
+
uvs[2 * i] = uv[0];
|
|
1402
|
+
uvs[2 * i + 1] = uv[1];
|
|
1403
|
+
}
|
|
1404
|
+
for (let i = 3 * this.hintStart; i < 3 * this.hintEnd; i++) {
|
|
1405
|
+
coords[0] = vert[3 * i];
|
|
1406
|
+
coords[1] = vert[3 * i + 1];
|
|
1407
|
+
coords[2] = vert[3 * i + 2];
|
|
1408
|
+
const uv = filler.tm.getuv(this.faceNum, coords);
|
|
1409
|
+
uvs[2 * i] = uv[0];
|
|
1410
|
+
uvs[2 * i + 1] = uv[1];
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
setTexture(filler, sd) {
|
|
1414
|
+
if (this.texturePtr === sd) {
|
|
1415
|
+
return 0;
|
|
1416
|
+
}
|
|
1417
|
+
this.texturePtr = sd;
|
|
1418
|
+
const sz = 6 * filler.sz;
|
|
1419
|
+
filler.uvs.copyWithin(6 * this.stickerStart, 6 * sd.stickerStart + sz, 6 * sd.stickerEnd + sz);
|
|
1420
|
+
filler.uvs.copyWithin(6 * this.hintStart, 6 * sd.hintStart + sz, 6 * sd.hintEnd + sz);
|
|
1421
|
+
return 1;
|
|
1422
|
+
}
|
|
1423
|
+
setColor(filler, sd) {
|
|
1424
|
+
const c = sd.origColorAppearance;
|
|
1425
|
+
if (this.faceColor !== c) {
|
|
1426
|
+
this.faceColor = c;
|
|
1427
|
+
const sz = filler.pos;
|
|
1428
|
+
filler.colors.copyWithin(9 * this.stickerStart, 9 * sd.stickerStart + sz, 9 * sd.stickerEnd + sz);
|
|
1429
|
+
filler.colors.copyWithin(9 * this.hintStart, 9 * sd.hintStart + sz, 9 * sd.hintEnd + sz);
|
|
1430
|
+
return 1;
|
|
1431
|
+
} else {
|
|
1432
|
+
return 0;
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
};
|
|
1436
|
+
var HitPlaneDef = class {
|
|
1437
|
+
constructor(hitface, tm) {
|
|
1438
|
+
this.cubie = new Group2();
|
|
1439
|
+
const coords = hitface.coords;
|
|
1440
|
+
const filler = new Filler(coords.length / 3 - 2, tm);
|
|
1441
|
+
for (let g = 1; 3 * g + 3 < coords.length; g++) {
|
|
1442
|
+
filler.addUncolored(coords, 0);
|
|
1443
|
+
filler.addUncolored(coords, g);
|
|
1444
|
+
filler.addUncolored(coords, g + 1);
|
|
1445
|
+
}
|
|
1446
|
+
this.geo = new BufferGeometry2();
|
|
1447
|
+
filler.setAttributes(this.geo);
|
|
1448
|
+
const obj = new Mesh2(this.geo, invisMaterial);
|
|
1449
|
+
obj.userData.name = hitface.name;
|
|
1450
|
+
this.cubie.scale.setScalar(0.99);
|
|
1451
|
+
this.cubie.add(obj);
|
|
1452
|
+
}
|
|
1453
|
+
};
|
|
1454
|
+
var AxisInfo2 = class {
|
|
1455
|
+
constructor(axisDat) {
|
|
1456
|
+
const vec = axisDat[0];
|
|
1457
|
+
this.axis = new Vector33(vec[0], vec[1], vec[2]);
|
|
1458
|
+
this.order = axisDat[2];
|
|
1459
|
+
}
|
|
1460
|
+
};
|
|
1461
|
+
var DEFAULT_COLOR_FRACTION = 0.71;
|
|
1462
|
+
var PG_SCALE = 0.5;
|
|
1463
|
+
var _pendingStickeringUpdate;
|
|
1464
|
+
var PG3D = class extends Object3D2 {
|
|
1465
|
+
constructor(cursor, scheduleRenderCallback, definition, pgdat, showFoundation = false, showHintStickers = false, hintStickerHeightScale = 1, params = {}) {
|
|
1466
|
+
super();
|
|
1467
|
+
this.scheduleRenderCallback = scheduleRenderCallback;
|
|
1468
|
+
this.definition = definition;
|
|
1469
|
+
this.pgdat = pgdat;
|
|
1470
|
+
this.showFoundation = showFoundation;
|
|
1471
|
+
this.showHintStickers = showHintStickers;
|
|
1472
|
+
this.params = params;
|
|
1473
|
+
this.stickerTargets = [];
|
|
1474
|
+
this.controlTargets = [];
|
|
1475
|
+
this.textured = false;
|
|
1476
|
+
__privateAdd(this, _pendingStickeringUpdate, false);
|
|
1477
|
+
if (pgdat.stickers.length === 0) {
|
|
1478
|
+
throw Error("Reuse of stickerdat from pg; please don't do that.");
|
|
1479
|
+
}
|
|
1480
|
+
this.hintMaterial = new MeshBasicMaterial2({
|
|
1481
|
+
vertexColors: true,
|
|
1482
|
+
transparent: true,
|
|
1483
|
+
opacity: 0.5
|
|
1484
|
+
});
|
|
1485
|
+
this.hintMaterialDisposable = true;
|
|
1486
|
+
this.stickerMaterial = basicStickerMaterial;
|
|
1487
|
+
this.stickerMaterialDisposable = false;
|
|
1488
|
+
this.axesInfo = {};
|
|
1489
|
+
const axesDef = this.pgdat.axis;
|
|
1490
|
+
for (const axis of axesDef) {
|
|
1491
|
+
this.axesInfo[axis[1]] = new AxisInfo2(axis);
|
|
1492
|
+
}
|
|
1493
|
+
const stickers = this.pgdat.stickers;
|
|
1494
|
+
this.stickers = {};
|
|
1495
|
+
this.materialArray1 = new Array(8);
|
|
1496
|
+
this.materialArray2 = new Array(8);
|
|
1497
|
+
this.enableFoundation(showFoundation);
|
|
1498
|
+
this.updateMaterialArrays();
|
|
1499
|
+
let triangleCount = 0;
|
|
1500
|
+
const multiplier = 3;
|
|
1501
|
+
for (const sticker of stickers) {
|
|
1502
|
+
const sides = sticker.coords.length / 3;
|
|
1503
|
+
triangleCount += multiplier * (sides - 2);
|
|
1504
|
+
}
|
|
1505
|
+
const filler = new Filler(triangleCount, pgdat.textureMapper);
|
|
1506
|
+
const black = 0;
|
|
1507
|
+
const normals = [];
|
|
1508
|
+
let totArea = 0;
|
|
1509
|
+
for (const f of pgdat.faces) {
|
|
1510
|
+
normals.push(normal(f.coords));
|
|
1511
|
+
totArea += polyarea(f.coords);
|
|
1512
|
+
}
|
|
1513
|
+
const colorfrac = DEFAULT_COLOR_FRACTION;
|
|
1514
|
+
let nonDupStickers = 0;
|
|
1515
|
+
for (const sticker of stickers) {
|
|
1516
|
+
if (!sticker.isDup) {
|
|
1517
|
+
nonDupStickers++;
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
const trim = Math.sqrt(totArea / nonDupStickers) * (1 - Math.sqrt(colorfrac)) / 2;
|
|
1521
|
+
for (const sticker of stickers) {
|
|
1522
|
+
const orbit = sticker.orbit;
|
|
1523
|
+
const ord = sticker.ord;
|
|
1524
|
+
const ori = sticker.ori;
|
|
1525
|
+
if (!this.stickers[orbit]) {
|
|
1526
|
+
this.stickers[orbit] = [];
|
|
1527
|
+
}
|
|
1528
|
+
if (!this.stickers[orbit][ori]) {
|
|
1529
|
+
this.stickers[orbit][ori] = [];
|
|
1530
|
+
}
|
|
1531
|
+
const options = {};
|
|
1532
|
+
if (params.appearance) {
|
|
1533
|
+
options.appearance = getFaceletAppearance(params.appearance, orbit, ord, ori, false);
|
|
1534
|
+
}
|
|
1535
|
+
const stickerdef = new StickerDef(filler, sticker, trim, options);
|
|
1536
|
+
this.stickers[orbit][ori][ord] = stickerdef;
|
|
1537
|
+
}
|
|
1538
|
+
for (const sticker of stickers) {
|
|
1539
|
+
const orbit = sticker.orbit;
|
|
1540
|
+
const ord = sticker.ord;
|
|
1541
|
+
const ori = sticker.ori;
|
|
1542
|
+
this.stickers[orbit][ori][ord].addHint(filler, sticker, showHintStickers, hintStickerHeightScale, trim, normals[sticker.face]);
|
|
1543
|
+
}
|
|
1544
|
+
this.foundationBound = filler.ipos;
|
|
1545
|
+
for (const sticker of stickers) {
|
|
1546
|
+
const orbit = sticker.orbit;
|
|
1547
|
+
const ord = sticker.ord;
|
|
1548
|
+
const ori = sticker.ori;
|
|
1549
|
+
this.stickers[orbit][ori][ord].addFoundation(filler, sticker, black);
|
|
1550
|
+
}
|
|
1551
|
+
const fixedGeo = new BufferGeometry2();
|
|
1552
|
+
filler.setAttributes(fixedGeo);
|
|
1553
|
+
filler.makeGroups(fixedGeo);
|
|
1554
|
+
const obj = new Mesh2(fixedGeo, this.materialArray1);
|
|
1555
|
+
obj.scale.set(PG_SCALE, PG_SCALE, PG_SCALE);
|
|
1556
|
+
this.add(obj);
|
|
1557
|
+
const obj2 = new Mesh2(fixedGeo, this.materialArray2);
|
|
1558
|
+
obj2.scale.set(PG_SCALE, PG_SCALE, PG_SCALE);
|
|
1559
|
+
this.add(obj2);
|
|
1560
|
+
const hitfaces = this.pgdat.faces;
|
|
1561
|
+
this.movingObj = obj2;
|
|
1562
|
+
this.fixedGeo = fixedGeo;
|
|
1563
|
+
this.filler = filler;
|
|
1564
|
+
for (const hitface of hitfaces) {
|
|
1565
|
+
const facedef = new HitPlaneDef(hitface, pgdat.textureMapper);
|
|
1566
|
+
facedef.cubie.scale.set(PG_SCALE, PG_SCALE, PG_SCALE);
|
|
1567
|
+
this.add(facedef.cubie);
|
|
1568
|
+
this.controlTargets.push(facedef.cubie.children[0]);
|
|
1569
|
+
}
|
|
1570
|
+
filler.saveOriginalColors();
|
|
1571
|
+
cursor.addPositionListener(this);
|
|
1572
|
+
pgdat.stickers = [];
|
|
1573
|
+
}
|
|
1574
|
+
dispose() {
|
|
1575
|
+
if (this.fixedGeo) {
|
|
1576
|
+
this.fixedGeo.dispose();
|
|
1577
|
+
}
|
|
1578
|
+
if (this.stickerMaterialDisposable) {
|
|
1579
|
+
this.stickerMaterial.dispose();
|
|
1580
|
+
this.stickerMaterial = basicStickerMaterial;
|
|
1581
|
+
this.stickerMaterialDisposable = false;
|
|
1582
|
+
}
|
|
1583
|
+
if (this.hintMaterialDisposable) {
|
|
1584
|
+
this.hintMaterial.dispose();
|
|
1585
|
+
this.hintMaterial = basicStickerMaterial;
|
|
1586
|
+
this.hintMaterialDisposable = false;
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
experimentalGetStickerTargets() {
|
|
1590
|
+
return this.stickerTargets;
|
|
1591
|
+
}
|
|
1592
|
+
experimentalGetControlTargets() {
|
|
1593
|
+
return this.controlTargets;
|
|
1594
|
+
}
|
|
1595
|
+
experimentalSetAppearance(appearance) {
|
|
1596
|
+
this.params.appearance = appearance;
|
|
1597
|
+
for (const orbitName in this.definition.orbits) {
|
|
1598
|
+
const { numPieces, orientations } = this.definition.orbits[orbitName];
|
|
1599
|
+
for (let pieceIdx = 0; pieceIdx < numPieces; pieceIdx++) {
|
|
1600
|
+
for (let faceletIdx = 0; faceletIdx < orientations; faceletIdx++) {
|
|
1601
|
+
const faceletAppearance = getFaceletAppearance(appearance, orbitName, pieceIdx, faceletIdx, false);
|
|
1602
|
+
const stickerDef = this.stickers[orbitName][faceletIdx][pieceIdx];
|
|
1603
|
+
stickerDef.setAppearance(this.filler, faceletAppearance);
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
if (this.scheduleRenderCallback) {
|
|
1608
|
+
__privateSet(this, _pendingStickeringUpdate, true);
|
|
1609
|
+
if (this.lastPos) {
|
|
1610
|
+
this.onPositionChange(this.lastPos);
|
|
1611
|
+
}
|
|
1612
|
+
this.scheduleRenderCallback();
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
onPositionChange(p) {
|
|
1616
|
+
const state = p.state;
|
|
1617
|
+
const noRotation = new Euler2();
|
|
1618
|
+
this.movingObj.rotation.copy(noRotation);
|
|
1619
|
+
let colormods = 0;
|
|
1620
|
+
const filler = this.filler;
|
|
1621
|
+
const ind = filler.ind;
|
|
1622
|
+
if (!this.lastPos || __privateGet(this, _pendingStickeringUpdate) || !areTransformationsEquivalent(this.definition, this.lastPos.state, state)) {
|
|
1623
|
+
for (const orbit in this.stickers) {
|
|
1624
|
+
const pieces = this.stickers[orbit];
|
|
1625
|
+
const pos2 = state[orbit];
|
|
1626
|
+
const orin = pieces.length;
|
|
1627
|
+
if (orin === 1) {
|
|
1628
|
+
const pieces2 = pieces[0];
|
|
1629
|
+
for (let i = 0; i < pieces2.length; i++) {
|
|
1630
|
+
const ni = pos2.permutation[i];
|
|
1631
|
+
if (this.textured) {
|
|
1632
|
+
colormods += pieces2[i].setTexture(filler, pieces2[ni]);
|
|
1633
|
+
} else {
|
|
1634
|
+
colormods += pieces2[i].setColor(filler, pieces2[ni]);
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
} else {
|
|
1638
|
+
for (let ori = 0; ori < orin; ori++) {
|
|
1639
|
+
const pieces2 = pieces[ori];
|
|
1640
|
+
for (let i = 0; i < pieces2.length; i++) {
|
|
1641
|
+
const nori = (ori + orin - pos2.orientation[i]) % orin;
|
|
1642
|
+
const ni = pos2.permutation[i];
|
|
1643
|
+
if (this.textured) {
|
|
1644
|
+
colormods += pieces2[i].setTexture(filler, pieces[nori][ni]);
|
|
1645
|
+
} else {
|
|
1646
|
+
colormods += pieces2[i].setColor(filler, pieces[nori][ni]);
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
this.lastPos = p;
|
|
1653
|
+
__privateSet(this, _pendingStickeringUpdate, false);
|
|
1654
|
+
}
|
|
1655
|
+
let vismods = 0;
|
|
1656
|
+
for (const moveProgress of p.movesInProgress) {
|
|
1657
|
+
const externalMove = moveProgress.move;
|
|
1658
|
+
const unswizzled = this.pgdat.unswizzle(externalMove);
|
|
1659
|
+
const move = this.pgdat.notationMapper.notationToInternal(externalMove);
|
|
1660
|
+
if (move === null) {
|
|
1661
|
+
throw Error("Bad blockmove " + externalMove.family);
|
|
1662
|
+
}
|
|
1663
|
+
const quantumTransformation = transformationForQuantumMove(this.definition, externalMove.quantum);
|
|
1664
|
+
const ax = this.axesInfo[unswizzled];
|
|
1665
|
+
const turnNormal = ax.axis;
|
|
1666
|
+
const angle = -this.ease(moveProgress.fraction) * moveProgress.direction * move.amount * TAU / ax.order;
|
|
1667
|
+
this.movingObj.rotateOnAxis(turnNormal, angle);
|
|
1668
|
+
if (this.lastMove !== quantumTransformation) {
|
|
1669
|
+
for (const orbit in this.stickers) {
|
|
1670
|
+
const pieces = this.stickers[orbit];
|
|
1671
|
+
const orin = pieces.length;
|
|
1672
|
+
const bmv = quantumTransformation[orbit];
|
|
1673
|
+
for (let ori = 0; ori < orin; ori++) {
|
|
1674
|
+
const pieces2 = pieces[ori];
|
|
1675
|
+
for (let i = 0; i < pieces2.length; i++) {
|
|
1676
|
+
const p2 = pieces2[i];
|
|
1677
|
+
const ni = bmv.permutation[i];
|
|
1678
|
+
let tv = 0;
|
|
1679
|
+
if (ni !== i || bmv.orientation[i] !== 0) {
|
|
1680
|
+
tv = 1;
|
|
1681
|
+
}
|
|
1682
|
+
if (tv !== p2.twistVal) {
|
|
1683
|
+
if (tv) {
|
|
1684
|
+
for (let j = p2.stickerStart; j < p2.stickerEnd; j++) {
|
|
1685
|
+
ind[j] |= 1;
|
|
1686
|
+
}
|
|
1687
|
+
for (let j = p2.hintStart; j < p2.hintEnd; j++) {
|
|
1688
|
+
ind[j] |= 1;
|
|
1689
|
+
}
|
|
1690
|
+
for (let j = p2.foundationStart; j < p2.foundationEnd; j++) {
|
|
1691
|
+
ind[j] |= 1;
|
|
1692
|
+
}
|
|
1693
|
+
} else {
|
|
1694
|
+
for (let j = p2.stickerStart; j < p2.stickerEnd; j++) {
|
|
1695
|
+
ind[j] &= ~1;
|
|
1696
|
+
}
|
|
1697
|
+
for (let j = p2.hintStart; j < p2.hintEnd; j++) {
|
|
1698
|
+
ind[j] &= ~1;
|
|
1699
|
+
}
|
|
1700
|
+
for (let j = p2.foundationStart; j < p2.foundationEnd; j++) {
|
|
1701
|
+
ind[j] &= ~1;
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
p2.twistVal = tv;
|
|
1705
|
+
vismods++;
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
this.lastMove = quantumTransformation;
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
if (vismods) {
|
|
1714
|
+
this.filler.makeGroups(this.fixedGeo);
|
|
1715
|
+
}
|
|
1716
|
+
if (colormods) {
|
|
1717
|
+
if (this.textured) {
|
|
1718
|
+
this.fixedGeo.getAttribute("uv").updateRange = {
|
|
1719
|
+
offset: 0,
|
|
1720
|
+
count: 6 * this.foundationBound
|
|
1721
|
+
};
|
|
1722
|
+
this.fixedGeo.getAttribute("uv").needsUpdate = true;
|
|
1723
|
+
} else {
|
|
1724
|
+
this.fixedGeo.getAttribute("color").updateRange = {
|
|
1725
|
+
offset: 0,
|
|
1726
|
+
count: 9 * this.foundationBound
|
|
1727
|
+
};
|
|
1728
|
+
this.fixedGeo.getAttribute("color").needsUpdate = true;
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
this.scheduleRenderCallback();
|
|
1732
|
+
}
|
|
1733
|
+
ease(fraction) {
|
|
1734
|
+
return smootherStep(fraction);
|
|
1735
|
+
}
|
|
1736
|
+
enableHintFacelets(v) {
|
|
1737
|
+
this.showHintStickers = v;
|
|
1738
|
+
this.updateMaterialArrays();
|
|
1739
|
+
}
|
|
1740
|
+
updateMaterialArrays() {
|
|
1741
|
+
for (let i = 0; i < 8; i++) {
|
|
1742
|
+
this.materialArray1[i] = invisMaterial;
|
|
1743
|
+
this.materialArray2[i] = invisMaterial;
|
|
1744
|
+
}
|
|
1745
|
+
this.materialArray1[0] = this.stickerMaterial;
|
|
1746
|
+
this.materialArray2[1] = this.stickerMaterial;
|
|
1747
|
+
if (this.showHintStickers) {
|
|
1748
|
+
this.materialArray1[2] = this.hintMaterial;
|
|
1749
|
+
this.materialArray2[3] = this.hintMaterial;
|
|
1750
|
+
} else {
|
|
1751
|
+
this.materialArray1[2] = invisMaterial;
|
|
1752
|
+
this.materialArray2[3] = invisMaterial;
|
|
1753
|
+
}
|
|
1754
|
+
if (this.showFoundation) {
|
|
1755
|
+
this.materialArray1[6] = foundationMaterial;
|
|
1756
|
+
this.materialArray2[7] = foundationMaterial;
|
|
1757
|
+
} else {
|
|
1758
|
+
this.materialArray1[6] = invisMaterial;
|
|
1759
|
+
this.materialArray2[7] = invisMaterial;
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
enableFoundation(v) {
|
|
1763
|
+
this.showFoundation = v;
|
|
1764
|
+
this.updateMaterialArrays();
|
|
1765
|
+
}
|
|
1766
|
+
setHintStickerOpacity(v) {
|
|
1767
|
+
if (this.hintMaterialDisposable) {
|
|
1768
|
+
this.hintMaterial.dispose();
|
|
1769
|
+
this.hintMaterialDisposable = false;
|
|
1770
|
+
}
|
|
1771
|
+
if (v === 0) {
|
|
1772
|
+
this.hintMaterial = invisMaterial;
|
|
1773
|
+
} else if (v === 1) {
|
|
1774
|
+
this.hintMaterial = this.stickerMaterial;
|
|
1775
|
+
} else {
|
|
1776
|
+
this.hintMaterial = new MeshBasicMaterial2({
|
|
1777
|
+
vertexColors: true,
|
|
1778
|
+
transparent: true,
|
|
1779
|
+
opacity: 0.5
|
|
1780
|
+
});
|
|
1781
|
+
this.hintMaterialDisposable = true;
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
experimentalUpdateOptions(options) {
|
|
1785
|
+
if (options.hintFacelets !== void 0) {
|
|
1786
|
+
this.enableHintFacelets(options.hintFacelets !== "none");
|
|
1787
|
+
}
|
|
1788
|
+
if (options.showFoundation !== void 0) {
|
|
1789
|
+
this.enableFoundation(options.showFoundation);
|
|
1790
|
+
}
|
|
1791
|
+
if (options.hintStickerOpacity !== void 0) {
|
|
1792
|
+
this.setHintStickerOpacity(options.hintStickerOpacity);
|
|
1793
|
+
}
|
|
1794
|
+
__privateSet(this, _pendingStickeringUpdate, true);
|
|
1795
|
+
if (this.lastPos) {
|
|
1796
|
+
this.onPositionChange(this.lastPos);
|
|
1797
|
+
}
|
|
1798
|
+
this.scheduleRenderCallback();
|
|
1799
|
+
}
|
|
1800
|
+
adduvs() {
|
|
1801
|
+
const filler = this.filler;
|
|
1802
|
+
if (filler.uvs) {
|
|
1803
|
+
return;
|
|
1804
|
+
}
|
|
1805
|
+
this.filler.uvs = new Float32Array(12 * filler.sz);
|
|
1806
|
+
for (const orbit in this.stickers) {
|
|
1807
|
+
const pieces = this.stickers[orbit];
|
|
1808
|
+
const orin = pieces.length;
|
|
1809
|
+
for (let ori = 0; ori < orin; ori++) {
|
|
1810
|
+
const pieces2 = pieces[ori];
|
|
1811
|
+
for (const piece2 of pieces2) {
|
|
1812
|
+
piece2.addUVs(this.filler);
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
filler.uvs.copyWithin(6 * filler.sz, 0, 6 * filler.sz);
|
|
1817
|
+
const sa1 = filler.uvs.subarray(0, 6 * filler.sz);
|
|
1818
|
+
this.fixedGeo.setAttribute("uv", new BufferAttribute2(sa1, 2, true));
|
|
1819
|
+
}
|
|
1820
|
+
experimentalUpdateTexture(enabled, stickerTexture, hintTexture) {
|
|
1821
|
+
if (!stickerTexture) {
|
|
1822
|
+
enabled = false;
|
|
1823
|
+
} else if (!hintTexture) {
|
|
1824
|
+
hintTexture = stickerTexture;
|
|
1825
|
+
}
|
|
1826
|
+
if (enabled && !this.filler.uvs) {
|
|
1827
|
+
this.adduvs();
|
|
1828
|
+
}
|
|
1829
|
+
this.textured = enabled;
|
|
1830
|
+
if (this.stickerMaterialDisposable) {
|
|
1831
|
+
this.stickerMaterial.dispose();
|
|
1832
|
+
this.stickerMaterialDisposable = false;
|
|
1833
|
+
}
|
|
1834
|
+
if (enabled) {
|
|
1835
|
+
this.stickerMaterial = new MeshBasicMaterial2({
|
|
1836
|
+
map: stickerTexture,
|
|
1837
|
+
side: FrontSide,
|
|
1838
|
+
transparent: false
|
|
1839
|
+
});
|
|
1840
|
+
this.stickerMaterialDisposable = true;
|
|
1841
|
+
} else {
|
|
1842
|
+
this.stickerMaterial = basicStickerMaterial;
|
|
1843
|
+
}
|
|
1844
|
+
if (this.hintMaterialDisposable) {
|
|
1845
|
+
this.hintMaterial.dispose();
|
|
1846
|
+
this.hintMaterialDisposable = false;
|
|
1847
|
+
}
|
|
1848
|
+
if (enabled) {
|
|
1849
|
+
this.hintMaterial = new MeshBasicMaterial2({
|
|
1850
|
+
map: hintTexture,
|
|
1851
|
+
side: FrontSide,
|
|
1852
|
+
transparent: false
|
|
1853
|
+
});
|
|
1854
|
+
this.hintMaterialDisposable = true;
|
|
1855
|
+
} else {
|
|
1856
|
+
this.hintMaterial = basicStickerMaterial;
|
|
1857
|
+
}
|
|
1858
|
+
this.updateMaterialArrays();
|
|
1859
|
+
__privateSet(this, _pendingStickeringUpdate, true);
|
|
1860
|
+
if (this.lastPos) {
|
|
1861
|
+
this.onPositionChange(this.lastPos);
|
|
1862
|
+
}
|
|
1863
|
+
this.scheduleRenderCallback();
|
|
1864
|
+
}
|
|
1865
|
+
};
|
|
1866
|
+
_pendingStickeringUpdate = new WeakMap();
|
|
1867
|
+
|
|
1868
|
+
// src/cubing/twisty/old/dom/viewers/Twisty3DCanvas.ts
|
|
1869
|
+
import { PerspectiveCamera, Vector3 as Vector35, WebGLRenderer } from "three";
|
|
1870
|
+
|
|
1871
|
+
// src/cubing/twisty/old/animation/RenderScheduler.ts
|
|
1872
|
+
var RenderScheduler = class {
|
|
1873
|
+
constructor(callback) {
|
|
1874
|
+
this.callback = callback;
|
|
1875
|
+
this.animFrameID = null;
|
|
1876
|
+
this.animFrame = this.animFrameWrapper.bind(this);
|
|
1877
|
+
}
|
|
1878
|
+
requestAnimFrame() {
|
|
1879
|
+
if (!this.animFrameID) {
|
|
1880
|
+
this.animFrameID = requestAnimationFrame(this.animFrame);
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
cancelAnimFrame() {
|
|
1884
|
+
if (this.animFrameID) {
|
|
1885
|
+
cancelAnimationFrame(this.animFrameID);
|
|
1886
|
+
this.animFrameID = 0;
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
animFrameWrapper(timestamp) {
|
|
1890
|
+
this.animFrameID = 0;
|
|
1891
|
+
this.callback(timestamp);
|
|
1892
|
+
}
|
|
1893
|
+
};
|
|
1894
|
+
|
|
1895
|
+
// src/cubing/twisty/old/dom/viewers/canvas.ts
|
|
1896
|
+
var globalPixelRatioOverride = null;
|
|
1897
|
+
function pixelRatio() {
|
|
1898
|
+
return globalPixelRatioOverride ?? (devicePixelRatio || 1);
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
// src/cubing/twisty/old/dom/viewers/Twisty3DCanvas.css.ts
|
|
1902
|
+
var twisty3DCanvasCSS = new CSSSource(`
|
|
1903
|
+
:host {
|
|
1904
|
+
width: 384px;
|
|
1905
|
+
height: 256px;
|
|
1906
|
+
display: grid;
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1909
|
+
.wrapper {
|
|
1910
|
+
width: 100%;
|
|
1911
|
+
height: 100%;
|
|
1912
|
+
display: grid;
|
|
1913
|
+
overflow: hidden;
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
/* TODO: This is due to stats hack. Replace with \`canvas\`. */
|
|
1917
|
+
.wrapper > canvas {
|
|
1918
|
+
max-width: 100%;
|
|
1919
|
+
max-height: 100%;
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
.wrapper.invisible {
|
|
1923
|
+
opacity: 0;
|
|
1924
|
+
}
|
|
1925
|
+
`);
|
|
1926
|
+
|
|
1927
|
+
// src/cubing/twisty/old/dom/viewers/TwistyOrbitControls.ts
|
|
1928
|
+
import { Spherical, Vector3 as Vector34 } from "three";
|
|
1929
|
+
var EPSILON = 1e-8;
|
|
1930
|
+
var INERTIA_DEFAULT = true;
|
|
1931
|
+
var LATITUDE_LIMITS_DEFAULT = "auto";
|
|
1932
|
+
var INERTIA_DURATION_MS = 500;
|
|
1933
|
+
var INERTIA_TIMEOUT_MS = 50;
|
|
1934
|
+
var VERTICAL_MOVEMENT_BASE_SCALE = 0.75;
|
|
1935
|
+
function momentumScale(progress) {
|
|
1936
|
+
return (Math.exp(1 - progress) - (1 - progress)) / (1 - Math.E) + 1;
|
|
1937
|
+
}
|
|
1938
|
+
var Inertia = class {
|
|
1939
|
+
constructor(startTimestamp, momentumX, momentumY, callback) {
|
|
1940
|
+
this.startTimestamp = startTimestamp;
|
|
1941
|
+
this.momentumX = momentumX;
|
|
1942
|
+
this.momentumY = momentumY;
|
|
1943
|
+
this.callback = callback;
|
|
1944
|
+
this.scheduler = new RenderScheduler(this.render.bind(this));
|
|
1945
|
+
this.scheduler.requestAnimFrame();
|
|
1946
|
+
this.lastTimestamp = startTimestamp;
|
|
1947
|
+
}
|
|
1948
|
+
render(now) {
|
|
1949
|
+
const progressBefore = (this.lastTimestamp - this.startTimestamp) / INERTIA_DURATION_MS;
|
|
1950
|
+
const progressAfter = Math.min(1, (now - this.startTimestamp) / INERTIA_DURATION_MS);
|
|
1951
|
+
if (progressBefore === 0 && progressAfter > INERTIA_TIMEOUT_MS / INERTIA_DURATION_MS) {
|
|
1952
|
+
return;
|
|
1953
|
+
}
|
|
1954
|
+
const delta = momentumScale(progressAfter) - momentumScale(progressBefore);
|
|
1955
|
+
this.callback(this.momentumX * delta * 1e3, this.momentumY * delta * 1e3);
|
|
1956
|
+
if (progressAfter < 1) {
|
|
1957
|
+
this.scheduler.requestAnimFrame();
|
|
1958
|
+
}
|
|
1959
|
+
this.lastTimestamp = now;
|
|
1960
|
+
}
|
|
1961
|
+
};
|
|
1962
|
+
var _spherical, _lookAt, _adjust, adjust_fn, _acceptPropagation, _propagateSpherical, propagateSpherical_fn;
|
|
1963
|
+
var TwistyOrbitControls = class {
|
|
1964
|
+
constructor(camera, canvas, scheduleRender) {
|
|
1965
|
+
this.camera = camera;
|
|
1966
|
+
this.canvas = canvas;
|
|
1967
|
+
this.scheduleRender = scheduleRender;
|
|
1968
|
+
__privateAdd(this, _adjust);
|
|
1969
|
+
__privateAdd(this, _propagateSpherical);
|
|
1970
|
+
__privateAdd(this, _spherical, new Spherical());
|
|
1971
|
+
__privateAdd(this, _lookAt, new Vector34(0, 0, 0));
|
|
1972
|
+
this.experimentalInertia = INERTIA_DEFAULT;
|
|
1973
|
+
this.experimentalLatitudeLimits = LATITUDE_LIMITS_DEFAULT;
|
|
1974
|
+
this.lastTouchClientX = 0;
|
|
1975
|
+
this.lastTouchClientY = 0;
|
|
1976
|
+
this.currentTouchID = null;
|
|
1977
|
+
this.onMoveBound = this.onMove.bind(this);
|
|
1978
|
+
this.onMouseMoveBound = this.onMouseMove.bind(this);
|
|
1979
|
+
this.onMouseEndBound = this.onMouseEnd.bind(this);
|
|
1980
|
+
this.onTouchMoveBound = this.onTouchMove.bind(this);
|
|
1981
|
+
this.onTouchEndBound = this.onTouchEnd.bind(this);
|
|
1982
|
+
this.lastTouchTimestamp = 0;
|
|
1983
|
+
this.lastTouchMoveMomentumX = 0;
|
|
1984
|
+
this.lastTouchMoveMomentumY = 0;
|
|
1985
|
+
this.lastMouseTimestamp = 0;
|
|
1986
|
+
this.lastMouseMoveMomentumX = 0;
|
|
1987
|
+
this.lastMouseMoveMomentumY = 0;
|
|
1988
|
+
this.experimentalHasBeenMoved = false;
|
|
1989
|
+
__privateAdd(this, _acceptPropagation, true);
|
|
1990
|
+
__privateGet(this, _spherical).setFromVector3(camera.position);
|
|
1991
|
+
__privateMethod(this, _propagateSpherical, propagateSpherical_fn).call(this);
|
|
1992
|
+
canvas.addEventListener("mousedown", this.onMouseStart.bind(this));
|
|
1993
|
+
canvas.addEventListener("touchstart", this.onTouchStart.bind(this));
|
|
1994
|
+
}
|
|
1995
|
+
lookAt(v) {
|
|
1996
|
+
if (!__privateGet(this, _acceptPropagation)) {
|
|
1997
|
+
return;
|
|
1998
|
+
}
|
|
1999
|
+
__privateSet(this, _lookAt, v);
|
|
2000
|
+
__privateSet(this, _acceptPropagation, false);
|
|
2001
|
+
__privateMethod(this, _adjust, adjust_fn).call(this);
|
|
2002
|
+
this.scheduleRender();
|
|
2003
|
+
try {
|
|
2004
|
+
if (this.mirrorControls) {
|
|
2005
|
+
this.mirrorControls.lookAt(v);
|
|
2006
|
+
}
|
|
2007
|
+
} finally {
|
|
2008
|
+
__privateSet(this, _acceptPropagation, true);
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
set latitude(newLatitude) {
|
|
2012
|
+
__privateGet(this, _spherical).phi = (90 - newLatitude) / DEGREES_PER_RADIAN;
|
|
2013
|
+
__privateMethod(this, _propagateSpherical, propagateSpherical_fn).call(this);
|
|
2014
|
+
}
|
|
2015
|
+
get latitude() {
|
|
2016
|
+
return 90 - __privateGet(this, _spherical).phi * DEGREES_PER_RADIAN;
|
|
2017
|
+
}
|
|
2018
|
+
set longitude(newLongitude) {
|
|
2019
|
+
__privateGet(this, _spherical).theta = newLongitude / DEGREES_PER_RADIAN;
|
|
2020
|
+
__privateMethod(this, _propagateSpherical, propagateSpherical_fn).call(this);
|
|
2021
|
+
}
|
|
2022
|
+
get longitude() {
|
|
2023
|
+
return __privateGet(this, _spherical).theta * DEGREES_PER_RADIAN;
|
|
2024
|
+
}
|
|
2025
|
+
set distance(newDistance) {
|
|
2026
|
+
__privateGet(this, _spherical).radius = newDistance;
|
|
2027
|
+
__privateMethod(this, _propagateSpherical, propagateSpherical_fn).call(this);
|
|
2028
|
+
}
|
|
2029
|
+
get distance() {
|
|
2030
|
+
return __privateGet(this, _spherical).radius;
|
|
2031
|
+
}
|
|
2032
|
+
get orbitCoordinates() {
|
|
2033
|
+
return {
|
|
2034
|
+
latitude: this.latitude,
|
|
2035
|
+
longitude: this.longitude,
|
|
2036
|
+
distance: this.distance
|
|
2037
|
+
};
|
|
2038
|
+
}
|
|
2039
|
+
set orbitCoordinates(orbitCoordinates) {
|
|
2040
|
+
this.latitude = orbitCoordinates.latitude;
|
|
2041
|
+
this.longitude = orbitCoordinates.longitude;
|
|
2042
|
+
this.distance = orbitCoordinates.distance;
|
|
2043
|
+
}
|
|
2044
|
+
temperMovement(f) {
|
|
2045
|
+
return Math.sign(f) * Math.log(Math.abs(f * 10) + 1) / 6;
|
|
2046
|
+
}
|
|
2047
|
+
onMouseStart(e) {
|
|
2048
|
+
this.experimentalHasBeenMoved = true;
|
|
2049
|
+
window.addEventListener("mousemove", this.onMouseMoveBound);
|
|
2050
|
+
window.addEventListener("mouseup", this.onMouseEndBound);
|
|
2051
|
+
this.onStart(e);
|
|
2052
|
+
this.lastMouseTimestamp = e.timeStamp;
|
|
2053
|
+
}
|
|
2054
|
+
onMouseMove(e) {
|
|
2055
|
+
if (e.buttons === 0) {
|
|
2056
|
+
this.onMouseEnd(e);
|
|
2057
|
+
return;
|
|
2058
|
+
}
|
|
2059
|
+
if (e.movementX === 0 && e.movementY === 0) {
|
|
2060
|
+
console.log("short-circuit mouse!");
|
|
2061
|
+
return;
|
|
2062
|
+
}
|
|
2063
|
+
const minDim = Math.min(this.canvas.offsetWidth, this.canvas.offsetHeight);
|
|
2064
|
+
const movementX = this.temperMovement(e.movementX / minDim);
|
|
2065
|
+
const movementY = this.temperMovement(e.movementY / minDim * VERTICAL_MOVEMENT_BASE_SCALE);
|
|
2066
|
+
this.onMove(movementX, movementY);
|
|
2067
|
+
const deltaMs = e.timeStamp - this.lastMouseTimestamp;
|
|
2068
|
+
if (deltaMs > 0) {
|
|
2069
|
+
this.lastMouseMoveMomentumX = movementX / deltaMs;
|
|
2070
|
+
this.lastMouseMoveMomentumY = movementY / deltaMs;
|
|
2071
|
+
this.lastMouseTimestamp = e.timeStamp;
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
onMouseEnd(e) {
|
|
2075
|
+
window.removeEventListener("mousemove", this.onMouseMoveBound);
|
|
2076
|
+
window.removeEventListener("mouseup", this.onMouseEndBound);
|
|
2077
|
+
this.onEnd(e);
|
|
2078
|
+
if (this.experimentalInertia) {
|
|
2079
|
+
new Inertia(this.lastMouseTimestamp, this.lastMouseMoveMomentumX, this.lastMouseMoveMomentumY, this.onMoveBound);
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
onTouchStart(e) {
|
|
2083
|
+
this.experimentalHasBeenMoved = true;
|
|
2084
|
+
if (this.currentTouchID === null) {
|
|
2085
|
+
if (e.touches[0].clientX === 0 && e.touches[0].clientY === 0) {
|
|
2086
|
+
console.log("short-circuit touch!");
|
|
2087
|
+
return;
|
|
2088
|
+
}
|
|
2089
|
+
this.currentTouchID = e.changedTouches[0].identifier;
|
|
2090
|
+
this.lastTouchClientX = e.touches[0].clientX;
|
|
2091
|
+
this.lastTouchClientY = e.touches[0].clientY;
|
|
2092
|
+
window.addEventListener("touchmove", this.onTouchMoveBound);
|
|
2093
|
+
window.addEventListener("touchend", this.onTouchEndBound);
|
|
2094
|
+
window.addEventListener("touchcancel", this.onTouchEndBound);
|
|
2095
|
+
this.onStart(e);
|
|
2096
|
+
this.lastTouchTimestamp = e.timeStamp;
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
onTouchMove(e) {
|
|
2100
|
+
for (let i = 0; i < e.changedTouches.length; i++) {
|
|
2101
|
+
const touch = e.changedTouches[i];
|
|
2102
|
+
if (touch.identifier === this.currentTouchID) {
|
|
2103
|
+
const minDim = Math.min(this.canvas.offsetWidth, this.canvas.offsetHeight);
|
|
2104
|
+
const movementX = this.temperMovement((touch.clientX - this.lastTouchClientX) / minDim);
|
|
2105
|
+
const movementY = this.temperMovement((touch.clientY - this.lastTouchClientY) / minDim * VERTICAL_MOVEMENT_BASE_SCALE);
|
|
2106
|
+
this.onMove(movementX, movementY);
|
|
2107
|
+
this.lastTouchClientX = touch.clientX;
|
|
2108
|
+
this.lastTouchClientY = touch.clientY;
|
|
2109
|
+
const deltaMs = e.timeStamp - this.lastTouchTimestamp;
|
|
2110
|
+
if (deltaMs > 0) {
|
|
2111
|
+
this.lastTouchMoveMomentumX = movementX / deltaMs;
|
|
2112
|
+
this.lastTouchMoveMomentumY = movementY / deltaMs;
|
|
2113
|
+
this.lastTouchTimestamp = e.timeStamp;
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
onTouchEnd(e) {
|
|
2119
|
+
for (let i = 0; i < e.changedTouches.length; i++) {
|
|
2120
|
+
const touch = e.changedTouches[i];
|
|
2121
|
+
if (touch.identifier === this.currentTouchID) {
|
|
2122
|
+
this.currentTouchID = null;
|
|
2123
|
+
window.removeEventListener("touchmove", this.onTouchMoveBound);
|
|
2124
|
+
window.removeEventListener("touchend", this.onTouchEndBound);
|
|
2125
|
+
window.removeEventListener("touchcancel", this.onTouchEndBound);
|
|
2126
|
+
this.onEnd(e);
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
if (this.experimentalInertia) {
|
|
2130
|
+
new Inertia(this.lastTouchTimestamp, this.lastTouchMoveMomentumX, this.lastTouchMoveMomentumY, this.onMoveBound);
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
onStart(e) {
|
|
2134
|
+
e.preventDefault();
|
|
2135
|
+
}
|
|
2136
|
+
onMove(movementX, movementY) {
|
|
2137
|
+
const newSpherical = new Spherical();
|
|
2138
|
+
newSpherical.copy(__privateGet(this, _spherical));
|
|
2139
|
+
newSpherical.theta += -2 * movementX;
|
|
2140
|
+
newSpherical.phi += -2 * movementY;
|
|
2141
|
+
if (this.experimentalLatitudeLimits !== "none") {
|
|
2142
|
+
newSpherical.phi = Math.max(newSpherical.phi, Math.PI * 0.3);
|
|
2143
|
+
newSpherical.phi = Math.min(newSpherical.phi, Math.PI * 0.7);
|
|
2144
|
+
} else {
|
|
2145
|
+
newSpherical.phi = Math.max(newSpherical.phi, EPSILON);
|
|
2146
|
+
newSpherical.phi = Math.min(newSpherical.phi, Math.PI - EPSILON);
|
|
2147
|
+
}
|
|
2148
|
+
if (isNaN(newSpherical.theta) || newSpherical.theta === Infinity || newSpherical.theta === -Infinity) {
|
|
2149
|
+
return;
|
|
2150
|
+
}
|
|
2151
|
+
if (isNaN(newSpherical.phi) || newSpherical.phi === Infinity || newSpherical.phi === -Infinity) {
|
|
2152
|
+
return;
|
|
2153
|
+
}
|
|
2154
|
+
__privateSet(this, _spherical, newSpherical);
|
|
2155
|
+
__privateMethod(this, _propagateSpherical, propagateSpherical_fn).call(this);
|
|
2156
|
+
}
|
|
2157
|
+
onEnd(e) {
|
|
2158
|
+
e.preventDefault();
|
|
2159
|
+
}
|
|
2160
|
+
setMirror(m) {
|
|
2161
|
+
this.mirrorControls = m;
|
|
2162
|
+
}
|
|
2163
|
+
updateMirroredCamera(orbitCoordinates) {
|
|
2164
|
+
if (__privateGet(this, _acceptPropagation)) {
|
|
2165
|
+
this.latitude = -orbitCoordinates.latitude;
|
|
2166
|
+
this.longitude = orbitCoordinates.longitude + 180;
|
|
2167
|
+
this.distance = orbitCoordinates.distance;
|
|
2168
|
+
__privateMethod(this, _adjust, adjust_fn).call(this);
|
|
2169
|
+
this.scheduleRender();
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
};
|
|
2173
|
+
_spherical = new WeakMap();
|
|
2174
|
+
_lookAt = new WeakMap();
|
|
2175
|
+
_adjust = new WeakSet();
|
|
2176
|
+
adjust_fn = function() {
|
|
2177
|
+
__privateGet(this, _spherical).makeSafe();
|
|
2178
|
+
this.camera.position.setFromSpherical(__privateGet(this, _spherical));
|
|
2179
|
+
this.camera.lookAt(__privateGet(this, _lookAt));
|
|
2180
|
+
};
|
|
2181
|
+
_acceptPropagation = new WeakMap();
|
|
2182
|
+
_propagateSpherical = new WeakSet();
|
|
2183
|
+
propagateSpherical_fn = function() {
|
|
2184
|
+
__privateSet(this, _acceptPropagation, false);
|
|
2185
|
+
try {
|
|
2186
|
+
__privateMethod(this, _adjust, adjust_fn).call(this);
|
|
2187
|
+
this.scheduleRender();
|
|
2188
|
+
this.mirrorControls?.updateMirroredCamera({
|
|
2189
|
+
latitude: this.latitude,
|
|
2190
|
+
longitude: this.longitude,
|
|
2191
|
+
distance: this.distance
|
|
2192
|
+
});
|
|
2193
|
+
} finally {
|
|
2194
|
+
__privateSet(this, _acceptPropagation, true);
|
|
2195
|
+
}
|
|
2196
|
+
};
|
|
2197
|
+
|
|
2198
|
+
// src/cubing/vendor/three/examples/jsm/libs/stats.modified.module.ts
|
|
2199
|
+
var performance = globalThis.performance;
|
|
2200
|
+
var Stats = class {
|
|
2201
|
+
constructor() {
|
|
2202
|
+
this.mode = 0;
|
|
2203
|
+
this.dom = document.createElement("div");
|
|
2204
|
+
this.beginTime = (performance || Date).now();
|
|
2205
|
+
this.prevTime = this.beginTime;
|
|
2206
|
+
this.frames = 0;
|
|
2207
|
+
this.fpsPanel = this.addPanel(new StatsPanel("FPS", "#0ff", "#002"));
|
|
2208
|
+
this.msPanel = this.addPanel(new StatsPanel("MS", "#0f0", "#020"));
|
|
2209
|
+
this.memPanel = performance?.memory ? this.addPanel(new StatsPanel("MB", "#f08", "#201")) : null;
|
|
2210
|
+
this.REVISION = 16;
|
|
2211
|
+
this.dom.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000";
|
|
2212
|
+
this.dom.addEventListener("click", (event) => {
|
|
2213
|
+
event.preventDefault();
|
|
2214
|
+
this.showPanel(++this.mode % this.dom.children.length);
|
|
2215
|
+
}, false);
|
|
2216
|
+
this.showPanel(0);
|
|
2217
|
+
}
|
|
2218
|
+
addPanel(panel) {
|
|
2219
|
+
this.dom.appendChild(panel.dom);
|
|
2220
|
+
return panel;
|
|
2221
|
+
}
|
|
2222
|
+
showPanel(id) {
|
|
2223
|
+
for (let i = 0; i < this.dom.children.length; i++) {
|
|
2224
|
+
this.dom.children[i].style.display = i === id ? "block" : "none";
|
|
2225
|
+
}
|
|
2226
|
+
this.mode = id;
|
|
2227
|
+
}
|
|
2228
|
+
begin() {
|
|
2229
|
+
this.beginTime = (performance || Date).now();
|
|
2230
|
+
}
|
|
2231
|
+
end() {
|
|
2232
|
+
this.frames++;
|
|
2233
|
+
const time = (performance || Date).now();
|
|
2234
|
+
this.msPanel.update(time - this.beginTime, 200);
|
|
2235
|
+
if (time >= this.prevTime + 1e3) {
|
|
2236
|
+
this.fpsPanel.update(this.frames * 1e3 / (time - this.prevTime), 100);
|
|
2237
|
+
this.prevTime = time;
|
|
2238
|
+
this.frames = 0;
|
|
2239
|
+
if (this.memPanel) {
|
|
2240
|
+
const memory = performance.memory;
|
|
2241
|
+
this.memPanel.update(memory.usedJSHeapSize / 1048576, memory.jsHeapSizeLimit / 1048576);
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
return time;
|
|
2245
|
+
}
|
|
2246
|
+
update() {
|
|
2247
|
+
this.beginTime = this.end();
|
|
2248
|
+
}
|
|
2249
|
+
};
|
|
2250
|
+
var PR = Math.round(globalThis?.window?.devicePixelRatio ?? 1);
|
|
2251
|
+
var WIDTH = 80 * PR;
|
|
2252
|
+
var HEIGHT = 48 * PR;
|
|
2253
|
+
var TEXT_X = 3 * PR;
|
|
2254
|
+
var TEXT_Y = 2 * PR;
|
|
2255
|
+
var GRAPH_X = 3 * PR;
|
|
2256
|
+
var GRAPH_Y = 15 * PR;
|
|
2257
|
+
var GRAPH_WIDTH = 74 * PR;
|
|
2258
|
+
var GRAPH_HEIGHT = 30 * PR;
|
|
2259
|
+
var StatsPanel = class {
|
|
2260
|
+
constructor(name, fg, bg) {
|
|
2261
|
+
this.name = name;
|
|
2262
|
+
this.fg = fg;
|
|
2263
|
+
this.bg = bg;
|
|
2264
|
+
this.min = Infinity;
|
|
2265
|
+
this.max = 0;
|
|
2266
|
+
this.dom = document.createElement("canvas");
|
|
2267
|
+
this.context = this.dom.getContext("2d");
|
|
2268
|
+
this.dom.width = WIDTH;
|
|
2269
|
+
this.dom.height = HEIGHT;
|
|
2270
|
+
this.dom.style.cssText = "width:80px;height:48px";
|
|
2271
|
+
this.context.font = `bold ${9 * PR}px Helvetica,Arial,sans-serif`;
|
|
2272
|
+
this.context.textBaseline = "top";
|
|
2273
|
+
this.context.fillStyle = bg;
|
|
2274
|
+
this.context.fillRect(0, 0, WIDTH, HEIGHT);
|
|
2275
|
+
this.context.fillStyle = fg;
|
|
2276
|
+
this.context.fillText(name, TEXT_X, TEXT_Y);
|
|
2277
|
+
this.context.fillRect(GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT);
|
|
2278
|
+
this.context.fillStyle = bg;
|
|
2279
|
+
this.context.globalAlpha = 0.9;
|
|
2280
|
+
this.context.fillRect(GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT);
|
|
2281
|
+
}
|
|
2282
|
+
update(value, maxValue) {
|
|
2283
|
+
this.min = Math.min(this.min, value);
|
|
2284
|
+
this.max = Math.max(this.max, value);
|
|
2285
|
+
this.context.fillStyle = this.bg;
|
|
2286
|
+
this.context.globalAlpha = 1;
|
|
2287
|
+
this.context.fillRect(0, 0, WIDTH, GRAPH_Y);
|
|
2288
|
+
this.context.fillStyle = this.fg;
|
|
2289
|
+
this.context.fillText(Math.round(value) + " " + this.name + " (" + Math.round(this.min) + "-" + Math.round(this.max) + ")", TEXT_X, TEXT_Y);
|
|
2290
|
+
this.context.drawImage(this.dom, GRAPH_X + PR, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT);
|
|
2291
|
+
this.context.fillRect(GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, GRAPH_HEIGHT);
|
|
2292
|
+
this.context.fillStyle = this.bg;
|
|
2293
|
+
this.context.globalAlpha = 0.9;
|
|
2294
|
+
this.context.fillRect(GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, Math.round((1 - value / maxValue) * GRAPH_HEIGHT));
|
|
2295
|
+
}
|
|
2296
|
+
};
|
|
2297
|
+
|
|
2298
|
+
// src/cubing/twisty/old/dom/viewers/Twisty3DCanvas.ts
|
|
2299
|
+
var SHOW_STATS = false;
|
|
2300
|
+
function experimentalShowRenderStats(show) {
|
|
2301
|
+
SHOW_STATS = show;
|
|
2302
|
+
}
|
|
2303
|
+
var shareAllNewRenderers = false;
|
|
2304
|
+
var sharedRenderer = null;
|
|
2305
|
+
function newRenderer() {
|
|
2306
|
+
return new WebGLRenderer({
|
|
2307
|
+
antialias: true,
|
|
2308
|
+
alpha: true
|
|
2309
|
+
});
|
|
2310
|
+
}
|
|
2311
|
+
function newSharedRenderer() {
|
|
2312
|
+
return sharedRenderer ?? (sharedRenderer = newRenderer());
|
|
2313
|
+
}
|
|
2314
|
+
var _invisible, _onRenderFinish, _resize, resize_fn;
|
|
2315
|
+
var Twisty3DCanvas = class extends ManagedCustomElement {
|
|
2316
|
+
constructor(scene, options = {}) {
|
|
2317
|
+
super();
|
|
2318
|
+
__privateAdd(this, _resize);
|
|
2319
|
+
this.legacyExperimentalShift = 0;
|
|
2320
|
+
this.scheduler = new RenderScheduler(this.render.bind(this));
|
|
2321
|
+
this.resizePending = false;
|
|
2322
|
+
this.stats = null;
|
|
2323
|
+
__privateAdd(this, _invisible, false);
|
|
2324
|
+
__privateAdd(this, _onRenderFinish, null);
|
|
2325
|
+
this.addCSS(twisty3DCanvasCSS);
|
|
2326
|
+
this.scene = scene;
|
|
2327
|
+
this.scene?.addRenderTarget(this);
|
|
2328
|
+
if (SHOW_STATS) {
|
|
2329
|
+
this.stats = new Stats();
|
|
2330
|
+
this.stats.dom.style.position = "absolute";
|
|
2331
|
+
this.addElement(this.stats.dom);
|
|
2332
|
+
}
|
|
2333
|
+
this.rendererIsShared = shareAllNewRenderers;
|
|
2334
|
+
this.renderer = this.rendererIsShared ? newSharedRenderer() : newRenderer();
|
|
2335
|
+
this.canvas = this.rendererIsShared ? document.createElement("canvas") : this.renderer.domElement;
|
|
2336
|
+
this.canvas2DContext = this.canvas.getContext("2d");
|
|
2337
|
+
this.addElement(this.canvas);
|
|
2338
|
+
this.camera = new PerspectiveCamera(20, 1, 0.1, 20);
|
|
2339
|
+
this.camera.position.copy(new Vector35(2, 4, 4));
|
|
2340
|
+
this.orbitControls = new TwistyOrbitControls(this.camera, this.canvas, this.scheduleRender.bind(this));
|
|
2341
|
+
if (options.orbitCoordinates) {
|
|
2342
|
+
this.orbitControls.latitude = options.orbitCoordinates.latitude * (options.negateCameraPosition ? -1 : 1);
|
|
2343
|
+
}
|
|
2344
|
+
if (options.orbitCoordinates) {
|
|
2345
|
+
this.orbitControls.longitude = options.orbitCoordinates.longitude + (options.negateCameraPosition ? 180 : 0);
|
|
2346
|
+
}
|
|
2347
|
+
if (options.orbitCoordinates) {
|
|
2348
|
+
this.orbitControls.distance = options.orbitCoordinates.distance;
|
|
2349
|
+
}
|
|
2350
|
+
this.camera.lookAt(new Vector35(0, 0, 0));
|
|
2351
|
+
const observer = new ResizeObserver(this.onResize.bind(this));
|
|
2352
|
+
observer.observe(this.contentWrapper);
|
|
2353
|
+
}
|
|
2354
|
+
setMirror(partner) {
|
|
2355
|
+
this.orbitControls.setMirror(partner.orbitControls);
|
|
2356
|
+
partner.orbitControls.setMirror(this.orbitControls);
|
|
2357
|
+
}
|
|
2358
|
+
experimentalSetLatitudeLimits(limits) {
|
|
2359
|
+
this.orbitControls.experimentalLatitudeLimits = limits;
|
|
2360
|
+
}
|
|
2361
|
+
connectedCallback() {
|
|
2362
|
+
__privateMethod(this, _resize, resize_fn).call(this);
|
|
2363
|
+
this.render();
|
|
2364
|
+
}
|
|
2365
|
+
scheduleRender() {
|
|
2366
|
+
this.scheduler.requestAnimFrame();
|
|
2367
|
+
}
|
|
2368
|
+
makeInvisibleUntilRender() {
|
|
2369
|
+
this.contentWrapper.classList.add("invisible");
|
|
2370
|
+
__privateSet(this, _invisible, true);
|
|
2371
|
+
}
|
|
2372
|
+
experimentalSetOnRenderFinish(f) {
|
|
2373
|
+
__privateSet(this, _onRenderFinish, f);
|
|
2374
|
+
}
|
|
2375
|
+
render() {
|
|
2376
|
+
this.stats?.begin();
|
|
2377
|
+
this.scheduler.cancelAnimFrame();
|
|
2378
|
+
if (this.resizePending) {
|
|
2379
|
+
__privateMethod(this, _resize, resize_fn).call(this);
|
|
2380
|
+
}
|
|
2381
|
+
if (this.rendererIsShared) {
|
|
2382
|
+
this.renderer.setSize(this.canvas.width, this.canvas.height, false);
|
|
2383
|
+
this.canvas2DContext.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
2384
|
+
}
|
|
2385
|
+
if (this.scene) {
|
|
2386
|
+
this.renderer.render(this.scene, this.camera);
|
|
2387
|
+
}
|
|
2388
|
+
if (this.rendererIsShared) {
|
|
2389
|
+
this.canvas2DContext.drawImage(this.renderer.domElement, 0, 0);
|
|
2390
|
+
}
|
|
2391
|
+
if (__privateGet(this, _invisible)) {
|
|
2392
|
+
this.contentWrapper.classList.remove("invisible");
|
|
2393
|
+
}
|
|
2394
|
+
this.stats?.end();
|
|
2395
|
+
if (__privateGet(this, _onRenderFinish)) {
|
|
2396
|
+
__privateGet(this, _onRenderFinish).call(this);
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
onResize() {
|
|
2400
|
+
this.resizePending = true;
|
|
2401
|
+
this.scheduleRender();
|
|
2402
|
+
}
|
|
2403
|
+
renderToDataURL(options = {}) {
|
|
2404
|
+
__privateMethod(this, _resize, resize_fn).call(this, options.minWidth, options.minHeight);
|
|
2405
|
+
this.render();
|
|
2406
|
+
let url;
|
|
2407
|
+
if (!options.squareCrop || this.canvas.width === this.canvas.height) {
|
|
2408
|
+
url = this.canvas.toDataURL();
|
|
2409
|
+
} else {
|
|
2410
|
+
const tempCanvas = document.createElement("canvas");
|
|
2411
|
+
const squareSize = Math.min(this.canvas.width, this.canvas.height);
|
|
2412
|
+
tempCanvas.width = squareSize;
|
|
2413
|
+
tempCanvas.height = squareSize;
|
|
2414
|
+
const tempCtx = tempCanvas.getContext("2d");
|
|
2415
|
+
tempCtx.drawImage(this.canvas, -(this.canvas.width - squareSize) / 2, -(this.canvas.height - squareSize) / 2);
|
|
2416
|
+
url = tempCanvas.toDataURL();
|
|
2417
|
+
}
|
|
2418
|
+
__privateMethod(this, _resize, resize_fn).call(this);
|
|
2419
|
+
return url;
|
|
2420
|
+
}
|
|
2421
|
+
};
|
|
2422
|
+
_invisible = new WeakMap();
|
|
2423
|
+
_onRenderFinish = new WeakMap();
|
|
2424
|
+
_resize = new WeakSet();
|
|
2425
|
+
resize_fn = function(minWidth = 0, minHeight = 0) {
|
|
2426
|
+
this.resizePending = false;
|
|
2427
|
+
const w = Math.max(this.contentWrapper.clientWidth, minWidth);
|
|
2428
|
+
const h = Math.max(this.contentWrapper.clientHeight, minHeight);
|
|
2429
|
+
let off = 0;
|
|
2430
|
+
if (this.legacyExperimentalShift > 0) {
|
|
2431
|
+
off = Math.max(0, Math.floor((w - h) * 0.5));
|
|
2432
|
+
} else if (this.legacyExperimentalShift < 0) {
|
|
2433
|
+
off = -Math.max(0, Math.floor((w - h) * 0.5));
|
|
2434
|
+
}
|
|
2435
|
+
let yoff = 0;
|
|
2436
|
+
let excess = 0;
|
|
2437
|
+
if (h > w) {
|
|
2438
|
+
excess = h - w;
|
|
2439
|
+
yoff = -Math.floor(0.5 * excess);
|
|
2440
|
+
}
|
|
2441
|
+
this.camera.aspect = w / h;
|
|
2442
|
+
this.camera.setViewOffset(w, h - excess, off, yoff, w, h);
|
|
2443
|
+
this.camera.updateProjectionMatrix();
|
|
2444
|
+
if (this.rendererIsShared) {
|
|
2445
|
+
this.canvas.width = w * pixelRatio();
|
|
2446
|
+
this.canvas.height = h * pixelRatio();
|
|
2447
|
+
this.canvas.style.width = w.toString();
|
|
2448
|
+
this.canvas.style.height = w.toString();
|
|
2449
|
+
} else {
|
|
2450
|
+
this.renderer.setPixelRatio(pixelRatio());
|
|
2451
|
+
this.renderer.setSize(w, h, true);
|
|
2452
|
+
}
|
|
2453
|
+
this.scheduleRender();
|
|
2454
|
+
};
|
|
2455
|
+
customElementsShim.define("twisty-3d-canvas", Twisty3DCanvas);
|
|
2456
|
+
|
|
2457
|
+
// src/cubing/twisty/views/3D/Twisty3DScene.ts
|
|
2458
|
+
import { Scene as ThreeScene } from "three";
|
|
2459
|
+
var Twisty3DScene = class extends ThreeScene {
|
|
2460
|
+
constructor() {
|
|
2461
|
+
super();
|
|
2462
|
+
this.renderTargets = new Set();
|
|
2463
|
+
this.twisty3Ds = new Set();
|
|
2464
|
+
}
|
|
2465
|
+
addRenderTarget(renderTarget) {
|
|
2466
|
+
this.renderTargets.add(renderTarget);
|
|
2467
|
+
}
|
|
2468
|
+
scheduleRender() {
|
|
2469
|
+
for (const renderTarget of this.renderTargets) {
|
|
2470
|
+
renderTarget.scheduleRender();
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
addTwisty3DPuzzle(twisty3DPuzzle) {
|
|
2474
|
+
this.twisty3Ds.add(twisty3DPuzzle);
|
|
2475
|
+
this.add(twisty3DPuzzle);
|
|
2476
|
+
}
|
|
2477
|
+
removeTwisty3DPuzzle(twisty3DPuzzle) {
|
|
2478
|
+
this.twisty3Ds.delete(twisty3DPuzzle);
|
|
2479
|
+
this.remove(twisty3DPuzzle);
|
|
2480
|
+
}
|
|
2481
|
+
clearPuzzles() {
|
|
2482
|
+
for (const puz of this.twisty3Ds) {
|
|
2483
|
+
this.remove(puz);
|
|
2484
|
+
}
|
|
2485
|
+
this.twisty3Ds.clear();
|
|
2486
|
+
}
|
|
2487
|
+
};
|
|
2488
|
+
|
|
2489
|
+
export {
|
|
2490
|
+
RenderScheduler,
|
|
2491
|
+
ClassListManager,
|
|
2492
|
+
HTMLElementShim,
|
|
2493
|
+
customElementsShim,
|
|
2494
|
+
CSSSource,
|
|
2495
|
+
ManagedCustomElement,
|
|
2496
|
+
DEGREES_PER_RADIAN,
|
|
2497
|
+
twistyViewerWrapperCSS,
|
|
2498
|
+
TwistyViewerWrapper,
|
|
2499
|
+
pyraminxLookAt,
|
|
2500
|
+
defaultCameraOrbitCoordinates,
|
|
2501
|
+
controlsLocations,
|
|
2502
|
+
TwistyPlayerConfig,
|
|
2503
|
+
Cube3D,
|
|
2504
|
+
PG3D,
|
|
2505
|
+
pixelRatio,
|
|
2506
|
+
twisty3DCanvasCSS,
|
|
2507
|
+
Stats,
|
|
2508
|
+
experimentalShowRenderStats,
|
|
2509
|
+
Twisty3DCanvas,
|
|
2510
|
+
Twisty3DScene
|
|
2511
|
+
};
|
|
2512
|
+
//# sourceMappingURL=chunk-5DN4DAAX.js.map
|