@thi.ng/imgui 3.1.18 → 3.2.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2025-01-29T16:25:48Z
3
+ - **Last updated**: 2025-02-05T15:49:26Z
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.
@@ -11,6 +11,21 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
11
11
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
12
12
  and/or version bumps of transitive dependencies.
13
13
 
14
+ ### [3.2.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/imgui@3.2.1) (2025-02-05)
15
+
16
+ #### 🩹 Bug fixes
17
+
18
+ - update dropdown label handling ([8dc2e93](https://github.com/thi-ng/umbrella/commit/8dc2e93))
19
+ - show label in default state if selected value is undefined
20
+ (e.g. because `value` was set to -1)
21
+ - update ramp color handling, add `fill` option ([874d701](https://github.com/thi-ng/umbrella/commit/874d701))
22
+
23
+ ## [3.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/imgui@3.2.0) (2025-02-05)
24
+
25
+ #### 🚀 Features
26
+
27
+ - add RampOpts.samples ([8aaaae5](https://github.com/thi-ng/umbrella/commit/8aaaae5))
28
+
14
29
  ## [3.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/imgui@3.1.0) (2024-10-07)
15
30
 
16
31
  #### 🚀 Features
@@ -70,7 +70,7 @@ const dropdown = ({
70
70
  gui,
71
71
  layout: box,
72
72
  id: `${id}-${value}`,
73
- label: items[value],
73
+ label: items[value] ?? label,
74
74
  labelHover: label,
75
75
  info
76
76
  })) {
@@ -1,12 +1,14 @@
1
1
  import type { Maybe } from "@thi.ng/api";
2
2
  import type { Ramp } from "@thi.ng/ramp";
3
- import { type ComponentOpts } from "../api.js";
3
+ import { type Color, type ComponentOpts } from "../api.js";
4
4
  export interface RampOpts extends Omit<ComponentOpts, "label"> {
5
5
  ramp: Ramp<number>;
6
6
  /**
7
7
  * User defined interpolation mode. Only used to compute internal hash of
8
8
  * ramp curve geometry, i.e. if the {@link RampOpts.ramp} interpolation
9
9
  * method changes, so should this mode value.
10
+ *
11
+ * @defaultValue 0
10
12
  */
11
13
  mode?: number;
12
14
  /**
@@ -15,6 +17,16 @@ export interface RampOpts extends Omit<ComponentOpts, "label"> {
15
17
  * @defaultValue 0.05
16
18
  */
17
19
  eps?: number;
20
+ /**
21
+ * Ramp resolution (number of vertices for area plot)
22
+ *
23
+ * @defaultValue 100
24
+ */
25
+ samples?: number;
26
+ /**
27
+ * Optional fill color override (default: GUI text color)
28
+ */
29
+ fill?: Color;
18
30
  }
19
- export declare const ramp: ({ gui, layout, id, ramp, mode, info, eps, }: RampOpts) => Maybe<Ramp<number>>;
31
+ export declare const ramp: ({ gui, layout, id, ramp, mode, info, eps, samples, fill, }: RampOpts) => Maybe<Ramp<number>>;
20
32
  //# sourceMappingURL=ramp.d.ts.map
@@ -22,7 +22,9 @@ const ramp = ({
22
22
  ramp: ramp2,
23
23
  mode = 0,
24
24
  info,
25
- eps = 0.05
25
+ eps = 0.05,
26
+ samples = 100,
27
+ fill = gui.textColor(false)
26
28
  }) => {
27
29
  const { x, y, w, h } = layoutBox(layout);
28
30
  const maxX = x + w;
@@ -32,7 +34,6 @@ const ramp = ({
32
34
  const key = hash([x, y, w, h]);
33
35
  gui.registerID(id, key);
34
36
  const box = gui.resource(id, key, () => rect([x, y], [w, h]));
35
- const col = gui.textColor(false);
36
37
  const hover = isHoverSlider(gui, id, box, "move");
37
38
  const stops = ramp2.stops;
38
39
  let selID = -1;
@@ -74,11 +75,11 @@ const ramp = ({
74
75
  [
75
76
  [x, maxY],
76
77
  mix2([], pos, maxPos, [0, stops[0][1]]),
77
- ...__rampVertices(ramp2, pos, maxPos),
78
+ ...__rampVertices(ramp2, pos, maxPos, samples),
78
79
  mix2([], pos, maxPos, [1, stops[stops.length - 1][1]]),
79
80
  [maxX, maxY]
80
81
  ],
81
- { fill: col }
82
+ { fill }
82
83
  )
83
84
  ),
84
85
  ...stops.map(([t], i) => {
@@ -106,7 +107,7 @@ const ramp = ({
106
107
  gui.lastID = id;
107
108
  return res;
108
109
  };
109
- const __rampVertices = (ramp2, pos, maxPos, numSamples = 100) => map((p) => mix2(p, pos, maxPos, p), ramp2.samples(numSamples));
110
+ const __rampVertices = (ramp2, pos, maxPos, numSamples) => map((p) => mix2(p, pos, maxPos, p), ramp2.samples(numSamples));
110
111
  const __handleRampKeys = (gui, ramp2, selID) => {
111
112
  switch (gui.key) {
112
113
  case Key.TAB:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/imgui",
3
- "version": "3.1.18",
3
+ "version": "3.2.1",
4
4
  "description": "Immediate mode GUI with flexible state handling & data only shape output",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -162,5 +162,5 @@
162
162
  ],
163
163
  "year": 2019
164
164
  },
165
- "gitHead": "fc1d498e8d4b690db873c30cc594352a804e7a65\n"
165
+ "gitHead": "c89ca042d58976982c31c1a7791bc64998e09128\n"
166
166
  }