cubing 0.35.18 → 0.36.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 (85) hide show
  1. package/dist/esm/alg/index.js +1 -1
  2. package/dist/esm/bluetooth/index.js +53 -5
  3. package/dist/esm/bluetooth/index.js.map +2 -2
  4. package/dist/esm/{chunk-Z6WT2ASL.js → chunk-6OUID4YZ.js} +6 -3
  5. package/dist/esm/{chunk-Z6WT2ASL.js.map → chunk-6OUID4YZ.js.map} +1 -1
  6. package/dist/esm/{chunk-YU62MHVH.js → chunk-7C5DKKWG.js} +35 -3
  7. package/dist/esm/chunk-7C5DKKWG.js.map +7 -0
  8. package/dist/esm/{chunk-TZLV35JV.js → chunk-7LQBLROH.js} +11 -7
  9. package/dist/esm/chunk-7LQBLROH.js.map +7 -0
  10. package/dist/esm/{chunk-UDX76B24.js → chunk-BI4IALY5.js} +99 -6
  11. package/dist/esm/{chunk-UDX76B24.js.map → chunk-BI4IALY5.js.map} +1 -1
  12. package/dist/esm/{chunk-HVZKPYTG.js → chunk-CFNRQVBC.js} +186 -2
  13. package/dist/esm/chunk-CFNRQVBC.js.map +7 -0
  14. package/dist/esm/{chunk-JVS2MAXS.js → chunk-EXWFZEJA.js} +6 -3
  15. package/dist/esm/{chunk-JVS2MAXS.js.map → chunk-EXWFZEJA.js.map} +1 -1
  16. package/dist/esm/{chunk-AA7SSE6X.js → chunk-IBLLQ5L6.js} +2 -2
  17. package/dist/esm/{chunk-AA7SSE6X.js.map → chunk-IBLLQ5L6.js.map} +1 -1
  18. package/dist/esm/{chunk-6KPOQHQA.js → chunk-LCARNWZG.js} +23 -16
  19. package/dist/esm/chunk-LCARNWZG.js.map +7 -0
  20. package/dist/esm/{chunk-LFMH7YXT.js → chunk-OZ7BVDDY.js} +32 -3
  21. package/dist/esm/{chunk-LFMH7YXT.js.map → chunk-OZ7BVDDY.js.map} +2 -2
  22. package/dist/esm/{chunk-FVWUXED6.js → chunk-RCFH7AT2.js} +3 -3
  23. package/dist/esm/{chunk-FVWUXED6.js.map → chunk-RCFH7AT2.js.map} +1 -1
  24. package/dist/esm/{chunk-6FGST3DR.js → chunk-TF2GO5ZC.js} +43 -14
  25. package/dist/esm/chunk-TF2GO5ZC.js.map +7 -0
  26. package/dist/esm/{chunk-LZTD2XRZ.js → chunk-UOAT7IN5.js} +16 -2
  27. package/dist/esm/{chunk-LZTD2XRZ.js.map → chunk-UOAT7IN5.js.map} +1 -1
  28. package/dist/esm/{chunk-EV25IJFC.js → chunk-ZYCJIZDN.js} +2 -1
  29. package/dist/esm/{chunk-EV25IJFC.js.map → chunk-ZYCJIZDN.js.map} +1 -1
  30. package/dist/esm/kpuzzle/index.js +2 -2
  31. package/dist/esm/notation/index.js +4 -4
  32. package/dist/esm/protocol/index.js +4 -4
  33. package/dist/esm/puzzle-geometry/index.js +116 -1
  34. package/dist/esm/puzzle-geometry/index.js.map +2 -2
  35. package/dist/esm/puzzles/index.js +4 -4
  36. package/dist/esm/{puzzles-dynamic-side-events-TEAE45HA.js → puzzles-dynamic-side-events-SRPR4BEO.js} +8 -1
  37. package/dist/esm/{puzzles-dynamic-side-events-TEAE45HA.js.map → puzzles-dynamic-side-events-SRPR4BEO.js.map} +1 -1
  38. package/dist/esm/scramble/index.js +9 -9
  39. package/dist/esm/search/index.js +9 -9
  40. package/dist/esm/{search-dynamic-sgs-side-events-T2RBUDFD.js → search-dynamic-sgs-side-events-QD7TLXPV.js} +6 -6
  41. package/dist/esm/search-dynamic-sgs-side-events-QD7TLXPV.js.map +7 -0
  42. package/dist/esm/{search-dynamic-sgs-unofficial-TJXF7BKM.js → search-dynamic-sgs-unofficial-UEIZW7YS.js} +6 -6
  43. package/dist/esm/search-dynamic-sgs-unofficial-UEIZW7YS.js.map +7 -0
  44. package/dist/esm/{search-dynamic-solve-3x3x3-VY7R3CDP.js → search-dynamic-solve-3x3x3-FJI2OWOW.js} +1 -1
  45. package/dist/esm/{search-dynamic-solve-3x3x3-VY7R3CDP.js.map → search-dynamic-solve-3x3x3-FJI2OWOW.js.map} +1 -1
  46. package/dist/esm/{search-dynamic-solve-4x4x4-I77ZF4Z5.js → search-dynamic-solve-4x4x4-USNQSEDX.js} +6 -6
  47. package/dist/esm/{search-dynamic-solve-4x4x4-I77ZF4Z5.js.map → search-dynamic-solve-4x4x4-USNQSEDX.js.map} +1 -1
  48. package/dist/esm/{search-dynamic-solve-fto-JJ32OJVM.js → search-dynamic-solve-fto-IDE3JR5R.js} +36 -1
  49. package/dist/esm/{search-dynamic-solve-fto-JJ32OJVM.js.map → search-dynamic-solve-fto-IDE3JR5R.js.map} +1 -1
  50. package/dist/esm/{search-dynamic-solve-kilominx-F22YIQDX.js → search-dynamic-solve-kilominx-DUXFWYAF.js} +2 -2
  51. package/dist/esm/{search-dynamic-solve-kilominx-F22YIQDX.js.map → search-dynamic-solve-kilominx-DUXFWYAF.js.map} +1 -1
  52. package/dist/esm/{search-dynamic-solve-master_tetraminx-UF5FKJW6.js → search-dynamic-solve-master_tetraminx-N2NAFS2P.js} +2 -1
  53. package/dist/esm/{search-dynamic-solve-master_tetraminx-UF5FKJW6.js.map → search-dynamic-solve-master_tetraminx-N2NAFS2P.js.map} +1 -1
  54. package/dist/esm/{search-dynamic-solve-sq1-S6V3FTO2.js → search-dynamic-solve-sq1-OKRDTBN4.js} +1 -1
  55. package/dist/esm/{search-dynamic-solve-sq1-S6V3FTO2.js.map → search-dynamic-solve-sq1-OKRDTBN4.js.map} +1 -1
  56. package/dist/esm/{search-worker-inside-generated-string-2SRY6LLB.js → search-worker-inside-generated-string-BOLAH6BY.js} +45 -36
  57. package/dist/esm/search-worker-inside-generated-string-BOLAH6BY.js.map +7 -0
  58. package/dist/esm/search-worker-js-entry-XBNFXQ5S.js +17 -0
  59. package/dist/esm/{search-worker-ts-entry-D3F64FG2.js → search-worker-ts-entry-ERCMEK5N.js} +4 -4
  60. package/dist/esm/{search-worker-ts-entry-D3F64FG2.js.map → search-worker-ts-entry-ERCMEK5N.js.map} +1 -1
  61. package/dist/esm/stream/index.js +1 -1
  62. package/dist/esm/twisty/index.js +179 -34
  63. package/dist/esm/twisty/index.js.map +3 -3
  64. package/dist/esm/{twisty-dynamic-3d-2TN37YPE.js → twisty-dynamic-3d-GJKWHMDR.js} +40 -6
  65. package/dist/esm/twisty-dynamic-3d-GJKWHMDR.js.map +7 -0
  66. package/dist/esm/{twsearch-BDAXZGZU-WI6J7JNA.js → twsearch-BDAXZGZU-4Y6SSRS3.js} +1 -1
  67. package/dist/esm/{twsearch-BDAXZGZU-WI6J7JNA.js.map → twsearch-BDAXZGZU-4Y6SSRS3.js.map} +1 -1
  68. package/dist/esm/{twsearch-DGXZZNDD.js → twsearch-GXY4U67H.js} +3 -3
  69. package/dist/esm/{twsearch-DGXZZNDD.js.map → twsearch-GXY4U67H.js.map} +1 -1
  70. package/dist/types/{TwizzleLink-9f92123d.d.ts → TwizzleLink-f8f2c814.d.ts} +17 -17
  71. package/dist/types/notation/index.d.ts +1 -1
  72. package/dist/types/puzzles/index.d.ts +2 -2
  73. package/dist/types/twisty/index.d.ts +2 -2
  74. package/package.json +17 -17
  75. package/dist/esm/chunk-6FGST3DR.js.map +0 -7
  76. package/dist/esm/chunk-6KPOQHQA.js.map +0 -7
  77. package/dist/esm/chunk-HVZKPYTG.js.map +0 -7
  78. package/dist/esm/chunk-TZLV35JV.js.map +0 -7
  79. package/dist/esm/chunk-YU62MHVH.js.map +0 -7
  80. package/dist/esm/search-dynamic-sgs-side-events-T2RBUDFD.js.map +0 -7
  81. package/dist/esm/search-dynamic-sgs-unofficial-TJXF7BKM.js.map +0 -7
  82. package/dist/esm/search-worker-inside-generated-string-2SRY6LLB.js.map +0 -7
  83. package/dist/esm/search-worker-js-entry-CLLXI4HB.js +0 -17
  84. package/dist/esm/twisty-dynamic-3d-2TN37YPE.js.map +0 -7
  85. /package/dist/esm/{search-worker-js-entry-CLLXI4HB.js.map → search-worker-js-entry-XBNFXQ5S.js.map} +0 -0
@@ -18,7 +18,7 @@ import {
18
18
  functionFromTraversal,
19
19
  keyToMove,
20
20
  setAlgDebug
21
- } from "../chunk-HVZKPYTG.js";
21
+ } from "../chunk-CFNRQVBC.js";
22
22
  export {
23
23
  Alg,
24
24
  AlgBuilder,
@@ -1,23 +1,23 @@
1
1
  import {
2
2
  binaryComponentsToReid3x3x3,
3
3
  twizzleBinaryToBinaryComponents
4
- } from "../chunk-FVWUXED6.js";
4
+ } from "../chunk-RCFH7AT2.js";
5
5
  import {
6
6
  cube3x3x3,
7
7
  puzzles
8
- } from "../chunk-6FGST3DR.js";
8
+ } from "../chunk-TF2GO5ZC.js";
9
9
  import {
10
10
  experimental3x3x3KPuzzle
11
- } from "../chunk-YU62MHVH.js";
11
+ } from "../chunk-7C5DKKWG.js";
12
12
  import {
13
13
  KState
14
- } from "../chunk-LZTD2XRZ.js";
14
+ } from "../chunk-UOAT7IN5.js";
15
15
  import {
16
16
  Alg,
17
17
  Move,
18
18
  experimentalAppendMove,
19
19
  keyToMove
20
- } from "../chunk-HVZKPYTG.js";
20
+ } from "../chunk-CFNRQVBC.js";
21
21
 
22
22
  // src/cubing/bluetooth/debug.ts
23
23
  var DEBUG_LOGGING_ENABLED = false;
@@ -64,6 +64,7 @@ var m = {
64
64
  "-x z": new Quaternion(0, 0, s2, s2)
65
65
  };
66
66
  var BasicRotationTransformer = class {
67
+ // private reorientQuat = new Quaternion();
67
68
  transformAlgLeaf(_algLeafEvent) {
68
69
  }
69
70
  transformOrientation(orientationEvent) {
@@ -89,8 +90,11 @@ var BluetoothPuzzle = class extends EventTarget {
89
90
  super(...arguments);
90
91
  this.transformers = [];
91
92
  this.listeners = [];
93
+ // TODO: type
92
94
  this.orientationListeners = [];
93
95
  }
96
+ // TODO: Can we make this reutrn (async) on success?
97
+ // TODO: require subclasses to implement this?
94
98
  async getState() {
95
99
  throw new Error("cannot get state");
96
100
  }
@@ -130,6 +134,7 @@ var BluetoothPuzzle = class extends EventTarget {
130
134
 
131
135
  // src/cubing/bluetooth/keyboard.ts
132
136
  var KeyboardPuzzle = class extends BluetoothPuzzle {
137
+ // TODO: Decide on the right arguments.
133
138
  constructor(target) {
134
139
  super();
135
140
  this.target = target;
@@ -376,12 +381,16 @@ var PhysicalState = class {
376
381
  }
377
382
  return quat.clone().multiply(homeQuatInverse.clone());
378
383
  }
384
+ // Loops from 255 to 0.
379
385
  moveCounter() {
380
386
  return this.arr[12];
381
387
  }
382
388
  numMovesSince(previousMoveCounter) {
383
389
  return this.moveCounter() - previousMoveCounter & 255;
384
390
  }
391
+ // Due to the design of the Gan356i protocol, it's common to query for the
392
+ // latest physical state and find 0 moves have been performed since the last
393
+ // query. Therefore, it's useful to allow 0 as an argument.
385
394
  latestMoves(n) {
386
395
  if (n < 0 || n > MAX_LATEST_MOVES) {
387
396
  throw new Error(`Must ask for 0 to 6 latest moves. (Asked for ${n})`);
@@ -514,6 +523,7 @@ var GanCube = class extends BluetoothPuzzle {
514
523
  this.state = kpuzzle.startState();
515
524
  this.startTrackingMoves();
516
525
  }
526
+ // We have to perform async operations before we call the constructor.
517
527
  static async connect(server) {
518
528
  const ganCubeService = await server.getPrimaryService(UUIDs.ganCubeService);
519
529
  debugLog("Service:", ganCubeService);
@@ -553,6 +563,7 @@ var GanCube = class extends BluetoothPuzzle {
553
563
  clearInterval(this.intervalHandle);
554
564
  this.intervalHandle = null;
555
565
  }
566
+ // TODO: Can we ever receive async responses out of order?
556
567
  async intervalHandler() {
557
568
  const physicalState = await PhysicalState.read(
558
569
  this.physicalStateCharacteristic,
@@ -572,6 +583,7 @@ var GanCube = class extends BluetoothPuzzle {
572
583
  timeStamp: physicalState.timeStamp,
573
584
  debug: physicalState.debugInfo(),
574
585
  state: this.state
586
+ // quaternion: physicalState.rotQuat(),
575
587
  });
576
588
  }
577
589
  this.dispatchOrientation({
@@ -652,6 +664,11 @@ var GanCube = class extends BluetoothPuzzle {
652
664
  const actualAngleAndBatteryCharacteristic = await this.actualAngleAndBatteryCharacteristic();
653
665
  return (await actualAngleAndBatteryCharacteristic.readValue()).buffer;
654
666
  }
667
+ // TODO
668
+ // private onphysicalStateCharacteristicChanged(event: any): void {
669
+ // var val = event.target.value;
670
+ // debugLog(val);
671
+ // }
655
672
  };
656
673
  var ganConfig = {
657
674
  connect: GanCube.connect.bind(GanCube),
@@ -882,14 +899,21 @@ var GiiKERCube = class extends BluetoothPuzzle {
882
899
  var giiKERConfig = {
883
900
  connect: GiiKERCube.connect.bind(GiiKERCube),
884
901
  prefixes: ["Gi", ""],
902
+ // Hack
885
903
  filters: [
904
+ // Known prefixes: GiC, GiS (3x3x3), Gi2 (2x2x2)
905
+ // Suspected prefixes GiY, Gi3
886
906
  { namePrefix: "Gi" },
887
907
  { services: ["0000aadb-0000-1000-8000-00805f9b34fb"] },
888
908
  { services: ["0000aaaa-0000-1000-8000-00805f9b34fb"] },
889
909
  { services: ["0000fe95-0000-1000-8000-00805f9b34fb"] }
890
910
  ],
891
911
  optionalServices: [
912
+ // "00001530-1212-efde-1523-785feabcd123",
913
+ // "0000aaaa-0000-1000-8000-00805f9b34fb",
892
914
  UUIDs2.cubeService
915
+ // "0000180f-0000-1000-8000-00805f9b34fb",
916
+ // "0000180a-0000-1000-8000-00805f9b34fb"
893
917
  ]
894
918
  };
895
919
 
@@ -932,6 +956,14 @@ var GoCube = class extends BluetoothPuzzle {
932
956
  super();
933
957
  this.server = server;
934
958
  this.goCubeStateCharacteristic = goCubeStateCharacteristic;
959
+ // public async getState(): Promise<PuzzleState> {
960
+ // return new Promise((resolve, reject) => {
961
+ // this.resolve = (value: any) => {
962
+ // resolve(buf2hex(value.buffer) as any);
963
+ // };
964
+ // this.goCubeStateCharacteristic.startNotifications();
965
+ // });
966
+ // }
935
967
  this.recorded = [];
936
968
  this.homeQuatInverse = null;
937
969
  this.lastRawQuat = new Quaternion3(0, 0, 0, 1);
@@ -939,6 +971,7 @@ var GoCube = class extends BluetoothPuzzle {
939
971
  this.lastTarget = new Quaternion3(0, 0, 0, 1);
940
972
  this.alg = new Alg();
941
973
  }
974
+ // We have to perform async operations before we call the constructor.
942
975
  static async connect(server) {
943
976
  const service = await server.getPrimaryService(UUIDs3.goCubeService);
944
977
  debugLog({ service });
@@ -1044,6 +1077,7 @@ var HeykubeCube = class extends BluetoothPuzzle {
1044
1077
  this.stateCharacteristic.startNotifications();
1045
1078
  this.startTrackingMoves();
1046
1079
  }
1080
+ // We have to perform async operations before we call the constructor.
1047
1081
  static async connect(server, device) {
1048
1082
  const service = await server.getPrimaryService(UUIDs4.heykubeService);
1049
1083
  debugLog("Service:", service);
@@ -1075,6 +1109,12 @@ var HeykubeCube = class extends BluetoothPuzzle {
1075
1109
  (e) => this.onStateCharacteristic(e)
1076
1110
  );
1077
1111
  }
1112
+ // public stopTrackingMoves(): void {}
1113
+ // public async getBattery(): Promise<number> {
1114
+ // return new Uint8Array(
1115
+ // await this.readActualAngleAndBatteryCharacteristic(),
1116
+ // )[7];
1117
+ // }srcElement: BluetoothRemoteGATTCharacteristic
1078
1118
  onStateCharacteristic(event) {
1079
1119
  const state = this.decodeState(event.target.value);
1080
1120
  this.dispatchAlgLeaf({
@@ -1099,6 +1139,8 @@ var HeykubeCube = class extends BluetoothPuzzle {
1099
1139
  new Move("D'"),
1100
1140
  new Move("R"),
1101
1141
  new Move("R'")
1142
+ // null,
1143
+ // null,
1102
1144
  ];
1103
1145
  const b2 = new Uint8Array(dv.byteLength);
1104
1146
  for (let i = 0; i < dv.byteLength; i++) {
@@ -1115,6 +1157,7 @@ var HeykubeCube = class extends BluetoothPuzzle {
1115
1157
  poIdxL: 0,
1116
1158
  poIdxU: 7,
1117
1159
  moSupport: 1,
1160
+ // TODO
1118
1161
  moMask: 0
1119
1162
  };
1120
1163
  return {
@@ -1140,6 +1183,7 @@ var smartPuzzleConfigs = [
1140
1183
  goCubeConfig,
1141
1184
  heykubeConfig,
1142
1185
  giiKERConfig
1186
+ // GiiKER must be last, due to Xiaomi naming. TODO: enforce this using tests.
1143
1187
  ];
1144
1188
  async function connectSmartPuzzle(options) {
1145
1189
  return bluetoothConnect(smartPuzzleConfigs, options);
@@ -1230,6 +1274,7 @@ var GanRobot = class extends EventTarget {
1230
1274
  this.experimentalDebugOnSend = null;
1231
1275
  this.experimentalDebugLog = () => {
1232
1276
  };
1277
+ // Because our Bluetooth connection code is set up not to know what kind of device is connecting, we put these options directly on the class.
1233
1278
  this.experimentalOptions = {
1234
1279
  xAngle: false,
1235
1280
  singleMoveFixHack: false,
@@ -1243,6 +1288,7 @@ var GanRobot = class extends EventTarget {
1243
1288
  this.onDisconnect.bind(this)
1244
1289
  );
1245
1290
  }
1291
+ // We have to perform async operations before we call the constructor.
1246
1292
  static async connect(server, device) {
1247
1293
  const ganTimerService = await server.getPrimaryService(
1248
1294
  UUIDs5.ganRobotService
@@ -1321,6 +1367,7 @@ var GanRobot = class extends EventTarget {
1321
1367
  }
1322
1368
  processQueue() {
1323
1369
  }
1370
+ // TODO: Don't let this resolve until the move is done?
1324
1371
  async queueMoves(moves) {
1325
1372
  this.moveQueue = this.moveQueue.concat(moves).experimentalSimplify({
1326
1373
  puzzleSpecificSimplifyOptions: cube3x3x3.puzzleSpecificSimplifyOptions
@@ -1419,6 +1466,7 @@ var GanTimer = class extends EventTarget {
1419
1466
  this.onDisconnect.bind(this)
1420
1467
  );
1421
1468
  }
1469
+ // We have to perform async operations before we call the constructor.
1422
1470
  static async connect(server, device) {
1423
1471
  const ganTimerService = await server.getPrimaryService(
1424
1472
  UUIDs6.ganTimerService