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
@@ -4331,7 +4331,9 @@ exports.PBText = PBText;
4331
4331
  * @modified 2023-02-10 Cleaning up most type errors in the main class (mostly null checks).
4332
4332
  * @modified 2023-02-10 Adding `enableZoom` and `enablePan` (both default true) to have the option to disable these functions.
4333
4333
  * @modified 2023-09-29 Adding proper dicionary key and value types to the params of `PlotBoilerplate.utils.safeMergeByKeys` (was `object` before).
4334
- * @version 1.17.3
4334
+ * @modified 2024-07-08 Adding `PlotBoilerplate.getGUI()` to retrieve the GUI instance.
4335
+ *
4336
+ * @version 1.18.0
4335
4337
  *
4336
4338
  * @file PlotBoilerplate
4337
4339
  * @fileoverview The main class.
@@ -4466,6 +4468,10 @@ var PlotBoilerplate = /** @class */ (function () {
4466
4468
  * @private
4467
4469
  */
4468
4470
  this.renderTime = 0;
4471
+ /**
4472
+ * A storage variable for retrieving the GUI instance once it was created.
4473
+ */
4474
+ this._gui = null;
4469
4475
  // This should be in some static block ...
4470
4476
  VertexAttr_1.VertexAttr.model = {
4471
4477
  bezierAutoAdjust: false,
@@ -6010,7 +6016,8 @@ var PlotBoilerplate = /** @class */ (function () {
6010
6016
  return { x: pos.x - bounds.left, y: pos.y - bounds.top };
6011
6017
  };
6012
6018
  // Make PB work together with both, AlloyFinger as a esm module or a commonjs function.
6013
- if (typeof globalThis["AlloyFinger"] === "function" || typeof globalThis["createAlloyFinger"] === "function") {
6019
+ if (typeof globalThis["AlloyFinger"] === "function" ||
6020
+ typeof globalThis["createAlloyFinger"] === "function") {
6014
6021
  try {
6015
6022
  var touchMovePos = null;
6016
6023
  var touchDownPos = null;
@@ -6209,12 +6216,20 @@ var PlotBoilerplate = /** @class */ (function () {
6209
6216
  // if (globalThis["utils"] && typeof globalThis["utils"].createGUI == "function") {
6210
6217
  // return (globalThis["utils" as keyof Object] as any as ({createGUI : (pb:PlotBoilerplate,props:DatGuiProps|undefined)=>GUI })).createGUI(this, props);
6211
6218
  if (utils && typeof utils.createGUI === "function") {
6212
- return utils.createGUI(this, props);
6219
+ return (this._gui = utils.createGUI(this, props));
6213
6220
  }
6214
6221
  else {
6215
- throw "Cannot create dat.GUI instance; did you load the ./utils/creategui helper function an the dat.GUI library?";
6222
+ throw "Cannot create dat.GUI or lil-gui instance; did you load the ./utils/creategui helper function an the dat.GUI/lil-gui library?";
6216
6223
  }
6217
6224
  };
6225
+ /**
6226
+ * Retriebe the GUI once it was created. If the `createGUI` method was not called or failed to create any
6227
+ * GUI then null is returned.
6228
+ * @returns {GUI | null}
6229
+ */
6230
+ PlotBoilerplate.prototype.getGUI = function () {
6231
+ return this._gui;
6232
+ };
6218
6233
  var _a;
6219
6234
  /** @constant {number} */
6220
6235
  PlotBoilerplate.DEFAULT_CANVAS_WIDTH = 1024;