plotboilerplate 1.23.1 → 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 +14 -8
- 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 +14 -8
- package/dist/plotboilerplate.min.js +1 -1
- package/package.json +1 -1
- package/src/cjs/PlotBoilerplate.d.ts +2 -1
- package/src/cjs/PlotBoilerplate.js +4 -2
- 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 +30 -0
- package/src/cjs/utils/InitializationObserver.js +7 -0
- package/src/cjs/utils/InitializationObserver.js.map +1 -1
- 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 +69 -1
- 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/esm/PlotBoilerplate.d.ts +2 -1
- package/src/esm/PlotBoilerplate.js +4 -2
- 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 +30 -0
- package/src/esm/utils/InitializationObserver.js +7 -0
- package/src/esm/utils/InitializationObserver.js.map +1 -1
- 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/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 +5 -2
- package/src/ts/drawutilssvg.ts +17 -6
- package/src/ts/interfaces/core.ts +5 -2
- package/src/ts/interfaces/externals.ts +34 -0
- package/src/ts/utils/InitializationObserver.ts +7 -0
- package/src/ts/utils/Params.ts +8 -3
- package/src/ts/utils/gup.ts +3 -1
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* @modified 2022-11-23 Added `drawRaster` to the `Config` interface.
|
|
20
20
|
* @modified 2023-02-10 All non-function attributes of the `Config` interface are now mandatory.
|
|
21
21
|
* @modified 2023-09-29 Added the `randomPoint(...)` function declaration to the IBounds interface.
|
|
22
|
+
* @modified 2024-08-25 Added the `CSSBackdropFilterParams` params to the global params (all optional).
|
|
22
23
|
**/
|
|
23
24
|
import { Vertex } from "../Vertex";
|
|
24
25
|
import { Vector } from "../Vector";
|
|
@@ -34,6 +35,7 @@ import { Line } from "../Line";
|
|
|
34
35
|
import { PlotBoilerplate } from "../PlotBoilerplate";
|
|
35
36
|
import { DrawLib } from "./DrawLib";
|
|
36
37
|
import { PBText } from "../PBText";
|
|
38
|
+
import { CSSBackdropFilterParams } from "./externals";
|
|
37
39
|
/**
|
|
38
40
|
* @classdesc Coordinates (x,y) on the plane.
|
|
39
41
|
*
|
|
@@ -93,7 +95,7 @@ export interface CanvasWrapper {
|
|
|
93
95
|
/**
|
|
94
96
|
* The config that's used by PB.
|
|
95
97
|
*/
|
|
96
|
-
export interface Config extends Record<string, boolean | number | string | Function | HTMLCanvasElement | SVGElement | undefined> {
|
|
98
|
+
export interface Config extends Record<string, boolean | number | string | Function | HTMLCanvasElement | SVGElement | undefined>, Pick<CSSBackdropFilterParams, "isBackdropFiltersEnabled"> {
|
|
97
99
|
canvas: HTMLCanvasElement | SVGElement | string;
|
|
98
100
|
fullSize: boolean;
|
|
99
101
|
fitToParent: boolean;
|
|
@@ -137,7 +139,7 @@ export interface Config extends Record<string, boolean | number | string | Funct
|
|
|
137
139
|
/**
|
|
138
140
|
* For initialization the constructor needs a mix of config and draw-settings.
|
|
139
141
|
*/
|
|
140
|
-
export interface PBParams extends Config {
|
|
142
|
+
export interface PBParams extends Config, CSSBackdropFilterParams {
|
|
141
143
|
title?: string;
|
|
142
144
|
}
|
|
143
145
|
export interface DrawSettings {
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* @modified 2022-11-23 Added `drawRaster` to the `Config` interface.
|
|
20
20
|
* @modified 2023-02-10 All non-function attributes of the `Config` interface are now mandatory.
|
|
21
21
|
* @modified 2023-09-29 Added the `randomPoint(...)` function declaration to the IBounds interface.
|
|
22
|
+
* @modified 2024-08-25 Added the `CSSBackdropFilterParams` params to the global params (all optional).
|
|
22
23
|
**/
|
|
23
24
|
export {};
|
|
24
25
|
//# sourceMappingURL=core.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../ts/interfaces/core.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../ts/interfaces/core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;IAsBI"}
|
|
@@ -24,3 +24,33 @@ export interface LilGuiProps {
|
|
|
24
24
|
closed?: boolean;
|
|
25
25
|
closeOnTop?: boolean;
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* This is just for the backdrop-filter vaules (CSS after effects filters). They are not directly
|
|
29
|
+
* used by PB but can be passed through by the config/params.
|
|
30
|
+
*/
|
|
31
|
+
export interface CSSBackdropFilterParams {
|
|
32
|
+
isBackdropFiltersEnabled?: boolean;
|
|
33
|
+
effectFilterColor?: string;
|
|
34
|
+
isEffectsColorEnabled?: boolean;
|
|
35
|
+
opacity?: number;
|
|
36
|
+
isOpacityEnabled?: boolean;
|
|
37
|
+
invert?: number;
|
|
38
|
+
isInvertEnabled?: boolean;
|
|
39
|
+
sepia?: number;
|
|
40
|
+
isSepiaEnabled?: boolean;
|
|
41
|
+
blur?: number;
|
|
42
|
+
isBlurEnabled?: boolean;
|
|
43
|
+
brightness?: number;
|
|
44
|
+
isBrightnessEnabled?: boolean;
|
|
45
|
+
contrast?: number;
|
|
46
|
+
isContrastEnabled?: boolean;
|
|
47
|
+
dropShadow?: number;
|
|
48
|
+
dropShadowColor?: string;
|
|
49
|
+
isDropShadowEnabled?: boolean;
|
|
50
|
+
grayscale?: number;
|
|
51
|
+
isGrayscaleEnabled?: boolean;
|
|
52
|
+
hueRotate?: number;
|
|
53
|
+
isHueRotateEnabled?: boolean;
|
|
54
|
+
saturate?: number;
|
|
55
|
+
isSaturateEnabled?: boolean;
|
|
56
|
+
}
|
|
@@ -11,6 +11,10 @@ export class InitializationObserver {
|
|
|
11
11
|
this._timeoutMessage = timeoutMessage !== null && timeoutMessage !== void 0 ? timeoutMessage : null;
|
|
12
12
|
globalThis.setTimeout(() => {
|
|
13
13
|
var _a;
|
|
14
|
+
if (this._isInitialized) {
|
|
15
|
+
return; // NOOP
|
|
16
|
+
}
|
|
17
|
+
// else
|
|
14
18
|
if (!this._timeoutMessage) {
|
|
15
19
|
console.warn("Failed to initialize object. Reason unknown.");
|
|
16
20
|
}
|
|
@@ -18,6 +22,9 @@ export class InitializationObserver {
|
|
|
18
22
|
}, timeout);
|
|
19
23
|
}
|
|
20
24
|
accept(value) {
|
|
25
|
+
if (this._isInitialized) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
21
28
|
this._isInitialized = true;
|
|
22
29
|
this._initializedValue = value;
|
|
23
30
|
this._fireAccept(value);
|
|
@@ -1 +1 @@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AAC;IAC1B,CAAC;IAEO,WAAW,CAAC,KAAQ;QAC1B,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACrC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,WAAW,CAAC,KAAe;QACjC,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACrC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,kBAAkB;QAChB,MAAM,KAAK,GAAG,IAAI,CAAC;QACnB,2DAA2D;QAC3D,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;YACzB,OAAO,IAAI,OAAO,CAAI,CAAC,MAA0B,EAAE,MAAiC,EAAE,EAAE;gBACtF,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;YAClC,CAAC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,OAAO,CAAI,CAAC,MAA0B,EAAE,MAAiC,EAAE,EAAE;gBACtF,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YACpD,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF"}
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
* Wraps a Record<string,string> and adds type conversion methods (developed this in
|
|
3
3
|
* some other project) and added this here (2023-10-28).
|
|
4
4
|
*
|
|
5
|
-
* @author
|
|
6
|
-
* @version
|
|
7
|
-
* @date
|
|
5
|
+
* @author Ikars Kappler
|
|
6
|
+
* @version 1.0.0
|
|
7
|
+
* @date 2023-03-13
|
|
8
|
+
* @modified 2024-08-26 Added the `hasParam` method.
|
|
8
9
|
*/
|
|
9
10
|
export declare class Params {
|
|
10
11
|
baseParams: Record<string, string>;
|
|
11
12
|
constructor(baseParams: Record<string, string>);
|
|
13
|
+
hasParam(name: string): boolean;
|
|
12
14
|
getString(name: string, fallback: string): string;
|
|
13
15
|
getNumber(name: string, fallback: number): number;
|
|
14
16
|
getBoolean(name: string, fallback: boolean): boolean;
|
package/src/esm/utils/Params.js
CHANGED
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
* Wraps a Record<string,string> and adds type conversion methods (developed this in
|
|
3
3
|
* some other project) and added this here (2023-10-28).
|
|
4
4
|
*
|
|
5
|
-
* @author
|
|
6
|
-
* @version
|
|
7
|
-
* @date
|
|
5
|
+
* @author Ikars Kappler
|
|
6
|
+
* @version 1.0.0
|
|
7
|
+
* @date 2023-03-13
|
|
8
|
+
* @modified 2024-08-26 Added the `hasParam` method.
|
|
8
9
|
*/
|
|
9
10
|
export class Params {
|
|
10
11
|
constructor(baseParams) {
|
|
11
12
|
this.baseParams = baseParams;
|
|
12
13
|
}
|
|
14
|
+
hasParam(name) {
|
|
15
|
+
return this.baseParams.hasOwnProperty(name);
|
|
16
|
+
}
|
|
13
17
|
getString(name, fallback) {
|
|
14
18
|
let value = this.baseParams[name];
|
|
15
19
|
if (typeof value === "undefined" || !value || (value = value.trim()).length === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Params.js","sourceRoot":"","sources":["../../ts/utils/Params.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Params.js","sourceRoot":"","sources":["../../ts/utils/Params.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,OAAO,MAAM;IAGjB,YAAY,UAAkC;QAC5C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED,QAAQ,CAAC,IAAY;QACnB,OAAO,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;IAED,SAAS,CAAC,IAAY,EAAE,QAAgB;QACtC,IAAI,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;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K,EAAE,CAAC;YACnH,OAAO,KAAK,CAAC;QACf,CAAC;aAAM,CAAC;YACN,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;CACF"}
|
package/src/esm/utils/gup.d.ts
CHANGED
package/src/esm/utils/gup.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
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
|
// Get the URI GET params as an assoc.
|
|
14
15
|
//
|
|
@@ -18,7 +19,8 @@
|
|
|
18
19
|
export const gup = () => {
|
|
19
20
|
const vars = {};
|
|
20
21
|
globalThis.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, (_m, key, value) => {
|
|
21
|
-
|
|
22
|
+
const keyName = key;
|
|
23
|
+
return (vars[decodeURIComponent(keyName)] = value);
|
|
22
24
|
});
|
|
23
25
|
return vars;
|
|
24
26
|
};
|
package/src/esm/utils/gup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gup.js","sourceRoot":"","sources":["../../ts/utils/gup.ts"],"names":[],"mappings":"AAAA
|
|
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;AACtK,MAAM,CAAC,MAAM,GAAG,GAAG,GAA2B,EAAE;IAC9C,MAAM,IAAI,GAA2B,EAAE,CAAC;IACxC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,yBAAyB,EAAE,CAAC,EAAU,EAAE,GAAW,EAAE,KAAa,EAAU,EAAE;QAC7G,MAAM,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"}
|
package/src/index-gl.js
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
// Fetch the GET params
|
|
17
17
|
let GUP = gup();
|
|
18
|
+
var isDarkmode = detectDarkMode(GUP);
|
|
19
|
+
var isDarkmode = detectDarkMode(GUP);
|
|
18
20
|
|
|
19
21
|
window.addEventListener("load", function () {
|
|
20
22
|
// All config params are optional.
|
|
@@ -40,7 +42,7 @@
|
|
|
40
42
|
autoAdjustOffset: true,
|
|
41
43
|
offsetAdjustXPercent: 50,
|
|
42
44
|
offsetAdjustYPercent: 50,
|
|
43
|
-
backgroundColor: "#ffffff",
|
|
45
|
+
backgroundColor: isDarkmode ? "#000000" : "#ffffff",
|
|
44
46
|
enableMouse: true,
|
|
45
47
|
enableTouch: true,
|
|
46
48
|
enableKeys: true,
|
package/src/index.js
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
window.pbInitialized = true;
|
|
24
24
|
// Fetch the GET params
|
|
25
25
|
let GUP = gup();
|
|
26
|
+
var isDarkmode = detectDarkMode(GUP);
|
|
26
27
|
var isInitialized = false;
|
|
27
28
|
|
|
28
29
|
// All config params are optional.
|
|
@@ -49,7 +50,7 @@
|
|
|
49
50
|
offsetAdjustXPercent: 50,
|
|
50
51
|
offsetAdjustYPercent: 50,
|
|
51
52
|
autoDetectRetina: false,
|
|
52
|
-
backgroundColor: "#ffffff",
|
|
53
|
+
backgroundColor: isDarkmode ? "#000000" : "#ffffff",
|
|
53
54
|
enableMouse: true,
|
|
54
55
|
enableTouch: true,
|
|
55
56
|
enableKeys: true,
|
|
@@ -84,8 +84,9 @@
|
|
|
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
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`.
|
|
87
88
|
*
|
|
88
|
-
* @version 1.
|
|
89
|
+
* @version 1.19.0
|
|
89
90
|
*
|
|
90
91
|
* @file PlotBoilerplate
|
|
91
92
|
* @fileoverview The main class.
|
|
@@ -469,7 +470,9 @@ export class PlotBoilerplate {
|
|
|
469
470
|
enablePan: f.bool(config, "enablePan", true), // default=true
|
|
470
471
|
|
|
471
472
|
// Experimental (and unfinished)
|
|
472
|
-
enableGL: f.bool(config, "enableGL", false)
|
|
473
|
+
enableGL: f.bool(config, "enableGL", false),
|
|
474
|
+
|
|
475
|
+
isBackdropFiltersEnabled: f.bool(config, "isBackdropFiltersEnabled", true)
|
|
473
476
|
}; // END confog
|
|
474
477
|
|
|
475
478
|
/**
|
package/src/ts/drawutilssvg.ts
CHANGED
|
@@ -46,7 +46,8 @@
|
|
|
46
46
|
* @modified 2023-10-04 Adding `strokeOptions` param to these draw function: line, arrow, cubicBezierArrow, cubicBezier, cubicBezierPath, circle, circleArc, ellipse, square, rect, polygon, polyline.
|
|
47
47
|
* @modified 2024-01-30 Fixing an issue with immutable style sets; changes to the global draw config did not reflect here (do now).
|
|
48
48
|
* @modified 2024-03-10 Fixing some types for Typescript 5 compatibility.
|
|
49
|
-
* @
|
|
49
|
+
* @modified 2024-07-24 Caching custom style defs in a private buffer variable.
|
|
50
|
+
* @version 1.6.10
|
|
50
51
|
**/
|
|
51
52
|
|
|
52
53
|
import { CircleSector } from "./CircleSector";
|
|
@@ -202,6 +203,11 @@ export class drawutilssvg implements DrawLib<void | SVGElement> {
|
|
|
202
203
|
*/
|
|
203
204
|
private drawConfig: DrawConfig;
|
|
204
205
|
|
|
206
|
+
/**
|
|
207
|
+
* A buffer element for custom style defs (will be re-generated on each draw cycle).
|
|
208
|
+
*/
|
|
209
|
+
private customStyleDefs: Map<string, string>;
|
|
210
|
+
|
|
205
211
|
/**
|
|
206
212
|
* Passed from primary to secondary instance.
|
|
207
213
|
*/
|
|
@@ -312,6 +318,15 @@ export class drawutilssvg implements DrawLib<void | SVGElement> {
|
|
|
312
318
|
console.warn(`Warning: your draw config is missing the key '${k}' which is required.`);
|
|
313
319
|
}
|
|
314
320
|
}
|
|
321
|
+
|
|
322
|
+
if (this.customStyleDefs) {
|
|
323
|
+
rules.push("\n/* Custom styles */\n");
|
|
324
|
+
this.customStyleDefs.forEach((value: string, key: string) => {
|
|
325
|
+
rules.push(key + " { " + value + " }");
|
|
326
|
+
});
|
|
327
|
+
// this.nodeStyle.innerHTML += "\n/* Custom styles */\n" + rules.join("\n");
|
|
328
|
+
}
|
|
329
|
+
|
|
315
330
|
this.nodeStyle.innerHTML = rules.join("\n");
|
|
316
331
|
}
|
|
317
332
|
|
|
@@ -337,11 +352,7 @@ export class drawutilssvg implements DrawLib<void | SVGElement> {
|
|
|
337
352
|
* @param {Map<string,string>} defs
|
|
338
353
|
*/
|
|
339
354
|
addCustomStyleDefs(defs: Map<string, string>) {
|
|
340
|
-
|
|
341
|
-
defs.forEach((value: string, key: string) => {
|
|
342
|
-
buffer.push(key + " { " + value + " }");
|
|
343
|
-
});
|
|
344
|
-
this.nodeStyle.innerHTML += "\n/* Custom styles */\n" + buffer.join("\n");
|
|
355
|
+
this.customStyleDefs = defs;
|
|
345
356
|
}
|
|
346
357
|
|
|
347
358
|
/**
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* @modified 2022-11-23 Added `drawRaster` to the `Config` interface.
|
|
20
20
|
* @modified 2023-02-10 All non-function attributes of the `Config` interface are now mandatory.
|
|
21
21
|
* @modified 2023-09-29 Added the `randomPoint(...)` function declaration to the IBounds interface.
|
|
22
|
+
* @modified 2024-08-25 Added the `CSSBackdropFilterParams` params to the global params (all optional).
|
|
22
23
|
**/
|
|
23
24
|
|
|
24
25
|
import { Vertex } from "../Vertex";
|
|
@@ -35,6 +36,7 @@ import { Line } from "../Line";
|
|
|
35
36
|
import { PlotBoilerplate } from "../PlotBoilerplate";
|
|
36
37
|
import { DrawLib } from "./DrawLib";
|
|
37
38
|
import { PBText } from "../PBText";
|
|
39
|
+
import { CSSBackdropFilterParams } from "./externals";
|
|
38
40
|
|
|
39
41
|
/**
|
|
40
42
|
* @classdesc Coordinates (x,y) on the plane.
|
|
@@ -113,7 +115,8 @@ export interface CanvasWrapper {
|
|
|
113
115
|
* The config that's used by PB.
|
|
114
116
|
*/
|
|
115
117
|
export interface Config
|
|
116
|
-
extends Record<string, boolean | number | string | Function | HTMLCanvasElement | SVGElement | undefined
|
|
118
|
+
extends Record<string, boolean | number | string | Function | HTMLCanvasElement | SVGElement | undefined>,
|
|
119
|
+
Pick<CSSBackdropFilterParams, "isBackdropFiltersEnabled"> {
|
|
117
120
|
canvas: HTMLCanvasElement | SVGElement | string; // Your canvas element in the DOM (required).
|
|
118
121
|
fullSize: boolean; // If set to true the canvas will gain full window size.
|
|
119
122
|
fitToParent: boolean; // If set to true the canvas will gain the size of its parent container (overrides fullSize).
|
|
@@ -174,7 +177,7 @@ export interface Config
|
|
|
174
177
|
/**
|
|
175
178
|
* For initialization the constructor needs a mix of config and draw-settings.
|
|
176
179
|
*/
|
|
177
|
-
export interface PBParams extends Config {
|
|
180
|
+
export interface PBParams extends Config, CSSBackdropFilterParams {
|
|
178
181
|
title?: string; // Specify any hover tile here. It will be attached as a `title` attribute to the most elevated element.
|
|
179
182
|
// No more additional attributes, just merge two interfaces.
|
|
180
183
|
}
|
|
@@ -30,3 +30,37 @@ export interface LilGuiProps {
|
|
|
30
30
|
closed?: boolean;
|
|
31
31
|
closeOnTop?: boolean;
|
|
32
32
|
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* This is just for the backdrop-filter vaules (CSS after effects filters). They are not directly
|
|
36
|
+
* used by PB but can be passed through by the config/params.
|
|
37
|
+
*/
|
|
38
|
+
export interface CSSBackdropFilterParams {
|
|
39
|
+
// A global switch to enable/disable all filters
|
|
40
|
+
isBackdropFiltersEnabled?: boolean;
|
|
41
|
+
// This is just for the global effect color
|
|
42
|
+
effectFilterColor?: string; // "#204a87",
|
|
43
|
+
isEffectsColorEnabled?: boolean;
|
|
44
|
+
// These are real filter values
|
|
45
|
+
opacity?: number; // 0.5,
|
|
46
|
+
isOpacityEnabled?: boolean; // false,
|
|
47
|
+
invert?: number; // 0.8,
|
|
48
|
+
isInvertEnabled?: boolean; // false,
|
|
49
|
+
sepia?: number; // 0.9,
|
|
50
|
+
isSepiaEnabled?: boolean; // false,
|
|
51
|
+
blur?: number; // 2, // px
|
|
52
|
+
isBlurEnabled?: boolean; // false,
|
|
53
|
+
brightness?: number; // 0.6,
|
|
54
|
+
isBrightnessEnabled?: boolean; // false,
|
|
55
|
+
contrast?: number; // 0.9,
|
|
56
|
+
isContrastEnabled?: boolean; // false,
|
|
57
|
+
dropShadow?: number; // 4, // px
|
|
58
|
+
dropShadowColor?: string; // "#00ffff",
|
|
59
|
+
isDropShadowEnabled?: boolean; // false,
|
|
60
|
+
grayscale?: number; // 0.3,
|
|
61
|
+
isGrayscaleEnabled?: boolean; // false,
|
|
62
|
+
hueRotate?: number; // 120, // deg
|
|
63
|
+
isHueRotateEnabled?: boolean; // false,
|
|
64
|
+
saturate?: number; // 2.0,
|
|
65
|
+
isSaturateEnabled?: boolean; // false
|
|
66
|
+
}
|
|
@@ -22,6 +22,10 @@ export class InitializationObserver<T, E> {
|
|
|
22
22
|
this._timeoutMessage = timeoutMessage ?? null;
|
|
23
23
|
|
|
24
24
|
globalThis.setTimeout(() => {
|
|
25
|
+
if (this._isInitialized) {
|
|
26
|
+
return; // NOOP
|
|
27
|
+
}
|
|
28
|
+
// else
|
|
25
29
|
if (!this._timeoutMessage) {
|
|
26
30
|
console.warn("Failed to initialize object. Reason unknown.");
|
|
27
31
|
}
|
|
@@ -30,6 +34,9 @@ export class InitializationObserver<T, E> {
|
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
public accept(value: T): void {
|
|
37
|
+
if (this._isInitialized) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
33
40
|
this._isInitialized = true;
|
|
34
41
|
this._initializedValue = value;
|
|
35
42
|
this._fireAccept(value);
|
package/src/ts/utils/Params.ts
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* Wraps a Record<string,string> and adds type conversion methods (developed this in
|
|
3
3
|
* some other project) and added this here (2023-10-28).
|
|
4
4
|
*
|
|
5
|
-
* @author
|
|
6
|
-
* @version
|
|
7
|
-
* @date
|
|
5
|
+
* @author Ikars Kappler
|
|
6
|
+
* @version 1.0.0
|
|
7
|
+
* @date 2023-03-13
|
|
8
|
+
* @modified 2024-08-26 Added the `hasParam` method.
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
11
|
export class Params {
|
|
@@ -14,6 +15,10 @@ export class Params {
|
|
|
14
15
|
this.baseParams = baseParams;
|
|
15
16
|
}
|
|
16
17
|
|
|
18
|
+
hasParam(name: string): boolean {
|
|
19
|
+
return this.baseParams.hasOwnProperty(name);
|
|
20
|
+
}
|
|
21
|
+
|
|
17
22
|
getString(name: string, fallback: string): string {
|
|
18
23
|
let value = this.baseParams[name];
|
|
19
24
|
if (typeof value === "undefined" || !value || (value = value.trim()).length === 0) {
|
package/src/ts/utils/gup.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
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
|
|
|
14
15
|
// Get the URI GET params as an assoc.
|
|
@@ -19,7 +20,8 @@
|
|
|
19
20
|
export const gup = (): Record<string, string> => {
|
|
20
21
|
const vars: Record<string, string> = {};
|
|
21
22
|
globalThis.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, (_m: string, key: string, value: string): string => {
|
|
22
|
-
|
|
23
|
+
const keyName: string = key as keyof Object;
|
|
24
|
+
return (vars[decodeURIComponent(keyName)] = value);
|
|
23
25
|
});
|
|
24
26
|
return vars;
|
|
25
27
|
};
|