UNPKG

@vscubing/cubing

Version:

A collection of JavaScript cubing libraries.

157 lines (144 loc) 5.91 kB
import { s as PuzzleID, u as PuzzleLoader, a6 as KeyMapping, K as KPattern, t as Alg, M as Move } from '../PuzzleLoader-lDTuf9C3.js'; import { B as BluetoothPuzzle } from '../bluetooth-puzzle-Dgnw9moX.js'; export { A as MoveEvent, O as OrientationEvent } from '../bluetooth-puzzle-Dgnw9moX.js'; import 'three/src/Three.js'; declare function enableDebugLogging(enable: boolean): void; /** @category Keyboard Puzzles */ declare class KeyboardPuzzle extends BluetoothPuzzle { private target; private keyMappingAndPatternPromise; listener: EventListener; constructor(target: Element, puzzle?: PuzzleID | PuzzleLoader); name(): string | undefined; setPuzzleInternal(puzzle: PuzzleID | PuzzleLoader): Promise<[KeyMapping | undefined, KPattern]>; disconnect(): void; getPattern(): Promise<KPattern>; private onKeyDown; } /** @category Keyboard Puzzles */ declare function debugKeyboardConnect(target?: any, puzzle?: PuzzleID | PuzzleLoader): Promise<KeyboardPuzzle>; /******** connect() ********/ interface BluetoothConnectOptions { acceptAllDevices?: boolean; } /** @category Smart Puzzles */ declare function connectSmartPuzzle(options?: BluetoothConnectOptions): Promise<BluetoothPuzzle>; /** @category Smart Puzzles */ declare class GanCube extends BluetoothPuzzle { private kpuzzle; private service; private server; private physicalStateCharacteristic; private lastMoveCounter; private aesKey; static connect(server: BluetoothRemoteGATTServer): Promise<GanCube>; INTERVAL_MS: number; private intervalHandle; private pattern; private cachedFaceletStatus1Characteristic; private cachedFaceletStatus2Characteristic; private cachedActualAngleAndBatteryCharacteristic; private constructor(); name(): string | undefined; disconnect(): void; startTrackingMoves(): void; stopTrackingMoves(): void; intervalHandler(): Promise<void>; getBattery(): Promise<number>; getPattern(): Promise<KPattern>; faceletStatus1Characteristic(): Promise<BluetoothRemoteGATTCharacteristic>; faceletStatus2Characteristic(): Promise<BluetoothRemoteGATTCharacteristic>; actualAngleAndBatteryCharacteristic(): Promise<BluetoothRemoteGATTCharacteristic>; reset(): Promise<void>; readFaceletStatus1Characteristic(): Promise<ArrayBufferLike>; readFaceletStatus2Characteristic(): Promise<string>; readActualAngleAndBatteryCharacteristic(): Promise<ArrayBufferLike>; } /** @category Smart Puzzles */ declare class GiiKERCube extends BluetoothPuzzle { private server; private cubeCharacteristic; private originalValue?; static connect(server: BluetoothRemoteGATTServer): Promise<GiiKERCube>; private constructor(); name(): string | undefined; disconnect(): void; getPattern(): Promise<KPattern>; private getBit; private toReid333; private onCubeCharacteristicChanged; private isRepeatedInitialValue; } /** @category Smart Puzzles */ declare class GoCube extends BluetoothPuzzle { private server; goCubeStateCharacteristic: BluetoothRemoteGATTCharacteristic; static connect(server: BluetoothRemoteGATTServer): Promise<GoCube>; private recorded; private homeQuatInverse; private lastRawQuat; private currentQuat; private lastTarget; private alg; private constructor(); disconnect(): void; reset(): void; resetAlg(alg?: Alg): void; resetOrientation(): void; name(): string | undefined; private onCubeCharacteristicChanged; } interface GanRobotOptions { xAngle: boolean; singleMoveFixHack: boolean; bufferQueue: number; postSleep: number; } /** @category Robots */ declare class GanRobot extends EventTarget { private server; private statusCharacteristic; private moveCharacteristic; experimentalDebugOnSend: ((alg: Alg) => void) | null; experimentalDebugLog: typeof console.log; experimentalOptions: GanRobotOptions; constructor(_service: BluetoothRemoteGATTService, server: BluetoothRemoteGATTServer, device: BluetoothDevice, statusCharacteristic: BluetoothRemoteGATTCharacteristic, moveCharacteristic: BluetoothRemoteGATTCharacteristic); static connect(server: BluetoothRemoteGATTServer, device: BluetoothDevice): Promise<GanRobot>; name(): string | undefined; disconnect(): void; onDisconnect(): void; private algNodeToNibble; private writeNibbles; private getStatus; locked: boolean; processQueue(): void; private moveQueue; private queueMoves; applyMoves(moves: Iterable<Move>): Promise<void>; } /** @category Robots */ type BluetoothRobot = GanRobot; /** @category Robots */ declare function connectSmartRobot(options?: BluetoothConnectOptions): Promise<BluetoothRobot>; /** @category Timers */ declare class GanTimer extends EventTarget { private server; private timeCharacteristic; private polling; private previousDetail; constructor(_service: BluetoothRemoteGATTService, server: BluetoothRemoteGATTServer, device: BluetoothDevice, timeCharacteristic: BluetoothRemoteGATTCharacteristic); static connect(server: BluetoothRemoteGATTServer, device: BluetoothDevice): Promise<GanTimer>; disconnect(): void; poll(): Promise<void>; onDisconnect(): void; getTimeCharacteristic(): Promise<Uint8Array<ArrayBufferLike>>; getTime(): Promise<number>; decodeTimeMs(bytes: Uint8Array): number; startPolling(): void; stopPolling(): void; } /** @category Timers */ type BluetoothTimer = GanTimer; /** @category Timers */ declare function connectSmartTimer(options?: BluetoothConnectOptions): Promise<BluetoothTimer>; export { BluetoothPuzzle, type BluetoothRobot, type BluetoothTimer, GanCube, GiiKERCube, GoCube, KeyboardPuzzle, connectSmartPuzzle, connectSmartRobot, connectSmartTimer, debugKeyboardConnect, enableDebugLogging };