@thi.ng/imgui 2.3.3 → 3.0.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-09-19T21:09:34Z
3
+ - **Last updated**: 2024-10-03T15:37:53Z
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
+ # [3.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/imgui@3.0.0) (2024-10-03)
13
+
14
+ #### 🛑 Breaking changes
15
+
16
+ - update all component/widget functions ([ffe21dd](https://github.com/thi-ng/umbrella/commit/ffe21dd))
17
+ - BREAKING CHANGE: replace function args w/ option objects
18
+
12
19
  ### [2.3.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/imgui@2.3.1) (2024-09-05)
13
20
 
14
21
  #### 🩹 Bug fixes
package/README.md CHANGED
@@ -119,15 +119,22 @@ import { toggle } from "@thi.ng/imgui";
119
119
  // example state (see @thi.ng/atom)
120
120
  const STATE = new History(new Atom({ foo: true }));
121
121
 
122
- //...IMGUI initialization omitted here
122
+ //...IMGUI & layout initialization omitted here
123
123
 
124
124
  // get atom snapshot
125
125
  const curr = STATE.deref();
126
126
 
127
127
  // toggle component will only return result if user clicked it
128
- let res = toggle(gui, layout, "foo", curr.foo, false, curr.foo ? "ON" : "OFF");
128
+ let res = toggle({
129
+ gui,
130
+ layout,
131
+ id: "foo",
132
+ value: curr.foo,
133
+ label: curr.foo ? "ON" : "OFF"
134
+ });
135
+
129
136
  // conditional immutable update (w/ automatic undo snapshot)
130
- res !== undefined && STATE.resetIn("foo", res);
137
+ if (res !== undefined) STATE.resetIn("foo", res);
131
138
  ```
132
139
 
133
140
  ### Layout support
@@ -157,6 +164,8 @@ multiple column/row spans.
157
164
  The code producing this structure:
158
165
 
159
166
  ```ts
167
+ import { gridLayout } from "@thi.ng/layout";
168
+
160
169
  // create a single column layout @ position 10,10 / 200px wide
161
170
  // the last values are row height and cell spacing
162
171
  const layout = gridLayout(10, 10, 200, 1, 16, 4);
@@ -262,7 +271,7 @@ Browser ESM import:
262
271
 
263
272
  [JSDelivr documentation](https://www.jsdelivr.com/)
264
273
 
265
- Package sizes (brotli'd, pre-treeshake): ESM: 7.14 KB
274
+ Package sizes (brotli'd, pre-treeshake): ESM: 7.43 KB
266
275
 
267
276
  ## Dependencies
268
277
 
package/api.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import type { Predicate } from "@thi.ng/api";
2
+ import type { IGridLayout, LayoutBox } from "@thi.ng/layout";
3
+ import type { IMGUI } from "./gui.js";
2
4
  export type Color = string | number | number[];
3
5
  export type Hash = number;
4
6
  export interface GUITheme {
@@ -26,6 +28,13 @@ export interface GUITheme {
26
28
  export interface IMGUIOpts {
27
29
  theme?: Partial<GUITheme>;
28
30
  }
31
+ export interface ComponentOpts {
32
+ id: string;
33
+ gui: IMGUI;
34
+ layout: IGridLayout<any> | LayoutBox;
35
+ label?: string;
36
+ info?: string;
37
+ }
29
38
  export declare enum MouseButton {
30
39
  LEFT = 1,
31
40
  RIGHT = 2,
@@ -1,8 +1,12 @@
1
1
  import type { IShape } from "@thi.ng/geom";
2
- import type { IGridLayout, LayoutBox } from "@thi.ng/layout";
3
- import type { Hash } from "../api.js";
2
+ import type { ComponentOpts, Hash } from "../api.js";
4
3
  import type { IMGUI } from "../gui.js";
5
- export declare const buttonH: (gui: IMGUI, layout: IGridLayout<any> | LayoutBox, id: string, label?: string, labelHover?: string | undefined, info?: string) => boolean;
6
- export declare const buttonV: (gui: IMGUI, layout: IGridLayout<any> | LayoutBox, id: string, rows: number, label?: string, labelHover?: string | undefined, info?: string) => boolean;
4
+ export interface ButtonOpts extends ComponentOpts {
5
+ labelHover?: string;
6
+ }
7
+ export declare const buttonH: ({ gui, layout, id, label, labelHover, info, }: ButtonOpts) => boolean;
8
+ export declare const buttonV: ({ gui, layout, rows, id, label, labelHover, info, }: ButtonOpts & {
9
+ rows: number;
10
+ }) => boolean;
7
11
  export declare const buttonRaw: (gui: IMGUI, id: string, shape: IShape, hash: Hash, label?: any, labelHover?: any, info?: string) => boolean;
8
12
  //# sourceMappingURL=button.d.ts.map
@@ -5,19 +5,14 @@ import { handleButtonKeys, hoverButton } from "../behaviors/button.js";
5
5
  import { labelHash } from "../hash.js";
6
6
  import { layoutBox } from "../layout.js";
7
7
  import { textLabelRaw, textTransformH, textTransformV } from "./textlabel.js";
8
- const __mkLabel = (gui, tx, id, key, x, y, w, h, hover, label) => gui.resource(
8
+ const buttonH = ({
9
+ gui,
10
+ layout,
9
11
  id,
10
- labelHash(key, label, gui.disabled),
11
- () => textLabelRaw(
12
- ZERO2,
13
- {
14
- transform: tx(gui.theme, x, y, w, h),
15
- fill: gui.textColor(hover)
16
- },
17
- label
18
- )
19
- );
20
- const buttonH = (gui, layout, id, label, labelHover = label, info) => {
12
+ label,
13
+ labelHover,
14
+ info
15
+ }) => {
21
16
  const { x, y, w, h } = layoutBox(layout);
22
17
  const key = hash([x, y, w, h]);
23
18
  return buttonRaw(
@@ -33,7 +28,15 @@ const buttonH = (gui, layout, id, label, labelHover = label, info) => {
33
28
  info
34
29
  );
35
30
  };
36
- const buttonV = (gui, layout, id, rows, label, labelHover = label, info) => {
31
+ const buttonV = ({
32
+ gui,
33
+ layout,
34
+ rows,
35
+ id,
36
+ label,
37
+ labelHover,
38
+ info
39
+ }) => {
37
40
  const { x, y, w, h } = layoutBox(layout, [1, rows]);
38
41
  const key = hash([x, y, w, h]);
39
42
  return buttonRaw(
@@ -67,6 +70,18 @@ const buttonRaw = (gui, id, shape, hash2, label, labelHover, info) => {
67
70
  gui.lastID = id;
68
71
  return !gui.buttons && gui.hotID === id && gui.activeID === id;
69
72
  };
73
+ const __mkLabel = (gui, tx, id, key, x, y, w, h, hover, label) => gui.resource(
74
+ id,
75
+ labelHash(key, label, gui.disabled),
76
+ () => textLabelRaw(
77
+ ZERO2,
78
+ {
79
+ transform: tx(gui.theme, x, y, w, h),
80
+ fill: gui.textColor(hover)
81
+ },
82
+ label
83
+ )
84
+ );
70
85
  export {
71
86
  buttonH,
72
87
  buttonRaw,
@@ -1,7 +1,26 @@
1
1
  import type { Fn, Maybe } from "@thi.ng/api";
2
- import type { IGridLayout, LayoutBox } from "@thi.ng/layout";
2
+ import type { IGridLayout } from "@thi.ng/layout";
3
+ import type { ComponentOpts } from "../api.js";
3
4
  import type { IMGUI } from "../gui.js";
4
- export declare const dial: (gui: IMGUI, layout: IGridLayout<any> | LayoutBox, id: string, min: number, max: number, prec: number, val: number, label?: string, fmt?: Fn<number, string>, info?: string) => Maybe<number>;
5
- export declare const dialGroup: (gui: IMGUI, layout: IGridLayout<any>, id: string, min: number, max: number, prec: number, horizontal: boolean, vals: number[], label: string[], fmt?: Fn<number, string>, info?: string[]) => number[] | undefined;
6
- export declare const dialRaw: (gui: IMGUI, id: string, x: number, y: number, w: number, h: number, min: number, max: number, prec: number, val: number, lx: number, ly: number, label?: string, fmt?: Fn<number, string>, info?: string) => Maybe<number>;
5
+ export interface DialOpts extends ComponentOpts {
6
+ min: number;
7
+ max: number;
8
+ step: number;
9
+ value: number;
10
+ fmt?: Fn<number, string>;
11
+ }
12
+ export declare const dial: ({ gui, layout, id, min, max, step, value, label, fmt, info, }: DialOpts) => Maybe<number>;
13
+ export interface DialGroupOpts extends Omit<DialOpts, "layout" | "value" | "label" | "info"> {
14
+ layout: IGridLayout<any>;
15
+ value: number[];
16
+ label: string[];
17
+ info?: string[];
18
+ /**
19
+ * If true (default), the dials will be arranged horizontally.
20
+ */
21
+ horizontal?: boolean;
22
+ fmt?: Fn<number, string>;
23
+ }
24
+ export declare const dialGroup: (opts: DialGroupOpts) => number[] | undefined;
25
+ export declare const dialRaw: (gui: IMGUI, id: string, x: number, y: number, w: number, h: number, min: number, max: number, step: number, value: number, lx: number, ly: number, label?: string, fmt?: Fn<number, string>, info?: string) => Maybe<number>;
7
26
  //# sourceMappingURL=dial.d.ts.map
@@ -9,7 +9,18 @@ import { dialVal } from "../behaviors/dial.js";
9
9
  import { handleSlider1Keys, isHoverSlider } from "../behaviors/slider.js";
10
10
  import { dialValueLabel } from "./textlabel.js";
11
11
  import { tooltipRaw } from "./tooltip.js";
12
- const dial = (gui, layout, id, min, max, prec, val, label, fmt, info) => {
12
+ const dial = ({
13
+ gui,
14
+ layout,
15
+ id,
16
+ min,
17
+ max,
18
+ step,
19
+ value,
20
+ label,
21
+ fmt,
22
+ info
23
+ }) => {
13
24
  const { x, y, w, h, ch } = isLayout(layout) ? layout.nextSquare() : layout;
14
25
  return dialRaw(
15
26
  gui,
@@ -20,8 +31,8 @@ const dial = (gui, layout, id, min, max, prec, val, label, fmt, info) => {
20
31
  h,
21
32
  min,
22
33
  max,
23
- prec,
24
- val,
34
+ step,
35
+ value,
25
36
  gui.theme.pad,
26
37
  h + ch / 2 + gui.theme.baseLine,
27
38
  label,
@@ -29,24 +40,21 @@ const dial = (gui, layout, id, min, max, prec, val, label, fmt, info) => {
29
40
  info
30
41
  );
31
42
  };
32
- const dialGroup = (gui, layout, id, min, max, prec, horizontal, vals, label, fmt, info = []) => {
33
- const n = vals.length;
34
- const nested = horizontal ? layout.nest(n, [n, 1]) : layout.nest(1, [1, (layout.rowsForHeight(layout.cellW) + 1) * n]);
43
+ const dialGroup = (opts) => {
44
+ const { layout, id, value, label, info } = opts;
45
+ const n = opts.value.length;
46
+ const nested = opts.horizontal !== false ? layout.nest(n, [n, 1]) : layout.nest(1, [1, (layout.rowsForHeight(layout.cellW) + 1) * n]);
35
47
  let res;
36
48
  let idx = -1;
37
49
  for (let i = 0; i < n; i++) {
38
- const v = dial(
39
- gui,
40
- nested,
41
- `${id}-${i}`,
42
- min,
43
- max,
44
- prec,
45
- vals[i],
46
- label[i],
47
- fmt,
48
- info[i]
49
- );
50
+ const v = dial({
51
+ ...opts,
52
+ layout: nested,
53
+ id: `${id}-${i}`,
54
+ value: value[i],
55
+ label: label[i],
56
+ info: info?.[i]
57
+ });
50
58
  if (v !== void 0) {
51
59
  res = v;
52
60
  idx = i;
@@ -54,7 +62,7 @@ const dialGroup = (gui, layout, id, min, max, prec, horizontal, vals, label, fmt
54
62
  }
55
63
  return res !== void 0 ? [idx, res] : void 0;
56
64
  };
57
- const dialRaw = (gui, id, x, y, w, h, min, max, prec, val, lx, ly, label, fmt, info) => {
65
+ const dialRaw = (gui, id, x, y, w, h, min, max, step, value, lx, ly, label, fmt, info) => {
58
66
  const r = Math.min(w, h) / 2;
59
67
  const pos = [x + w / 2, y + h / 2];
60
68
  const thetaGap = PI / 2;
@@ -64,13 +72,13 @@ const dialRaw = (gui, id, x, y, w, h, min, max, prec, val, lx, ly, label, fmt, i
64
72
  const bgShape = gui.resource(id, key, () => circle(pos, r, {}));
65
73
  const hover = isHoverSlider(gui, id, bgShape, "pointer");
66
74
  const draw = gui.draw;
67
- let v = val;
75
+ let v = value;
68
76
  let res;
69
77
  if (hover) {
70
78
  gui.hotID = id;
71
79
  if (gui.isMouseDown()) {
72
80
  gui.activeID = id;
73
- res = dialVal(gui.mouse, pos, startTheta, thetaGap, min, max, prec);
81
+ res = dialVal(gui.mouse, pos, startTheta, thetaGap, min, max, step);
74
82
  }
75
83
  info && draw && tooltipRaw(gui, info);
76
84
  }
@@ -105,7 +113,7 @@ const dialRaw = (gui, id, x, y, w, h, min, max, prec, val, lx, ly, label, fmt, i
105
113
  valShape.attribs.weight = 2;
106
114
  gui.add(bgShape, valShape, valLabel);
107
115
  }
108
- if (focused && (v = handleSlider1Keys(gui, min, max, prec, v)) !== void 0) {
116
+ if (focused && (v = handleSlider1Keys(gui, min, max, step, v)) !== void 0) {
109
117
  return v;
110
118
  }
111
119
  gui.lastID = id;
@@ -1,15 +1,12 @@
1
1
  import type { Maybe } from "@thi.ng/api";
2
- import type { IGridLayout, LayoutBox } from "@thi.ng/layout";
3
- import type { IMGUI } from "../gui.js";
4
- /**
5
- *
6
- * @param gui -
7
- * @param layout -
8
- * @param id -
9
- * @param sel -
10
- * @param items -
11
- * @param title -
12
- * @param info -
13
- */
14
- export declare const dropdown: (gui: IMGUI, layout: IGridLayout<any> | LayoutBox, id: string, sel: number, items: string[], title: string, info?: string) => Maybe<number>;
2
+ import { type ComponentOpts } from "../api.js";
3
+ export interface DropDownOpts extends ComponentOpts {
4
+ /**
5
+ * Index of selected item.
6
+ */
7
+ value: number;
8
+ items: string[];
9
+ title: string;
10
+ }
11
+ export declare const dropdown: ({ gui, layout, id, value, items, title, info, }: DropDownOpts) => Maybe<number>;
15
12
  //# sourceMappingURL=dropdown.d.ts.map
@@ -5,7 +5,15 @@ import { clamp0 } from "@thi.ng/math/interval";
5
5
  import { hash } from "@thi.ng/vectors/hash";
6
6
  import { Key } from "../api.js";
7
7
  import { buttonH } from "./button.js";
8
- const dropdown = (gui, layout, id, sel, items, title, info) => {
8
+ const dropdown = ({
9
+ gui,
10
+ layout,
11
+ id,
12
+ value,
13
+ items,
14
+ title,
15
+ info
16
+ }) => {
9
17
  const open = gui.state(id, () => false);
10
18
  const nested = isLayout(layout) ? layout.nest(1, [1, open ? items.length : 1]) : gridLayout(layout.x, layout.y, layout.w, 1, layout.ch, layout.gap);
11
19
  let res;
@@ -16,7 +24,13 @@ const dropdown = (gui, layout, id, sel, items, title, info) => {
16
24
  const ty = y + h / 2;
17
25
  const draw = gui.draw;
18
26
  if (open) {
19
- const bt = buttonH(gui, box, `${id}-title`, title);
27
+ const bt = buttonH({
28
+ gui,
29
+ layout: box,
30
+ id: `${id}-title`,
31
+ label: title,
32
+ info
33
+ });
20
34
  draw && gui.add(
21
35
  gui.resource(id, key + 1, () => __triangle(gui, tx, ty, true))
22
36
  );
@@ -24,8 +38,13 @@ const dropdown = (gui, layout, id, sel, items, title, info) => {
24
38
  gui.setState(id, false);
25
39
  } else {
26
40
  for (let i = 0, n = items.length; i < n; i++) {
27
- if (buttonH(gui, nested, `${id}-${i}`, items[i])) {
28
- i !== sel && (res = i);
41
+ if (buttonH({
42
+ gui,
43
+ layout: nested,
44
+ id: `${id}-${i}`,
45
+ label: items[i]
46
+ })) {
47
+ i !== value && (res = i);
29
48
  gui.setState(id, false);
30
49
  }
31
50
  }
@@ -35,19 +54,26 @@ const dropdown = (gui, layout, id, sel, items, title, info) => {
35
54
  gui.setState(id, false);
36
55
  break;
37
56
  case Key.UP:
38
- return __update(gui, id, clamp0(sel - 1));
57
+ return __update(gui, id, clamp0(value - 1));
39
58
  case Key.DOWN:
40
59
  return __update(
41
60
  gui,
42
61
  id,
43
- Math.min(items.length - 1, sel + 1)
62
+ Math.min(items.length - 1, value + 1)
44
63
  );
45
64
  default:
46
65
  }
47
66
  }
48
67
  }
49
68
  } else {
50
- if (buttonH(gui, box, `${id}-${sel}`, items[sel], title, info)) {
69
+ if (buttonH({
70
+ gui,
71
+ layout: box,
72
+ id: `${id}-${value}`,
73
+ label: items[value],
74
+ labelHover: title,
75
+ info
76
+ })) {
51
77
  gui.setState(id, true);
52
78
  }
53
79
  draw && gui.add(
@@ -1,4 +1,7 @@
1
- import type { IGridLayout, LayoutBox } from "@thi.ng/layout";
2
- import type { IMGUI } from "../gui.js";
3
- export declare const iconButton: (gui: IMGUI, layout: IGridLayout<any> | LayoutBox, id: string, icon: any, iconW: number, iconH: number, label?: string, info?: string) => boolean;
1
+ import type { ComponentOpts } from "../api.js";
2
+ export interface IconButtonOpts extends ComponentOpts {
3
+ icon: any;
4
+ iconSize: [number, number];
5
+ }
6
+ export declare const iconButton: ({ gui, layout, id, icon, iconSize: [iconW, iconH], label, info, }: IconButtonOpts) => boolean;
4
7
  //# sourceMappingURL=icon-button.d.ts.map
@@ -4,7 +4,15 @@ import { hash } from "@thi.ng/vectors/hash";
4
4
  import { mixHash } from "../hash.js";
5
5
  import { buttonRaw } from "./button.js";
6
6
  import { textLabelRaw } from "./textlabel.js";
7
- const iconButton = (gui, layout, id, icon, iconW, iconH, label, info) => {
7
+ const iconButton = ({
8
+ gui,
9
+ layout,
10
+ id,
11
+ icon,
12
+ iconSize: [iconW, iconH],
13
+ label,
14
+ info
15
+ }) => {
8
16
  const theme = gui.theme;
9
17
  const pad = theme.pad;
10
18
  const bodyW = label ? iconW + 3 * pad + gui.textWidth(label) : iconW + 2 * pad;
@@ -1,4 +1,11 @@
1
1
  import type { Maybe } from "@thi.ng/api";
2
- import type { IMGUI } from "../gui.js";
3
- export declare const radialMenu: (gui: IMGUI, id: string, x: number, y: number, r: number, items: string[], info: string[]) => Maybe<number>;
2
+ import { type ComponentOpts } from "../api.js";
3
+ export interface RadialMenuOpts extends Omit<ComponentOpts, "layout" | "label" | "info"> {
4
+ x: number;
5
+ y: number;
6
+ r: number;
7
+ items: string[];
8
+ info?: string[];
9
+ }
10
+ export declare const radialMenu: ({ gui, id, x, y, r, items, info, }: RadialMenuOpts) => Maybe<number>;
4
11
  //# sourceMappingURL=radial-menu.d.ts.map
@@ -12,7 +12,15 @@ import { hash } from "@thi.ng/vectors/hash";
12
12
  import { Key } from "../api.js";
13
13
  import { buttonRaw } from "./button.js";
14
14
  import { textLabelRaw } from "./textlabel.js";
15
- const radialMenu = (gui, id, x, y, r, items, info) => {
15
+ const radialMenu = ({
16
+ gui,
17
+ id,
18
+ x,
19
+ y,
20
+ r,
21
+ items,
22
+ info
23
+ }) => {
16
24
  const n = items.length;
17
25
  const key = hash([x, y, r, n, ~~gui.disabled]);
18
26
  gui.registerID(id, key);
@@ -36,7 +44,7 @@ const radialMenu = (gui, id, x, y, r, items, info) => {
36
44
  for (let i = 0; i < n; i++) {
37
45
  const cell = cells[i];
38
46
  const _id = id + i;
39
- buttonRaw(gui, _id, cell[0], cell[1], cell[2], cell[3], info[i]) && (res = i);
47
+ buttonRaw(gui, _id, cell[0], cell[1], cell[2], cell[3], info?.[i]) && (res = i);
40
48
  gui.focusID === _id && (sel = i);
41
49
  }
42
50
  if (sel !== -1) {
@@ -1,5 +1,19 @@
1
1
  import type { Maybe } from "@thi.ng/api";
2
- import type { IGridLayout, LayoutBox } from "@thi.ng/layout";
3
- import type { IMGUI } from "../gui.js";
4
- export declare const radio: (gui: IMGUI, layout: IGridLayout<any> | LayoutBox, id: string, horizontal: boolean, sel: number, square: boolean, labels: string[], info?: string[]) => Maybe<number>;
2
+ import type { ComponentOpts } from "../api.js";
3
+ export interface RadioOpts extends Omit<ComponentOpts, "label" | "info"> {
4
+ /**
5
+ * If true (default: false), the radio buttons will be arranged
6
+ * horizontally.
7
+ */
8
+ horizontal?: boolean;
9
+ /**
10
+ * If true (default: false), the radio buttons will be square and the labels
11
+ * positioned next to it.
12
+ */
13
+ square?: boolean;
14
+ value: number;
15
+ label: string[];
16
+ info?: string[];
17
+ }
18
+ export declare const radio: ({ gui, layout, id, horizontal, square, value, label, info, }: RadioOpts) => Maybe<number>;
5
19
  //# sourceMappingURL=radio.d.ts.map
@@ -1,20 +1,29 @@
1
1
  import { isLayout } from "@thi.ng/layout/checks";
2
2
  import { gridLayout } from "@thi.ng/layout/grid-layout";
3
3
  import { toggle } from "./toggle.js";
4
- const radio = (gui, layout, id, horizontal, sel, square, labels, info = []) => {
5
- const n = labels.length;
4
+ const radio = ({
5
+ gui,
6
+ layout,
7
+ id,
8
+ horizontal,
9
+ square,
10
+ value,
11
+ label,
12
+ info
13
+ }) => {
14
+ const n = label.length;
6
15
  const nested = isLayout(layout) ? horizontal ? layout.nest(n, [n, 1]) : layout.nest(1, [1, n]) : horizontal ? gridLayout(layout.x, layout.y, layout.w, n, layout.ch, layout.gap) : gridLayout(layout.x, layout.y, layout.w, 1, layout.ch, layout.gap);
7
16
  let res;
8
17
  for (let i = 0; i < n; i++) {
9
- toggle(
18
+ toggle({
10
19
  gui,
11
- nested,
12
- `${id}-${i}`,
13
- sel === i,
14
20
  square,
15
- labels[i],
16
- info[i]
17
- ) !== void 0 && (res = i);
21
+ layout: nested,
22
+ id: `${id}-${i}`,
23
+ value: value === i,
24
+ label: label[i],
25
+ info: info?.[i]
26
+ }) !== void 0 && (res = i);
18
27
  }
19
28
  return res;
20
29
  };
@@ -1,6 +1,9 @@
1
1
  import type { Maybe } from "@thi.ng/api";
2
- import type { IGridLayout, LayoutBox } from "@thi.ng/layout";
3
2
  import type { Ramp } from "@thi.ng/ramp";
4
- import type { IMGUI } from "../gui.js";
5
- export declare const ramp: (gui: IMGUI, layout: IGridLayout<any> | LayoutBox, id: string, ramp: Ramp<number>, rampMode?: number, info?: string) => Maybe<Ramp<number>>;
3
+ import { type ComponentOpts } from "../api.js";
4
+ export interface RampOpts extends Omit<ComponentOpts, "label"> {
5
+ ramp: Ramp<number>;
6
+ mode?: number;
7
+ }
8
+ export declare const ramp: ({ gui, layout, id, ramp, mode, info }: RampOpts) => Maybe<Ramp<number>>;
6
9
  //# sourceMappingURL=ramp.d.ts.map
@@ -15,8 +15,8 @@ import { Key } from "../api.js";
15
15
  import { isHoverSlider } from "../behaviors/slider.js";
16
16
  import { layoutBox } from "../layout.js";
17
17
  import { tooltipRaw } from "./tooltip.js";
18
- const ramp = (gui, layout, id, ramp2, rampMode = 0, info) => {
19
- let { x, y, w, h } = layoutBox(layout);
18
+ const ramp = ({ gui, layout, id, ramp: ramp2, mode = 0, info }) => {
19
+ const { x, y, w, h } = layoutBox(layout);
20
20
  const maxX = x + w;
21
21
  const maxY = y + h;
22
22
  const pos = [x, maxY];
@@ -61,7 +61,7 @@ const ramp = (gui, layout, id, ramp2, rampMode = 0, info) => {
61
61
  box,
62
62
  gui.resource(
63
63
  id,
64
- hash(stops.flatMap((x2) => x2)) + rampMode,
64
+ hash(stops.flatMap((x2) => x2)) + mode,
65
65
  () => polygon(
66
66
  [
67
67
  [x, maxY],
@@ -1,7 +1,27 @@
1
1
  import type { Fn, Maybe } from "@thi.ng/api";
2
- import type { IGridLayout, LayoutBox } from "@thi.ng/layout";
2
+ import type { IGridLayout } from "@thi.ng/layout";
3
+ import type { ComponentOpts } from "../api.js";
3
4
  import type { IMGUI } from "../gui.js";
4
- export declare const ring: (gui: IMGUI, layout: IGridLayout<any> | LayoutBox, id: string, min: number, max: number, prec: number, val: number, thetaGap: number, rscale: number, label?: string, fmt?: Fn<number, string>, info?: string) => Maybe<number>;
5
- export declare const ringGroup: (gui: IMGUI, layout: IGridLayout<any>, id: string, min: number, max: number, prec: number, horizontal: boolean, thetaGap: number, rscale: number, vals: number[], label: string[], fmt?: Fn<number, string>, info?: string[]) => number[] | undefined;
5
+ export interface RingOpts extends ComponentOpts {
6
+ min: number;
7
+ max: number;
8
+ step: number;
9
+ value: number;
10
+ gap?: number;
11
+ rscale?: number;
12
+ fmt?: Fn<number, string>;
13
+ }
14
+ export declare const ring: ({ gui, layout, id, min, max, step, value, gap, rscale, label, info, fmt, }: RingOpts) => Maybe<number>;
15
+ export interface RingGroupOpts extends Omit<RingOpts, "layout" | "value" | "label" | "info"> {
16
+ layout: IGridLayout<any>;
17
+ /**
18
+ * If true (default), the controls will be arranged horizontally.
19
+ */
20
+ horizontal?: boolean;
21
+ value: number[];
22
+ label: string[];
23
+ info?: string[];
24
+ }
25
+ export declare const ringGroup: (opts: RingGroupOpts) => number[] | undefined;
6
26
  export declare const ringRaw: (gui: IMGUI, id: string, x: number, y: number, w: number, h: number, min: number, max: number, prec: number, val: number, thetaGap: number, rscale: number, lx: number, ly: number, label?: string, fmt?: Fn<number, string>, info?: string) => Maybe<number>;
7
27
  //# sourceMappingURL=ring.d.ts.map
@@ -12,21 +12,27 @@ import { dialVal } from "../behaviors/dial.js";
12
12
  import { handleSlider1Keys } from "../behaviors/slider.js";
13
13
  import { dialValueLabel } from "./textlabel.js";
14
14
  import { tooltipRaw } from "./tooltip.js";
15
- const __ringHeight = (w, thetaGap) => w / 2 * (1 + Math.sin(HALF_PI + thetaGap / 2));
16
- const __arcVerts = (o, r, start, end, thetaRes = 12) => r > 1 ? map(
17
- (t) => cartesian2(null, [r, mix(start, end, t)], o),
18
- normRange(
19
- Math.max(1, Math.abs(end - start) / (PI / thetaRes)) | 0
20
- )
21
- ) : [o];
22
- const ring = (gui, layout, id, min, max, prec, val, thetaGap, rscale, label, fmt, info) => {
15
+ const ring = ({
16
+ gui,
17
+ layout,
18
+ id,
19
+ min,
20
+ max,
21
+ step,
22
+ value,
23
+ gap = Math.PI,
24
+ rscale = 0.5,
25
+ label,
26
+ info,
27
+ fmt
28
+ }) => {
23
29
  let h;
24
30
  let box;
25
31
  if (isLayout(layout)) {
26
- h = __ringHeight(layout.cellW, thetaGap);
32
+ h = __ringHeight(layout.cellW, gap);
27
33
  box = layout.next([1, layout.rowsForHeight(h) + 1]);
28
34
  } else {
29
- h = __ringHeight(layout.cw, thetaGap);
35
+ h = __ringHeight(layout.cw, gap);
30
36
  box = layout;
31
37
  }
32
38
  return ringRaw(
@@ -38,9 +44,9 @@ const ring = (gui, layout, id, min, max, prec, val, thetaGap, rscale, label, fmt
38
44
  h,
39
45
  min,
40
46
  max,
41
- prec,
42
- val,
43
- thetaGap,
47
+ step,
48
+ value,
49
+ gap,
44
50
  rscale,
45
51
  0,
46
52
  h + box.ch / 2 + gui.theme.baseLine,
@@ -49,29 +55,26 @@ const ring = (gui, layout, id, min, max, prec, val, thetaGap, rscale, label, fmt
49
55
  info
50
56
  );
51
57
  };
52
- const ringGroup = (gui, layout, id, min, max, prec, horizontal, thetaGap, rscale, vals, label, fmt, info = []) => {
53
- const n = vals.length;
54
- const nested = horizontal ? layout.nest(n, [n, 1]) : layout.nest(1, [
58
+ const ringGroup = (opts) => {
59
+ const { layout, id, value, label, info } = opts;
60
+ const n = value.length;
61
+ const nested = opts.horizontal !== false ? layout.nest(n, [n, 1]) : layout.nest(1, [
55
62
  1,
56
- (layout.rowsForHeight(__ringHeight(layout.cellW, thetaGap)) + 1) * n
63
+ (layout.rowsForHeight(
64
+ __ringHeight(layout.cellW, opts.gap ?? Math.PI)
65
+ ) + 1) * n
57
66
  ]);
58
67
  let res;
59
68
  let idx = -1;
60
69
  for (let i = 0; i < n; i++) {
61
- const v = ring(
62
- gui,
63
- nested,
64
- `${id}-${i}`,
65
- min,
66
- max,
67
- prec,
68
- vals[i],
69
- thetaGap,
70
- rscale,
71
- label[i],
72
- fmt,
73
- info[i]
74
- );
70
+ const v = ring({
71
+ ...opts,
72
+ layout: nested,
73
+ id: `${id}-${i}`,
74
+ value: value[i],
75
+ label: label[i],
76
+ info: info?.[i]
77
+ });
75
78
  if (v !== void 0) {
76
79
  res = v;
77
80
  idx = i;
@@ -135,6 +138,13 @@ const ringRaw = (gui, id, x, y, w, h, min, max, prec, val, thetaGap, rscale, lx,
135
138
  gui.lastID = id;
136
139
  return res;
137
140
  };
141
+ const __ringHeight = (w, thetaGap) => w / 2 * (1 + Math.sin(HALF_PI + thetaGap / 2));
142
+ const __arcVerts = (o, r, start, end, thetaRes = 12) => r > 1 ? map(
143
+ (t) => cartesian2(null, [r, mix(start, end, t)], o),
144
+ normRange(
145
+ Math.max(1, Math.abs(end - start) / (PI / thetaRes)) | 0
146
+ )
147
+ ) : [o];
138
148
  export {
139
149
  ring,
140
150
  ringGroup,
@@ -1,7 +1,25 @@
1
1
  import type { Fn, Maybe } from "@thi.ng/api";
2
- import type { IGridLayout, LayoutBox } from "@thi.ng/layout";
2
+ import type { IGridLayout } from "@thi.ng/layout";
3
+ import type { ComponentOpts } from "../api.js";
3
4
  import type { IMGUI } from "../gui.js";
4
- export declare const sliderH: (gui: IMGUI, layout: IGridLayout<any> | LayoutBox, id: string, min: number, max: number, prec: number, val: number, label?: string, fmt?: Fn<number, string>, info?: string) => Maybe<number>;
5
- export declare const sliderHGroup: (gui: IMGUI, layout: IGridLayout<any>, id: string, min: number, max: number, prec: number, horizontal: boolean, vals: number[], label: string[], fmt?: Fn<number, string>, info?: string[]) => number[] | undefined;
5
+ export interface SliderOpts extends ComponentOpts {
6
+ min: number;
7
+ max: number;
8
+ step: number;
9
+ value: number;
10
+ fmt?: Fn<number, string>;
11
+ }
12
+ export declare const sliderH: ({ gui, layout, id, min, max, step, value, label, info, fmt, }: SliderOpts) => Maybe<number>;
13
+ export interface SliderGroupOpts extends Omit<SliderOpts, "layout" | "value" | "label" | "info"> {
14
+ layout: IGridLayout<any>;
15
+ /**
16
+ * If true (default: false), the sliders will be arranged horizontally.
17
+ */
18
+ horizontal?: boolean;
19
+ value: number[];
20
+ label: string[];
21
+ info?: string[];
22
+ }
23
+ export declare const sliderHGroup: (opts: SliderGroupOpts) => number[] | undefined;
6
24
  export declare const sliderHRaw: (gui: IMGUI, id: string, x: number, y: number, w: number, h: number, min: number, max: number, prec: number, val: number, label?: string, fmt?: Fn<number, string>, info?: string) => Maybe<number>;
7
25
  //# sourceMappingURL=sliderh.d.ts.map
@@ -10,7 +10,18 @@ import { valHash } from "../hash.js";
10
10
  import { layoutBox } from "../layout.js";
11
11
  import { textLabelRaw } from "./textlabel.js";
12
12
  import { tooltipRaw } from "./tooltip.js";
13
- const sliderH = (gui, layout, id, min, max, prec, val, label, fmt, info) => {
13
+ const sliderH = ({
14
+ gui,
15
+ layout,
16
+ id,
17
+ min,
18
+ max,
19
+ step,
20
+ value,
21
+ label,
22
+ info,
23
+ fmt
24
+ }) => {
14
25
  const box = layoutBox(layout);
15
26
  return sliderHRaw(
16
27
  gui,
@@ -21,31 +32,28 @@ const sliderH = (gui, layout, id, min, max, prec, val, label, fmt, info) => {
21
32
  box.h,
22
33
  min,
23
34
  max,
24
- prec,
25
- val,
35
+ step,
36
+ value,
26
37
  label,
27
38
  fmt,
28
39
  info
29
40
  );
30
41
  };
31
- const sliderHGroup = (gui, layout, id, min, max, prec, horizontal, vals, label, fmt, info = []) => {
32
- const n = vals.length;
33
- const nested = horizontal ? layout.nest(n, [n, 1]) : layout.nest(1, [1, n]);
42
+ const sliderHGroup = (opts) => {
43
+ const { layout, id, value, label, info } = opts;
44
+ const n = value.length;
45
+ const nested = opts.horizontal ? layout.nest(n, [n, 1]) : layout.nest(1, [1, n]);
34
46
  let res;
35
47
  let idx = -1;
36
48
  for (let i = 0; i < n; i++) {
37
- const v = sliderH(
38
- gui,
39
- nested,
40
- `${id}-${i}`,
41
- min,
42
- max,
43
- prec,
44
- vals[i],
45
- label[i],
46
- fmt,
47
- info[i]
48
- );
49
+ const v = sliderH({
50
+ ...opts,
51
+ layout: nested,
52
+ id: `${id}-${i}`,
53
+ value: value[i],
54
+ label: label[i],
55
+ info: info?.[i]
56
+ });
49
57
  if (v !== void 0) {
50
58
  res = v;
51
59
  idx = i;
@@ -1,7 +1,12 @@
1
1
  import type { Fn, Maybe } from "@thi.ng/api";
2
- import type { IGridLayout, LayoutBox } from "@thi.ng/layout";
3
2
  import type { IMGUI } from "../gui.js";
4
- export declare const sliderV: (gui: IMGUI, layout: IGridLayout<any> | LayoutBox, id: string, min: number, max: number, prec: number, val: number, rows: number, label?: string, fmt?: Fn<number, string>, info?: string) => Maybe<number>;
5
- export declare const sliderVGroup: (gui: IMGUI, layout: IGridLayout<any>, id: string, min: number, max: number, prec: number, vals: number[], rows: number, label: string[], fmt?: Fn<number, string>, info?: string[]) => number[] | undefined;
3
+ import type { SliderGroupOpts, SliderOpts } from "./sliderh.js";
4
+ export declare const sliderV: ({ gui, layout, id, rows, min, max, step, value, label, info, fmt, }: SliderOpts & {
5
+ rows: number;
6
+ }) => Maybe<number>;
7
+ export interface SliderVGroupOpts extends Omit<SliderGroupOpts, "horizontal"> {
8
+ rows: number;
9
+ }
10
+ export declare const sliderVGroup: (opts: SliderVGroupOpts) => number[] | undefined;
6
11
  export declare const sliderVRaw: (gui: IMGUI, id: string, x: number, y: number, w: number, h: number, min: number, max: number, prec: number, val: number, label?: string, fmt?: Fn<number, string>, info?: string) => Maybe<number>;
7
12
  //# sourceMappingURL=sliderv.d.ts.map
@@ -11,7 +11,19 @@ import { valHash } from "../hash.js";
11
11
  import { layoutBox } from "../layout.js";
12
12
  import { textLabelRaw, textTransformV } from "./textlabel.js";
13
13
  import { tooltipRaw } from "./tooltip.js";
14
- const sliderV = (gui, layout, id, min, max, prec, val, rows, label, fmt, info) => {
14
+ const sliderV = ({
15
+ gui,
16
+ layout,
17
+ id,
18
+ rows,
19
+ min,
20
+ max,
21
+ step,
22
+ value,
23
+ label,
24
+ info,
25
+ fmt
26
+ }) => {
15
27
  const box = layoutBox(layout, [1, rows]);
16
28
  return sliderVRaw(
17
29
  gui,
@@ -22,32 +34,28 @@ const sliderV = (gui, layout, id, min, max, prec, val, rows, label, fmt, info) =
22
34
  box.h,
23
35
  min,
24
36
  max,
25
- prec,
26
- val,
37
+ step,
38
+ value,
27
39
  label,
28
40
  fmt,
29
41
  info
30
42
  );
31
43
  };
32
- const sliderVGroup = (gui, layout, id, min, max, prec, vals, rows, label, fmt, info = []) => {
33
- const n = vals.length;
34
- const nested = layout.nest(n, [1, rows]);
44
+ const sliderVGroup = (opts) => {
45
+ const { id, value, label, info } = opts;
46
+ const n = value.length;
47
+ const layout = opts.layout.nest(n, [1, opts.rows]);
35
48
  let res;
36
49
  let idx = -1;
37
50
  for (let i = 0; i < n; i++) {
38
- const v = sliderV(
39
- gui,
40
- nested,
41
- `${id}-${i}`,
42
- min,
43
- max,
44
- prec,
45
- vals[i],
46
- rows,
47
- label[i],
48
- fmt,
49
- info[i]
50
- );
51
+ const v = sliderV({
52
+ ...opts,
53
+ layout,
54
+ id: `${id}-${i}`,
55
+ value: value[i],
56
+ label: label[i],
57
+ info: info?.[i]
58
+ });
51
59
  if (v !== void 0) {
52
60
  res = v;
53
61
  idx = i;
@@ -1,6 +1,10 @@
1
1
  import type { Predicate } from "@thi.ng/api";
2
- import type { IGridLayout, LayoutBox } from "@thi.ng/layout";
2
+ import type { ComponentOpts } from "../api.js";
3
3
  import type { IMGUI } from "../gui.js";
4
- export declare const textField: (gui: IMGUI, layout: IGridLayout<any> | LayoutBox, id: string, label: string, filter?: Predicate<string>, info?: string) => string | undefined;
4
+ export interface TextfieldOpts extends Omit<ComponentOpts, "label"> {
5
+ value: string;
6
+ filter?: Predicate<string>;
7
+ }
8
+ export declare const textField: ({ gui, layout, id, value, info, filter, }: TextfieldOpts) => string | undefined;
5
9
  export declare const textFieldRaw: (gui: IMGUI, id: string, x: number, y: number, w: number, h: number, txt: string, filter?: Predicate<string>, info?: string) => string | undefined;
6
10
  //# sourceMappingURL=textfield.d.ts.map
@@ -6,7 +6,14 @@ import { handleTextfieldKeys } from "../behaviors/text.js";
6
6
  import { layoutBox } from "../layout.js";
7
7
  import { textLabelRaw } from "./textlabel.js";
8
8
  import { tooltipRaw } from "./tooltip.js";
9
- const textField = (gui, layout, id, label, filter = () => true, info) => {
9
+ const textField = ({
10
+ gui,
11
+ layout,
12
+ id,
13
+ value,
14
+ info,
15
+ filter = () => true
16
+ }) => {
10
17
  const box = layoutBox(layout);
11
18
  return textFieldRaw(
12
19
  gui,
@@ -15,7 +22,7 @@ const textField = (gui, layout, id, label, filter = () => true, info) => {
15
22
  box.y,
16
23
  box.w,
17
24
  box.h,
18
- label,
25
+ value,
19
26
  filter,
20
27
  info
21
28
  );
@@ -1,19 +1,14 @@
1
1
  import type { Maybe } from "@thi.ng/api";
2
- import type { IGridLayout, LayoutBox } from "@thi.ng/layout";
2
+ import type { ComponentOpts } from "../api.js";
3
3
  import type { IMGUI } from "../gui.js";
4
- /**
5
- * If `square` is true, the clickable area will not fill the entire
6
- * cell, but only a left-aligned square of cell/row height.
7
- *
8
- * @param gui -
9
- * @param layout -
10
- * @param id -
11
- * @param val -
12
- * @param i -
13
- * @param square -
14
- * @param label -
15
- * @param info -
16
- */
17
- export declare const toggle: (gui: IMGUI, layout: IGridLayout<any> | LayoutBox, id: string, val: boolean, square?: boolean, label?: string, info?: string) => Maybe<boolean>;
4
+ export interface ToggleOpts extends ComponentOpts {
5
+ /**
6
+ * If `square` is true (default: false), the clickable area will not fill
7
+ * the entire cell, but only a left-aligned square of cell/row height.
8
+ */
9
+ square?: boolean;
10
+ value: boolean;
11
+ }
12
+ export declare const toggle: ({ gui, layout, id, value, square, label, info, }: ToggleOpts) => Maybe<boolean>;
18
13
  export declare const toggleRaw: (gui: IMGUI, id: string, x: number, y: number, w: number, h: number, lx: number, val: boolean, label?: string, info?: string) => Maybe<boolean>;
19
14
  //# sourceMappingURL=toggle.d.ts.map
@@ -3,7 +3,15 @@ import { hash } from "@thi.ng/vectors/hash";
3
3
  import { handleButtonKeys, hoverButton } from "../behaviors/button.js";
4
4
  import { layoutBox } from "../layout.js";
5
5
  import { textLabelRaw } from "./textlabel.js";
6
- const toggle = (gui, layout, id, val, square, label, info) => {
6
+ const toggle = ({
7
+ gui,
8
+ layout,
9
+ id,
10
+ value,
11
+ square,
12
+ label,
13
+ info
14
+ }) => {
7
15
  const { x, y, w, h } = layoutBox(layout);
8
16
  return toggleRaw(
9
17
  gui,
@@ -13,7 +21,7 @@ const toggle = (gui, layout, id, val, square, label, info) => {
13
21
  square ? h : w,
14
22
  h,
15
23
  square ? h : 0,
16
- val,
24
+ value,
17
25
  label,
18
26
  info
19
27
  );
@@ -1,27 +1,28 @@
1
1
  import type { Fn, Maybe } from "@thi.ng/api";
2
2
  import type { IGridLayout } from "@thi.ng/layout";
3
- import type { Vec } from "@thi.ng/vectors";
3
+ import type { ReadonlyVec, Vec } from "@thi.ng/vectors";
4
+ import type { ComponentOpts } from "../api.js";
4
5
  import type { IMGUI } from "../gui.js";
5
- /**
6
- * `mode` interpretation:
7
- *
8
- * - -2 = square
9
- * - -1 = proportional height (snapped to rows)
10
- * - >0 = fixed row height
11
- *
12
- * @param gui -
13
- * @param layout -
14
- * @param id -
15
- * @param min -
16
- * @param max -
17
- * @param prec -
18
- * @param val -
19
- * @param mode -
20
- * @param yUp -
21
- * @param label -
22
- * @param fmt -
23
- * @param info -
24
- */
25
- export declare const xyPad: (gui: IMGUI, layout: IGridLayout<any>, id: string, min: Vec, max: Vec, prec: number, val: Vec, mode: number, yUp: boolean, label?: string, fmt?: Fn<Vec, string>, info?: string) => Maybe<Vec>;
6
+ export interface XYPadOpts extends Omit<ComponentOpts, "layout"> {
7
+ layout: IGridLayout<any>;
8
+ min: ReadonlyVec;
9
+ max: ReadonlyVec;
10
+ step: number;
11
+ value: Vec;
12
+ /**
13
+ * If `square` (default), the component will allocate a square, if `prop` an
14
+ * area of proportional height (snapped to rows). If given a number > 0, the
15
+ * component will occupy the given number of rows.
16
+ */
17
+ mode?: "square" | "prop" | number;
18
+ /**
19
+ * If true (default), the top-right corner of the XY pad corresponds to the
20
+ * configured {@link XYPadOpts.max} value. Otherwise, the bottom-right
21
+ * corner is used.
22
+ */
23
+ yUp?: boolean;
24
+ fmt?: Fn<Vec, string>;
25
+ }
26
+ export declare const xyPad: ({ gui, layout, id, min, max, step, value, mode, yUp, label, info, fmt, }: XYPadOpts) => Maybe<Vec>;
26
27
  export declare const xyPadRaw: (gui: IMGUI, id: string, x: number, y: number, w: number, h: number, min: Vec, max: Vec, prec: number, val: Vec, yUp: boolean | undefined, lx: number, ly: number, label?: string, fmt?: Fn<Vec, string>, info?: string) => Maybe<Vec>;
27
28
  //# sourceMappingURL=xypad.d.ts.map
@@ -9,14 +9,27 @@ import {
9
9
  } from "../behaviors/slider.js";
10
10
  import { textLabelRaw } from "./textlabel.js";
11
11
  import { tooltipRaw } from "./tooltip.js";
12
- const xyPad = (gui, layout, id, min, max, prec, val, mode, yUp, label, fmt, info) => {
12
+ const xyPad = ({
13
+ gui,
14
+ layout,
15
+ id,
16
+ min,
17
+ max,
18
+ step,
19
+ value,
20
+ mode = "square",
21
+ yUp = true,
22
+ label,
23
+ info,
24
+ fmt
25
+ }) => {
13
26
  let box;
14
27
  const ch = layout.cellH;
15
28
  const gap = layout.gap;
16
- if (mode === -2) {
29
+ if (mode === "square") {
17
30
  box = layout.nextSquare();
18
31
  } else {
19
- let rows = (mode > 0 ? mode : layout.cellW / (ch + gap)) | 0;
32
+ const rows = mode === "prop" ? layout.cellW / (ch + gap) | 0 : mode;
20
33
  box = layout.next([1, rows + 1]);
21
34
  box.h -= ch + gap;
22
35
  }
@@ -29,8 +42,8 @@ const xyPad = (gui, layout, id, min, max, prec, val, mode, yUp, label, fmt, info
29
42
  box.h,
30
43
  min,
31
44
  max,
32
- prec,
33
- val,
45
+ step,
46
+ value,
34
47
  yUp,
35
48
  0,
36
49
  box.h + gap + ch / 2 + gui.theme.baseLine,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/imgui",
3
- "version": "2.3.3",
3
+ "version": "3.0.0",
4
4
  "description": "Immediate mode GUI with flexible state handling & data only shape output",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -160,5 +160,5 @@
160
160
  ],
161
161
  "year": 2019
162
162
  },
163
- "gitHead": "b52baa3750ddd1256892df966ab7ac9b4806a9ef\n"
163
+ "gitHead": "dadc6e71940c091e50fbf9f88ea3ba115d3937df\n"
164
164
  }