plotboilerplate 1.23.0 → 1.23.1

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 (38) hide show
  1. package/dist/index.esm.js +19 -4
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/index.esm.min.js +1 -1
  4. package/dist/index.esm.min.js.map +1 -1
  5. package/dist/plotboilerplate.browser.min.js +1 -1
  6. package/dist/plotboilerplate.browser.min.js.map +1 -1
  7. package/dist/plotboilerplate.js +19 -4
  8. package/dist/plotboilerplate.min.js +1 -1
  9. package/package.json +3 -1
  10. package/src/cjs/PlotBoilerplate.d.ts +16 -3
  11. package/src/cjs/PlotBoilerplate.js +19 -4
  12. package/src/cjs/PlotBoilerplate.js.map +1 -1
  13. package/src/cjs/interfaces/externals.d.ts +12 -0
  14. package/src/cjs/utils/InitializationObserver.d.ts +18 -0
  15. package/src/cjs/utils/InitializationObserver.js +56 -0
  16. package/src/cjs/utils/InitializationObserver.js.map +1 -0
  17. package/src/cjs/utils/creategui.js +319 -251
  18. package/src/cjs/utils/dat.gui.arrowbounce.polyfill.js +74 -73
  19. package/src/cjs/utils/dat.gui.title.polyfill.js +9 -7
  20. package/src/cjs/utils/dom/guiSizeToggler.d.ts +17 -0
  21. package/src/cjs/utils/dom/guiSizeToggler.js +42 -0
  22. package/src/cjs/utils/dom/guiSizeToggler.js.map +1 -0
  23. package/src/cjs/utils/lil.gui.arrowbounce.polyfill.js +133 -0
  24. package/src/cjs/utils/lil.gui.title.polyfill.js +32 -0
  25. package/src/esm/PlotBoilerplate.d.ts +16 -3
  26. package/src/esm/PlotBoilerplate.js +19 -4
  27. package/src/esm/PlotBoilerplate.js.map +1 -1
  28. package/src/esm/interfaces/externals.d.ts +12 -0
  29. package/src/esm/utils/InitializationObserver.d.ts +18 -0
  30. package/src/esm/utils/InitializationObserver.js +50 -0
  31. package/src/esm/utils/InitializationObserver.js.map +1 -0
  32. package/src/esm/utils/dom/guiSizeToggler.d.ts +17 -0
  33. package/src/esm/utils/dom/guiSizeToggler.js +38 -0
  34. package/src/esm/utils/dom/guiSizeToggler.js.map +1 -0
  35. package/src/ts/PlotBoilerplate.ts +38 -10
  36. package/src/ts/interfaces/externals.ts +16 -0
  37. package/src/ts/utils/InitializationObserver.ts +63 -0
  38. package/src/ts/utils/dom/guiSizeToggler.ts +45 -0
package/dist/index.esm.js CHANGED
@@ -10892,7 +10892,9 @@ VEllipseSector.ellipseSectorUtils = {
10892
10892
  * @modified 2023-02-10 Cleaning up most type errors in the main class (mostly null checks).
10893
10893
  * @modified 2023-02-10 Adding `enableZoom` and `enablePan` (both default true) to have the option to disable these functions.
10894
10894
  * @modified 2023-09-29 Adding proper dicionary key and value types to the params of `PlotBoilerplate.utils.safeMergeByKeys` (was `object` before).
10895
- * @version 1.17.3
10895
+ * @modified 2024-07-08 Adding `PlotBoilerplate.getGUI()` to retrieve the GUI instance.
10896
+ *
10897
+ * @version 1.18.0
10896
10898
  *
10897
10899
  * @file PlotBoilerplate
10898
10900
  * @fileoverview The main class.
@@ -11005,6 +11007,10 @@ class PlotBoilerplate {
11005
11007
  * @private
11006
11008
  */
11007
11009
  this.renderTime = 0;
11010
+ /**
11011
+ * A storage variable for retrieving the GUI instance once it was created.
11012
+ */
11013
+ this._gui = null;
11008
11014
  // This should be in some static block ...
11009
11015
  VertexAttr.model = {
11010
11016
  bezierAutoAdjust: false,
@@ -12547,7 +12553,8 @@ class PlotBoilerplate {
12547
12553
  return { x: pos.x - bounds.left, y: pos.y - bounds.top };
12548
12554
  };
12549
12555
  // Make PB work together with both, AlloyFinger as a esm module or a commonjs function.
12550
- if (typeof globalThis["AlloyFinger"] === "function" || typeof globalThis["createAlloyFinger"] === "function") {
12556
+ if (typeof globalThis["AlloyFinger"] === "function" ||
12557
+ typeof globalThis["createAlloyFinger"] === "function") {
12551
12558
  try {
12552
12559
  var touchMovePos = null;
12553
12560
  var touchDownPos = null;
@@ -12746,12 +12753,20 @@ class PlotBoilerplate {
12746
12753
  // if (globalThis["utils"] && typeof globalThis["utils"].createGUI == "function") {
12747
12754
  // return (globalThis["utils" as keyof Object] as any as ({createGUI : (pb:PlotBoilerplate,props:DatGuiProps|undefined)=>GUI })).createGUI(this, props);
12748
12755
  if (utils && typeof utils.createGUI === "function") {
12749
- return utils.createGUI(this, props);
12756
+ return (this._gui = utils.createGUI(this, props));
12750
12757
  }
12751
12758
  else {
12752
- throw "Cannot create dat.GUI instance; did you load the ./utils/creategui helper function an the dat.GUI library?";
12759
+ throw "Cannot create dat.GUI or lil-gui instance; did you load the ./utils/creategui helper function an the dat.GUI/lil-gui library?";
12753
12760
  }
12754
12761
  }
12762
+ /**
12763
+ * Retriebe the GUI once it was created. If the `createGUI` method was not called or failed to create any
12764
+ * GUI then null is returned.
12765
+ * @returns {GUI | null}
12766
+ */
12767
+ getGUI() {
12768
+ return this._gui;
12769
+ }
12755
12770
  } // END class PlotBoilerplate
12756
12771
  /** @constant {number} */
12757
12772
  PlotBoilerplate.DEFAULT_CANVAS_WIDTH = 1024;