@houstonp/rubiks-cube 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +258 -54
  2. package/package.json +6 -6
  3. package/src/{cameraState.js → camera/cameraState.js} +3 -3
  4. package/src/core.js +387 -67
  5. package/src/cube/animationSlice.js +205 -0
  6. package/src/cube/animationState.js +96 -0
  7. package/src/cube/cubeSettings.js +6 -5
  8. package/src/cube/cubeState.js +284 -139
  9. package/src/cube/stickerState.js +188 -0
  10. package/src/debouncer.js +1 -1
  11. package/src/index.js +153 -28
  12. package/src/settings.js +20 -8
  13. package/src/three/centerPiece.js +44 -0
  14. package/src/three/cornerPiece.js +60 -0
  15. package/src/three/cube.js +492 -0
  16. package/src/three/edgePiece.js +50 -0
  17. package/src/three/sticker.js +37 -0
  18. package/tests/common.js +27 -0
  19. package/tests/cube.five.test.js +126 -0
  20. package/tests/cube.four.test.js +126 -0
  21. package/tests/cube.seven.test.js +126 -0
  22. package/tests/cube.six.test.js +126 -0
  23. package/tests/cube.three.test.js +151 -0
  24. package/tests/cube.two.test.js +125 -0
  25. package/tests/setup.js +36 -0
  26. package/types/{cameraState.d.ts → camera/cameraState.d.ts} +4 -4
  27. package/types/core.d.ts +396 -67
  28. package/types/cube/animationSlice.d.ts +26 -0
  29. package/types/cube/animationState.d.ts +41 -0
  30. package/types/cube/cubeSettings.d.ts +7 -7
  31. package/types/cube/cubeState.d.ts +38 -7
  32. package/types/cube/stickerState.d.ts +21 -0
  33. package/types/index.d.ts +23 -1
  34. package/types/settings.d.ts +8 -4
  35. package/types/three/centerPiece.d.ts +15 -0
  36. package/types/three/cornerPiece.d.ts +24 -0
  37. package/types/three/cube.d.ts +130 -0
  38. package/types/three/edgePiece.d.ts +16 -0
  39. package/types/three/sticker.d.ts +15 -0
  40. package/src/cube/cube.js +0 -324
  41. package/src/cube/cubeRotation.js +0 -79
  42. package/src/cube/slice.js +0 -143
  43. package/src/schema.js +0 -22
  44. package/src/threejs/materials.js +0 -54
  45. package/src/threejs/pieces.js +0 -100
  46. package/src/threejs/stickers.js +0 -40
  47. package/types/cube/cube.d.ts +0 -102
  48. package/types/cube/cubeRotation.d.ts +0 -33
  49. package/types/cube/slice.d.ts +0 -15
  50. package/types/schema.d.ts +0 -11
  51. package/types/threejs/materials.d.ts +0 -21
  52. package/types/threejs/pieces.d.ts +0 -28
  53. package/types/threejs/stickers.d.ts +0 -6
package/types/core.d.ts CHANGED
@@ -1,52 +1,361 @@
1
1
  /**
2
- * @typedef {typeof Movements[keyof typeof Movements]} Movement
2
+ * @typedef {typeof Movements.Single[keyof typeof Movements.Single]} SingleMove
3
+ * @typedef {typeof Movements.Wide[keyof typeof Movements.Wide]} WideMove
4
+ * @typedef {typeof Movements.Two[keyof typeof Movements.Two]} TwoMove
5
+ * @typedef {typeof Movements.Three[keyof typeof Movements.Three]} ThreeMove
6
+ * @typedef {typeof Movements.Four[keyof typeof Movements.Four]} FourMove
7
+ * @typedef {typeof Movements.Five[keyof typeof Movements.Five]} FiveMove
8
+ * @typedef {typeof Movements.Six[keyof typeof Movements.Six]} SixMove
9
+ * @typedef {SingleMove | WideMove | TwoMove | ThreeMove | FourMove | FiveMove | SixMove} Movement
3
10
  */
4
11
  export const Movements: Readonly<{
5
- R: "R";
6
- R2: "R2";
7
- RP: "R'";
8
- L: "L";
9
- L2: "L2";
10
- LP: "L'";
11
- U: "U";
12
- U2: "U2";
13
- UP: "U'";
14
- D: "D";
15
- D2: "D2";
16
- DP: "D'";
17
- F: "F";
18
- F2: "F2";
19
- FP: "F'";
20
- B: "B";
21
- B2: "B2";
22
- BP: "B'";
23
- r: "r";
24
- r2: "r2";
25
- rP: "r'";
26
- l: "l";
27
- l2: "l2";
28
- lP: "l'";
29
- u: "u";
30
- u2: "u2";
31
- uP: "u'";
32
- d: "d";
33
- d2: "d2";
34
- dP: "d'";
35
- f: "f";
36
- f2: "f2";
37
- fP: "f'";
38
- b: "b";
39
- b2: "b2";
40
- bP: "b'";
41
- M: "M";
42
- M2: "M2";
43
- MP: "M'";
44
- E: "E";
45
- E2: "E2";
46
- EP: "E'";
47
- S: "S";
48
- S2: "S2";
49
- SP: "S'";
12
+ Single: Readonly<{
13
+ R: "R";
14
+ R2: "R2";
15
+ RP: "R'";
16
+ L: "L";
17
+ L2: "L2";
18
+ LP: "L'";
19
+ U: "U";
20
+ U2: "U2";
21
+ UP: "U'";
22
+ D: "D";
23
+ D2: "D2";
24
+ DP: "D'";
25
+ F: "F";
26
+ F2: "F2";
27
+ FP: "F'";
28
+ B: "B";
29
+ B2: "B2";
30
+ BP: "B'";
31
+ M: "M";
32
+ M2: "M2";
33
+ MP: "M'";
34
+ E: "E";
35
+ E2: "E2";
36
+ EP: "E'";
37
+ S: "S";
38
+ S2: "S2";
39
+ SP: "S'";
40
+ }>;
41
+ Wide: Readonly<{
42
+ Rw: "Rw";
43
+ Rw2: "Rw2";
44
+ RwP: "Rw'";
45
+ r: "r";
46
+ r2: "r2";
47
+ rP: "r'";
48
+ Lw: "Lw";
49
+ Lw2: "Lw2";
50
+ LwP: "Lw'";
51
+ l: "l";
52
+ l2: "l2";
53
+ lP: "l'";
54
+ Fw: "Fw";
55
+ Fw2: "Fw2";
56
+ FwP: "Fw'";
57
+ f: "f";
58
+ f2: "f2";
59
+ fP: "f'";
60
+ Bw: "Bw";
61
+ Bw2: "Bw2";
62
+ BwP: "Bw'";
63
+ b: "b";
64
+ b2: "b2";
65
+ bP: "b'";
66
+ Uw: "Uw";
67
+ Uw2: "Uw2";
68
+ UwP: "Uw'";
69
+ u: "u";
70
+ u2: "u2";
71
+ uP: "u'";
72
+ Dw: "Dw";
73
+ Dw2: "D2";
74
+ DwP: "Dw'";
75
+ d: "d";
76
+ d2: "d2";
77
+ dP: "d'";
78
+ }>;
79
+ Two: Readonly<{
80
+ Rw: "2Rw";
81
+ Rw2: "2Rw2";
82
+ RwP: "2Rw'";
83
+ r: "2r";
84
+ r2: "2r2";
85
+ rP: "2r'";
86
+ R: "2R";
87
+ R2: "2R2";
88
+ RP: "2R'";
89
+ Lw: "2Lw";
90
+ Lw2: "2Lw2";
91
+ LwP: "2Lw'";
92
+ l: "2l";
93
+ l2: "2l2";
94
+ lP: "2l'";
95
+ L: "2L";
96
+ L2: "2L2";
97
+ LP: "2L'";
98
+ Fw: "2Fw";
99
+ Fw2: "2Fw2";
100
+ FwP: "2Fw'";
101
+ f: "2f";
102
+ f2: "2f2";
103
+ fP: "2f'";
104
+ F: "2F";
105
+ F2: "2F2";
106
+ FP: "2F'";
107
+ Bw: "2Bw";
108
+ Bw2: "2Bw2";
109
+ BwP: "2Bw'";
110
+ b: "2b";
111
+ b2: "2b2";
112
+ bP: "2b'";
113
+ B: "2B";
114
+ B2: "2B2";
115
+ BP: "2B'";
116
+ Uw: "2Uw";
117
+ Uw2: "2Uw2";
118
+ UwP: "2Uw'";
119
+ u: "2u";
120
+ u2: "2u2";
121
+ uP: "2u'";
122
+ U: "2U";
123
+ U2: "2U2";
124
+ UP: "2U'";
125
+ Dw: "2Dw";
126
+ Dw2: "2Dw2";
127
+ DwP: "2Dw'";
128
+ d: "2d";
129
+ d2: "2d2";
130
+ dP: "2d'";
131
+ D: "2D";
132
+ D2: "2D2";
133
+ DP: "2D'";
134
+ }>;
135
+ Three: Readonly<{
136
+ Rw: "3Rw";
137
+ Rw2: "3Rw2";
138
+ RwP: "3Rw'";
139
+ r: "3r";
140
+ r2: "3r2";
141
+ rP: "3r'";
142
+ R: "3R";
143
+ R2: "3R2";
144
+ RP: "3R'";
145
+ Lw: "3Lw";
146
+ Lw2: "3Lw2";
147
+ LwP: "3Lw'";
148
+ l: "3l";
149
+ l2: "3l2";
150
+ lP: "3l'";
151
+ L: "3L";
152
+ L2: "3L2";
153
+ LP: "3L'";
154
+ Fw: "3Fw";
155
+ Fw2: "3Fw2";
156
+ FwP: "3Fw'";
157
+ f: "3f";
158
+ f2: "3f2";
159
+ fP: "3f'";
160
+ F: "3F";
161
+ F2: "3F2";
162
+ FP: "3F'";
163
+ Bw: "3Bw";
164
+ Bw2: "3Bw2";
165
+ BwP: "3Bw'";
166
+ b: "3b";
167
+ b2: "3b2";
168
+ bP: "3b'";
169
+ B: "3B";
170
+ B2: "3B2";
171
+ BP: "3B'";
172
+ Uw: "3Uw";
173
+ Uw2: "3Uw2";
174
+ UwP: "3Uw'";
175
+ u: "3u";
176
+ u2: "3u2";
177
+ uP: "3u'";
178
+ U: "3U";
179
+ U2: "3U2";
180
+ UP: "3U'";
181
+ Dw: "3Dw";
182
+ Dw2: "3Dw2";
183
+ DwP: "3Dw'";
184
+ d: "3d";
185
+ d2: "3d2";
186
+ dP: "3d'";
187
+ D: "3D";
188
+ D2: "3D2";
189
+ DP: "3D'";
190
+ }>;
191
+ Four: Readonly<{
192
+ Rw: "4Rw";
193
+ Rw2: "4Rw2";
194
+ RwP: "4Rw'";
195
+ r: "4r";
196
+ r2: "4r2";
197
+ rP: "4r'";
198
+ R: "4R";
199
+ R2: "4R2";
200
+ RP: "4R'";
201
+ Lw: "4Lw";
202
+ Lw2: "4Lw2";
203
+ LwP: "4Lw'";
204
+ l: "4l";
205
+ l2: "4l2";
206
+ lP: "4l'";
207
+ L: "4L";
208
+ L2: "4L2";
209
+ LP: "4L'";
210
+ Fw: "4Fw";
211
+ Fw2: "4Fw2";
212
+ FwP: "4Fw'";
213
+ f: "4f";
214
+ f2: "4f2";
215
+ fP: "4f'";
216
+ F: "4F";
217
+ F2: "4F2";
218
+ FP: "4F'";
219
+ Bw: "4Bw";
220
+ Bw2: "4Bw2";
221
+ BwP: "4Bw'";
222
+ b: "4b";
223
+ b2: "4b2";
224
+ bP: "4b'";
225
+ B: "4B";
226
+ B2: "4B2";
227
+ BP: "4B'";
228
+ Uw: "4Uw";
229
+ Uw2: "4Uw2";
230
+ UwP: "4Uw'";
231
+ u: "4u";
232
+ u2: "4u2";
233
+ uP: "4u'";
234
+ U: "4U";
235
+ U2: "4U2";
236
+ UP: "4U'";
237
+ Dw: "4Dw";
238
+ Dw2: "4Dw2";
239
+ DwP: "4Dw'";
240
+ d: "4d";
241
+ d2: "4d2";
242
+ dP: "4d'";
243
+ D: "4D";
244
+ D2: "4D2";
245
+ DP: "4D'";
246
+ }>;
247
+ Five: Readonly<{
248
+ Rw: "5Rw";
249
+ Rw2: "5Rw2";
250
+ RwP: "5Rw'";
251
+ r: "5r";
252
+ r2: "5r2";
253
+ rP: "5r'";
254
+ R: "5R";
255
+ R2: "5R2";
256
+ RP: "5R'";
257
+ Lw: "5Lw";
258
+ Lw2: "5Lw2";
259
+ LwP: "5Lw'";
260
+ l: "5l";
261
+ l2: "5l2";
262
+ lP: "5l'";
263
+ L: "5L";
264
+ L2: "5L2";
265
+ LP: "5L'";
266
+ Fw: "5Fw";
267
+ Fw2: "5Fw2";
268
+ FwP: "5Fw'";
269
+ f: "5f";
270
+ f2: "5f2";
271
+ fP: "5f'";
272
+ F: "5F";
273
+ F2: "5F2";
274
+ FP: "5F'";
275
+ Bw: "5Bw";
276
+ Bw2: "5Bw2";
277
+ BwP: "5Bw'";
278
+ b: "5b";
279
+ b2: "5b2";
280
+ bP: "5b'";
281
+ B: "5B";
282
+ B2: "5B2";
283
+ BP: "5B'";
284
+ Uw: "5Uw";
285
+ Uw2: "5Uw2";
286
+ UwP: "5Uw'";
287
+ u: "5u";
288
+ u2: "5u2";
289
+ uP: "5u'";
290
+ U: "5U";
291
+ U2: "5U2";
292
+ UP: "5U'";
293
+ Dw: "5Dw";
294
+ Dw2: "5Dw2";
295
+ DwP: "5Dw'";
296
+ d: "5d";
297
+ d2: "5d2";
298
+ dP: "5d'";
299
+ D: "5D";
300
+ D2: "5D2";
301
+ DP: "5D'";
302
+ }>;
303
+ Six: Readonly<{
304
+ Rw: "6Rw";
305
+ Rw2: "6Rw2";
306
+ RwP: "6Rw'";
307
+ r: "6r";
308
+ r2: "6r2";
309
+ rP: "6r'";
310
+ R: "6R";
311
+ R2: "6R2";
312
+ RP: "6R'";
313
+ Lw: "6Lw";
314
+ Lw2: "6Lw2";
315
+ LwP: "6Lw'";
316
+ l: "6l";
317
+ l2: "6l2";
318
+ lP: "6l'";
319
+ L: "6L";
320
+ L2: "6L2";
321
+ LP: "6L'";
322
+ Fw: "6Fw";
323
+ Fw2: "6Fw2";
324
+ FwP: "6Fw'";
325
+ f: "6f";
326
+ f2: "6f2";
327
+ fP: "6f'";
328
+ F: "6F";
329
+ F2: "6F2";
330
+ FP: "6F'";
331
+ Bw: "6Bw";
332
+ Bw2: "6Bw2";
333
+ BwP: "6Bw'";
334
+ b: "6b";
335
+ b2: "6b2";
336
+ bP: "6b'";
337
+ B: "6B";
338
+ B2: "6B2";
339
+ BP: "6B'";
340
+ Uw: "6Uw";
341
+ Uw2: "6Uw2";
342
+ UwP: "6Uw'";
343
+ u: "6u";
344
+ u2: "6u2";
345
+ uP: "6u'";
346
+ U: "6U";
347
+ U2: "6U2";
348
+ UP: "6U'";
349
+ Dw: "6Dw";
350
+ Dw2: "6Dw2";
351
+ DwP: "6Dw'";
352
+ d: "6d";
353
+ d2: "6d2";
354
+ dP: "6d'";
355
+ D: "6D";
356
+ D2: "6D2";
357
+ DP: "6D'";
358
+ }>;
50
359
  }>;
51
360
  /**
52
361
  * @typedef {typeof Rotations[keyof typeof Rotations]} Rotation
@@ -63,34 +372,46 @@ export const Rotations: Readonly<{
63
372
  zP: "z'";
64
373
  }>;
65
374
  /**
66
- * @typedef {typeof Axi[keyof typeof Axi]} Axis
375
+ * @typedef {typeof Faces [keyof typeof Faces]} Face
67
376
  */
68
- export const Axi: Readonly<{
69
- x: "x";
70
- y: "y";
71
- z: "z";
377
+ export const Faces: Readonly<{
378
+ U: "U";
379
+ D: "D";
380
+ L: "L";
381
+ R: "R";
382
+ F: "F";
383
+ B: "B";
72
384
  }>;
73
385
  /**
74
- * @typedef {typeof Faces [keyof typeof Faces]} Face
386
+ * @typedef {typeof CubeTypes [keyof typeof CubeTypes]} CubeType
75
387
  */
76
- export const Faces: Readonly<{
77
- up: "U";
78
- down: "D";
79
- left: "L";
80
- right: "R";
81
- front: "F";
82
- back: "B";
388
+ export const CubeTypes: Readonly<{
389
+ Two: "Two";
390
+ Three: "Three";
391
+ Four: "Four";
392
+ Five: "Five";
393
+ Six: "Six";
394
+ Seven: "Seven";
395
+ }>;
396
+ /**
397
+ * @typedef {typeof AnimationStyles[keyof typeof AnimationStyles]} AnimationStyle
398
+ */
399
+ export const AnimationStyles: Readonly<{
400
+ Exponential: "exponential";
401
+ Next: "next";
402
+ Fixed: "fixed";
403
+ Match: "match";
83
404
  }>;
84
405
  /**
85
406
  * @typedef {typeof FaceColours [keyof typeof FaceColours]} FaceColour
86
407
  */
87
408
  export const FaceColours: Readonly<{
88
- up: "white";
89
- down: "yellow";
90
- left: "orange";
91
- right: "red";
92
- front: "green";
93
- back: "blue";
409
+ U: "white";
410
+ D: "yellow";
411
+ L: "#fc9a05";
412
+ R: "red";
413
+ F: "#2cbf13";
414
+ B: "blue";
94
415
  }>;
95
416
  /**
96
417
  * @typedef {typeof PeekTypes [keyof typeof PeekTypes]} PeekType
@@ -116,10 +437,18 @@ export const PeekStates: Readonly<{
116
437
  LeftUp: "leftUp";
117
438
  LeftDown: "leftDown";
118
439
  }>;
119
- export type Movement = (typeof Movements)[keyof typeof Movements];
440
+ export type SingleMove = (typeof Movements.Single)[keyof typeof Movements.Single];
441
+ export type WideMove = (typeof Movements.Wide)[keyof typeof Movements.Wide];
442
+ export type TwoMove = (typeof Movements.Two)[keyof typeof Movements.Two];
443
+ export type ThreeMove = (typeof Movements.Three)[keyof typeof Movements.Three];
444
+ export type FourMove = (typeof Movements.Four)[keyof typeof Movements.Four];
445
+ export type FiveMove = (typeof Movements.Five)[keyof typeof Movements.Five];
446
+ export type SixMove = (typeof Movements.Six)[keyof typeof Movements.Six];
447
+ export type Movement = SingleMove | WideMove | TwoMove | ThreeMove | FourMove | FiveMove | SixMove;
120
448
  export type Rotation = (typeof Rotations)[keyof typeof Rotations];
121
- export type Axis = (typeof Axi)[keyof typeof Axi];
122
449
  export type Face = (typeof Faces)[keyof typeof Faces];
450
+ export type CubeType = (typeof CubeTypes)[keyof typeof CubeTypes];
451
+ export type AnimationStyle = (typeof AnimationStyles)[keyof typeof AnimationStyles];
123
452
  export type FaceColour = (typeof FaceColours)[keyof typeof FaceColours];
124
453
  export type PeekType = (typeof PeekTypes)[keyof typeof PeekTypes];
125
454
  export type PeekState = (typeof PeekStates)[keyof typeof PeekStates];
@@ -0,0 +1,26 @@
1
+ /** @typedef {{axis: Axis, layers: number[], direction: number}} Slice */
2
+ /**
3
+ * @param {import('../core').Movement } outerBlockMovement
4
+ * @param {import('../core').CubeType} cubeType
5
+ * @param {boolean} prioritiseStandardMovement
6
+ * @returns {Slice | undefined}
7
+ */
8
+ export function GetLayerSlice(outerBlockMovement: import("../core").Movement, cubeType: import("../core").CubeType, prioritiseStandardMovement?: boolean): Slice | undefined;
9
+ /**
10
+ * @param {import("../core").Rotation} rotation
11
+ * @param {import('../core').CubeType} cubeType
12
+ * @returns {Slice | undefined}
13
+ */
14
+ export function GetRotationSlice(rotation: import("../core").Rotation, cubeType: import("../core").CubeType): Slice | undefined;
15
+ /** @typedef {typeof Axi[keyof typeof Axi]} Axis */
16
+ export const Axi: Readonly<{
17
+ x: "x";
18
+ y: "y";
19
+ z: "z";
20
+ }>;
21
+ export type Slice = {
22
+ axis: Axis;
23
+ layers: number[];
24
+ direction: number;
25
+ };
26
+ export type Axis = (typeof Axi)[keyof typeof Axi];
@@ -0,0 +1,41 @@
1
+ /** @typedef {AnimationStatus[keyof AnimationStatus]} AnimationStatusType */
2
+ export const AnimationStatus: Readonly<{
3
+ Pending: "pending";
4
+ Initialised: "initialised";
5
+ InProgress: "inProgress";
6
+ Complete: "complete";
7
+ Disposed: "disposed";
8
+ }>;
9
+ export class AnimationState {
10
+ /**
11
+ * @param {import('./animationSlice').Slice} slice
12
+ * @param {((state: string) => void )} completedCallback
13
+ * @param {((reason: string) => void )} failedCallback
14
+ */
15
+ constructor(slice: import("./animationSlice").Slice, completedCallback: ((state: string) => void), failedCallback: ((reason: string) => void));
16
+ /** @type {((state: string) => void )} */
17
+ completedCallback: ((state: string) => void);
18
+ /** @type {((reason: string) => void )} */
19
+ failedCallback: ((reason: string) => void);
20
+ /** @type {import('./animationSlice').Slice} */
21
+ slice: import("./animationSlice").Slice;
22
+ /** @type {AnimationStatusType} */
23
+ status: AnimationStatusType;
24
+ /** @type {number} */
25
+ timestampMs: number;
26
+ /** @type {number | undefined} */
27
+ _lastUpdatedTimeMs: number | undefined;
28
+ /** @type {number} */
29
+ _rotationPercentage: number;
30
+ initialise(): void;
31
+ /** @param {string} state */
32
+ complete(state: string): void;
33
+ /** @param {string} reason */
34
+ abort(reason: string): void;
35
+ /**
36
+ * @param {number} speedMs
37
+ * @returns {number} rotationIncrement
38
+ */
39
+ update(speedMs: number): number;
40
+ }
41
+ export type AnimationStatusType = "pending" | "initialised" | "inProgress" | "complete" | "disposed";
@@ -1,17 +1,17 @@
1
- /** @typedef {"exponential" | "next" | "fixed" | "match"} AnimationStyle */
2
1
  export default class CubeSettings {
3
2
  /**
4
- *
3
+ * @param {import('../core').CubeType} cubeType
5
4
  * @param {number} pieceGap
6
5
  * @param {number} animationSpeed
7
- * @param {AnimationStyle} animationStyle
6
+ * @param {import('../core').AnimationStyle} animationStyle
8
7
  */
9
- constructor(pieceGap: number, animationSpeed: number, animationStyle: AnimationStyle);
8
+ constructor(pieceGap: number, animationSpeed: number, animationStyle: import("../core").AnimationStyle, cubeType: import("../core").CubeType);
10
9
  /** @type {number} pieceGap */
11
10
  pieceGap: number;
11
+ /** @type {import("../core").CubeType} */
12
+ cubeType: import("../core").CubeType;
12
13
  /** @type {number} pieceGap */
13
14
  animationSpeedMs: number;
14
- /** @type {AnimationStyle} pieceGap */
15
- animationStyle: AnimationStyle;
15
+ /** @type {import('../core').AnimationStyle} pieceGap */
16
+ animationStyle: import("../core").AnimationStyle;
16
17
  }
17
- export type AnimationStyle = "exponential" | "next" | "fixed" | "match";
@@ -1,3 +1,41 @@
1
+ /** @typedef {{cubeType: import('../core').CubeType, layers: number[], pieceSize: number, coreSize: number,initialStickerState: import('./stickerState').StickerState, outerLayerMultiplier: number, corners: state[], edges: state[], centers: state[]}} CubeInfo */
2
+ /**
3
+ * @param {import("../core").CubeType} cubeType
4
+ * @return {CubeInfo}
5
+ */
6
+ export function getCubeInfo(cubeType: import("../core").CubeType): CubeInfo;
7
+ export namespace FaceColors {
8
+ let B: string;
9
+ let D: string;
10
+ let F: string;
11
+ let L: string;
12
+ let R: string;
13
+ let U: string;
14
+ }
15
+ export function ColorToFace(color: import("three").ColorRepresentation): import("../core").Face;
16
+ export function outlerLayerMultiplier(cubeType: import("../core").CubeType): number;
17
+ export function coreSize(cubeType: import("../core").CubeType): number;
18
+ export function getMiddleLayers(cubeType: import("../core").CubeType): number[];
19
+ export function getAllLayers(cubeType: import("../core").CubeType): number[];
20
+ export function pieceSize(cubeType: import("../core").CubeType): number;
21
+ /**
22
+ * @typedef {{position: vector, rotation: vector}} state
23
+ */
24
+ /** @type {state[]} */
25
+ export const corners: state[];
26
+ export function centers(layers: number[]): state[];
27
+ export function edges(layers: number[]): state[];
28
+ export type CubeInfo = {
29
+ cubeType: import("../core").CubeType;
30
+ layers: number[];
31
+ pieceSize: number;
32
+ coreSize: number;
33
+ initialStickerState: import("./stickerState").StickerState;
34
+ outerLayerMultiplier: number;
35
+ corners: state[];
36
+ edges: state[];
37
+ centers: state[];
38
+ };
1
39
  export type vector = {
2
40
  x: number;
3
41
  y: number;
@@ -6,11 +44,4 @@ export type vector = {
6
44
  export type state = {
7
45
  position: vector;
8
46
  rotation: vector;
9
- type: "corner" | "edge" | "center";
10
- group: Group;
11
47
  };
12
- /**
13
- * @return {state[]}
14
- */
15
- export function createCubeState(): state[];
16
- import { Group } from 'three';
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @param {StickerState} stickerState
3
+ * @returns {string}
4
+ */
5
+ export function toKociemba(stickerState: StickerState): string;
6
+ /**
7
+ * @param {string} kociembaString
8
+ * @param {import('../core').CubeType} cubeType
9
+ * @returns {StickerState | undefined} stickerState
10
+ */
11
+ export function fromKociemba(kociembaString: string, cubeType: import("../core").CubeType): StickerState | undefined;
12
+ export function defaultStickerState(cubeType: import("../core").CubeType): StickerState;
13
+ export function getEmptyStickerState(cubeType: import("../core").CubeType): StickerState;
14
+ export type StickerState = {
15
+ up: import("../core").Face[][];
16
+ down: import("../core").Face[][];
17
+ front: import("../core").Face[][];
18
+ back: import("../core").Face[][];
19
+ left: import("../core").Face[][];
20
+ right: import("../core").Face[][];
21
+ };