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.
- package/README.md +1 -1
- package/dist/index.esm.js +32 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/plotboilerplate.browser.min.js +1 -1
- package/dist/plotboilerplate.browser.min.js.map +1 -1
- package/dist/plotboilerplate.js +32 -11
- package/dist/plotboilerplate.min.js +1 -1
- package/package.json +3 -1
- package/src/cjs/PlotBoilerplate.d.ts +17 -3
- package/src/cjs/PlotBoilerplate.js +22 -5
- package/src/cjs/PlotBoilerplate.js.map +1 -1
- package/src/cjs/drawutilssvg.d.ts +6 -1
- package/src/cjs/drawutilssvg.js +10 -6
- package/src/cjs/drawutilssvg.js.map +1 -1
- package/src/cjs/interfaces/core.d.ts +4 -2
- package/src/cjs/interfaces/core.js +1 -0
- package/src/cjs/interfaces/core.js.map +1 -1
- package/src/cjs/interfaces/externals.d.ts +42 -0
- package/src/cjs/utils/InitializationObserver.d.ts +18 -0
- package/src/cjs/utils/InitializationObserver.js +63 -0
- package/src/cjs/utils/InitializationObserver.js.map +1 -0
- package/src/cjs/utils/Params.d.ts +5 -3
- package/src/cjs/utils/Params.js +7 -3
- package/src/cjs/utils/Params.js.map +1 -1
- package/src/cjs/utils/creategui.js +386 -250
- package/src/cjs/utils/dat.gui.arrowbounce.polyfill.js +74 -73
- package/src/cjs/utils/dat.gui.title.polyfill.js +9 -7
- package/src/cjs/utils/dom/guiSizeToggler.d.ts +17 -0
- package/src/cjs/utils/dom/guiSizeToggler.js +42 -0
- package/src/cjs/utils/dom/guiSizeToggler.js.map +1 -0
- package/src/cjs/utils/gup.d.ts +1 -0
- package/src/cjs/utils/gup.js +3 -1
- package/src/cjs/utils/gup.js.map +1 -1
- package/src/cjs/utils/lil.gui.arrowbounce.polyfill.js +133 -0
- package/src/cjs/utils/lil.gui.title.polyfill.js +32 -0
- package/src/esm/PlotBoilerplate.d.ts +17 -3
- package/src/esm/PlotBoilerplate.js +22 -5
- package/src/esm/PlotBoilerplate.js.map +1 -1
- package/src/esm/drawutilssvg.d.ts +6 -1
- package/src/esm/drawutilssvg.js +10 -6
- package/src/esm/drawutilssvg.js.map +1 -1
- package/src/esm/interfaces/core.d.ts +4 -2
- package/src/esm/interfaces/core.js +1 -0
- package/src/esm/interfaces/core.js.map +1 -1
- package/src/esm/interfaces/externals.d.ts +42 -0
- package/src/esm/utils/InitializationObserver.d.ts +18 -0
- package/src/esm/utils/InitializationObserver.js +57 -0
- package/src/esm/utils/InitializationObserver.js.map +1 -0
- package/src/esm/utils/Params.d.ts +5 -3
- package/src/esm/utils/Params.js +7 -3
- package/src/esm/utils/Params.js.map +1 -1
- package/src/esm/utils/dom/guiSizeToggler.d.ts +17 -0
- package/src/esm/utils/dom/guiSizeToggler.js +38 -0
- package/src/esm/utils/dom/guiSizeToggler.js.map +1 -0
- package/src/esm/utils/gup.d.ts +1 -0
- package/src/esm/utils/gup.js +3 -1
- package/src/esm/utils/gup.js.map +1 -1
- package/src/index-gl.js +3 -1
- package/src/index.js +2 -1
- package/src/ts/PlotBoilerplate.ts +42 -11
- package/src/ts/drawutilssvg.ts +17 -6
- package/src/ts/interfaces/core.ts +5 -2
- package/src/ts/interfaces/externals.ts +50 -0
- package/src/ts/utils/InitializationObserver.ts +70 -0
- package/src/ts/utils/Params.ts +8 -3
- package/src/ts/utils/dom/guiSizeToggler.ts +45 -0
- package/src/ts/utils/gup.ts +3 -1
package/README.md
CHANGED
|
@@ -304,7 +304,7 @@ var pb = new PlotBoilerplate({
|
|
|
304
304
|
|
|
305
305
|
// string
|
|
306
306
|
// A background color (CSS string) for the canvas.
|
|
307
|
-
backgroundColor: "#ffffff",
|
|
307
|
+
backgroundColor: isDarkmode ? "#000000" : "#ffffff",
|
|
308
308
|
|
|
309
309
|
// boolean
|
|
310
310
|
// Switch auto-redrawing on resize on/off (some applications
|
package/dist/index.esm.js
CHANGED
|
@@ -4711,7 +4711,8 @@ CircleSector.circleSectorUtils = {
|
|
|
4711
4711
|
* @modified 2023-10-04 Adding `strokeOptions` param to these draw function: line, arrow, cubicBezierArrow, cubicBezier, cubicBezierPath, circle, circleArc, ellipse, square, rect, polygon, polyline.
|
|
4712
4712
|
* @modified 2024-01-30 Fixing an issue with immutable style sets; changes to the global draw config did not reflect here (do now).
|
|
4713
4713
|
* @modified 2024-03-10 Fixing some types for Typescript 5 compatibility.
|
|
4714
|
-
* @
|
|
4714
|
+
* @modified 2024-07-24 Caching custom style defs in a private buffer variable.
|
|
4715
|
+
* @version 1.6.10
|
|
4715
4716
|
**/
|
|
4716
4717
|
const RAD_TO_DEG = 180 / Math.PI;
|
|
4717
4718
|
/**
|
|
@@ -4819,6 +4820,13 @@ class drawutilssvg {
|
|
|
4819
4820
|
console.warn(`Warning: your draw config is missing the key '${k}' which is required.`);
|
|
4820
4821
|
}
|
|
4821
4822
|
}
|
|
4823
|
+
if (this.customStyleDefs) {
|
|
4824
|
+
rules.push("\n/* Custom styles */\n");
|
|
4825
|
+
this.customStyleDefs.forEach((value, key) => {
|
|
4826
|
+
rules.push(key + " { " + value + " }");
|
|
4827
|
+
});
|
|
4828
|
+
// this.nodeStyle.innerHTML += "\n/* Custom styles */\n" + rules.join("\n");
|
|
4829
|
+
}
|
|
4822
4830
|
this.nodeStyle.innerHTML = rules.join("\n");
|
|
4823
4831
|
}
|
|
4824
4832
|
/**
|
|
@@ -4842,11 +4850,7 @@ class drawutilssvg {
|
|
|
4842
4850
|
* @param {Map<string,string>} defs
|
|
4843
4851
|
*/
|
|
4844
4852
|
addCustomStyleDefs(defs) {
|
|
4845
|
-
|
|
4846
|
-
defs.forEach((value, key) => {
|
|
4847
|
-
buffer.push(key + " { " + value + " }");
|
|
4848
|
-
});
|
|
4849
|
-
this.nodeStyle.innerHTML += "\n/* Custom styles */\n" + buffer.join("\n");
|
|
4853
|
+
this.customStyleDefs = defs;
|
|
4850
4854
|
}
|
|
4851
4855
|
/**
|
|
4852
4856
|
* Retieve an old (cached) element.
|
|
@@ -10892,7 +10896,10 @@ VEllipseSector.ellipseSectorUtils = {
|
|
|
10892
10896
|
* @modified 2023-02-10 Cleaning up most type errors in the main class (mostly null checks).
|
|
10893
10897
|
* @modified 2023-02-10 Adding `enableZoom` and `enablePan` (both default true) to have the option to disable these functions.
|
|
10894
10898
|
* @modified 2023-09-29 Adding proper dicionary key and value types to the params of `PlotBoilerplate.utils.safeMergeByKeys` (was `object` before).
|
|
10895
|
-
* @
|
|
10899
|
+
* @modified 2024-07-08 Adding `PlotBoilerplate.getGUI()` to retrieve the GUI instance.
|
|
10900
|
+
* @modified 2024-08-25 Extending main class `PlotBoilerplate` optional param `isBackdropFiltersEnabled`.
|
|
10901
|
+
*
|
|
10902
|
+
* @version 1.19.0
|
|
10896
10903
|
*
|
|
10897
10904
|
* @file PlotBoilerplate
|
|
10898
10905
|
* @fileoverview The main class.
|
|
@@ -11005,6 +11012,10 @@ class PlotBoilerplate {
|
|
|
11005
11012
|
* @private
|
|
11006
11013
|
*/
|
|
11007
11014
|
this.renderTime = 0;
|
|
11015
|
+
/**
|
|
11016
|
+
* A storage variable for retrieving the GUI instance once it was created.
|
|
11017
|
+
*/
|
|
11018
|
+
this._gui = null;
|
|
11008
11019
|
// This should be in some static block ...
|
|
11009
11020
|
VertexAttr.model = {
|
|
11010
11021
|
bezierAutoAdjust: false,
|
|
@@ -11071,7 +11082,8 @@ class PlotBoilerplate {
|
|
|
11071
11082
|
enableZoom: f.bool(config, "enableZoom", true), // default=true
|
|
11072
11083
|
enablePan: f.bool(config, "enablePan", true), // default=true
|
|
11073
11084
|
// Experimental (and unfinished)
|
|
11074
|
-
enableGL: f.bool(config, "enableGL", false)
|
|
11085
|
+
enableGL: f.bool(config, "enableGL", false),
|
|
11086
|
+
isBackdropFiltersEnabled: f.bool(config, "isBackdropFiltersEnabled", true)
|
|
11075
11087
|
}; // END confog
|
|
11076
11088
|
/**
|
|
11077
11089
|
* Configuration for drawing things.
|
|
@@ -12547,7 +12559,8 @@ class PlotBoilerplate {
|
|
|
12547
12559
|
return { x: pos.x - bounds.left, y: pos.y - bounds.top };
|
|
12548
12560
|
};
|
|
12549
12561
|
// Make PB work together with both, AlloyFinger as a esm module or a commonjs function.
|
|
12550
|
-
if (typeof globalThis["AlloyFinger"] === "function" ||
|
|
12562
|
+
if (typeof globalThis["AlloyFinger"] === "function" ||
|
|
12563
|
+
typeof globalThis["createAlloyFinger"] === "function") {
|
|
12551
12564
|
try {
|
|
12552
12565
|
var touchMovePos = null;
|
|
12553
12566
|
var touchDownPos = null;
|
|
@@ -12746,12 +12759,20 @@ class PlotBoilerplate {
|
|
|
12746
12759
|
// if (globalThis["utils"] && typeof globalThis["utils"].createGUI == "function") {
|
|
12747
12760
|
// return (globalThis["utils" as keyof Object] as any as ({createGUI : (pb:PlotBoilerplate,props:DatGuiProps|undefined)=>GUI })).createGUI(this, props);
|
|
12748
12761
|
if (utils && typeof utils.createGUI === "function") {
|
|
12749
|
-
return utils.createGUI(this, props);
|
|
12762
|
+
return (this._gui = utils.createGUI(this, props));
|
|
12750
12763
|
}
|
|
12751
12764
|
else {
|
|
12752
|
-
throw "Cannot create dat.GUI instance; did you load the ./utils/creategui helper function an the dat.GUI library?";
|
|
12765
|
+
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
12766
|
}
|
|
12754
12767
|
}
|
|
12768
|
+
/**
|
|
12769
|
+
* Retriebe the GUI once it was created. If the `createGUI` method was not called or failed to create any
|
|
12770
|
+
* GUI then null is returned.
|
|
12771
|
+
* @returns {GUI | null}
|
|
12772
|
+
*/
|
|
12773
|
+
getGUI() {
|
|
12774
|
+
return this._gui;
|
|
12775
|
+
}
|
|
12755
12776
|
} // END class PlotBoilerplate
|
|
12756
12777
|
/** @constant {number} */
|
|
12757
12778
|
PlotBoilerplate.DEFAULT_CANVAS_WIDTH = 1024;
|