@woosh/meep-engine 2.117.0 → 2.117.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/package.json +1 -1
- package/src/core/collection/array/array_pick_best_element.d.ts +10 -1
- package/src/core/model/object/object_deep_clone.d.ts +8 -0
- package/src/core/model/object/object_deep_clone.d.ts.map +1 -0
- package/src/core/model/object/object_deep_clone.js +47 -0
- package/src/view/elements/progress/SmoothProgressBar.d.ts +7 -14
- package/src/view/elements/progress/SmoothProgressBar.d.ts.map +1 -1
- package/src/view/elements/progress/SmoothProgressBar.js +23 -6
package/package.json
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Picks element with highest score from the array using supplied scoring function.
|
|
3
|
+
* If multiple elements with the same highest score exist, the result will be first such encountered element
|
|
4
|
+
* @template T
|
|
5
|
+
* @param {T[]} array
|
|
6
|
+
* @param {function(el:T, index:number):number} scoreFunction
|
|
7
|
+
* @returns {T|undefined}
|
|
8
|
+
*/
|
|
9
|
+
export function array_pick_best_element<T>(array: T[], scoreFunction: any): T;
|
|
10
|
+
//# sourceMappingURL=array_pick_best_element.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Will invoke any "clone" methods and inherit prototypes where possible creating as close to identical copy as possible
|
|
3
|
+
* @template T
|
|
4
|
+
* @param {T} source
|
|
5
|
+
* @returns {T}
|
|
6
|
+
*/
|
|
7
|
+
export function object_deep_clone<T>(source: T): T;
|
|
8
|
+
//# sourceMappingURL=object_deep_clone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object_deep_clone.d.ts","sourceRoot":"","sources":["../../../../../src/core/model/object/object_deep_clone.js"],"names":[],"mappings":"AAmBA;;;;;GAKG;AACH,mDAqBC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {Object} source
|
|
4
|
+
* @returns {Object}
|
|
5
|
+
*/
|
|
6
|
+
function structural_clone(source) {
|
|
7
|
+
const result = Object.create(Object.getPrototypeOf(source));
|
|
8
|
+
|
|
9
|
+
const ownKeys = Reflect.ownKeys(source);
|
|
10
|
+
|
|
11
|
+
for (let i = 0; i < ownKeys.length; i++) {
|
|
12
|
+
const ownKey = ownKeys[i];
|
|
13
|
+
|
|
14
|
+
result[ownKey] = object_deep_clone(source[ownKey]);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Will invoke any "clone" methods and inherit prototypes where possible creating as close to identical copy as possible
|
|
22
|
+
* @template T
|
|
23
|
+
* @param {T} source
|
|
24
|
+
* @returns {T}
|
|
25
|
+
*/
|
|
26
|
+
export function object_deep_clone(source) {
|
|
27
|
+
|
|
28
|
+
const source_type = typeof source;
|
|
29
|
+
if (source_type === "object") {
|
|
30
|
+
if (source !== null) {
|
|
31
|
+
if (typeof source.clone === "function") {
|
|
32
|
+
// has clone method
|
|
33
|
+
return source.clone();
|
|
34
|
+
} else {
|
|
35
|
+
// do structural cloning
|
|
36
|
+
return structural_clone(source);
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
// value is null
|
|
40
|
+
return source;
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
// not an object, assume primitive type and just return that
|
|
44
|
+
return source;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
}
|
|
@@ -3,19 +3,13 @@ declare class ProgressBarView extends View<HTMLElement> {
|
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
5
|
* @param {number[]|BoundedValue} [model]
|
|
6
|
-
* @param classList
|
|
7
|
-
* @param displayLabel
|
|
8
|
-
* @param displayLabelType
|
|
9
|
-
* @param displayTipMarker
|
|
10
|
-
* @param process
|
|
6
|
+
* @param {string[]} [classList]
|
|
7
|
+
* @param {boolean} [displayLabel]
|
|
8
|
+
* @param {string} [displayLabelType]
|
|
9
|
+
* @param {boolean} [displayTipMarker]
|
|
10
|
+
* @param {function(number):string} [process]
|
|
11
11
|
*/
|
|
12
|
-
constructor(model?: number[] | BoundedValue, { classList, displayLabel, displayLabelType, displayTipMarker, process }?:
|
|
13
|
-
classList?: any[];
|
|
14
|
-
displayLabel?: boolean;
|
|
15
|
-
displayLabelType?: string;
|
|
16
|
-
displayTipMarker?: boolean;
|
|
17
|
-
process?: typeof passThrough;
|
|
18
|
-
});
|
|
12
|
+
constructor(model?: number[] | BoundedValue, { classList, displayLabel, displayLabelType, displayTipMarker, process }?: string[]);
|
|
19
13
|
model: number[] | BoundedValue;
|
|
20
14
|
el: Element;
|
|
21
15
|
/**
|
|
@@ -23,7 +17,7 @@ declare class ProgressBarView extends View<HTMLElement> {
|
|
|
23
17
|
*/
|
|
24
18
|
__el_fill: HTMLElement;
|
|
25
19
|
__el_fill_container: HTMLDivElement;
|
|
26
|
-
__display_tip_marker:
|
|
20
|
+
__display_tip_marker: any;
|
|
27
21
|
__el_tip_marker: HTMLDivElement;
|
|
28
22
|
/**
|
|
29
23
|
*
|
|
@@ -68,5 +62,4 @@ declare class ProgressBarView extends View<HTMLElement> {
|
|
|
68
62
|
}
|
|
69
63
|
import View from "../../View.js";
|
|
70
64
|
import BoundedValue from "../../../core/model/BoundedValue.js";
|
|
71
|
-
import { passThrough } from "../../../core/function/passThrough.js";
|
|
72
65
|
//# sourceMappingURL=SmoothProgressBar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmoothProgressBar.d.ts","sourceRoot":"","sources":["../../../../../src/view/elements/progress/SmoothProgressBar.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"SmoothProgressBar.d.ts","sourceRoot":"","sources":["../../../../../src/view/elements/progress/SmoothProgressBar.js"],"names":[],"mappings":";AAmCA;IACI;;;;;;;;OAQG;IACH,oBAPW,MAAM,EAAE,GAAC,YAAY,6EACrB,MAAM,EAAE,EAmGlB;IAnFG,+BAAkB;IAIlB,YAAkB;IAIlB;;OAEG;IACH,WAFU,WAAW,CAEmC;IAExD,oCAAwD;IAaxD,0BAA4C;IAGxC,gCAAoD;IAOxD;;;;OAIG;IACH,kBAAwB;IAExB;;;;OAIG;IACH,gCAA2C;IAC3C;;;;OAIG;IACH,6BAA4C;IAE5C;;;;OAIG;IACH,oBAAyB;IAEzB,wBAAwB;IACxB,oBAAoB;IAGpB,6BAA0D;IAsB9D,uBAQC;IAZD,oBAEC;IAgBD,qBAQC;IAZD,kBAEC;IAYD,eA2BC;IAED;;OAEG;IACH,0BAGC;IAED;;OAEG;IACH,iCAGC;CACJ;iBA9MgB,eAAe;yBAHP,qCAAqC"}
|
|
@@ -6,25 +6,42 @@ import { frameThrottle } from "../../../engine/graphics/FrameThrottle.js";
|
|
|
6
6
|
import dom from "../../DOM.js";
|
|
7
7
|
import View from "../../View.js";
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param {number} value
|
|
12
|
+
* @param {number} max
|
|
13
|
+
* @param {function(number):string} process
|
|
14
|
+
* @returns {string}
|
|
15
|
+
*/
|
|
9
16
|
function makeTextPercentage(value, max, process) {
|
|
10
17
|
const r = (value / max) * 100;
|
|
11
18
|
const x = process(r);
|
|
12
19
|
return `${x}%`;
|
|
13
20
|
}
|
|
14
21
|
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param {number} value
|
|
25
|
+
* @param {number} max
|
|
26
|
+
* @param {function(number):string} process
|
|
27
|
+
* @returns {string}
|
|
28
|
+
*/
|
|
15
29
|
function makeTextAbsolute(value, max, process) {
|
|
16
|
-
|
|
30
|
+
const _max = process(max);
|
|
31
|
+
const _val = process(value);
|
|
32
|
+
|
|
33
|
+
return `${_val} / ${_max}`;
|
|
17
34
|
}
|
|
18
35
|
|
|
19
36
|
class ProgressBarView extends View {
|
|
20
37
|
/**
|
|
21
38
|
*
|
|
22
39
|
* @param {number[]|BoundedValue} [model]
|
|
23
|
-
* @param classList
|
|
24
|
-
* @param displayLabel
|
|
25
|
-
* @param displayLabelType
|
|
26
|
-
* @param displayTipMarker
|
|
27
|
-
* @param process
|
|
40
|
+
* @param {string[]} [classList]
|
|
41
|
+
* @param {boolean} [displayLabel]
|
|
42
|
+
* @param {string} [displayLabelType]
|
|
43
|
+
* @param {boolean} [displayTipMarker]
|
|
44
|
+
* @param {function(number):string} [process]
|
|
28
45
|
*/
|
|
29
46
|
constructor(model, {
|
|
30
47
|
classList = [],
|