@thi.ng/imgui 2.1.88 → 2.2.0
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 +8 -1
- package/README.md +1 -1
- package/gui.d.ts +5 -4
- package/gui.js +12 -9
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2023-
|
|
3
|
+
- **Last updated**: 2023-10-18T18:06:31Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,13 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
## [2.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/imgui@2.2.0) (2023-10-18)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- add defGUI() factory fn (syntax sugar) ([84ef0a8](https://github.com/thi-ng/umbrella/commit/84ef0a8))
|
|
17
|
+
- minor internal refactoring
|
|
18
|
+
|
|
12
19
|
### [2.1.9](https://github.com/thi-ng/umbrella/tree/@thi.ng/imgui@2.1.9) (2022-04-07)
|
|
13
20
|
|
|
14
21
|
#### ♻️ Refactoring
|
package/README.md
CHANGED
package/gui.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Fn0, IClear, IToHiccup } from "@thi.ng/api";
|
|
2
2
|
import type { Vec } from "@thi.ng/vectors";
|
|
3
3
|
import { type GUITheme, type Hash, type IMGUIOpts } from "./api.js";
|
|
4
|
+
export declare const defGUI: (opts: IMGUIOpts) => IMGUI;
|
|
4
5
|
export declare class IMGUI implements IClear, IToHiccup {
|
|
5
6
|
attribs: any;
|
|
6
7
|
layers: any[];
|
|
@@ -74,9 +75,9 @@ export declare class IMGUI implements IClear, IToHiccup {
|
|
|
74
75
|
* previous theme and returns component result.
|
|
75
76
|
*
|
|
76
77
|
* @param theme -
|
|
77
|
-
* @param
|
|
78
|
+
* @param component -
|
|
78
79
|
*/
|
|
79
|
-
withTheme<T>(theme: Partial<GUITheme>,
|
|
80
|
+
withTheme<T>(theme: Partial<GUITheme>, component: Fn0<T>): T;
|
|
80
81
|
/**
|
|
81
82
|
* Pushes given disabled component state flag on stack (default:
|
|
82
83
|
* true, i.e. disabled). Pass `false` to temporarily enable
|
|
@@ -94,9 +95,9 @@ export declare class IMGUI implements IClear, IToHiccup {
|
|
|
94
95
|
* restores previous disabled state and returns component result.
|
|
95
96
|
*
|
|
96
97
|
* @param disabled -
|
|
97
|
-
* @param
|
|
98
|
+
* @param component -
|
|
98
99
|
*/
|
|
99
|
-
withDisabled<T>(disabled: boolean,
|
|
100
|
+
withDisabled<T>(disabled: boolean, component: Fn0<T>): T;
|
|
100
101
|
/**
|
|
101
102
|
* Sets `focusID` to given `id` if the component can receive focus.
|
|
102
103
|
* Returns true if component is focused.
|
package/gui.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { set2 } from "@thi.ng/vectors/set";
|
|
2
2
|
import { DEFAULT_THEME, Key, KeyModifier, MouseButton, NONE, } from "./api.js";
|
|
3
|
+
export const defGUI = (opts) => new IMGUI(opts);
|
|
3
4
|
export class IMGUI {
|
|
4
5
|
constructor(opts) {
|
|
5
6
|
this.mouse = [-1e3, -1e3];
|
|
@@ -18,6 +19,7 @@ export class IMGUI {
|
|
|
18
19
|
this.states = new Map();
|
|
19
20
|
this.layers = [[], []];
|
|
20
21
|
this.attribs = {};
|
|
22
|
+
this.cursor = "default";
|
|
21
23
|
this.disabledStack = [false];
|
|
22
24
|
this.setTheme(opts.theme || {});
|
|
23
25
|
this.draw = true;
|
|
@@ -98,18 +100,18 @@ export class IMGUI {
|
|
|
98
100
|
* Removes current theme from stack (unless only one theme left).
|
|
99
101
|
*/
|
|
100
102
|
endTheme() {
|
|
101
|
-
|
|
103
|
+
__popIfNotLast(this.themeStack);
|
|
102
104
|
}
|
|
103
105
|
/**
|
|
104
106
|
* Applies component function with given theme, then restores
|
|
105
107
|
* previous theme and returns component result.
|
|
106
108
|
*
|
|
107
109
|
* @param theme -
|
|
108
|
-
* @param
|
|
110
|
+
* @param component -
|
|
109
111
|
*/
|
|
110
|
-
withTheme(theme,
|
|
112
|
+
withTheme(theme, component) {
|
|
111
113
|
this.beginTheme(theme);
|
|
112
|
-
const res =
|
|
114
|
+
const res = component();
|
|
113
115
|
this.themeStack.pop();
|
|
114
116
|
return res;
|
|
115
117
|
}
|
|
@@ -127,18 +129,18 @@ export class IMGUI {
|
|
|
127
129
|
* Removes current disabled flag from stack (unless only one theme left).
|
|
128
130
|
*/
|
|
129
131
|
endDisabled() {
|
|
130
|
-
|
|
132
|
+
__popIfNotLast(this.disabledStack);
|
|
131
133
|
}
|
|
132
134
|
/**
|
|
133
135
|
* Applies component function with given disabled flag, then
|
|
134
136
|
* restores previous disabled state and returns component result.
|
|
135
137
|
*
|
|
136
138
|
* @param disabled -
|
|
137
|
-
* @param
|
|
139
|
+
* @param component -
|
|
138
140
|
*/
|
|
139
|
-
withDisabled(disabled,
|
|
141
|
+
withDisabled(disabled, component) {
|
|
140
142
|
this.disabledStack.push(disabled);
|
|
141
|
-
const res =
|
|
143
|
+
const res = component();
|
|
142
144
|
this.disabledStack.pop();
|
|
143
145
|
return res;
|
|
144
146
|
}
|
|
@@ -387,4 +389,5 @@ export class IMGUI {
|
|
|
387
389
|
];
|
|
388
390
|
}
|
|
389
391
|
}
|
|
390
|
-
|
|
392
|
+
/** @internal */
|
|
393
|
+
const __popIfNotLast = (stack) => stack.length > 1 && stack.pop();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/imgui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Immediate mode GUI with flexible state handling & data only shape output",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@thi.ng/api": "^8.9.5",
|
|
38
38
|
"@thi.ng/checks": "^3.4.5",
|
|
39
|
-
"@thi.ng/geom": "^5.2.
|
|
40
|
-
"@thi.ng/geom-api": "^3.4.
|
|
41
|
-
"@thi.ng/geom-isec": "^2.1.
|
|
42
|
-
"@thi.ng/geom-tessellate": "^2.1.
|
|
39
|
+
"@thi.ng/geom": "^5.2.9",
|
|
40
|
+
"@thi.ng/geom-api": "^3.4.37",
|
|
41
|
+
"@thi.ng/geom-isec": "^2.1.79",
|
|
42
|
+
"@thi.ng/geom-tessellate": "^2.1.79",
|
|
43
43
|
"@thi.ng/layout": "^2.1.34",
|
|
44
44
|
"@thi.ng/math": "^5.6.2",
|
|
45
|
-
"@thi.ng/transducers": "^8.8.
|
|
46
|
-
"@thi.ng/vectors": "^7.7.
|
|
45
|
+
"@thi.ng/transducers": "^8.8.2",
|
|
46
|
+
"@thi.ng/vectors": "^7.7.19"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@microsoft/api-extractor": "^7.36.4",
|
|
@@ -158,5 +158,5 @@
|
|
|
158
158
|
],
|
|
159
159
|
"year": 2019
|
|
160
160
|
},
|
|
161
|
-
"gitHead": "
|
|
161
|
+
"gitHead": "46e445c09f2909d1aeaa9fdc8d8b3aa61c114db2\n"
|
|
162
162
|
}
|