@thi.ng/imgui 2.2.12 → 2.2.14
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/CHANGELOG.md +1 -1
- package/README.md +1 -1
- package/api.js +94 -84
- package/behaviors/button.js +26 -22
- package/behaviors/dial.js +12 -4
- package/behaviors/slider.js +46 -43
- package/behaviors/text.js +75 -70
- package/components/button.js +64 -41
- package/components/dial.js +102 -52
- package/components/dropdown.js +62 -64
- package/components/icon-button.js +40 -31
- package/components/radial-menu.js +43 -37
- package/components/radio.js +19 -14
- package/components/ring.js +123 -79
- package/components/sliderh.js +96 -46
- package/components/sliderv.js +100 -53
- package/components/textfield.js +83 -44
- package/components/textlabel.js +28 -14
- package/components/toggle.js +45 -38
- package/components/tooltip.js +16 -6
- package/components/xypad.js +89 -73
- package/events.js +36 -47
- package/gui.js +400 -415
- package/hash.js +17 -45
- package/layout.js +4 -1
- package/package.json +16 -14
package/hash.js
CHANGED
|
@@ -1,48 +1,20 @@
|
|
|
1
1
|
import { hash } from "@thi.ng/vectors/hash";
|
|
2
2
|
const BUF = new Array(1024);
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
const encodeString = (txt, buf = BUF) => {
|
|
4
|
+
const n = buf.length = txt.length;
|
|
5
|
+
for (let i = 0; i < n; i++) {
|
|
6
|
+
buf[i] = txt.charCodeAt(i);
|
|
7
|
+
}
|
|
8
|
+
return buf;
|
|
9
|
+
};
|
|
10
|
+
const hashString = (txt) => hash(encodeString(txt));
|
|
11
|
+
const mixHash = (key, txt) => key ^ hashString(txt);
|
|
12
|
+
const labelHash = (key, label, disabled) => mixHash(key + ~~disabled, label);
|
|
13
|
+
const valHash = (key, val, disabled) => mixHash(key + ~~disabled, String(val));
|
|
14
|
+
export {
|
|
15
|
+
encodeString,
|
|
16
|
+
hashString,
|
|
17
|
+
labelHash,
|
|
18
|
+
mixHash,
|
|
19
|
+
valHash
|
|
17
20
|
};
|
|
18
|
-
/**
|
|
19
|
-
* Returns Murmur3 hashcode for given string.
|
|
20
|
-
*
|
|
21
|
-
* @param txt -
|
|
22
|
-
*/
|
|
23
|
-
export const hashString = (txt) => hash(encodeString(txt));
|
|
24
|
-
/**
|
|
25
|
-
* Mixes existing hash with that of given string.
|
|
26
|
-
*
|
|
27
|
-
* @param key -
|
|
28
|
-
* @param txt -
|
|
29
|
-
*/
|
|
30
|
-
export const mixHash = (key, txt) => key ^ hashString(txt);
|
|
31
|
-
/**
|
|
32
|
-
* Hash helper for labels. Mixes existing hash with given label and
|
|
33
|
-
* GUI's disabled flag.
|
|
34
|
-
*
|
|
35
|
-
* @param key -
|
|
36
|
-
* @param label -
|
|
37
|
-
* @param disabled -
|
|
38
|
-
*/
|
|
39
|
-
export const labelHash = (key, label, disabled) => mixHash(key + ~~disabled, label);
|
|
40
|
-
/**
|
|
41
|
-
* Hash helper for numeric value labels. Mixes existing hash with given
|
|
42
|
-
* value and GUI's disabled flag.
|
|
43
|
-
*
|
|
44
|
-
* @param key -
|
|
45
|
-
* @param val -
|
|
46
|
-
* @param disabled -
|
|
47
|
-
*/
|
|
48
|
-
export const valHash = (key, val, disabled) => mixHash(key + ~~disabled, String(val));
|
package/layout.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/imgui",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.14",
|
|
4
4
|
"description": "Immediate mode GUI with flexible state handling & data only shape output",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
"author": "Karsten Schmidt (https://thi.ng)",
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"scripts": {
|
|
27
|
-
"build": "yarn
|
|
27
|
+
"build": "yarn build:esbuild && yarn build:decl",
|
|
28
|
+
"build:decl": "tsc --declaration --emitDeclarationOnly",
|
|
29
|
+
"build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
|
|
28
30
|
"clean": "rimraf --glob '*.js' '*.d.ts' '*.map' doc behaviors components",
|
|
29
31
|
"doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
|
|
30
32
|
"doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
|
|
@@ -33,20 +35,20 @@
|
|
|
33
35
|
"test": "bun test"
|
|
34
36
|
},
|
|
35
37
|
"dependencies": {
|
|
36
|
-
"@thi.ng/api": "^8.9.
|
|
37
|
-
"@thi.ng/checks": "^3.4.
|
|
38
|
-
"@thi.ng/geom": "^6.0.
|
|
39
|
-
"@thi.ng/geom-api": "^3.4.
|
|
40
|
-
"@thi.ng/geom-isec": "^2.1.
|
|
41
|
-
"@thi.ng/geom-tessellate": "^2.1.
|
|
42
|
-
"@thi.ng/layout": "^3.0.
|
|
43
|
-
"@thi.ng/math": "^5.7.
|
|
44
|
-
"@thi.ng/transducers": "^8.8.
|
|
45
|
-
"@thi.ng/vectors": "^7.8.
|
|
38
|
+
"@thi.ng/api": "^8.9.12",
|
|
39
|
+
"@thi.ng/checks": "^3.4.12",
|
|
40
|
+
"@thi.ng/geom": "^6.0.8",
|
|
41
|
+
"@thi.ng/geom-api": "^3.4.50",
|
|
42
|
+
"@thi.ng/geom-isec": "^2.1.92",
|
|
43
|
+
"@thi.ng/geom-tessellate": "^2.1.93",
|
|
44
|
+
"@thi.ng/layout": "^3.0.7",
|
|
45
|
+
"@thi.ng/math": "^5.7.7",
|
|
46
|
+
"@thi.ng/transducers": "^8.8.15",
|
|
47
|
+
"@thi.ng/vectors": "^7.8.9"
|
|
46
48
|
},
|
|
47
49
|
"devDependencies": {
|
|
48
50
|
"@microsoft/api-extractor": "^7.38.3",
|
|
49
|
-
"
|
|
51
|
+
"esbuild": "^0.19.8",
|
|
50
52
|
"rimraf": "^5.0.5",
|
|
51
53
|
"tools": "^0.0.1",
|
|
52
54
|
"typedoc": "^0.25.4",
|
|
@@ -157,5 +159,5 @@
|
|
|
157
159
|
],
|
|
158
160
|
"year": 2019
|
|
159
161
|
},
|
|
160
|
-
"gitHead": "
|
|
162
|
+
"gitHead": "5e7bafedfc3d53bc131469a28de31dd8e5b4a3ff\n"
|
|
161
163
|
}
|