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
@@ -8,72 +8,73 @@
8
8
  * @author Ikaros Kappler
9
9
  * @date 2020-02-13
10
10
  * @modified 2020-10-14 Changed 'window' to 'globalthis'.
11
- * version 1.0.1
11
+ * @version 1.0.1
12
+ * @DEPRECATED dat.gui was replaced by lil-gui.
12
13
  **/
13
14
 
14
-
15
- (function() {
16
-
17
- /* dat.GUI copies the prototype of superclass Controller to all other controllers, so it is not enough to add it only to
15
+ (function () {
16
+ /* dat.GUI copies the prototype of superclass Controller to all other controllers, so it is not enough to add it only to
18
17
  the super class as the reference is not maintained */
19
- var eachController = function(fnc) {
20
- for (var controllerName in dat.controllers) {
21
- if (dat.controllers.hasOwnProperty(controllerName)) {
22
- fnc(dat.controllers[controllerName]);
23
- }
24
- }
18
+ var eachController = function (fnc) {
19
+ for (var controllerName in dat.controllers) {
20
+ if (dat.controllers.hasOwnProperty(controllerName)) {
21
+ fnc(dat.controllers[controllerName]);
22
+ }
25
23
  }
24
+ };
26
25
 
27
- var setArrowBounce = function(v,options) {
28
- options = options || {};
29
- if( typeof options.fadeDelay == "undefined" )
30
- options.fadeDelay = 5000;
31
- options.fadeDelay = options.fadeDelay/1000;
26
+ var setArrowBounce = function (v, options) {
27
+ options = options || {};
28
+ if (typeof options.fadeDelay == "undefined") options.fadeDelay = 5000;
29
+ options.fadeDelay = options.fadeDelay / 1000;
32
30
 
33
- var randomkey = 'arrowbounce-'+Math.round(Math.random()*Math.pow(2,16));
31
+ var randomkey = "arrowbounce-" + Math.round(Math.random() * Math.pow(2, 16));
34
32
 
35
- var _self = this;
36
- removeElement = function() {
37
- _self.__li.querySelectorAll('.arrowBounce').forEach( function(elem) {
38
- elem.parentElement.removeChild(elem);
39
- } );
40
- _self.__li.style.overflow = 'hidden'; // Restore old overflow
41
- _self.__li.style.position = 'static';
42
- };
43
-
44
- // __li is the root dom element of each controller
45
- if (v) {
46
- this.__li.style.position = 'relative';
47
- this.__li.style.overflow = 'visible';
48
- //this.__li.style.overflowX = 'visible';
49
- //this.__li.style.overflowY = 'hidden';
50
- var node = document.createElement('div');
51
- node.style.position = 'absolute';
52
- // node.style.lineHeight = '24px';
53
- node.style.left = 0;
54
- node.style.top = 0;
55
- node.style.transform = 'translateX(-100%)';
56
- node.classList = randomkey + " arrowBounce hideAfterNs" + (typeof options.className != 'undefined' ? ' '+options.className : '');
57
- // BEGIN custom Styling
58
- node.style.paddingRight = '1em';
59
- // node.style.paddingTop = node.style.paddingBottom = '0em';
60
- node.style.color = 'rgb(0,0,0)';
61
- // END custom Styling
62
-
63
- node.innerHTML = '<div class="bounce">' + v + '&nbsp;<span style="margin-left: 3em;">➤</span></div>';
64
- this.__li.prepend(node);
65
- if( typeof options.detachAfter == 'number' )
66
- globalThis.setTimeout( function() { removeElement(); }, options.detachAfter );
67
- } else {
68
- removeElement();
69
- }
33
+ var _self = this;
34
+ removeElement = function () {
35
+ _self.__li.querySelectorAll(".arrowBounce").forEach(function (elem) {
36
+ elem.parentElement.removeChild(elem);
37
+ });
38
+ _self.__li.style.overflow = "hidden"; // Restore old overflow
39
+ _self.__li.style.position = "static";
40
+ };
70
41
 
71
- // --- Unfortunately IE does not support ES6 Template Literals ---
72
- // --- So use '§' instead '$' here plus string.replace(...) ---
73
- // Define a dynamic and local CSS class
74
- var style = document.createElement('style');
75
- style.type = 'text/css';
76
- style.innerHTML = `.§{randomkey}.hideAfterNs {
42
+ // __li is the root dom element of each controller
43
+ if (v) {
44
+ this.__li.style.position = "relative";
45
+ this.__li.style.overflow = "visible";
46
+ //this.__li.style.overflowX = 'visible';
47
+ //this.__li.style.overflowY = 'hidden';
48
+ var node = document.createElement("div");
49
+ node.style.position = "absolute";
50
+ // node.style.lineHeight = '24px';
51
+ node.style.left = 0;
52
+ node.style.top = 0;
53
+ node.style.transform = "translateX(-100%)";
54
+ node.classList =
55
+ randomkey + " arrowBounce hideAfterNs" + (typeof options.className != "undefined" ? " " + options.className : "");
56
+ // BEGIN custom Styling
57
+ node.style.paddingRight = "1em";
58
+ // node.style.paddingTop = node.style.paddingBottom = '0em';
59
+ node.style.color = "rgb(0,0,0)";
60
+ // END custom Styling
61
+
62
+ node.innerHTML = '<div class="bounce">' + v + '&nbsp;<span style="margin-left: 3em;">➤</span></div>';
63
+ this.__li.prepend(node);
64
+ if (typeof options.detachAfter == "number")
65
+ globalThis.setTimeout(function () {
66
+ removeElement();
67
+ }, options.detachAfter);
68
+ } else {
69
+ removeElement();
70
+ }
71
+
72
+ // --- Unfortunately IE does not support ES6 Template Literals ---
73
+ // --- So use '§' instead '$' here plus string.replace(...) ---
74
+ // Define a dynamic and local CSS class
75
+ var style = document.createElement("style");
76
+ style.type = "text/css";
77
+ style.innerHTML = `.§{randomkey}.hideAfterNs {
77
78
  animation: fadeout 0.5s 1;
78
79
  -webkit-animation: fadeout 0.5s 1;
79
80
  animation-fill-mode: forwards;
@@ -81,15 +82,15 @@
81
82
  animation-delay: ${options.fadeDelay}s;
82
83
  -webkit-animation-delay:§{options.fadeDelay}s; /* Safari and Chrome */
83
84
  -webkit-animation-fill-mode: forwards;
84
- }` .replace(/§\{fadeTime\}/g, (options.fadeDelay/1000).toString());
85
- document.getElementsByTagName('head')[0].appendChild(style);
86
- return this;
87
- };
85
+ }`.replace(/§\{fadeTime\}/g, (options.fadeDelay / 1000).toString());
86
+ document.getElementsByTagName("head")[0].appendChild(style);
87
+ return this;
88
+ };
88
89
 
89
- // Define a global CSS class
90
- var style = document.createElement('style');
91
- style.type = 'text/css';
92
- style.innerHTML = `.bounce {
90
+ // Define a global CSS class
91
+ var style = document.createElement("style");
92
+ style.type = "text/css";
93
+ style.innerHTML = `.bounce {
93
94
  animation: bounce 2s infinite;
94
95
  background: rgba(255,255,255,0.7);
95
96
  border-radius: 8px;
@@ -116,12 +117,12 @@
116
117
  from {opacity :1;}
117
118
  to {opacity :0;display:none;}
118
119
  }`;
119
- document.getElementsByTagName('head')[0].appendChild(style);
120
+ document.getElementsByTagName("head")[0].appendChild(style);
120
121
 
121
- // Install the new feature
122
- eachController(function(controller) {
123
- if (!controller.prototype.hasOwnProperty('arrowBounce')) {
124
- controller.prototype.arrowBounce = setArrowBounce;
125
- }
126
- });
122
+ // Install the new feature
123
+ eachController(function (controller) {
124
+ if (!controller.prototype.hasOwnProperty("arrowBounce")) {
125
+ controller.prototype.arrowBounce = setArrowBounce;
126
+ }
127
+ });
127
128
  })();
@@ -4,30 +4,32 @@
4
4
  * Found at
5
5
  * https://stackoverflow.com/questions/27362914/how-to-add-tooltips-to-dat-gui
6
6
  * Thanks to greginvm
7
+ *
8
+ * @DEPRECATED dat.gui was replaced by lil-gui.
7
9
  **/
8
10
 
9
11
  /* dat.GUI copies the prototype of superclass Controller to all other controllers, so it is not enough to add it only to
10
12
  the super class as the reference is not maintained */
11
- var eachController = function(fnc) {
13
+ var eachController = function (fnc) {
12
14
  for (var controllerName in dat.controllers) {
13
15
  if (dat.controllers.hasOwnProperty(controllerName)) {
14
16
  fnc(dat.controllers[controllerName]);
15
17
  }
16
18
  }
17
- }
19
+ };
18
20
 
19
- var setTitle = function(v) {
21
+ var setTitle = function (v) {
20
22
  // __li is the root dom element of each controller
21
23
  if (v) {
22
- this.__li.setAttribute('title', v);
24
+ this.__li.setAttribute("title", v);
23
25
  } else {
24
- this.__li.removeAttribute('title')
26
+ this.__li.removeAttribute("title");
25
27
  }
26
28
  return this;
27
29
  };
28
30
 
29
- eachController(function(controller) {
30
- if (!controller.prototype.hasOwnProperty('title')) {
31
+ eachController(function (controller) {
32
+ if (!controller.prototype.hasOwnProperty("title")) {
31
33
  controller.prototype.title = setTitle;
32
34
  }
33
35
  });
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @requires lil-gui
3
+ *
4
+ * @author Ikaros Kappler
5
+ * @date 2021-12-13
6
+ * @modified 2022-01-10
7
+ * @modified 2024-06-25 Ported to typescript and moved to utils/dom (was located inside demos before).
8
+ * @version 1.1.0
9
+ */
10
+ import { GUI } from "../../interfaces/externals";
11
+ interface ITogglerConfig {
12
+ guiDoubleSize?: boolean;
13
+ }
14
+ export declare const guiSizeToggler: (gui: GUI, config: ITogglerConfig, cssProps: Record<string, string>) => {
15
+ update: () => void;
16
+ };
17
+ export {};
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ /**
3
+ * @requires lil-gui
4
+ *
5
+ * @author Ikaros Kappler
6
+ * @date 2021-12-13
7
+ * @modified 2022-01-10
8
+ * @modified 2024-06-25 Ported to typescript and moved to utils/dom (was located inside demos before).
9
+ * @version 1.1.0
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.guiSizeToggler = void 0;
13
+ /**
14
+ * @param {GUI} gui - The GUI (compatible with dat.gui and lil-gui).
15
+ * @param {boolean} guiDoubleSize - True or false.
16
+ * @param {Record<string,string>} cssProps - The CSS props to use.
17
+ */
18
+ var applyGuiSize = function (gui, guiDoubleSize, cssProps) {
19
+ if (cssProps && cssProps.hasOwnProperty("transformOrigin")) {
20
+ gui.domElement.style["transform-origin"] = cssProps["transformOrigin"];
21
+ }
22
+ else {
23
+ gui.domElement.style["transform-origin"] = "100% 0%";
24
+ }
25
+ var transform = cssProps && cssProps.hasOwnProperty("transform") ? cssProps["transform"] + " " : "";
26
+ console.log("transform", transform);
27
+ if (guiDoubleSize) {
28
+ gui.domElement.style["transform"] = transform + "scale(2.0)";
29
+ }
30
+ else {
31
+ gui.domElement.style["transform"] = transform + "scale(1.0)";
32
+ }
33
+ };
34
+ var guiSizeToggler /* gst */ = function (gui, config, cssProps) {
35
+ return {
36
+ update: function () {
37
+ applyGuiSize(gui, Boolean(config.guiDoubleSize), cssProps);
38
+ }
39
+ };
40
+ };
41
+ exports.guiSizeToggler /* gst */ = guiSizeToggler;
42
+ //# sourceMappingURL=guiSizeToggler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guiSizeToggler.js","sourceRoot":"","sources":["../../../ts/utils/dom/guiSizeToggler.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAQH;;;;GAIG;AACH,IAAM,YAAY,GAAG,UAAC,GAAQ,EAAE,aAAsB,EAAE,QAAgC;IACtF,IAAI,QAAQ,IAAI,QAAQ,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAC3D,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,kBAAkB,CAAC,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IACzE,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,kBAAkB,CAAC,GAAG,SAAS,CAAC;IACvD,CAAC;IAED,IAAM,SAAS,GAAG,QAAQ,IAAI,QAAQ,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAEtG,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IACpC,IAAI,aAAa,EAAE,CAAC;QAClB,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,SAAS,GAAG,YAAY,CAAC;IAC/D,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,SAAS,GAAG,YAAY,CAAC;IAC/D,CAAC;AACH,CAAC,CAAC;AAEK,IAAM,cAAc,CAAC,SAAS,GAAG,UAAC,GAAQ,EAAE,MAAsB,EAAE,QAAgC;IACzG,OAAO;QACL,MAAM,EAAE;YACN,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC7D,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AANW,QAAA,cAAc,CAAC,SAAS,kBAMnC"}
@@ -9,5 +9,6 @@
9
9
  * Ported to typescript.
10
10
  * @date 2021-05-21
11
11
  * @modified 2024-03-10 Fixed some type for Typescript 5 compatibility.
12
+ * @modified 2024-08-26 Decoding URI components in GET params.
12
13
  */
13
14
  export declare const gup: () => Record<string, string>;
@@ -10,6 +10,7 @@
10
10
  * Ported to typescript.
11
11
  * @date 2021-05-21
12
12
  * @modified 2024-03-10 Fixed some type for Typescript 5 compatibility.
13
+ * @modified 2024-08-26 Decoding URI components in GET params.
13
14
  */
14
15
  Object.defineProperty(exports, "__esModule", { value: true });
15
16
  exports.gup = void 0;
@@ -21,7 +22,8 @@ exports.gup = void 0;
21
22
  var gup = function () {
22
23
  var vars = {};
23
24
  globalThis.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (_m, key, value) {
24
- return (vars[key] = value);
25
+ var keyName = key;
26
+ return (vars[decodeURIComponent(keyName)] = value);
25
27
  });
26
28
  return vars;
27
29
  };
@@ -1 +1 @@
1
- {"version":3,"file":"gup.js","sourceRoot":"","sources":["../../ts/utils/gup.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH,sCAAsC;AACtC,EAAE;AACF,6BAA6B;AAC7B,WAAW;AACX,sKAAsK;AAC/J,IAAM,GAAG,GAAG;IACjB,IAAM,IAAI,GAA2B,EAAE,CAAC;IACxC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,yBAAyB,EAAE,UAAC,EAAU,EAAE,GAAW,EAAE,KAAa;QACjG,OAAO,CAAC,IAAI,CAAC,GAAmB,CAAC,GAAG,KAAK,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AANW,QAAA,GAAG,OAMd"}
1
+ {"version":3,"file":"gup.js","sourceRoot":"","sources":["../../ts/utils/gup.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAEH,sCAAsC;AACtC,EAAE;AACF,6BAA6B;AAC7B,WAAW;AACX,sKAAsK;AAC/J,IAAM,GAAG,GAAG;IACjB,IAAM,IAAI,GAA2B,EAAE,CAAC;IACxC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,yBAAyB,EAAE,UAAC,EAAU,EAAE,GAAW,EAAE,KAAa;QACjG,IAAM,OAAO,GAAW,GAAmB,CAAC;QAC5C,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAPW,QAAA,GAAG,OAOd"}
@@ -0,0 +1,133 @@
1
+ /**
2
+ * This snippet adds an 'arrowBounce' prototype function to all dat.GUI components.
3
+ *
4
+ * It's an adaption of the 'title' polyfill found at
5
+ * https://stackoverflow.com/questions/27362914/how-to-add-tooltips-to-dat-gui
6
+ * by greginvm
7
+ *
8
+ * @author Ikaros Kappler
9
+ * @date 2024-06-25 Copied from dat.gui and adapted for lil-gui
10
+ * version 1.0.0
11
+ **/
12
+
13
+ (function () {
14
+ /* lil.GUI copies the prototype of superclass Controller to all other controllers, so it is not enough to add it only to
15
+ the super class as the reference is not maintained */
16
+ var eachController = function (fnc) {
17
+ fnc(lil.Controller);
18
+ };
19
+
20
+ var setArrowBounce = function (v, options) {
21
+ options = options || {};
22
+ if (typeof options.fadeDelay == "undefined") {
23
+ options.fadeDelay = 5000;
24
+ }
25
+ options.fadeDelay = options.fadeDelay / 1000;
26
+ var randomkey = "arrowbounce-" + Math.round(Math.random() * Math.pow(2, 16));
27
+
28
+ var _self = this;
29
+ removeElement = function () {
30
+ _self.domElement.querySelectorAll(".arrowBounce").forEach(function (elem) {
31
+ elem.parentElement.removeChild(elem);
32
+ });
33
+ _self.domElement.style.overflow = "hidden"; // Restore old overflow
34
+ _self.domElement.style.position = "static";
35
+ };
36
+
37
+ // domElement is the root dom element of each controller
38
+ if (v) {
39
+ this.domElement.style.position = "relative";
40
+ this.domElement.style.overflow = "visible";
41
+ //this.domElement.style.overflowX = 'visible';
42
+ //this.domElement.style.overflowY = 'hidden';
43
+ var node = document.createElement("div");
44
+ node.style.position = "absolute";
45
+ // node.style.lineHeight = '24px';
46
+ node.style.left = 0;
47
+ node.style.top = 0;
48
+ node.style.transform = "translateX(-100%)";
49
+ node.style.height = "100%";
50
+ node.classList =
51
+ randomkey + " arrowBounce hideAfterNs" + (typeof options.className != "undefined" ? " " + options.className : "");
52
+ // BEGIN custom Styling
53
+ node.style.paddingRight = "1em";
54
+ // node.style.paddingTop = node.style.paddingBottom = '0em';
55
+ node.style.color = "rgb(0,0,0)";
56
+ // END custom Styling
57
+
58
+ node.innerHTML = '<div class="bounce">' + v + '&nbsp;<span style="margin-left: 3em;">➤</span></div>';
59
+ this.domElement.prepend(node);
60
+ if (typeof options.detachAfter == "number")
61
+ globalThis.setTimeout(function () {
62
+ removeElement();
63
+ }, options.detachAfter);
64
+ } else {
65
+ removeElement();
66
+ }
67
+
68
+ // --- Unfortunately IE does not support ES6 Template Literals ---
69
+ // --- So use '§' instead '$' here plus string.replace(...) ---
70
+ // Define a dynamic and local CSS class
71
+ var style = document.createElement("style");
72
+ style.innerHTML = `.§{randomkey}.hideAfterNs {
73
+ animation: fadeout 0.5s 1;
74
+ -webkit-animation: fadeout 0.5s 1;
75
+ animation-fill-mode: forwards;
76
+
77
+ animation-delay: ${options.fadeDelay}s;
78
+ -webkit-animation-delay:§{options.fadeDelay}s; /* Safari and Chrome */
79
+ -webkit-animation-fill-mode: forwards;
80
+ }`.replace(/§\{fadeTime\}/g, (options.fadeDelay / 1000).toString());
81
+ document.getElementsByTagName("head")[0].appendChild(style);
82
+ return this;
83
+ };
84
+
85
+ // Define a global CSS class
86
+ var style = document.createElement("style");
87
+ // style.type = "text/css";
88
+ style.innerHTML = `.bounce {
89
+ animation: bounce 2s infinite;
90
+ background: rgba(255,255,255,0.7);
91
+ border-radius: 8px;
92
+ padding-left: 1em;
93
+ padding-right: 1em;
94
+ display: flex;
95
+ align-items: center;
96
+ height: 100%;
97
+ }
98
+
99
+ @keyframes bounce {
100
+ 0%, 20%, 50%, 80%, 100% {
101
+ transform: translateX(0);
102
+ }
103
+ 40% {
104
+ transform: translateX(-30px);
105
+ }
106
+ 60% {
107
+ transform: translateX(-15px);
108
+ }
109
+ }
110
+ @keyframes fadeout {
111
+ from {opacity :1;}
112
+ to {opacity :0; display:none;}
113
+ }
114
+ @-webkit-keyframes fadeout {
115
+ from {opacity :1;}
116
+ to {opacity :0;display:none;}
117
+ }
118
+
119
+ /* override lil.gui style to make arrowbounce work */
120
+ .lil-gui .children {
121
+ overflow-x: visible !important;
122
+ overflow-y: visible !important;
123
+ }
124
+ `;
125
+ document.getElementsByTagName("head")[0].appendChild(style);
126
+
127
+ // Install the new feature
128
+ eachController(function (controller) {
129
+ if (!controller.prototype.hasOwnProperty("arrowBounce")) {
130
+ controller.prototype.arrowBounce = setArrowBounce;
131
+ }
132
+ });
133
+ })();
@@ -0,0 +1,32 @@
1
+ /* lil.GUI copies the prototype of superclass Controller to all other controllers, so it is not enough to add it only to
2
+ the super class as the reference is not maintained */
3
+
4
+ (function () {
5
+ var eachController = function (fnc) {
6
+ // Only in super controller required (?)
7
+ fnc(lil.Controller);
8
+ fnc(lil.BooleanController);
9
+ fnc(lil.ColorController);
10
+ fnc(lil.FunctionController);
11
+ fnc(lil.OptionController);
12
+ fnc(lil.NumberController);
13
+ fnc(lil.StringController);
14
+ };
15
+
16
+ var setTitle = function (v) {
17
+ // __li is the root dom element of each controller
18
+ // console.log("Controller", v, this);
19
+ if (v) {
20
+ this.domElement.setAttribute("title", v);
21
+ } else {
22
+ this.domElement.removeAttribute("title");
23
+ }
24
+ return this;
25
+ };
26
+
27
+ eachController(function (controller) {
28
+ if (!controller.prototype.hasOwnProperty("title")) {
29
+ controller.prototype.title = setTitle;
30
+ }
31
+ });
32
+ })();
@@ -83,7 +83,10 @@
83
83
  * @modified 2023-02-10 Cleaning up most type errors in the main class (mostly null checks).
84
84
  * @modified 2023-02-10 Adding `enableZoom` and `enablePan` (both default true) to have the option to disable these functions.
85
85
  * @modified 2023-09-29 Adding proper dicionary key and value types to the params of `PlotBoilerplate.utils.safeMergeByKeys` (was `object` before).
86
- * @version 1.17.3
86
+ * @modified 2024-07-08 Adding `PlotBoilerplate.getGUI()` to retrieve the GUI instance.
87
+ * @modified 2024-08-25 Extending main class `PlotBoilerplate` optional param `isBackdropFiltersEnabled`.
88
+ *
89
+ * @version 1.19.0
87
90
  *
88
91
  * @file PlotBoilerplate
89
92
  * @fileoverview The main class.
@@ -95,7 +98,8 @@ import { Bounds } from "./Bounds";
95
98
  import { Grid } from "./Grid";
96
99
  import { Polygon } from "./Polygon";
97
100
  import { Vertex } from "./Vertex";
98
- import { IDraggable, Config, DrawLib, Drawable, DrawConfig, IHooks, PBParams, XYCoords, XYDimension, DatGuiProps } from "./interfaces";
101
+ import { IDraggable, Config, DrawLib, Drawable, DrawConfig, IHooks, PBParams, XYCoords, XYDimension, DatGuiProps, // DEPRECATED. Please do not use any more.
102
+ LilGuiProps } from "./interfaces";
99
103
  /**
100
104
  * @classdesc The main class of the PlotBoilerplate.
101
105
  *
@@ -263,6 +267,10 @@ export declare class PlotBoilerplate {
263
267
  * @private
264
268
  */
265
269
  private renderTime;
270
+ /**
271
+ * A storage variable for retrieving the GUI instance once it was created.
272
+ */
273
+ private _gui;
266
274
  /**
267
275
  * The constructor.
268
276
  *
@@ -784,7 +792,13 @@ export declare class PlotBoilerplate {
784
792
  * @memberof PlotBoilerplate
785
793
  * @return {dat.gui.GUI}
786
794
  **/
787
- createGUI(props?: DatGuiProps): GUI;
795
+ createGUI(props?: DatGuiProps | LilGuiProps): GUI;
796
+ /**
797
+ * Retriebe the GUI once it was created. If the `createGUI` method was not called or failed to create any
798
+ * GUI then null is returned.
799
+ * @returns {GUI | null}
800
+ */
801
+ getGUI(): GUI | null;
788
802
  /**
789
803
  * A set of helper functions.
790
804
  **/
@@ -83,7 +83,10 @@
83
83
  * @modified 2023-02-10 Cleaning up most type errors in the main class (mostly null checks).
84
84
  * @modified 2023-02-10 Adding `enableZoom` and `enablePan` (both default true) to have the option to disable these functions.
85
85
  * @modified 2023-09-29 Adding proper dicionary key and value types to the params of `PlotBoilerplate.utils.safeMergeByKeys` (was `object` before).
86
- * @version 1.17.3
86
+ * @modified 2024-07-08 Adding `PlotBoilerplate.getGUI()` to retrieve the GUI instance.
87
+ * @modified 2024-08-25 Extending main class `PlotBoilerplate` optional param `isBackdropFiltersEnabled`.
88
+ *
89
+ * @version 1.19.0
87
90
  *
88
91
  * @file PlotBoilerplate
89
92
  * @fileoverview The main class.
@@ -217,6 +220,10 @@ export class PlotBoilerplate {
217
220
  * @private
218
221
  */
219
222
  this.renderTime = 0;
223
+ /**
224
+ * A storage variable for retrieving the GUI instance once it was created.
225
+ */
226
+ this._gui = null;
220
227
  // This should be in some static block ...
221
228
  VertexAttr.model = {
222
229
  bezierAutoAdjust: false,
@@ -283,7 +290,8 @@ export class PlotBoilerplate {
283
290
  enableZoom: f.bool(config, "enableZoom", true), // default=true
284
291
  enablePan: f.bool(config, "enablePan", true), // default=true
285
292
  // Experimental (and unfinished)
286
- enableGL: f.bool(config, "enableGL", false)
293
+ enableGL: f.bool(config, "enableGL", false),
294
+ isBackdropFiltersEnabled: f.bool(config, "isBackdropFiltersEnabled", true)
287
295
  }; // END confog
288
296
  /**
289
297
  * Configuration for drawing things.
@@ -1759,7 +1767,8 @@ export class PlotBoilerplate {
1759
1767
  return { x: pos.x - bounds.left, y: pos.y - bounds.top };
1760
1768
  };
1761
1769
  // Make PB work together with both, AlloyFinger as a esm module or a commonjs function.
1762
- if (typeof globalThis["AlloyFinger"] === "function" || typeof globalThis["createAlloyFinger"] === "function") {
1770
+ if (typeof globalThis["AlloyFinger"] === "function" ||
1771
+ typeof globalThis["createAlloyFinger"] === "function") {
1763
1772
  try {
1764
1773
  var touchMovePos = null;
1765
1774
  var touchDownPos = null;
@@ -1958,12 +1967,20 @@ export class PlotBoilerplate {
1958
1967
  // if (globalThis["utils"] && typeof globalThis["utils"].createGUI == "function") {
1959
1968
  // return (globalThis["utils" as keyof Object] as any as ({createGUI : (pb:PlotBoilerplate,props:DatGuiProps|undefined)=>GUI })).createGUI(this, props);
1960
1969
  if (utils && typeof utils.createGUI === "function") {
1961
- return utils.createGUI(this, props);
1970
+ return (this._gui = utils.createGUI(this, props));
1962
1971
  }
1963
1972
  else {
1964
- throw "Cannot create dat.GUI instance; did you load the ./utils/creategui helper function an the dat.GUI library?";
1973
+ throw "Cannot create dat.GUI or lil-gui instance; did you load the ./utils/creategui helper function an the dat.GUI/lil-gui library?";
1965
1974
  }
1966
1975
  }
1976
+ /**
1977
+ * Retriebe the GUI once it was created. If the `createGUI` method was not called or failed to create any
1978
+ * GUI then null is returned.
1979
+ * @returns {GUI | null}
1980
+ */
1981
+ getGUI() {
1982
+ return this._gui;
1983
+ }
1967
1984
  } // END class PlotBoilerplate
1968
1985
  /** @constant {number} */
1969
1986
  PlotBoilerplate.DEFAULT_CANVAS_WIDTH = 1024;