plotboilerplate 1.23.0 → 1.23.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 (69) hide show
  1. package/README.md +1 -1
  2. package/dist/index.esm.js +32 -11
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.esm.min.js +1 -1
  5. package/dist/index.esm.min.js.map +1 -1
  6. package/dist/plotboilerplate.browser.min.js +1 -1
  7. package/dist/plotboilerplate.browser.min.js.map +1 -1
  8. package/dist/plotboilerplate.js +32 -11
  9. package/dist/plotboilerplate.min.js +1 -1
  10. package/package.json +3 -1
  11. package/src/cjs/PlotBoilerplate.d.ts +17 -3
  12. package/src/cjs/PlotBoilerplate.js +22 -5
  13. package/src/cjs/PlotBoilerplate.js.map +1 -1
  14. package/src/cjs/drawutilssvg.d.ts +6 -1
  15. package/src/cjs/drawutilssvg.js +10 -6
  16. package/src/cjs/drawutilssvg.js.map +1 -1
  17. package/src/cjs/interfaces/core.d.ts +4 -2
  18. package/src/cjs/interfaces/core.js +1 -0
  19. package/src/cjs/interfaces/core.js.map +1 -1
  20. package/src/cjs/interfaces/externals.d.ts +42 -0
  21. package/src/cjs/utils/InitializationObserver.d.ts +18 -0
  22. package/src/cjs/utils/InitializationObserver.js +63 -0
  23. package/src/cjs/utils/InitializationObserver.js.map +1 -0
  24. package/src/cjs/utils/Params.d.ts +5 -3
  25. package/src/cjs/utils/Params.js +7 -3
  26. package/src/cjs/utils/Params.js.map +1 -1
  27. package/src/cjs/utils/creategui.js +386 -250
  28. package/src/cjs/utils/dat.gui.arrowbounce.polyfill.js +74 -73
  29. package/src/cjs/utils/dat.gui.title.polyfill.js +9 -7
  30. package/src/cjs/utils/dom/guiSizeToggler.d.ts +17 -0
  31. package/src/cjs/utils/dom/guiSizeToggler.js +42 -0
  32. package/src/cjs/utils/dom/guiSizeToggler.js.map +1 -0
  33. package/src/cjs/utils/gup.d.ts +1 -0
  34. package/src/cjs/utils/gup.js +3 -1
  35. package/src/cjs/utils/gup.js.map +1 -1
  36. package/src/cjs/utils/lil.gui.arrowbounce.polyfill.js +133 -0
  37. package/src/cjs/utils/lil.gui.title.polyfill.js +32 -0
  38. package/src/esm/PlotBoilerplate.d.ts +17 -3
  39. package/src/esm/PlotBoilerplate.js +22 -5
  40. package/src/esm/PlotBoilerplate.js.map +1 -1
  41. package/src/esm/drawutilssvg.d.ts +6 -1
  42. package/src/esm/drawutilssvg.js +10 -6
  43. package/src/esm/drawutilssvg.js.map +1 -1
  44. package/src/esm/interfaces/core.d.ts +4 -2
  45. package/src/esm/interfaces/core.js +1 -0
  46. package/src/esm/interfaces/core.js.map +1 -1
  47. package/src/esm/interfaces/externals.d.ts +42 -0
  48. package/src/esm/utils/InitializationObserver.d.ts +18 -0
  49. package/src/esm/utils/InitializationObserver.js +57 -0
  50. package/src/esm/utils/InitializationObserver.js.map +1 -0
  51. package/src/esm/utils/Params.d.ts +5 -3
  52. package/src/esm/utils/Params.js +7 -3
  53. package/src/esm/utils/Params.js.map +1 -1
  54. package/src/esm/utils/dom/guiSizeToggler.d.ts +17 -0
  55. package/src/esm/utils/dom/guiSizeToggler.js +38 -0
  56. package/src/esm/utils/dom/guiSizeToggler.js.map +1 -0
  57. package/src/esm/utils/gup.d.ts +1 -0
  58. package/src/esm/utils/gup.js +3 -1
  59. package/src/esm/utils/gup.js.map +1 -1
  60. package/src/index-gl.js +3 -1
  61. package/src/index.js +2 -1
  62. package/src/ts/PlotBoilerplate.ts +42 -11
  63. package/src/ts/drawutilssvg.ts +17 -6
  64. package/src/ts/interfaces/core.ts +5 -2
  65. package/src/ts/interfaces/externals.ts +50 -0
  66. package/src/ts/utils/InitializationObserver.ts +70 -0
  67. package/src/ts/utils/Params.ts +8 -3
  68. package/src/ts/utils/dom/guiSizeToggler.ts +45 -0
  69. package/src/ts/utils/gup.ts +3 -1
@@ -4331,7 +4331,10 @@ 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
+ * @modified 2024-08-25 Extending main class `PlotBoilerplate` optional param `isBackdropFiltersEnabled`.
4336
+ *
4337
+ * @version 1.19.0
4335
4338
  *
4336
4339
  * @file PlotBoilerplate
4337
4340
  * @fileoverview The main class.
@@ -4466,6 +4469,10 @@ var PlotBoilerplate = /** @class */ (function () {
4466
4469
  * @private
4467
4470
  */
4468
4471
  this.renderTime = 0;
4472
+ /**
4473
+ * A storage variable for retrieving the GUI instance once it was created.
4474
+ */
4475
+ this._gui = null;
4469
4476
  // This should be in some static block ...
4470
4477
  VertexAttr_1.VertexAttr.model = {
4471
4478
  bezierAutoAdjust: false,
@@ -4532,7 +4539,8 @@ var PlotBoilerplate = /** @class */ (function () {
4532
4539
  enableZoom: f.bool(config, "enableZoom", true), // default=true
4533
4540
  enablePan: f.bool(config, "enablePan", true), // default=true
4534
4541
  // Experimental (and unfinished)
4535
- enableGL: f.bool(config, "enableGL", false)
4542
+ enableGL: f.bool(config, "enableGL", false),
4543
+ isBackdropFiltersEnabled: f.bool(config, "isBackdropFiltersEnabled", true)
4536
4544
  }; // END confog
4537
4545
  /**
4538
4546
  * Configuration for drawing things.
@@ -6010,7 +6018,8 @@ var PlotBoilerplate = /** @class */ (function () {
6010
6018
  return { x: pos.x - bounds.left, y: pos.y - bounds.top };
6011
6019
  };
6012
6020
  // 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") {
6021
+ if (typeof globalThis["AlloyFinger"] === "function" ||
6022
+ typeof globalThis["createAlloyFinger"] === "function") {
6014
6023
  try {
6015
6024
  var touchMovePos = null;
6016
6025
  var touchDownPos = null;
@@ -6209,12 +6218,20 @@ var PlotBoilerplate = /** @class */ (function () {
6209
6218
  // if (globalThis["utils"] && typeof globalThis["utils"].createGUI == "function") {
6210
6219
  // return (globalThis["utils" as keyof Object] as any as ({createGUI : (pb:PlotBoilerplate,props:DatGuiProps|undefined)=>GUI })).createGUI(this, props);
6211
6220
  if (utils && typeof utils.createGUI === "function") {
6212
- return utils.createGUI(this, props);
6221
+ return (this._gui = utils.createGUI(this, props));
6213
6222
  }
6214
6223
  else {
6215
- throw "Cannot create dat.GUI instance; did you load the ./utils/creategui helper function an the dat.GUI library?";
6224
+ 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
6225
  }
6217
6226
  };
6227
+ /**
6228
+ * Retriebe the GUI once it was created. If the `createGUI` method was not called or failed to create any
6229
+ * GUI then null is returned.
6230
+ * @returns {GUI | null}
6231
+ */
6232
+ PlotBoilerplate.prototype.getGUI = function () {
6233
+ return this._gui;
6234
+ };
6218
6235
  var _a;
6219
6236
  /** @constant {number} */
6220
6237
  PlotBoilerplate.DEFAULT_CANVAS_WIDTH = 1024;
@@ -11768,7 +11785,8 @@ var GLU = /** @class */ (function () {
11768
11785
  * @modified 2023-10-04 Adding `strokeOptions` param to these draw function: line, arrow, cubicBezierArrow, cubicBezier, cubicBezierPath, circle, circleArc, ellipse, square, rect, polygon, polyline.
11769
11786
  * @modified 2024-01-30 Fixing an issue with immutable style sets; changes to the global draw config did not reflect here (do now).
11770
11787
  * @modified 2024-03-10 Fixing some types for Typescript 5 compatibility.
11771
- * @version 1.6.9
11788
+ * @modified 2024-07-24 Caching custom style defs in a private buffer variable.
11789
+ * @version 1.6.10
11772
11790
  **/
11773
11791
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11774
11792
  exports.drawutilssvg = void 0;
@@ -11883,6 +11901,13 @@ var drawutilssvg = /** @class */ (function () {
11883
11901
  console.warn("Warning: your draw config is missing the key '".concat(k, "' which is required."));
11884
11902
  }
11885
11903
  }
11904
+ if (this.customStyleDefs) {
11905
+ rules.push("\n/* Custom styles */\n");
11906
+ this.customStyleDefs.forEach(function (value, key) {
11907
+ rules.push(key + " { " + value + " }");
11908
+ });
11909
+ // this.nodeStyle.innerHTML += "\n/* Custom styles */\n" + rules.join("\n");
11910
+ }
11886
11911
  this.nodeStyle.innerHTML = rules.join("\n");
11887
11912
  };
11888
11913
  /**
@@ -11906,11 +11931,7 @@ var drawutilssvg = /** @class */ (function () {
11906
11931
  * @param {Map<string,string>} defs
11907
11932
  */
11908
11933
  drawutilssvg.prototype.addCustomStyleDefs = function (defs) {
11909
- var buffer = [];
11910
- defs.forEach(function (value, key) {
11911
- buffer.push(key + " { " + value + " }");
11912
- });
11913
- this.nodeStyle.innerHTML += "\n/* Custom styles */\n" + buffer.join("\n");
11934
+ this.customStyleDefs = defs;
11914
11935
  };
11915
11936
  /**
11916
11937
  * Retieve an old (cached) element.