cubing 0.24.1 → 0.24.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/{2x2x2.sgs.json-2QRQG2UF.js → 2x2x2.sgs.json-5MCXGXA6.js} +2 -2
- package/dist/esm/{2x2x2.sgs.json-2QRQG2UF.js.map → 2x2x2.sgs.json-5MCXGXA6.js.map} +0 -0
- package/dist/esm/{3d-dynamic-inside-EQIKTTYZ.js → 3d-dynamic-inside-XYXXTULQ.js} +3 -3
- package/dist/esm/{3d-dynamic-inside-EQIKTTYZ.js.map → 3d-dynamic-inside-XYXXTULQ.js.map} +0 -0
- package/dist/esm/bluetooth/index.js +1 -1
- package/dist/esm/{chunk-SLUMTYHP.js → chunk-2CGRUO5X.js} +3 -5
- package/dist/esm/chunk-2CGRUO5X.js.map +7 -0
- package/dist/esm/{chunk-YVHK2LDM.js → chunk-2I3MTSRM.js} +2 -2
- package/dist/esm/{chunk-YVHK2LDM.js.map → chunk-2I3MTSRM.js.map} +0 -0
- package/dist/esm/{chunk-B6IDD5MD.js → chunk-HU55EGD6.js} +2 -2
- package/dist/esm/{chunk-B6IDD5MD.js.map → chunk-HU55EGD6.js.map} +0 -0
- package/dist/esm/{chunk-42DBDQQX.js → chunk-TOPMNZ57.js} +2 -2
- package/dist/esm/{chunk-42DBDQQX.js.map → chunk-TOPMNZ57.js.map} +0 -0
- package/dist/esm/{chunk-37CDJ45V.js → chunk-UZTY6GHM.js} +3 -3
- package/dist/esm/{chunk-37CDJ45V.js.map → chunk-UZTY6GHM.js.map} +0 -0
- package/dist/esm/{entry-UARUM747.js → entry-FOASJVBZ.js} +9 -9
- package/dist/esm/{entry-UARUM747.js.map → entry-FOASJVBZ.js.map} +0 -0
- package/dist/esm/{fto.sgs.json-DKPRQRDL.js → fto.sgs.json-USK5JCKN.js} +2 -2
- package/dist/esm/{fto.sgs.json-DKPRQRDL.js.map → fto.sgs.json-USK5JCKN.js.map} +0 -0
- package/dist/esm/{module-entry-7NBG44KF.js → module-entry-DBPFVUZH.js} +2 -2
- package/dist/esm/{module-entry-7NBG44KF.js.map → module-entry-DBPFVUZH.js.map} +0 -0
- package/dist/esm/puzzles/index.js +1 -1
- package/dist/esm/{pyraminx.sgs.json-KGPI57MS.js → pyraminx.sgs.json-ARYGZ7E4.js} +3 -3
- package/dist/esm/{pyraminx.sgs.json-KGPI57MS.js.map → pyraminx.sgs.json-ARYGZ7E4.js.map} +0 -0
- package/dist/esm/scramble/index.js +3 -3
- package/dist/esm/{scramble_444-M3Q3OZN3.js → scramble_444-HZ7HJLTT.js} +3 -3
- package/dist/esm/{scramble_444-M3Q3OZN3.js.map → scramble_444-HZ7HJLTT.js.map} +0 -0
- package/dist/esm/search/index.js +3 -3
- package/dist/esm/twisty/index.js +226 -200
- package/dist/esm/twisty/index.js.map +3 -3
- package/dist/esm/{worker-inside-generated-string-6QDQTUCQ.js → worker-inside-generated-string-OWBTRAXR.js} +18 -18
- package/dist/esm/worker-inside-generated-string-OWBTRAXR.js.map +7 -0
- package/dist/types/search/worker-inside-generated-string.d.ts +1 -1
- package/dist/types/twisty/model/TwistyPlayerModel.d.ts +44 -42
- package/dist/types/twisty/model/props/puzzle/state/AlgTransformationProp.d.ts +1 -1
- package/dist/types/twisty/model/props/puzzle/state/{AnchoredStartProp.d.ts → AnchorTransformationProp.d.ts} +3 -3
- package/dist/types/twisty/views/ManagedCustomElement.d.ts +1 -1
- package/dist/types/twisty/views/TwistyAlgEditor/TwistyAlgEditor.d.ts +1 -1
- package/dist/types/twisty/views/twizzle/TwizzleLink.d.ts +2 -0
- package/package.json +1 -1
- package/dist/esm/chunk-SLUMTYHP.js.map +0 -7
- package/dist/esm/worker-inside-generated-string-6QDQTUCQ.js.map +0 -7
package/dist/esm/twisty/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
TwistyPropDerived,
|
|
11
11
|
TwistyPropSource,
|
|
12
12
|
proxy3D
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-TOPMNZ57.js";
|
|
14
14
|
import {
|
|
15
15
|
countAnimatedLeaves,
|
|
16
16
|
countMoves
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
cubeAppearance,
|
|
21
21
|
customPGPuzzleLoader,
|
|
22
22
|
puzzles
|
|
23
|
-
} from "../chunk-
|
|
23
|
+
} from "../chunk-2CGRUO5X.js";
|
|
24
24
|
import "../chunk-B27E6KTE.js";
|
|
25
25
|
import {
|
|
26
26
|
Alg,
|
|
@@ -144,8 +144,8 @@ var CatchUpHelper = class {
|
|
|
144
144
|
this.scheduler.requestAnimFrame();
|
|
145
145
|
const delta = (timestamp - this.lastTimestamp) / this.catchUpMs;
|
|
146
146
|
this.lastTimestamp = timestamp;
|
|
147
|
-
this.model.
|
|
148
|
-
const previousCatchUpMove = await this.model.
|
|
147
|
+
this.model.catchUpMove.set((async () => {
|
|
148
|
+
const previousCatchUpMove = await this.model.catchUpMove.get();
|
|
149
149
|
if (previousCatchUpMove.move === null) {
|
|
150
150
|
return previousCatchUpMove;
|
|
151
151
|
}
|
|
@@ -153,7 +153,7 @@ var CatchUpHelper = class {
|
|
|
153
153
|
if (amount >= 1) {
|
|
154
154
|
this.pendingFrame = true;
|
|
155
155
|
this.stop();
|
|
156
|
-
this.model.
|
|
156
|
+
this.model.timestampRequest.set("end");
|
|
157
157
|
return {
|
|
158
158
|
move: null,
|
|
159
159
|
amount: 0
|
|
@@ -179,9 +179,9 @@ var TwistyAnimationController = class {
|
|
|
179
179
|
__privateAdd(this, _animFrameEffectiveTimestampStaleDropper, new StaleDropper());
|
|
180
180
|
this.model = model;
|
|
181
181
|
this.lastTimestampPromise = __privateMethod(this, _effectiveTimestampMilliseconds, effectiveTimestampMilliseconds_fn).call(this);
|
|
182
|
-
this.model.
|
|
182
|
+
this.model.playingInfo.addFreshListener(this.onPlayingProp.bind(this));
|
|
183
183
|
this.catchUpHelper = new CatchUpHelper(this.model);
|
|
184
|
-
this.model.
|
|
184
|
+
this.model.catchUpMove.addFreshListener(this.onCatchUpMoveProp.bind(this));
|
|
185
185
|
}
|
|
186
186
|
async onPlayingProp(playingInfo) {
|
|
187
187
|
if (playingInfo.playing !== this.playing) {
|
|
@@ -196,14 +196,14 @@ var TwistyAnimationController = class {
|
|
|
196
196
|
this.scheduler.requestAnimFrame();
|
|
197
197
|
}
|
|
198
198
|
jumpToStart(options) {
|
|
199
|
-
this.model.
|
|
199
|
+
this.model.timestampRequest.set("start");
|
|
200
200
|
this.pause();
|
|
201
201
|
if (options?.flash) {
|
|
202
202
|
this.delegate.flash();
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
jumpToEnd(options) {
|
|
206
|
-
this.model.
|
|
206
|
+
this.model.timestampRequest.set("end");
|
|
207
207
|
this.pause();
|
|
208
208
|
if (options?.flash) {
|
|
209
209
|
this.delegate.flash();
|
|
@@ -218,18 +218,18 @@ var TwistyAnimationController = class {
|
|
|
218
218
|
}
|
|
219
219
|
async play(options) {
|
|
220
220
|
const direction = options?.direction ?? Direction.Forwards;
|
|
221
|
-
const coarseTimelineInfo = await this.model.
|
|
221
|
+
const coarseTimelineInfo = await this.model.coarseTimelineInfo.get();
|
|
222
222
|
if (options?.autoSkipToOtherEndIfStartingAtBoundary ?? true) {
|
|
223
223
|
if (direction === Direction.Forwards && coarseTimelineInfo.atEnd) {
|
|
224
|
-
this.model.
|
|
224
|
+
this.model.timestampRequest.set("start");
|
|
225
225
|
this.delegate.flash();
|
|
226
226
|
}
|
|
227
227
|
if (direction === Direction.Backwards && coarseTimelineInfo.atStart) {
|
|
228
|
-
this.model.
|
|
228
|
+
this.model.timestampRequest.set("end");
|
|
229
229
|
this.delegate.flash();
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
-
this.model.
|
|
232
|
+
this.model.playingInfo.set({
|
|
233
233
|
playing: true,
|
|
234
234
|
direction,
|
|
235
235
|
untilBoundary: options?.untilBoundary ?? BoundaryType.EntireTimeline,
|
|
@@ -243,7 +243,7 @@ var TwistyAnimationController = class {
|
|
|
243
243
|
pause() {
|
|
244
244
|
this.playing = false;
|
|
245
245
|
this.scheduler.cancelAnimFrame();
|
|
246
|
-
this.model.
|
|
246
|
+
this.model.playingInfo.set({
|
|
247
247
|
playing: false,
|
|
248
248
|
untilBoundary: BoundaryType.EntireTimeline
|
|
249
249
|
});
|
|
@@ -254,11 +254,11 @@ var TwistyAnimationController = class {
|
|
|
254
254
|
}
|
|
255
255
|
const lastDatestamp = this.lastDatestamp;
|
|
256
256
|
const freshenerResult = await __privateGet(this, _animFrameEffectiveTimestampStaleDropper).queue(Promise.all([
|
|
257
|
-
this.model.
|
|
257
|
+
this.model.playingInfo.get(),
|
|
258
258
|
this.lastTimestampPromise,
|
|
259
|
-
this.model.
|
|
260
|
-
this.model.
|
|
261
|
-
this.model.
|
|
259
|
+
this.model.timeRange.get(),
|
|
260
|
+
this.model.tempoScale.get(),
|
|
261
|
+
this.model.currentMoveInfo.get()
|
|
262
262
|
]));
|
|
263
263
|
const [playingInfo, lastTimestamp, timeRange, tempoScale, currentMoveInfo] = freshenerResult;
|
|
264
264
|
if (!playingInfo.playing) {
|
|
@@ -288,7 +288,7 @@ var TwistyAnimationController = class {
|
|
|
288
288
|
newTimestamp = end;
|
|
289
289
|
}
|
|
290
290
|
this.playing = false;
|
|
291
|
-
this.model.
|
|
291
|
+
this.model.playingInfo.set({
|
|
292
292
|
playing: false
|
|
293
293
|
});
|
|
294
294
|
}
|
|
@@ -302,19 +302,19 @@ var TwistyAnimationController = class {
|
|
|
302
302
|
newTimestamp = start;
|
|
303
303
|
}
|
|
304
304
|
this.playing = false;
|
|
305
|
-
this.model.
|
|
305
|
+
this.model.playingInfo.set({
|
|
306
306
|
playing: false
|
|
307
307
|
});
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
this.lastDatestamp = frameDatestamp;
|
|
311
311
|
this.lastTimestampPromise = Promise.resolve(newTimestamp);
|
|
312
|
-
this.model.
|
|
312
|
+
this.model.timestampRequest.set(newSmartTimestampRequest ?? newTimestamp);
|
|
313
313
|
}
|
|
314
314
|
};
|
|
315
315
|
_effectiveTimestampMilliseconds = new WeakSet();
|
|
316
316
|
effectiveTimestampMilliseconds_fn = async function() {
|
|
317
|
-
return (await this.model.
|
|
317
|
+
return (await this.model.detailedTimelineInfo.get()).timestamp;
|
|
318
318
|
};
|
|
319
319
|
_animFrameEffectiveTimestampStaleDropper = new WeakMap();
|
|
320
320
|
|
|
@@ -395,13 +395,15 @@ var ManagedCustomElement = class extends HTMLElementShim {
|
|
|
395
395
|
this.shadow.appendChild(this.contentWrapper);
|
|
396
396
|
}
|
|
397
397
|
addCSS(cssSource) {
|
|
398
|
-
|
|
399
|
-
|
|
398
|
+
const existing = __privateGet(this, _cssSourceMap).get(cssSource);
|
|
399
|
+
if (existing) {
|
|
400
|
+
return existing;
|
|
400
401
|
}
|
|
401
402
|
const cssElem = document.createElement("style");
|
|
402
403
|
cssElem.textContent = cssSource.getAsString();
|
|
403
404
|
__privateGet(this, _cssSourceMap).set(cssSource, cssElem);
|
|
404
405
|
this.shadow.appendChild(cssElem);
|
|
406
|
+
return cssElem;
|
|
405
407
|
}
|
|
406
408
|
removeCSS(cssSource) {
|
|
407
409
|
const cssElem = __privateGet(this, _cssSourceMap).get(cssSource);
|
|
@@ -688,12 +690,12 @@ var Twisty2DPuzzle = class extends ManagedCustomElement {
|
|
|
688
690
|
__privateAdd(this, _freshListenerManager, new FreshListenerManager());
|
|
689
691
|
this.addCSS(twisty2DSVGCSS);
|
|
690
692
|
this.resetSVG();
|
|
691
|
-
__privateGet(this, _freshListenerManager).addListener(this.model.
|
|
693
|
+
__privateGet(this, _freshListenerManager).addListener(this.model.puzzleID, (puzzleID) => {
|
|
692
694
|
if (puzzleLoader?.id !== puzzleID) {
|
|
693
695
|
this.disconnect();
|
|
694
696
|
}
|
|
695
697
|
});
|
|
696
|
-
__privateGet(this, _freshListenerManager).addListener(this.model.
|
|
698
|
+
__privateGet(this, _freshListenerManager).addListener(this.model.legacyPosition, this.onPositionChange.bind(this));
|
|
697
699
|
if (this.options?.experimentalStickering) {
|
|
698
700
|
this.experimentalSetStickering(this.options.experimentalStickering);
|
|
699
701
|
}
|
|
@@ -763,7 +765,7 @@ var Twisty2DPuzzleWrapper = class {
|
|
|
763
765
|
__privateAdd(this, _freshListenerManager2, new FreshListenerManager());
|
|
764
766
|
__privateAdd(this, _cachedTwisty2DPuzzle, null);
|
|
765
767
|
this.twisty2DPuzzle();
|
|
766
|
-
__privateGet(this, _freshListenerManager2).addListener(this.model.
|
|
768
|
+
__privateGet(this, _freshListenerManager2).addListener(this.model.stickering, async (stickering) => {
|
|
767
769
|
(await this.twisty2DPuzzle()).experimentalSetStickering(stickering);
|
|
768
770
|
});
|
|
769
771
|
}
|
|
@@ -799,7 +801,7 @@ var Twisty2DSceneWrapper = class extends ManagedCustomElement {
|
|
|
799
801
|
async connectedCallback() {
|
|
800
802
|
this.addCSS(twistyViewerWrapperCSS);
|
|
801
803
|
if (this.model) {
|
|
802
|
-
__privateGet(this, _freshListenerManager3).addListener(this.model.
|
|
804
|
+
__privateGet(this, _freshListenerManager3).addListener(this.model.puzzleLoader, this.onPuzzleLoader.bind(this));
|
|
803
805
|
}
|
|
804
806
|
}
|
|
805
807
|
async scene() {
|
|
@@ -872,12 +874,12 @@ var Twisty3DPuzzleWrapper = class {
|
|
|
872
874
|
__privateAdd(this, _freshListenerManager4, new FreshListenerManager());
|
|
873
875
|
__privateAdd(this, _cachedTwisty3DPuzzle, null);
|
|
874
876
|
this.twisty3DPuzzle();
|
|
875
|
-
__privateGet(this, _freshListenerManager4).addListener(this.model.
|
|
877
|
+
__privateGet(this, _freshListenerManager4).addListener(this.model.puzzleLoader, (puzzleLoader2) => {
|
|
876
878
|
if (this.puzzleLoader.id !== puzzleLoader2.id) {
|
|
877
879
|
this.disconnect();
|
|
878
880
|
}
|
|
879
881
|
});
|
|
880
|
-
__privateGet(this, _freshListenerManager4).addListener(this.model.
|
|
882
|
+
__privateGet(this, _freshListenerManager4).addListener(this.model.legacyPosition, async (position) => {
|
|
881
883
|
try {
|
|
882
884
|
(await this.twisty3DPuzzle()).onPositionChange(position);
|
|
883
885
|
this.scheduleRender();
|
|
@@ -885,19 +887,19 @@ var Twisty3DPuzzleWrapper = class {
|
|
|
885
887
|
this.disconnect();
|
|
886
888
|
}
|
|
887
889
|
});
|
|
888
|
-
__privateGet(this, _freshListenerManager4).addListener(this.model.
|
|
890
|
+
__privateGet(this, _freshListenerManager4).addListener(this.model.hintFacelet, async (hintFaceletStyle) => {
|
|
889
891
|
(await this.twisty3DPuzzle()).experimentalUpdateOptions({
|
|
890
892
|
hintFacelets: hintFaceletStyle === "auto" ? "floating" : hintFaceletStyle
|
|
891
893
|
});
|
|
892
894
|
this.scheduleRender();
|
|
893
895
|
});
|
|
894
|
-
__privateGet(this, _freshListenerManager4).addListener(this.model.
|
|
896
|
+
__privateGet(this, _freshListenerManager4).addListener(this.model.foundationDisplay, async (foundationDisplay) => {
|
|
895
897
|
(await this.twisty3DPuzzle()).experimentalUpdateOptions({
|
|
896
898
|
showFoundation: foundationDisplay !== "none"
|
|
897
899
|
});
|
|
898
900
|
this.scheduleRender();
|
|
899
901
|
});
|
|
900
|
-
__privateGet(this, _freshListenerManager4).addListener(this.model.
|
|
902
|
+
__privateGet(this, _freshListenerManager4).addListener(this.model.stickering, async (stickering) => {
|
|
901
903
|
if ("setStickering" in await this.twisty3DPuzzle()) {
|
|
902
904
|
(await this.twisty3DPuzzle()).setStickering(stickering);
|
|
903
905
|
this.scheduleRender();
|
|
@@ -941,7 +943,7 @@ var Twisty3DPuzzleWrapper = class {
|
|
|
941
943
|
const [foundationSprite, hintSprite, experimentalStickering] = await Promise.all([
|
|
942
944
|
this.model.foundationStickerSprite.get(),
|
|
943
945
|
this.model.hintStickerSprite.get(),
|
|
944
|
-
this.model.
|
|
946
|
+
this.model.stickering.get()
|
|
945
947
|
]);
|
|
946
948
|
return (await proxyPromise).cube3DShim({
|
|
947
949
|
foundationSprite,
|
|
@@ -950,7 +952,7 @@ var Twisty3DPuzzleWrapper = class {
|
|
|
950
952
|
});
|
|
951
953
|
} else {
|
|
952
954
|
const [hintFacelets, foundationSprite, hintSprite] = await Promise.all([
|
|
953
|
-
this.model.
|
|
955
|
+
this.model.hintFacelet.get(),
|
|
954
956
|
this.model.foundationStickerSprite.get(),
|
|
955
957
|
this.model.hintStickerSprite.get()
|
|
956
958
|
]);
|
|
@@ -1322,8 +1324,8 @@ var TwistyOrbitControls = class {
|
|
|
1322
1324
|
const minDim = Math.min(this.canvas.offsetWidth, this.canvas.offsetHeight);
|
|
1323
1325
|
const temperedX = this.temperMovement(movementX / minDim);
|
|
1324
1326
|
const temperedY = this.temperMovement(movementY / minDim * VERTICAL_MOVEMENT_BASE_SCALE);
|
|
1325
|
-
this.model.
|
|
1326
|
-
const prevCoords = await this.model.
|
|
1327
|
+
this.model.orbitCoordinatesRequest.set((async () => {
|
|
1328
|
+
const prevCoords = await this.model.orbitCoordinates.get();
|
|
1327
1329
|
const newCoords = {
|
|
1328
1330
|
latitude: prevCoords.latitude + 2 * temperedY * DEGREES_PER_RADIAN * scale,
|
|
1329
1331
|
longitude: prevCoords.longitude - 2 * temperedX * DEGREES_PER_RADIAN
|
|
@@ -1451,7 +1453,7 @@ var Twisty3DVantage = class extends ManagedCustomElement {
|
|
|
1451
1453
|
return __privateGet(this, _cachedOrbitControls) ?? __privateSet(this, _cachedOrbitControls, (async () => {
|
|
1452
1454
|
const orbitControls = new TwistyOrbitControls(this.model, !!this.options?.backView, (await this.canvasInfo()).canvas, await __privateMethod(this, _dragTracker, dragTracker_fn).call(this));
|
|
1453
1455
|
if (this.model) {
|
|
1454
|
-
this.addListener(this.model.
|
|
1456
|
+
this.addListener(this.model.orbitCoordinates, async (orbitCoordinates) => {
|
|
1455
1457
|
const camera = await this.camera();
|
|
1456
1458
|
setCameraFromOrbitCoordinates(camera, orbitCoordinates, this.options?.backView);
|
|
1457
1459
|
this.scheduleRender();
|
|
@@ -1497,7 +1499,7 @@ _setupBasicPresses = new WeakSet();
|
|
|
1497
1499
|
setupBasicPresses_fn = async function() {
|
|
1498
1500
|
const dragTracker = await __privateMethod(this, _dragTracker, dragTracker_fn).call(this);
|
|
1499
1501
|
dragTracker.addEventListener("press", async (e) => {
|
|
1500
|
-
const movePressInput = await this.model.
|
|
1502
|
+
const movePressInput = await this.model.movePressInput.get();
|
|
1501
1503
|
if (movePressInput !== "basic") {
|
|
1502
1504
|
return;
|
|
1503
1505
|
}
|
|
@@ -1584,8 +1586,8 @@ var Twisty3DSceneWrapper = class extends ManagedCustomElement {
|
|
|
1584
1586
|
const vantage = new Twisty3DVantage(this.model, this);
|
|
1585
1587
|
this.addVantage(vantage);
|
|
1586
1588
|
if (this.model) {
|
|
1587
|
-
__privateGet(this, _freshListenerManager5).addMultiListener([this.model.
|
|
1588
|
-
__privateGet(this, _freshListenerManager5).addListener(this.model.
|
|
1589
|
+
__privateGet(this, _freshListenerManager5).addMultiListener([this.model.puzzleLoader, this.model.visualizationStrategy], this.onPuzzle.bind(this));
|
|
1590
|
+
__privateGet(this, _freshListenerManager5).addListener(this.model.backView, this.onBackView.bind(this));
|
|
1589
1591
|
}
|
|
1590
1592
|
this.scheduleRender();
|
|
1591
1593
|
}
|
|
@@ -1918,7 +1920,7 @@ var TwistyButtonsV2 = class extends ManagedCustomElement {
|
|
|
1918
1920
|
this.addElement(button);
|
|
1919
1921
|
}
|
|
1920
1922
|
this.buttons = buttons;
|
|
1921
|
-
this.model?.
|
|
1923
|
+
this.model?.buttonAppearance.addFreshListener(this.update.bind(this));
|
|
1922
1924
|
}
|
|
1923
1925
|
async onFullscreenButton() {
|
|
1924
1926
|
if (!this.fullscreenElement) {
|
|
@@ -2100,7 +2102,7 @@ var TwistyScrubberV2 = class extends ManagedCustomElement {
|
|
|
2100
2102
|
const elem = document.createElement("input");
|
|
2101
2103
|
elem.type = "range";
|
|
2102
2104
|
elem.disabled = true;
|
|
2103
|
-
this.model?.
|
|
2105
|
+
this.model?.detailedTimelineInfo.addFreshListener(this.onDetailedTimelineInfo.bind(this));
|
|
2104
2106
|
elem.addEventListener("input", this.onInput.bind(this));
|
|
2105
2107
|
return elem;
|
|
2106
2108
|
})());
|
|
@@ -2112,8 +2114,8 @@ var TwistyScrubberV2 = class extends ManagedCustomElement {
|
|
|
2112
2114
|
const inputElem = await this.inputElem();
|
|
2113
2115
|
await this.slowDown(e, inputElem);
|
|
2114
2116
|
const value = parseInt(inputElem.value);
|
|
2115
|
-
this.model?.
|
|
2116
|
-
this.model?.
|
|
2117
|
+
this.model?.playingInfo.set({ playing: false });
|
|
2118
|
+
this.model?.timestampRequest.set(value);
|
|
2117
2119
|
}
|
|
2118
2120
|
async slowDown(e, inputElem) {
|
|
2119
2121
|
if (!SLOW_DOWN_SCRUBBING) {
|
|
@@ -2161,12 +2163,12 @@ async function screenshot(model, options) {
|
|
|
2161
2163
|
})());
|
|
2162
2164
|
const scene = new (await THREEJS).Scene();
|
|
2163
2165
|
const twisty3DWrapper = new Twisty3DPuzzleWrapper(model, { scheduleRender: () => {
|
|
2164
|
-
} }, await model.
|
|
2165
|
-
await model.
|
|
2166
|
+
} }, await model.puzzleLoader.get(), await model.visualizationStrategy.get());
|
|
2167
|
+
await model.stickering.get();
|
|
2166
2168
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
2167
|
-
await model.
|
|
2169
|
+
await model.legacyPosition.get();
|
|
2168
2170
|
scene.add(await twisty3DWrapper.twisty3DPuzzle());
|
|
2169
|
-
const orbitCoordinates = await model.
|
|
2171
|
+
const orbitCoordinates = await model.orbitCoordinates.get();
|
|
2170
2172
|
await setCameraFromOrbitCoordinates(camera, orbitCoordinates);
|
|
2171
2173
|
const renderer = new (await THREEJS).WebGLRenderer({
|
|
2172
2174
|
antialias: true,
|
|
@@ -2185,8 +2187,8 @@ async function screenshot(model, options) {
|
|
|
2185
2187
|
}
|
|
2186
2188
|
async function getDefaultFilename(model) {
|
|
2187
2189
|
const [puzzleID, algWithIssues] = await Promise.all([
|
|
2188
|
-
model.
|
|
2189
|
-
model.
|
|
2190
|
+
model.puzzleID.get(),
|
|
2191
|
+
model.alg.get()
|
|
2190
2192
|
]);
|
|
2191
2193
|
return `[${puzzleID}]${algWithIssues.alg.experimentalNumUnits() === 0 ? "" : " " + algWithIssues.alg.toString()}`;
|
|
2192
2194
|
}
|
|
@@ -3461,7 +3463,7 @@ var PuzzleAlgProp = class extends TwistyPropDerived {
|
|
|
3461
3463
|
// src/cubing/twisty/model/props/puzzle/state/AlgTransformationProp.ts
|
|
3462
3464
|
var AlgTransformationProp = class extends TwistyPropDerived {
|
|
3463
3465
|
derive(input) {
|
|
3464
|
-
return input.kpuzzle.algToTransformation(input.
|
|
3466
|
+
return input.kpuzzle.algToTransformation(input.setupAlg.alg);
|
|
3465
3467
|
}
|
|
3466
3468
|
};
|
|
3467
3469
|
|
|
@@ -3472,8 +3474,8 @@ var IndexerProp = class extends TwistyPropDerived {
|
|
|
3472
3474
|
}
|
|
3473
3475
|
};
|
|
3474
3476
|
|
|
3475
|
-
// src/cubing/twisty/model/props/puzzle/state/
|
|
3476
|
-
var
|
|
3477
|
+
// src/cubing/twisty/model/props/puzzle/state/AnchorTransformationProp.ts
|
|
3478
|
+
var AnchorTransformationProp = class extends TwistyPropDerived {
|
|
3477
3479
|
derive(inputs) {
|
|
3478
3480
|
switch (inputs.setupAnchor) {
|
|
3479
3481
|
case "start":
|
|
@@ -3716,112 +3718,112 @@ var FoundationDisplayProp = class extends SimpleTwistyPropSource {
|
|
|
3716
3718
|
var TwistyPlayerModel = class {
|
|
3717
3719
|
constructor() {
|
|
3718
3720
|
this.userVisibleErrorTracker = new UserVisibleErrorTracker();
|
|
3719
|
-
this.
|
|
3720
|
-
this.
|
|
3721
|
-
this.
|
|
3722
|
-
this.
|
|
3723
|
-
this.
|
|
3724
|
-
this.
|
|
3721
|
+
this.alg = new AlgProp();
|
|
3722
|
+
this.background = new BackgroundProp();
|
|
3723
|
+
this.backView = new BackViewProp();
|
|
3724
|
+
this.controlPanel = new ControlPanelProp();
|
|
3725
|
+
this.catchUpMove = new CatchUpMoveProp();
|
|
3726
|
+
this.foundationDisplay = new FoundationDisplayProp();
|
|
3725
3727
|
this.foundationStickerSpriteURL = new URLProp();
|
|
3726
|
-
this.
|
|
3728
|
+
this.hintFacelet = new HintFaceletProp();
|
|
3727
3729
|
this.hintStickerSpriteURL = new URLProp();
|
|
3728
|
-
this.
|
|
3729
|
-
this.
|
|
3730
|
-
this.
|
|
3731
|
-
this.
|
|
3732
|
-
this.
|
|
3733
|
-
this.
|
|
3734
|
-
this.
|
|
3735
|
-
this.
|
|
3736
|
-
this.
|
|
3737
|
-
this.
|
|
3738
|
-
this.
|
|
3739
|
-
this.
|
|
3740
|
-
this.
|
|
3741
|
-
this.
|
|
3730
|
+
this.indexerConstructorRequest = new IndexerConstructorRequestProp();
|
|
3731
|
+
this.latitudeLimit = new LatitudeLimitProp();
|
|
3732
|
+
this.movePressInput = new MovePressInputProp();
|
|
3733
|
+
this.orbitCoordinatesRequest = new OrbitCoordinatesRequestProp();
|
|
3734
|
+
this.playingInfo = new PlayingInfoProp();
|
|
3735
|
+
this.puzzleDescriptionRequest = new PGPuzzleDescriptionStringProp();
|
|
3736
|
+
this.puzzleIDRequest = new PuzzleIDRequestProp();
|
|
3737
|
+
this.setupAnchor = new SetupAnchorProp();
|
|
3738
|
+
this.setupAlg = new AlgProp();
|
|
3739
|
+
this.stickering = new StickeringProp();
|
|
3740
|
+
this.tempoScale = new TempoScaleProp();
|
|
3741
|
+
this.timestampRequest = new TimestampRequestProp();
|
|
3742
|
+
this.viewerLink = new ViewerLinkProp();
|
|
3743
|
+
this.visualizationFormat = new VisualizationFormatProp();
|
|
3742
3744
|
this.foundationStickerSprite = new SpriteProp({
|
|
3743
3745
|
spriteURL: this.foundationStickerSpriteURL
|
|
3744
3746
|
});
|
|
3745
3747
|
this.hintStickerSprite = new SpriteProp({
|
|
3746
3748
|
spriteURL: this.hintStickerSpriteURL
|
|
3747
3749
|
});
|
|
3748
|
-
this.
|
|
3749
|
-
puzzleIDRequest: this.
|
|
3750
|
-
puzzleDescriptionRequest: this.
|
|
3750
|
+
this.puzzleLoader = new PuzzleLoaderProp({
|
|
3751
|
+
puzzleIDRequest: this.puzzleIDRequest,
|
|
3752
|
+
puzzleDescriptionRequest: this.puzzleDescriptionRequest
|
|
3751
3753
|
}, this.userVisibleErrorTracker);
|
|
3752
|
-
this.
|
|
3753
|
-
this.
|
|
3754
|
-
this.
|
|
3755
|
-
algWithIssues: this.
|
|
3756
|
-
kpuzzle: this.
|
|
3754
|
+
this.kpuzzle = new KPuzzleProp({ puzzleLoader: this.puzzleLoader });
|
|
3755
|
+
this.puzzleID = new PuzzleIDProp({ puzzleLoader: this.puzzleLoader });
|
|
3756
|
+
this.puzzleAlg = new PuzzleAlgProp({
|
|
3757
|
+
algWithIssues: this.alg,
|
|
3758
|
+
kpuzzle: this.kpuzzle
|
|
3757
3759
|
});
|
|
3758
|
-
this.
|
|
3759
|
-
algWithIssues: this.
|
|
3760
|
-
kpuzzle: this.
|
|
3760
|
+
this.puzzleSetupAlg = new PuzzleAlgProp({
|
|
3761
|
+
algWithIssues: this.setupAlg,
|
|
3762
|
+
kpuzzle: this.kpuzzle
|
|
3761
3763
|
});
|
|
3762
|
-
this.
|
|
3763
|
-
visualizationRequest: this.
|
|
3764
|
-
puzzleID: this.
|
|
3764
|
+
this.visualizationStrategy = new VisualizationStrategyProp({
|
|
3765
|
+
visualizationRequest: this.visualizationFormat,
|
|
3766
|
+
puzzleID: this.puzzleID
|
|
3765
3767
|
});
|
|
3766
|
-
this.
|
|
3767
|
-
alg: this.
|
|
3768
|
-
puzzle: this.
|
|
3769
|
-
visualizationStrategy: this.
|
|
3770
|
-
indexerConstructorRequest: this.
|
|
3768
|
+
this.indexerConstructor = new IndexerConstructorProp({
|
|
3769
|
+
alg: this.alg,
|
|
3770
|
+
puzzle: this.puzzleID,
|
|
3771
|
+
visualizationStrategy: this.visualizationStrategy,
|
|
3772
|
+
indexerConstructorRequest: this.indexerConstructorRequest
|
|
3771
3773
|
});
|
|
3772
|
-
this.
|
|
3773
|
-
this.
|
|
3774
|
-
orbitCoordinatesRequest: this.
|
|
3775
|
-
latitudeLimit: this.
|
|
3776
|
-
puzzleID: this.
|
|
3777
|
-
strategy: this.
|
|
3774
|
+
this.moveCount = new NaiveMoveCountProp({ alg: this.puzzleAlg });
|
|
3775
|
+
this.orbitCoordinates = new OrbitCoordinatesProp({
|
|
3776
|
+
orbitCoordinatesRequest: this.orbitCoordinatesRequest,
|
|
3777
|
+
latitudeLimit: this.latitudeLimit,
|
|
3778
|
+
puzzleID: this.puzzleID,
|
|
3779
|
+
strategy: this.visualizationStrategy
|
|
3778
3780
|
});
|
|
3779
|
-
this.
|
|
3780
|
-
|
|
3781
|
-
kpuzzle: this.
|
|
3781
|
+
this.setupAlgTransformation = new AlgTransformationProp({
|
|
3782
|
+
setupAlg: this.puzzleSetupAlg,
|
|
3783
|
+
kpuzzle: this.kpuzzle
|
|
3782
3784
|
});
|
|
3783
|
-
this.
|
|
3784
|
-
indexerConstructor: this.
|
|
3785
|
-
algWithIssues: this.
|
|
3786
|
-
kpuzzle: this.
|
|
3785
|
+
this.indexer = new IndexerProp({
|
|
3786
|
+
indexerConstructor: this.indexerConstructor,
|
|
3787
|
+
algWithIssues: this.puzzleAlg,
|
|
3788
|
+
kpuzzle: this.kpuzzle
|
|
3787
3789
|
});
|
|
3788
|
-
this.
|
|
3789
|
-
setupAnchor: this.
|
|
3790
|
-
setupTransformation: this.
|
|
3791
|
-
indexer: this.
|
|
3790
|
+
this.anchorTransformation = new AnchorTransformationProp({
|
|
3791
|
+
setupAnchor: this.setupAnchor,
|
|
3792
|
+
setupTransformation: this.setupAlgTransformation,
|
|
3793
|
+
indexer: this.indexer
|
|
3792
3794
|
});
|
|
3793
|
-
this.
|
|
3794
|
-
indexer: this.
|
|
3795
|
+
this.timeRange = new TimeRangeProp({
|
|
3796
|
+
indexer: this.indexer
|
|
3795
3797
|
});
|
|
3796
|
-
this.
|
|
3797
|
-
timestampRequest: this.
|
|
3798
|
-
timeRange: this.
|
|
3799
|
-
setupAnchor: this.
|
|
3798
|
+
this.detailedTimelineInfo = new DetailedTimelineInfoProp({
|
|
3799
|
+
timestampRequest: this.timestampRequest,
|
|
3800
|
+
timeRange: this.timeRange,
|
|
3801
|
+
setupAnchor: this.setupAnchor
|
|
3800
3802
|
});
|
|
3801
|
-
this.
|
|
3802
|
-
detailedTimelineInfo: this.
|
|
3803
|
-
playingInfo: this.
|
|
3803
|
+
this.coarseTimelineInfo = new CoarseTimelineInfoProp({
|
|
3804
|
+
detailedTimelineInfo: this.detailedTimelineInfo,
|
|
3805
|
+
playingInfo: this.playingInfo
|
|
3804
3806
|
});
|
|
3805
|
-
this.
|
|
3806
|
-
indexer: this.
|
|
3807
|
-
detailedTimelineInfo: this.
|
|
3808
|
-
catchUpMove: this.
|
|
3807
|
+
this.currentMoveInfo = new CurrentMoveInfoProp({
|
|
3808
|
+
indexer: this.indexer,
|
|
3809
|
+
detailedTimelineInfo: this.detailedTimelineInfo,
|
|
3810
|
+
catchUpMove: this.catchUpMove
|
|
3809
3811
|
});
|
|
3810
|
-
this.
|
|
3811
|
-
coarseTimelineInfo: this.
|
|
3812
|
-
viewerLink: this.
|
|
3812
|
+
this.buttonAppearance = new ButtonAppearanceProp({
|
|
3813
|
+
coarseTimelineInfo: this.coarseTimelineInfo,
|
|
3814
|
+
viewerLink: this.viewerLink
|
|
3813
3815
|
});
|
|
3814
|
-
this.
|
|
3815
|
-
currentMoveInfo: this.
|
|
3816
|
+
this.currentLeavesSimplified = new CurrentLeavesSimplifiedProp({
|
|
3817
|
+
currentMoveInfo: this.currentMoveInfo
|
|
3816
3818
|
});
|
|
3817
|
-
this.
|
|
3818
|
-
anchoredStart: this.
|
|
3819
|
-
currentLeavesSimplified: this.
|
|
3820
|
-
indexer: this.
|
|
3819
|
+
this.currentState = new CurrentStateProp({
|
|
3820
|
+
anchoredStart: this.anchorTransformation,
|
|
3821
|
+
currentLeavesSimplified: this.currentLeavesSimplified,
|
|
3822
|
+
indexer: this.indexer
|
|
3821
3823
|
});
|
|
3822
|
-
this.
|
|
3823
|
-
currentMoveInfo: this.
|
|
3824
|
-
state: this.
|
|
3824
|
+
this.legacyPosition = new LegacyPositionProp({
|
|
3825
|
+
currentMoveInfo: this.currentMoveInfo,
|
|
3826
|
+
state: this.currentState
|
|
3825
3827
|
});
|
|
3826
3828
|
}
|
|
3827
3829
|
async twizzleLink() {
|
|
@@ -3834,13 +3836,13 @@ var TwistyPlayerModel = class {
|
|
|
3834
3836
|
anchor,
|
|
3835
3837
|
experimentalStickering
|
|
3836
3838
|
] = await Promise.all([
|
|
3837
|
-
this.
|
|
3838
|
-
this.
|
|
3839
|
-
this.
|
|
3840
|
-
this.
|
|
3841
|
-
this.
|
|
3842
|
-
this.
|
|
3843
|
-
this.
|
|
3839
|
+
this.viewerLink.get(),
|
|
3840
|
+
this.puzzleID.get(),
|
|
3841
|
+
this.puzzleDescriptionRequest.get(),
|
|
3842
|
+
this.alg.get(),
|
|
3843
|
+
this.setupAlg.get(),
|
|
3844
|
+
this.setupAnchor.get(),
|
|
3845
|
+
this.stickering.get()
|
|
3844
3846
|
]);
|
|
3845
3847
|
const isExplorer = viewerLink === "experimental-twizzle-explorer";
|
|
3846
3848
|
console.log({ isExplorer, viewerLink });
|
|
@@ -3867,19 +3869,23 @@ var TwistyPlayerModel = class {
|
|
|
3867
3869
|
experimentalAddMove(flexibleMove, options = {}) {
|
|
3868
3870
|
const move = typeof flexibleMove === "string" ? new Move(flexibleMove) : flexibleMove;
|
|
3869
3871
|
(async () => {
|
|
3870
|
-
const alg = (await this.
|
|
3872
|
+
const alg = (await this.alg.get()).alg;
|
|
3871
3873
|
const newAlg = experimentalAppendMove(alg, move, {
|
|
3872
3874
|
coalesce: options?.coalesce,
|
|
3873
3875
|
mod: options?.mod
|
|
3874
3876
|
});
|
|
3875
|
-
this.
|
|
3876
|
-
this.
|
|
3877
|
-
this.
|
|
3877
|
+
this.alg.set(newAlg);
|
|
3878
|
+
this.timestampRequest.set("end");
|
|
3879
|
+
this.catchUpMove.set({
|
|
3878
3880
|
move,
|
|
3879
3881
|
amount: 0
|
|
3880
3882
|
});
|
|
3881
3883
|
})();
|
|
3882
3884
|
}
|
|
3885
|
+
get playingInfoProp() {
|
|
3886
|
+
console.warn("Using deprecated prop: `playingInfoProp`. Please switch to: `playingInfo`");
|
|
3887
|
+
return this.playingInfo;
|
|
3888
|
+
}
|
|
3883
3889
|
};
|
|
3884
3890
|
|
|
3885
3891
|
// src/cubing/twisty/views/TwistyPlayerSettable.ts
|
|
@@ -3893,121 +3899,121 @@ var TwistyPlayerSettable = class extends ManagedCustomElement {
|
|
|
3893
3899
|
this.experimentalGet = new ExperimentalGetters(this.experimentalModel);
|
|
3894
3900
|
}
|
|
3895
3901
|
set alg(newAlg) {
|
|
3896
|
-
this.experimentalModel.
|
|
3902
|
+
this.experimentalModel.alg.set(newAlg);
|
|
3897
3903
|
}
|
|
3898
3904
|
get alg() {
|
|
3899
3905
|
throw err("alg");
|
|
3900
3906
|
}
|
|
3901
3907
|
set experimentalSetupAlg(newSetup) {
|
|
3902
|
-
this.experimentalModel.
|
|
3908
|
+
this.experimentalModel.setupAlg.set(newSetup);
|
|
3903
3909
|
}
|
|
3904
3910
|
get experimentalSetupAlg() {
|
|
3905
3911
|
throw err("setup");
|
|
3906
3912
|
}
|
|
3907
3913
|
set experimentalSetupAnchor(anchor) {
|
|
3908
|
-
this.experimentalModel.
|
|
3914
|
+
this.experimentalModel.setupAnchor.set(anchor);
|
|
3909
3915
|
}
|
|
3910
3916
|
get experimentalSetupAnchor() {
|
|
3911
3917
|
throw err("anchor");
|
|
3912
3918
|
}
|
|
3913
3919
|
set puzzle(puzzleID) {
|
|
3914
|
-
this.experimentalModel.
|
|
3920
|
+
this.experimentalModel.puzzleIDRequest.set(puzzleID);
|
|
3915
3921
|
}
|
|
3916
3922
|
get puzzle() {
|
|
3917
3923
|
throw err("puzzle");
|
|
3918
3924
|
}
|
|
3919
3925
|
set experimentalPuzzleDescription(puzzleDescription) {
|
|
3920
|
-
this.experimentalModel.
|
|
3926
|
+
this.experimentalModel.puzzleDescriptionRequest.set(puzzleDescription);
|
|
3921
3927
|
}
|
|
3922
3928
|
get experimentalPuzzleDescription() {
|
|
3923
3929
|
throw err("experimentalPuzzleDescription");
|
|
3924
3930
|
}
|
|
3925
3931
|
set timestamp(timestamp) {
|
|
3926
|
-
this.experimentalModel.
|
|
3932
|
+
this.experimentalModel.timestampRequest.set(timestamp);
|
|
3927
3933
|
}
|
|
3928
3934
|
get timestamp() {
|
|
3929
3935
|
throw err("timestamp");
|
|
3930
3936
|
}
|
|
3931
3937
|
set hintFacelets(hintFaceletStyle) {
|
|
3932
|
-
this.experimentalModel.
|
|
3938
|
+
this.experimentalModel.hintFacelet.set(hintFaceletStyle);
|
|
3933
3939
|
}
|
|
3934
3940
|
get hintFacelets() {
|
|
3935
3941
|
throw err("hintFacelets");
|
|
3936
3942
|
}
|
|
3937
3943
|
set experimentalStickering(stickering) {
|
|
3938
|
-
this.experimentalModel.
|
|
3944
|
+
this.experimentalModel.stickering.set(stickering);
|
|
3939
3945
|
}
|
|
3940
3946
|
get experimentalStickering() {
|
|
3941
3947
|
throw err("stickering");
|
|
3942
3948
|
}
|
|
3943
3949
|
set backView(backView) {
|
|
3944
|
-
this.experimentalModel.
|
|
3950
|
+
this.experimentalModel.backView.set(backView);
|
|
3945
3951
|
}
|
|
3946
3952
|
get backView() {
|
|
3947
3953
|
throw err("backView");
|
|
3948
3954
|
}
|
|
3949
3955
|
set background(backgroundTheme) {
|
|
3950
|
-
this.experimentalModel.
|
|
3956
|
+
this.experimentalModel.background.set(backgroundTheme);
|
|
3951
3957
|
}
|
|
3952
3958
|
get background() {
|
|
3953
3959
|
throw err("background");
|
|
3954
3960
|
}
|
|
3955
3961
|
set controlPanel(newControlPanel) {
|
|
3956
|
-
this.experimentalModel.
|
|
3962
|
+
this.experimentalModel.controlPanel.set(newControlPanel);
|
|
3957
3963
|
}
|
|
3958
3964
|
get controlPanel() {
|
|
3959
3965
|
throw err("controlPanel");
|
|
3960
3966
|
}
|
|
3961
3967
|
set visualization(visualizationFormat) {
|
|
3962
|
-
this.experimentalModel.
|
|
3968
|
+
this.experimentalModel.visualizationFormat.set(visualizationFormat);
|
|
3963
3969
|
}
|
|
3964
3970
|
get visualization() {
|
|
3965
3971
|
throw err("visualization");
|
|
3966
3972
|
}
|
|
3967
3973
|
set viewerLink(viewerLinkPage) {
|
|
3968
|
-
this.experimentalModel.
|
|
3974
|
+
this.experimentalModel.viewerLink.set(viewerLinkPage);
|
|
3969
3975
|
}
|
|
3970
3976
|
get viewerLink() {
|
|
3971
3977
|
throw err("viewerLink");
|
|
3972
3978
|
}
|
|
3973
3979
|
set experimentalMovePressInput(movePressInput) {
|
|
3974
|
-
this.experimentalModel.
|
|
3980
|
+
this.experimentalModel.movePressInput.set(movePressInput);
|
|
3975
3981
|
}
|
|
3976
3982
|
get experimentalMovePressInput() {
|
|
3977
3983
|
throw err("experimentalMovePressInput");
|
|
3978
3984
|
}
|
|
3979
3985
|
set cameraLatitude(latitude) {
|
|
3980
|
-
this.experimentalModel.
|
|
3986
|
+
this.experimentalModel.orbitCoordinatesRequest.set({ latitude });
|
|
3981
3987
|
}
|
|
3982
3988
|
get cameraLatitude() {
|
|
3983
3989
|
throw err("cameraLatitude");
|
|
3984
3990
|
}
|
|
3985
3991
|
set cameraLongitude(longitude) {
|
|
3986
|
-
this.experimentalModel.
|
|
3992
|
+
this.experimentalModel.orbitCoordinatesRequest.set({ longitude });
|
|
3987
3993
|
}
|
|
3988
3994
|
get cameraLongitude() {
|
|
3989
3995
|
throw err("cameraLongitude");
|
|
3990
3996
|
}
|
|
3991
3997
|
set cameraDistance(distance) {
|
|
3992
|
-
this.experimentalModel.
|
|
3998
|
+
this.experimentalModel.orbitCoordinatesRequest.set({ distance });
|
|
3993
3999
|
}
|
|
3994
4000
|
get cameraDistance() {
|
|
3995
4001
|
throw err("cameraDistance");
|
|
3996
4002
|
}
|
|
3997
4003
|
set cameraLatitudeLimit(latitudeLimit) {
|
|
3998
|
-
this.experimentalModel.
|
|
4004
|
+
this.experimentalModel.latitudeLimit.set(latitudeLimit);
|
|
3999
4005
|
}
|
|
4000
4006
|
get cameraLatitudeLimit() {
|
|
4001
4007
|
throw err("cameraLatitudeLimit");
|
|
4002
4008
|
}
|
|
4003
4009
|
set indexer(indexer) {
|
|
4004
|
-
this.experimentalModel.
|
|
4010
|
+
this.experimentalModel.indexerConstructorRequest.set(indexer);
|
|
4005
4011
|
}
|
|
4006
4012
|
get indexer() {
|
|
4007
4013
|
throw err("indexer");
|
|
4008
4014
|
}
|
|
4009
4015
|
set tempoScale(newTempoScale) {
|
|
4010
|
-
this.experimentalModel.
|
|
4016
|
+
this.experimentalModel.tempoScale.set(newTempoScale);
|
|
4011
4017
|
}
|
|
4012
4018
|
get tempoScale() {
|
|
4013
4019
|
throw err("tempoScale");
|
|
@@ -4030,16 +4036,16 @@ var ExperimentalGetters = class {
|
|
|
4030
4036
|
this.model = model;
|
|
4031
4037
|
}
|
|
4032
4038
|
async alg() {
|
|
4033
|
-
return (await this.model.
|
|
4039
|
+
return (await this.model.alg.get()).alg;
|
|
4034
4040
|
}
|
|
4035
4041
|
async setupAlg() {
|
|
4036
|
-
return (await this.model.
|
|
4042
|
+
return (await this.model.setupAlg.get()).alg;
|
|
4037
4043
|
}
|
|
4038
4044
|
puzzleID() {
|
|
4039
|
-
return this.model.
|
|
4045
|
+
return this.model.puzzleID.get();
|
|
4040
4046
|
}
|
|
4041
4047
|
async timestamp() {
|
|
4042
|
-
return (await this.model.
|
|
4048
|
+
return (await this.model.detailedTimelineInfo.get()).timestamp;
|
|
4043
4049
|
}
|
|
4044
4050
|
};
|
|
4045
4051
|
|
|
@@ -4109,14 +4115,14 @@ var TwistyPlayer = class extends TwistyPlayerSettable {
|
|
|
4109
4115
|
this.contentWrapper.appendChild(scrubber);
|
|
4110
4116
|
this.buttons = new TwistyButtonsV2(this.experimentalModel, this.controller, this);
|
|
4111
4117
|
this.contentWrapper.appendChild(this.buttons);
|
|
4112
|
-
this.experimentalModel.
|
|
4118
|
+
this.experimentalModel.background.addFreshListener((backgroundTheme) => {
|
|
4113
4119
|
this.contentWrapper.classList.toggle("checkered", backgroundTheme !== "none");
|
|
4114
4120
|
});
|
|
4115
|
-
this.experimentalModel.
|
|
4121
|
+
this.experimentalModel.controlPanel.addFreshListener((controlPanel) => {
|
|
4116
4122
|
__privateGet(this, _controlsManager).setValue(controlPanel);
|
|
4117
4123
|
});
|
|
4118
|
-
this.experimentalModel.
|
|
4119
|
-
this.experimentalModel.
|
|
4124
|
+
this.experimentalModel.visualizationStrategy.addFreshListener(__privateMethod(this, _setVisualizationWrapper, setVisualizationWrapper_fn).bind(this));
|
|
4125
|
+
this.experimentalModel.puzzleID.addFreshListener(this.flash.bind(this));
|
|
4120
4126
|
}
|
|
4121
4127
|
flash() {
|
|
4122
4128
|
__privateGet(this, _visualizationWrapper)?.animate([{ opacity: 0.25 }, { opacity: 1 }], {
|
|
@@ -4175,7 +4181,7 @@ var TwistyPlayer = class extends TwistyPlayerSettable {
|
|
|
4175
4181
|
return (await screenshot(this.experimentalModel, options)).dataURL;
|
|
4176
4182
|
}
|
|
4177
4183
|
async experimentalDownloadScreenshot(filename) {
|
|
4178
|
-
if (["2D", "experimental-2D-LL"].includes(await this.experimentalModel.
|
|
4184
|
+
if (["2D", "experimental-2D-LL"].includes(await this.experimentalModel.visualizationStrategy.get())) {
|
|
4179
4185
|
const wrapper2D = __privateGet(this, _visualizationWrapper);
|
|
4180
4186
|
const twisty2DPuzzle = await wrapper2D.currentTwisty2DPuzzleWrapper().twisty2DPuzzle();
|
|
4181
4187
|
const str = new XMLSerializer().serializeToString(twisty2DPuzzle.svg.element);
|
|
@@ -4489,13 +4495,13 @@ var TwistyAlgViewer = class extends HTMLElementShim {
|
|
|
4489
4495
|
return;
|
|
4490
4496
|
}
|
|
4491
4497
|
this.twistyPlayer = twistyPlayer;
|
|
4492
|
-
this.twistyPlayer.experimentalModel.
|
|
4498
|
+
this.twistyPlayer.experimentalModel.alg.addFreshListener((algWithIssues) => {
|
|
4493
4499
|
this.setAlg(algWithIssues.alg);
|
|
4494
4500
|
});
|
|
4495
|
-
const sourceAlg = (await this.twistyPlayer.experimentalModel.
|
|
4501
|
+
const sourceAlg = (await this.twistyPlayer.experimentalModel.alg.get()).alg;
|
|
4496
4502
|
const parsedAlg = "startCharIndex" in sourceAlg ? sourceAlg : Alg.fromString(sourceAlg.toString());
|
|
4497
4503
|
this.setAlg(parsedAlg);
|
|
4498
|
-
twistyPlayer.experimentalModel.
|
|
4504
|
+
twistyPlayer.experimentalModel.currentMoveInfo.addFreshListener((currentMoveInfo) => {
|
|
4499
4505
|
let moveInfo = currentMoveInfo.currentMoves[0];
|
|
4500
4506
|
moveInfo ?? (moveInfo = currentMoveInfo.movesStarting[0]);
|
|
4501
4507
|
moveInfo ?? (moveInfo = currentMoveInfo.movesFinishing[0]);
|
|
@@ -4506,7 +4512,7 @@ var TwistyAlgViewer = class extends HTMLElementShim {
|
|
|
4506
4512
|
this.highlighter.set(mainCurrentMove);
|
|
4507
4513
|
}
|
|
4508
4514
|
});
|
|
4509
|
-
twistyPlayer.experimentalModel.
|
|
4515
|
+
twistyPlayer.experimentalModel.detailedTimelineInfo.addFreshListener((detailedTimelineInfo) => {
|
|
4510
4516
|
if (detailedTimelineInfo.timestamp !== this.lastClickTimestamp) {
|
|
4511
4517
|
this.lastClickTimestamp = null;
|
|
4512
4518
|
}
|
|
@@ -4517,11 +4523,11 @@ var TwistyAlgViewer = class extends HTMLElementShim {
|
|
|
4517
4523
|
if (twistyPlayer) {
|
|
4518
4524
|
twistyPlayer.pause();
|
|
4519
4525
|
const timestampPromise = (async () => {
|
|
4520
|
-
const indexer = await twistyPlayer.experimentalModel.
|
|
4526
|
+
const indexer = await twistyPlayer.experimentalModel.indexer.get();
|
|
4521
4527
|
const offset = offsetIntoMove ? DEFAULT_OFFSET_MS : 0;
|
|
4522
4528
|
return (indexer.indexToMoveStartTimestamp(index) ?? -offset) + offset;
|
|
4523
4529
|
})();
|
|
4524
|
-
twistyPlayer.experimentalModel.
|
|
4530
|
+
twistyPlayer.experimentalModel.timestampRequest.set(await timestampPromise);
|
|
4525
4531
|
if (this.lastClickTimestamp === await timestampPromise) {
|
|
4526
4532
|
twistyPlayer.play();
|
|
4527
4533
|
this.lastClickTimestamp = null;
|
|
@@ -4840,8 +4846,8 @@ var TwistyAlgEditor = class extends ManagedCustomElement {
|
|
|
4840
4846
|
if (options?.twistyPlayer) {
|
|
4841
4847
|
this.twistyPlayer = options.twistyPlayer;
|
|
4842
4848
|
}
|
|
4843
|
-
__privateSet(this, _twistyPlayerProp, options?.twistyPlayerProp ?? "
|
|
4844
|
-
if (options?.twistyPlayerProp === "
|
|
4849
|
+
__privateSet(this, _twistyPlayerProp, options?.twistyPlayerProp ?? "alg");
|
|
4850
|
+
if (options?.twistyPlayerProp === "alg") {
|
|
4845
4851
|
this.model.leafToHighlight.addFreshListener((highlightInfo) => {
|
|
4846
4852
|
if (highlightInfo) {
|
|
4847
4853
|
this.highlightLeaf(highlightInfo.leafInfo.leaf);
|
|
@@ -4870,7 +4876,7 @@ var TwistyAlgEditor = class extends ManagedCustomElement {
|
|
|
4870
4876
|
if (document.activeElement !== this || this.shadow.activeElement !== __privateGet(this, _textarea)) {
|
|
4871
4877
|
return;
|
|
4872
4878
|
}
|
|
4873
|
-
if (__privateGet(this, _twistyPlayerProp) !== "
|
|
4879
|
+
if (__privateGet(this, _twistyPlayerProp) !== "alg") {
|
|
4874
4880
|
return;
|
|
4875
4881
|
}
|
|
4876
4882
|
const { selectionStart, selectionEnd } = __privateGet(this, _textarea);
|
|
@@ -4885,7 +4891,7 @@ var TwistyAlgEditor = class extends ManagedCustomElement {
|
|
|
4885
4891
|
__privateGet(this, _textareaClassListValidForPuzzleManager).setValue(issues);
|
|
4886
4892
|
}
|
|
4887
4893
|
highlightLeaf(leaf) {
|
|
4888
|
-
if (__privateGet(this, _twistyPlayerProp) !== "
|
|
4894
|
+
if (__privateGet(this, _twistyPlayerProp) !== "alg") {
|
|
4889
4895
|
return;
|
|
4890
4896
|
}
|
|
4891
4897
|
if (leaf === null) {
|
|
@@ -4918,8 +4924,8 @@ var TwistyAlgEditor = class extends ManagedCustomElement {
|
|
|
4918
4924
|
(async () => {
|
|
4919
4925
|
this.algString = __privateGet(this, _algProp, algProp_get) ? (await __privateGet(this, _algProp, algProp_get).get()).alg.toString() : "";
|
|
4920
4926
|
})();
|
|
4921
|
-
if (__privateGet(this, _twistyPlayerProp) === "
|
|
4922
|
-
__privateGet(this, _twistyPlayer)?.experimentalModel.
|
|
4927
|
+
if (__privateGet(this, _twistyPlayerProp) === "alg") {
|
|
4928
|
+
__privateGet(this, _twistyPlayer)?.experimentalModel.puzzleAlg.addFreshListener((algWithIssues) => {
|
|
4923
4929
|
if (algWithIssues.issues.errors.length === 0) {
|
|
4924
4930
|
this.setAlgIssueClassForPuzzle(algWithIssues.issues.warnings.length === 0 ? "none" : "warning");
|
|
4925
4931
|
const newAlg = algWithIssues.alg;
|
|
@@ -4938,8 +4944,8 @@ var TwistyAlgEditor = class extends ManagedCustomElement {
|
|
|
4938
4944
|
return;
|
|
4939
4945
|
}
|
|
4940
4946
|
const [indexer, timestampRequest] = await Promise.all([
|
|
4941
|
-
await twistyPlayer.experimentalModel.
|
|
4942
|
-
await twistyPlayer.experimentalModel.
|
|
4947
|
+
await twistyPlayer.experimentalModel.indexer.get(),
|
|
4948
|
+
await twistyPlayer.experimentalModel.timestampRequest.get()
|
|
4943
4949
|
]);
|
|
4944
4950
|
if (timestampRequest === "opposite-anchor" && !__privateGet(this, _onInputHasFired)) {
|
|
4945
4951
|
return;
|
|
@@ -4964,11 +4970,11 @@ var TwistyAlgEditor = class extends ManagedCustomElement {
|
|
|
4964
4970
|
throw new Error("Invalid where!");
|
|
4965
4971
|
}
|
|
4966
4972
|
if (!this.debugNeverRequestTimestamp) {
|
|
4967
|
-
twistyPlayer.experimentalModel.
|
|
4973
|
+
twistyPlayer.experimentalModel.timestampRequest.set(newTimestamp);
|
|
4968
4974
|
}
|
|
4969
4975
|
});
|
|
4970
|
-
twistyPlayer.experimentalModel.
|
|
4971
|
-
const indexer = await twistyPlayer.experimentalModel.
|
|
4976
|
+
twistyPlayer.experimentalModel.currentLeavesSimplified.addFreshListener(async (currentLeavesSimplified) => {
|
|
4977
|
+
const indexer = await twistyPlayer.experimentalModel.indexer.get();
|
|
4972
4978
|
const leaf = indexer.getAnimLeaf(currentLeavesSimplified.stateIndex);
|
|
4973
4979
|
this.highlightLeaf(leaf);
|
|
4974
4980
|
});
|
|
@@ -5054,6 +5060,8 @@ var twizzleLinkCSS = new CSSSource(`
|
|
|
5054
5060
|
|
|
5055
5061
|
twisty-player {
|
|
5056
5062
|
width: 100%;
|
|
5063
|
+
resize: vertical;
|
|
5064
|
+
overflow-y: hidden;
|
|
5057
5065
|
}
|
|
5058
5066
|
|
|
5059
5067
|
twisty-player + .heading {
|
|
@@ -5070,12 +5078,12 @@ var URLParamUpdater = class {
|
|
|
5070
5078
|
constructor(model, options) {
|
|
5071
5079
|
__privateAdd(this, _prefix, void 0);
|
|
5072
5080
|
__privateSet(this, _prefix, options?.prefix ?? "");
|
|
5073
|
-
this.listenToAlgProp(model.
|
|
5074
|
-
this.listenToAlgProp(model.
|
|
5075
|
-
this.listenToStringSourceProp(model.
|
|
5076
|
-
this.listenToStringSourceProp(model.
|
|
5077
|
-
this.listenToStringOrNoValueProp(model.
|
|
5078
|
-
this.listenToStringOrNoValueProp(model.
|
|
5081
|
+
this.listenToAlgProp(model.alg, "alg");
|
|
5082
|
+
this.listenToAlgProp(model.setupAlg, "setup-alg");
|
|
5083
|
+
this.listenToStringSourceProp(model.stickering, "stickering");
|
|
5084
|
+
this.listenToStringSourceProp(model.setupAnchor, "setup-anchor");
|
|
5085
|
+
this.listenToStringOrNoValueProp(model.puzzleIDRequest, "puzzle", NO_VALUE);
|
|
5086
|
+
this.listenToStringOrNoValueProp(model.puzzleDescriptionRequest, "puzzle-description", NO_VALUE);
|
|
5079
5087
|
}
|
|
5080
5088
|
setURLParam(unprefixedKey, value, defaultString) {
|
|
5081
5089
|
const prefixedKey = __privateGet(this, _prefix) + unprefixedKey;
|
|
@@ -5134,14 +5142,28 @@ function getConfigFromURL(prefix = "", url = location.href) {
|
|
|
5134
5142
|
}
|
|
5135
5143
|
|
|
5136
5144
|
// src/cubing/twisty/views/twizzle/TwizzleLink.ts
|
|
5145
|
+
var _cssElem;
|
|
5137
5146
|
var TwizzleLink = class extends ManagedCustomElement {
|
|
5138
5147
|
constructor() {
|
|
5139
5148
|
super({ mode: "open" });
|
|
5140
5149
|
this.twistyPlayer = null;
|
|
5141
5150
|
this.a = null;
|
|
5151
|
+
__privateAdd(this, _cssElem, void 0);
|
|
5152
|
+
}
|
|
5153
|
+
fallback() {
|
|
5154
|
+
this.contentWrapper.textContent = "";
|
|
5155
|
+
if (this.a) {
|
|
5156
|
+
const span = this.contentWrapper.appendChild(document.createElement("span"));
|
|
5157
|
+
span.textContent = "\u2757\uFE0F";
|
|
5158
|
+
span.title = "Could not show a player for link";
|
|
5159
|
+
this.addElement(this.a);
|
|
5160
|
+
}
|
|
5161
|
+
if (__privateGet(this, _cssElem)) {
|
|
5162
|
+
__privateGet(this, _cssElem).remove();
|
|
5163
|
+
}
|
|
5142
5164
|
}
|
|
5143
5165
|
async connectedCallback() {
|
|
5144
|
-
this.addCSS(twizzleLinkCSS);
|
|
5166
|
+
__privateSet(this, _cssElem, this.addCSS(twizzleLinkCSS));
|
|
5145
5167
|
this.a = this.querySelector("a");
|
|
5146
5168
|
if (!this.a) {
|
|
5147
5169
|
return;
|
|
@@ -5150,6 +5172,7 @@ var TwizzleLink = class extends ManagedCustomElement {
|
|
|
5150
5172
|
const href = this.a?.href;
|
|
5151
5173
|
const { hostname, pathname } = new URL(href);
|
|
5152
5174
|
if (hostname !== "alpha.twizzle.net") {
|
|
5175
|
+
this.fallback();
|
|
5153
5176
|
return;
|
|
5154
5177
|
}
|
|
5155
5178
|
if (["/edit/", "/explore/"].includes(pathname)) {
|
|
@@ -5172,6 +5195,8 @@ var TwizzleLink = class extends ManagedCustomElement {
|
|
|
5172
5195
|
this.addHeading("Moves");
|
|
5173
5196
|
const twistyAlgViewer = this.addElement(new TwistyAlgViewer({ twistyPlayer: this.twistyPlayer }));
|
|
5174
5197
|
twistyAlgViewer.part.add("twisty-alg-viewer");
|
|
5198
|
+
} else {
|
|
5199
|
+
this.fallback();
|
|
5175
5200
|
}
|
|
5176
5201
|
}
|
|
5177
5202
|
addHeading(text) {
|
|
@@ -5180,6 +5205,7 @@ var TwizzleLink = class extends ManagedCustomElement {
|
|
|
5180
5205
|
headingDiv.textContent = text;
|
|
5181
5206
|
}
|
|
5182
5207
|
};
|
|
5208
|
+
_cssElem = new WeakMap();
|
|
5183
5209
|
customElementsShim.define("twizzle-link", TwizzleLink);
|
|
5184
5210
|
export {
|
|
5185
5211
|
NO_VALUE as EXPERIMENTAL_PROP_NO_VALUE,
|