cubing 0.21.1 → 0.21.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.
Files changed (36) hide show
  1. package/{src/cubing/search → dist}/.DS_Store +0 -0
  2. package/dist/bundle-global/cubing.bundle-global.js +52 -52
  3. package/dist/esm/twisty/index.js +11 -6
  4. package/dist/esm/twisty/index.js.map +2 -2
  5. package/{src/cubing/kpuzzle → dist/types}/.DS_Store +0 -0
  6. package/dist/types/cubing.bundle-global.d.ts +1 -24
  7. package/dist/types/cubing.bundle-global.d.ts.map +1 -1
  8. package/dist/types/twisty/index.d.ts +1 -1
  9. package/dist/types/twisty/views/3D/Twisty3DVantage.d.ts +1 -1
  10. package/dist/types/twisty/views/3D/Twisty3DVantage.d.ts.map +1 -1
  11. package/docs/.DS_Store +0 -0
  12. package/docs/cubing/.DS_Store +0 -0
  13. package/package.json +1 -1
  14. package/src/cubing/.DS_Store +0 -0
  15. package/src/cubing/cubing.bundle-global.ts +5 -1
  16. package/src/cubing/twisty/.DS_Store +0 -0
  17. package/src/cubing/twisty/index.ts +1 -1
  18. package/src/cubing/twisty/views/.DS_Store +0 -0
  19. package/src/cubing/twisty/{model → views/3D}/.DS_Store +0 -0
  20. package/src/cubing/twisty/views/3D/Twisty3DVantage.ts +15 -5
  21. package/dist/types/twisty/views/3D/puzzles/TwistyTestBox.d.ts +0 -9
  22. package/dist/types/twisty/views/3D/puzzles/TwistyTestBox.d.ts.map +0 -1
  23. package/src/cubing/alg/.DS_Store +0 -0
  24. package/src/cubing/alg/units/.DS_Store +0 -0
  25. package/src/cubing/bluetooth/.DS_Store +0 -0
  26. package/src/cubing/puzzles/.DS_Store +0 -0
  27. package/src/cubing/puzzles/implementations/.DS_Store +0 -0
  28. package/src/cubing/stream/.DS_Store +0 -0
  29. package/src/cubing/twisty/model/props/.DS_Store +0 -0
  30. package/src/cubing/twisty/model/props/puzzle/.DS_Store +0 -0
  31. package/src/cubing/twisty/old/.DS_Store +0 -0
  32. package/src/cubing/twisty/old/animation/.DS_Store +0 -0
  33. package/src/cubing/twisty/old/animation/indexer/.DS_Store +0 -0
  34. package/src/cubing/twisty/old/dom/.DS_Store +0 -0
  35. package/src/cubing/twisty/views/3D/puzzles/TwistyTestBox.ts +0 -22
  36. package/src/cubing/vendor/.DS_Store +0 -0
@@ -1,25 +1,2 @@
1
- import * as alg from "./alg";
2
- import * as bluetooth from "./bluetooth";
3
- import * as kpuzzle from "./kpuzzle";
4
- import * as notation from "./notation";
5
- import * as protocol from "./protocol";
6
- import * as puzzleGeometry from "./puzzle-geometry";
7
- import * as puzzles from "./puzzles";
8
- import * as scramble from "./scramble";
9
- import * as stream from "./stream";
10
- import * as search from "./search";
11
- import * as twisty from "./twisty";
12
- export declare const cubing: {
13
- alg: typeof alg;
14
- bluetooth: typeof bluetooth;
15
- kpuzzle: typeof kpuzzle;
16
- notation: typeof notation;
17
- protocol: typeof protocol;
18
- puzzleGeometry: typeof puzzleGeometry;
19
- puzzles: typeof puzzles;
20
- scramble: typeof scramble;
21
- stream: typeof stream;
22
- search: typeof search;
23
- twisty: typeof twisty;
24
- };
1
+ export {};
25
2
  //# sourceMappingURL=cubing.bundle-global.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cubing.bundle-global.d.ts","sourceRoot":"","sources":["../../src/cubing/cubing.bundle-global.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,cAAc,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,eAAO,MAAM,MAAM;;;;;;;;;;;;CAYlB,CAAC"}
1
+ {"version":3,"file":"cubing.bundle-global.d.ts","sourceRoot":"","sources":["../../src/cubing/cubing.bundle-global.ts"],"names":[],"mappings":""}
@@ -2,7 +2,7 @@ export { TwistyPlayer } from "./views/TwistyPlayer";
2
2
  export { TwistyAlgViewer } from "./views/TwistyAlgViewer";
3
3
  export { TwistyAlgEditor } from "./views/TwistyAlgEditor/TwistyAlgEditor";
4
4
  export type { TwistyPlayerConfig } from "./views/TwistyPlayer";
5
- export { experimentalSetShareAllNewRenderers } from "./views/3D/Twisty3DVantage";
5
+ export { experimentalForceNewRendererSharing } from "./views/3D/Twisty3DVantage";
6
6
  export { NO_VALUE as EXPERIMENTAL_PROP_NO_VALUE } from "./model/props/TwistyProp";
7
7
  export type { Twisty3DPuzzle } from "./views/3D/puzzles/Twisty3DPuzzle";
8
8
  export { experimentalShowRenderStats, Twisty3DCanvas, } from "./old/dom/viewers/Twisty3DCanvas";
@@ -8,7 +8,7 @@ import type { Twisty3DSceneWrapper } from "./Twisty3DSceneWrapper";
8
8
  import { TwistyOrbitControlsV2 } from "./TwistyOrbitControlsV2";
9
9
  export declare function showStats(enable: boolean): void;
10
10
  export declare function setCameraFromOrbitCoordinates(camera: PerspectiveCamera, orbitCoordinates: OrbitCoordinatesV2, backView?: boolean): Promise<void>;
11
- export declare function experimentalSetShareAllNewRenderers(share: boolean): void;
11
+ export declare function experimentalForceNewRendererSharing(share: boolean | null): void;
12
12
  export declare class Twisty3DVantage extends ManagedCustomElement {
13
13
  #private;
14
14
  private model?;
@@ -1 +1 @@
1
- {"version":3,"file":"Twisty3DVantage.d.ts","sourceRoot":"","sources":["../../../../../src/cubing/twisty/views/3D/Twisty3DVantage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBA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B,GAAG,IAAI,CAAQ;IAE1C,KAAK,EAAE,KAAK,GAAG,IAAI,CAAQ;IAE3B,OAAO,CAAC,gBAAgB,CAA4B;gBAG1C,KAAK,CAAC,+BAAmB,EACjC,KAAK,CAAC,EAAE,oBAAoB,EACpB,OAAO,CAAC;;iBAAwB;IAYpC,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAgDlC,QAAQ,IAAI,OAAO,CAAC,aAAa,CAAC;IAQlC,MAAM,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAWpC,MAAM,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAoBpC,aAAa,IAAI,OAAO,CAAC,qBAAqB,CAAC;IA6BrD,WAAW,CAAC,CAAC,EACX,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,EACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAC3B,IAAI;IASP,UAAU,IAAI,IAAI;IAOZ,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAsB7B,cAAc,IAAI,IAAI;CAIvB"}
package/docs/.DS_Store CHANGED
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cubing",
3
- "version": "0.21.1",
3
+ "version": "0.21.2",
4
4
  "description": "A collection of Javascript cubing libraries.",
5
5
  "author": "The js.cubing.net team",
6
6
  "type": "module",
Binary file
@@ -10,7 +10,7 @@ import * as stream from "./stream";
10
10
  import * as search from "./search";
11
11
  import * as twisty from "./twisty";
12
12
 
13
- export const cubing = {
13
+ const cubing = {
14
14
  alg,
15
15
  bluetooth,
16
16
  kpuzzle,
@@ -29,3 +29,7 @@ try {
29
29
  } catch (e) {
30
30
  console.log("Unable to set `cubing` on the global object.");
31
31
  }
32
+
33
+ if (globalThis.module?.exports) {
34
+ globalThis.module.exports = cubing;
35
+ }
Binary file
@@ -2,7 +2,7 @@ export { TwistyPlayer } from "./views/TwistyPlayer";
2
2
  export { TwistyAlgViewer } from "./views/TwistyAlgViewer";
3
3
  export { TwistyAlgEditor } from "./views/TwistyAlgEditor/TwistyAlgEditor";
4
4
  export type { TwistyPlayerConfig } from "./views/TwistyPlayer";
5
- export { experimentalSetShareAllNewRenderers } from "./views/3D/Twisty3DVantage";
5
+ export { experimentalForceNewRendererSharing } from "./views/3D/Twisty3DVantage";
6
6
 
7
7
  export { NO_VALUE as EXPERIMENTAL_PROP_NO_VALUE } from "./model/props/TwistyProp";
8
8
 
Binary file
@@ -40,20 +40,30 @@ let shareAllNewRenderers: boolean | null = null;
40
40
  // WARNING: The current shared renderer implementation is not every efficient.
41
41
  // Avoid using for players that are likely to have dimensions approaching 1 megapixel or higher.
42
42
  // TODO: use a dedicated renderer while fullscreen?
43
- export function experimentalSetShareAllNewRenderers(share: boolean): void {
43
+ // - true: Force all new (i.e. constructed in the future) renderers to be shared
44
+ // - false: Force all new (i.e. constructed in the future) renderers to be dedicated
45
+ // - null: Reset to the default heuristics.
46
+ export function experimentalForceNewRendererSharing(
47
+ share: boolean | null,
48
+ ): void {
44
49
  shareAllNewRenderers = share;
45
50
  }
46
51
 
47
- let anyRenderersSofar = false;
52
+ let dedicatedRenderersSoFar = 0;
53
+ const DEFAULT_MAX_DEDICATED_RENDERERS = 2; // This allows for a front view and a back view (or two separate front views).
48
54
  function shareRenderer(): boolean {
49
55
  if (shareAllNewRenderers !== null) {
56
+ if (!shareAllNewRenderers) {
57
+ dedicatedRenderersSoFar++;
58
+ }
50
59
  return shareAllNewRenderers;
51
60
  }
52
- if (!anyRenderersSofar) {
53
- anyRenderersSofar = true;
61
+ if (dedicatedRenderersSoFar < DEFAULT_MAX_DEDICATED_RENDERERS) {
62
+ dedicatedRenderersSoFar++;
54
63
  return false;
64
+ } else {
65
+ return true;
55
66
  }
56
- return true;
57
67
  }
58
68
 
59
69
  export class Twisty3DVantage extends ManagedCustomElement {
@@ -1,9 +0,0 @@
1
- import type { Twisty3DPuzzle } from "./Twisty3DPuzzle";
2
- import { Object3D } from "three";
3
- import type { AlgCursor } from "../../../old/animation/cursor/AlgCursor";
4
- import type { PuzzlePosition } from "../../../old/animation/cursor/CursorTypes";
5
- export declare class TwistyTestBox extends Object3D implements Twisty3DPuzzle {
6
- constructor(cursor: AlgCursor);
7
- onPositionChange(_position: PuzzlePosition): void;
8
- }
9
- //# sourceMappingURL=TwistyTestBox.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TwistyTestBox.d.ts","sourceRoot":"","sources":["../../../../../../src/cubing/twisty/views/3D/puzzles/TwistyTestBox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAkC,QAAQ,EAAQ,MAAM,OAAO,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAEhF,qBAAa,aAAc,SAAQ,QAAS,YAAW,cAAc;gBACvD,MAAM,EAAE,SAAS;IAY7B,gBAAgB,CAAC,SAAS,EAAE,cAAc,GAAG,IAAI;CAGlD"}
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,22 +0,0 @@
1
- import type { Twisty3DPuzzle } from "./Twisty3DPuzzle";
2
- import { BoxGeometry, MeshBasicMaterial, Object3D, Mesh } from "three";
3
- import type { AlgCursor } from "../../../old/animation/cursor/AlgCursor";
4
- import type { PuzzlePosition } from "../../../old/animation/cursor/CursorTypes";
5
-
6
- export class TwistyTestBox extends Object3D implements Twisty3DPuzzle {
7
- constructor(cursor: AlgCursor) {
8
- super();
9
- const geometry = new BoxGeometry(1, 1, 1);
10
- const material = new MeshBasicMaterial({ color: 0x00ff00 });
11
- const cube = new Mesh(geometry, material);
12
-
13
- this.add(cube);
14
-
15
- /*...*/
16
- cursor.addPositionListener(this);
17
- }
18
-
19
- onPositionChange(_position: PuzzlePosition): void {
20
- // nothing
21
- }
22
- }
Binary file