muigui 0.0.10 → 0.0.13

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/README.md CHANGED
@@ -1,15 +1,11 @@
1
- # muigui
2
-
3
- # NOT READY for USE
4
-
5
- <!---
6
-
7
- <img src="./images/muigui.png" style="max-width: 640px">
1
+ # muigui (⍺)
8
2
 
9
3
  A simple Web UI library.
10
4
 
5
+ [See docs here](https://muigui.org)
6
+
11
7
  muigui is a simple UI library in the spirit of
12
- [dat.gui](https://github.com/dataarts/dat.gui) and/or [lil-gui](https://github.com/georgealways/).
8
+ [dat.gui](https://github.com/dataarts/dat.gui) and/or [lil-gui](https://github.com/georgealways/) and [tweakpane](https://cocopon.github.io/tweakpane/)
13
9
 
14
10
  ## Usage
15
11
 
@@ -28,66 +24,377 @@ Then
28
24
  ```js
29
25
  const s = {
30
26
  someNumber: 123,
31
- someString: "hello",
32
- someOption: "dog",
27
+ someString: 'hello',
28
+ someOption: 'dog',
33
29
  someColor: '#ED3281',
34
30
  someFunction: () => console.log('called')
35
31
  };
36
32
 
37
33
  const gui = new GUI();
38
34
  gui.add(s, 'someNumber', 0, 200); // range 0 to 200
39
- gui.add(s, 'someString);
40
- gui.add(s, 'someOption, ['cat', 'bird', 'dog']);
35
+ gui.add(s, 'someString');
36
+ gui.add(s, 'someOption', ['cat', 'bird', 'dog']);
41
37
  gui.addColor(s, 'someColor');
42
38
  gui.add(s, 'someFunction');
43
39
  ```
44
40
 
45
41
  produces
46
42
 
47
- <img src="./images/muigui-screenshot.png" style="max-width: 275px">
43
+ <img src="./images/muigui-screenshot.png" style="max-width: 250px">
48
44
 
49
- or a shorter version
45
+ ## Why
50
46
 
51
- ```js
52
- const s = {
53
- someNumber: 123,
54
- someString: "hello",
55
- someOption: "dog",
56
- someColor: '#ED3281',
57
- someFunction: () => console.log('called')
58
- };
47
+ So, to be honest, I like [tweakpane](https://cocopon.github.io/tweakpane/) and
48
+ I didn't know about it when I started this library. That said, I've looked
49
+ into using tweakpane and it doesn't meet my needs as of v4.0.0. Examples below
50
+
51
+ * ## Simpler
52
+
53
+ I wanted certain things to be simpler. For example, in dat.gui/lil.gui/tweakpane, if I wanted
54
+ to store radians in code but show degrees in the UI I had to jump through
55
+ hoops. I could either, store degrees and convert 😢
56
+
57
+ ```js
58
+ const settings = {
59
+ angle: 45,
60
+ };
61
+ gui.add(settings, 'angle', -360, 360);
62
+
63
+ ...
64
+ const rotation = settings.angle * Math.PI / 180
65
+ ```
66
+
67
+ That's bad IMO. I shouldn't have to refactor my code to fit the GUI.
68
+
69
+ I can make some proxy class that presents degrees to the GUI
70
+ and stores them in radians like this
71
+
72
+ ```js
73
+ class DegRadHelper {
74
+ constructor( obj, prop ) {
75
+ this.obj = obj;
76
+ this.prop = prop;
77
+ }
78
+ get value() {
79
+ return this.obj[this.prop] * 180 / Math.PI;
80
+ }
81
+ set value(v) {
82
+ this.obj[this.prop] = v * Math.PI / 180;
83
+ }
84
+ }
85
+ const settings = {
86
+ angle: Math.PI * 0.5,
87
+ };
88
+ gui.add(new DegRadHelper(settings, 'angle'), 'value', -360, 360);
89
+ ```
90
+
91
+ But that looks poor to use. What is `'value'`?? 😭
92
+
93
+ So, muigui handles that slightly nicer in the form of converters.
94
+
95
+ ```js
96
+ const settings = {
97
+ angle: Math.PI * 0.5,
98
+ };
99
+ const degToRad = d => d * Math.PI / 180;
100
+ const radToDeg = r => r * 180 / Math.PI;
101
+ gui.add(s, 'angleRad', {
102
+ min: -360, max: 360,
103
+ converters: {
104
+ to: radToDeg,
105
+ from: v => [true, degToRad(v)],
106
+ }});
107
+ ```
108
+
109
+ Typically I'll pull out the settings like this
110
+
111
+ ```js
112
+ const degToRad = d => d * Math.PI / 180;
113
+ const radToDeg = r => r * 180 / Math.PI;
114
+ const radToDegSettings {
115
+ min: -360, max: 360,
116
+ converters: {
117
+ to: radToDeg,
118
+ from: v => [true, degToRad(v)],
119
+ }});
120
+ ```
121
+
122
+ And then I can use it like this
123
+
124
+ ```js
125
+ const settings = {
126
+ angle: Math.PI * 0.5,
127
+ rotation: Math.PI * 0.25,
128
+ };
129
+ gui.add(s, 'angleRad', radToDegSettings);
130
+ gui.add(s, 'rotation', radToDegSettings);
131
+ ```
132
+
133
+ You provide converters where `to` converts to the form the UI wants
134
+ and `from` converts back. The reason `from` returns a tuple is that
135
+ it's used to convert the text and gives you a chance to say the text
136
+ does not match the required format in which case you return `[false]`
137
+
138
+ Other examples of simpler: Want a drop-down for numbers?
139
+
140
+ ```js
141
+ const settings = { speed: 1 }
142
+
143
+ // tweakpane
144
+ pane.addBinding(settings, speed, {
145
+ options: {
146
+ slow: 0,
147
+ medium: 1,
148
+ fast: 2,
149
+ }
150
+ })
151
+
152
+ // muigui
153
+ gui.add(settings, 'speed', ['slow', 'medium', 'fast']);
154
+ ```
155
+
156
+ Want a drop-down for strings
157
+
158
+ ```js
159
+ const settings = { alphaMode: 'opaque' }
160
+
161
+ // tweakpane
162
+ pane.addBindng(settings, 'alphaMode', {
163
+ options: {
164
+ 'opaque': 'opaque',
165
+ 'premultiplied': 'premultiplied',
166
+ }
167
+ });
168
+
169
+ // muigui
170
+ gui.add(settings, 'alphaMode', ['opaque', 'premultiplied']);
171
+ ```
172
+
173
+ Of course you can also pass in key/value settings like tweakpane.
174
+
175
+ * ## Color formats and storage
176
+
177
+ I often work with WebGL and WebGPU. The most common colors are in an array or a typedArray
178
+
179
+ ```js
180
+ const uniforms = {
181
+ color1: [1, 0.5, 0.25], // orange
182
+ color2: new Float32Array([0, 1, 1]); // cyan
183
+ color3: new Uint8Array([0, 128, 0, 128]); // transparent green
184
+ }
185
+ ```
186
+
187
+ Neither dat.gui, lil.gui, nor tweakpane can edit these AFAICT. (2023)
188
+ You'd have to jump
189
+ through the hoops like the `DegRadHelper` example above but it's not
190
+ that easy because, if you're showing the value textually
191
+ then you want that value to be the one you want to show the user,
192
+ not the value the editor wants.
193
+
194
+ This is still an issue in muigui where it uses the browser's built
195
+ in color editor in parts. That editor might show 0-255 values but if it's
196
+ editing 0 to 1 values it'd be nice if the editor showed 0 to 1 values.
197
+
198
+ muigui does handle this in the text part of it's color display. If you
199
+ ask it to edit 0 to 1 values it shows 0 to 1 values in the text part.
200
+ The reason you need the text part is so you can copy and paste colors
59
201
 
60
- const options = {
61
- someNumber: [1, 200], // range 0 to 200
62
- someOption: ['cat', 'bird', 'dog'],
63
- }
202
+ muigui also edits hsl colors. By that I don't mean the editor can
203
+ switch to an HSL editor, I mean the actual value that comes out
204
+ is `hsl(hue, sat, luminance)` and not some RGB value. Like the number
205
+ conversions, it would be easy to add `hsv`, `hsb`, maybe `labch` etc...
206
+
207
+ * ## More Use Cases
208
+
209
+ In some projects, I'd end up writing a small
210
+ app with an HTML form and then have to write all the code to parse
211
+ the form and I'd be thinking "It would be so nice if I could use
212
+ the same API as dat.gui 🙁
213
+
214
+ So, I thought I'd try to write a library that handled that case.
215
+
216
+ I also wanted to explore various things though many of them
217
+ have not made it into muigui yet.
218
+
219
+ * ## PropertyGrid
220
+
221
+ I'm sure the first app to do this was something from the 60s or 70s
222
+ in Smalltalk or something but my first experience was C#. In C#
223
+ the UI library had a `PropertyGrid` which you could pass any class
224
+ and with would auto-magically make UI to edit the public fields
225
+ of that class. If you've ever used Unity, it's the same. You declare
226
+ a class and it immediately shows a UI for all of its public properties.
227
+
228
+ That's easier in a typed language than a more loose language like
229
+ JavaScript.
230
+
231
+ I'm still experimenting with ideas but it sure would be nice to
232
+ get that for JS. Just give it an object and get a UI. You can
233
+ then customize later.
234
+
235
+ To be more concrete. Here's some code to setup a GUI
236
+
237
+ ```js
238
+ const s = {
239
+ someNumber: 123,
240
+ someString: 'hello',
241
+ someOption: 'dog',
242
+ someColor: '#ED3281',
243
+ someFunction: () => console.log('called')
244
+ };
245
+
246
+ const gui = new GUI();
247
+ gui.add(s, 'someNumber', 0, 200); // range 0 to 200
248
+ gui.add(s, 'someString');
249
+ gui.add(s, 'someOption', ['cat', 'bird', 'dog']);
250
+ gui.addColor(s, 'someColor');
251
+ gui.add(s, 'someFunction');
252
+ ```
253
+
254
+ I'd really like it to be this
255
+
256
+ ```js
257
+ const s = {
258
+ someNumber: 123,
259
+ someString: 'hello',
260
+ someOption: 'dog',
261
+ someColor: '#ED3281',
262
+ someFunction: () => console.log('called')
263
+ };
264
+
265
+ const gui = new GUI();
266
+ gui.add(s);
267
+ ```
268
+
269
+ At the moment that won't work. `someNumber` could only become
270
+ a `TextNumber` because there's no range. `someOption` would
271
+ only become a `Text` because there's no info that it's an enum.
272
+ `someColor` would become a `Text` because there's no info that
273
+ it's a color. So in the end only 2 of the 5 would work without
274
+ having to provide more info.
275
+
276
+ It's not clear in JS that adding that info would be a win
277
+ for keeping it simple but it sure would be nice.
278
+
279
+ * ## Modularity
280
+
281
+ Ideally I'd like it to be easy to make UIs based on collections
282
+ of parts. A simple example might be a 3 component vector
283
+ editor that is the combination of 3 number editors.
284
+
285
+ I'm still experimenting. While muigui has components that
286
+ do this I'm not happy with the API ergonomics yet.
287
+
288
+ Similarly I'd like to more easily split layout so it's trivial
289
+ to layout sub components. Again, still experimenting.
290
+
291
+ * ## Don't over specialize
292
+
293
+ This might be ranty, but I find libraries that try to do too much,
294
+ frustrating. In this case, it would
295
+ be a library that graphs data for you. The problem
296
+ with this functionality is that there is no end to
297
+ the number of features that will be requested.
298
+
299
+ You start with "graph an array of numbers".
300
+ Then you'll be asked to be able to supply a range.
301
+ Then you'll be asked to allow more than one array
302
+ for the graph.
303
+ You'll next be asked to let you specify a different
304
+ color for each array. Next you'll be asked to draw
305
+ axes, in different colors, with different units,
306
+ and labels. Then you'll be asked to have an option
307
+ to fill under the graph. Etc, etc, etc... forever.
308
+
309
+ In this case, It's arguably better to provide
310
+ a canvas and let the developer write their
311
+ own graphing code. Maybe provide an example or
312
+ a simple helper for the simplest case.
313
+
314
+ They can even choose when to update vs having to
315
+ choose an interval.
316
+
317
+ Let's compare
318
+
319
+ ```js
320
+ // tweakpane
321
+ const pane = new Pane();
322
+ pane.addBinding(PARAMS, 'wave', {
323
+ readonly: true,
324
+ view: 'graph',
325
+ min: -1,
326
+ max: +1,
327
+ });
328
+
329
+ // muigui
330
+ const gui = new GUI();
331
+ helpers.graph(gui.addCanvas('wave'), waveData, {
332
+ min: -1,
333
+ max: +1,
334
+ });
335
+ ```
336
+
337
+ It wasn't any harder to use, but the fact that we
338
+ just returned a canvas and left the rest outside
339
+ the library made it way more flexible.
340
+
341
+ This problem of providing too specialized a solution
342
+ is endemic throughout the library ecosystem of pretty much
343
+ every language.
344
+
345
+ There's a balance, but in general, if you need
346
+ to add more and more options then it was probably the
347
+ wrong solution. It's better to provide the
348
+ building blocks.
349
+
350
+ ## No Save/Restore
351
+
352
+ The problem with save/restore in lil.gui etc is it assumes the data
353
+ I want to edit can be serialized to JSON
354
+
355
+ Just as the simplest example I can think of
356
+
357
+ ```js
358
+ const material = new THREE.MeshBasicMaterial();
64
359
 
65
360
  const gui = new GUI();
66
- gui.add(s, options);
361
+ gui.addColor(material, 'color');
67
362
  ```
68
363
 
69
- ## What
364
+ It makes no sense to save/restore here. I'm editing a three.js material.
365
+ If I wanted to serialize anything I'd serialize the material.
70
366
 
71
- It is not a general purpose library for every type of GUI.
72
- Rather, it is a small, easy to use library for small apps.
73
- Basically I liked how simple it was to use dat.gui to add
74
- a few sliders and options to a demo.
367
+ Otherwise I can just save the stuff I passed to the GUI.
75
368
 
76
- I thought I'd try to make a CSS/DOM based UI standard elements
77
- only and then require CSS to style it and see how far I got.
369
+ ```js
370
+ const s = {
371
+ someNumber: 123,
372
+ someString: 'hello',
373
+ someOption: 'dog',
374
+ someColor: '#ED3281',
375
+ };
78
376
 
79
- ### Not invented here syndrome
377
+ // save
378
+ const str = JSON.stringify(s);
80
379
 
81
- It's possible this already exists but if so I couldn't find it.
82
- Most UI libraries seem to be giant and require a build step.
83
- I wanted something hopefully not too big and something I could
84
- easily add to any example with 1 file (or 2 if you add CSS).
380
+ // restore
381
+ Object.assign(s, JSON.parse(str));
382
+ gui.updateDisplay();
383
+ ```
85
384
 
86
- ## muigui - wat?
385
+ In other words, the serialization is too specialized. It's trivial
386
+ to call `JSON.stringify` on data that serializable. No need to put
387
+ serialization in the GUI. Note: I get that you might want to save
388
+ some hidden gui state like whether or not a folder is expanded.
389
+ You still run into the issue though that the data being edited
390
+ might not be easily serializable so you'd have to find another solution.
87
391
 
88
- https://user-images.githubusercontent.com/234804/177000460-3449c2dd-da94-4119-903f-cc7460b46e7b.mp4
392
+ ## Future
89
393
 
90
- -->
394
+ I'm under sure how much time I'll continue to put into this.
395
+ I get the feeling other people are far more motivated to make
396
+ UIs. Maybe if I'm lucky they'll take some inspiration from
397
+ the thoughts above and I'll find they've covered it all.
91
398
 
92
399
  ## License
93
400
 
package/package.json CHANGED
@@ -1,17 +1,22 @@
1
1
  {
2
2
  "name": "muigui",
3
- "version": "0.0.10",
3
+ "version": "0.0.13",
4
4
  "description": "A Simple GUI",
5
5
  "main": "muigui.js",
6
6
  "module": "src/muigui.js",
7
7
  "type": "module",
8
8
  "scripts": {
9
9
  "build": "npm run build-normal",
10
+ "build-ci": "npm run build && node build/prep-for-deploy.js",
10
11
  "build-normal": "rollup -c",
11
12
  "build-min": "rollup -c",
13
+ "check-ci": "npm run pre-push",
12
14
  "eslint": "eslint \"**/*.js\"",
13
- "pre-push": "npm run eslint",
14
- "test": "echo \"Error: no test specified\" && exit 1"
15
+ "fix": "eslint --fix",
16
+ "pre-push": "npm run eslint && npm run build && npm run test",
17
+ "start": "node build/serve.js",
18
+ "test": "node test/puppeteer.js",
19
+ "watch": "npm run start"
15
20
  },
16
21
  "repository": {
17
22
  "type": "git",
@@ -35,10 +40,20 @@
35
40
  "devDependencies": {
36
41
  "@rollup/plugin-node-resolve": "^15.0.1",
37
42
  "@rollup/plugin-terser": "^0.4.0",
38
- "eslint": "^8.20.0",
43
+ "@rollup/plugin-typescript": "^11.1.5",
44
+ "@tsconfig/recommended": "^1.0.3",
45
+ "@typescript-eslint/eslint-plugin": "^6.12.0",
46
+ "@typescript-eslint/parser": "^6.12.0",
47
+ "chokidar": "^3.5.3",
48
+ "eslint": "^8.54.0",
39
49
  "eslint-plugin-html": "^7.1.0",
50
+ "eslint-plugin-one-variable-per-var": "^0.0.3",
40
51
  "eslint-plugin-optional-comma-spacing": "0.0.4",
41
52
  "eslint-plugin-require-trailing-comma": "0.0.1",
42
- "rollup": "^3.20.2"
53
+ "puppeteer": "^21.5.2",
54
+ "rollup": "^3.20.2",
55
+ "servez": "^2.1.2",
56
+ "tslib": "^2.6.2",
57
+ "typescript": "5.2"
43
58
  }
44
59
  }
@@ -26,6 +26,9 @@ export default class Button extends Controller {
26
26
  }));
27
27
  this.setOptions({name: property, ...options});
28
28
  }
29
+ name(name) {
30
+ this.#buttonElem.textContent = name;
31
+ }
29
32
  setOptions(options) {
30
33
  copyExistingProperties(this.#options, options);
31
34
  const {name} = this.#options;
@@ -5,8 +5,8 @@ import LabelController from './LabelController.js';
5
5
  export default class Canvas extends LabelController {
6
6
  #canvasElem;
7
7
 
8
- constructor() {
9
- super('muigui-canvas');
8
+ constructor(name) {
9
+ super('muigui-canvas', name);
10
10
  this.#canvasElem = this.add(
11
11
  new ElementView('canvas', 'muigui-canvas'),
12
12
  ).domElement;
@@ -1,12 +1,53 @@
1
+ /* eslint-disable no-underscore-dangle */
2
+ import {
3
+ colorFormatConverters,
4
+ guessFormat,
5
+ hasAlpha,
6
+ hexToUint8RGB,
7
+ hslToRgbUint8,
8
+ rgbUint8ToHsl,
9
+ uint8RGBToHex,
10
+ } from '../libs/color-utils.js';
1
11
  import ColorChooserView from '../views/ColorChooserView.js';
2
12
  import TextView from '../views/TextView.js';
3
13
  import PopDownController from './PopDownController.js';
4
14
 
5
15
  export default class ColorChooser extends PopDownController {
6
- constructor(object, property) {
16
+ #colorView;
17
+ #textView;
18
+ #to;
19
+
20
+ constructor(object, property, options = {}) {
7
21
  super(object, property, 'muigui-color-chooser');
8
- this.addTop(new TextView(this));
9
- this.addBottom(new ColorChooserView(this));
22
+ const format = options.format || guessFormat(this.getValue());
23
+ const {color, text} = colorFormatConverters[format];
24
+ this.#to = color.to;
25
+ this.#textView = new TextView(this, {converters: text, alpha: hasAlpha(format)});
26
+ this.#colorView = new ColorChooserView(this, {converters: color, alpha: hasAlpha(format)});
27
+ this.addTop(this.#textView);
28
+ this.addBottom(this.#colorView);
29
+ // WTF! FIX!
30
+ this.___setKnobHelper = true;
10
31
  this.updateDisplay();
11
32
  }
33
+ #setKnobHelper() {
34
+ if (this.#to) {
35
+ const hex6Or8 = this.#to(this.getValue());
36
+ const alpha = hex6Or8.length === 9 ? hex6Or8.substring(7, 9) : 'FF';
37
+ const hsl = rgbUint8ToHsl(hexToUint8RGB(hex6Or8));
38
+ hsl[2] = (hsl[2] + 50) % 100;
39
+ const hex = uint8RGBToHex(hslToRgbUint8(hsl));
40
+ this.setKnobColor(`${hex6Or8.substring(0, 7)}${alpha}`, hex);
41
+ }
42
+ }
43
+ updateDisplay() {
44
+ super.updateDisplay();
45
+ if (this.___setKnobHelper) {
46
+ this.#setKnobHelper();
47
+ }
48
+ }
49
+ setOptions(options) {
50
+ super.setOptions(options);
51
+ return this;
52
+ }
12
53
  }
@@ -43,14 +43,14 @@ export default class Container extends Controller {
43
43
  }
44
44
  return this;
45
45
  }
46
- _addControllerImpl(controller) {
46
+ #addControllerImpl(controller) {
47
47
  this.domElement.appendChild(controller.domElement);
48
48
  this.#controllers.push(controller);
49
49
  controller.setParent(this);
50
50
  return controller;
51
51
  }
52
52
  addController(controller) {
53
- return this.#childDestController._addControllerImpl(controller);
53
+ return this.#childDestController.#addControllerImpl(controller);
54
54
  }
55
55
  pushContainer(container) {
56
56
  this.addController(container);
@@ -11,6 +11,7 @@ export default class Folder extends Container {
11
11
  type: 'button',
12
12
  onClick: () => this.toggleOpen(),
13
13
  }, [this.#labelElem]));
14
+ this.pushContainer(new Container('muigui-open-container'));
14
15
  this.pushContainer(new Container());
15
16
  this.name(name);
16
17
  this.open();
@@ -29,8 +29,11 @@ pc.addBottom
29
29
  export default class PopDownController extends ValueController {
30
30
  #top;
31
31
  #valuesView;
32
+ #checkboxElem;
32
33
  #bottom;
33
- #options = {open: false};
34
+ #options = {
35
+ open: false,
36
+ };
34
37
 
35
38
  constructor(object, property, options = {}) {
36
39
  super(object, property, 'muigui-pop-down-controller');
@@ -46,12 +49,25 @@ export default class PopDownController extends ValueController {
46
49
  type: 'checkbox',
47
50
  onChange: () => {
48
51
  this.#options.open = checkboxElem.checked;
52
+ this.updateDisplay();
49
53
  },
50
54
  }));
55
+ this.#checkboxElem = checkboxElem;
51
56
  this.#valuesView = this.#top.add(new ElementView('div', 'muigui-pop-down-values'));
52
- this.#bottom = this.add(new ElementView('div', 'muigui-pop-down-bottom'));
57
+ const container = new ElementView('div', 'muigui-pop-down-bottom muigui-open-container');
58
+ this.#bottom = new ElementView('div');
59
+ container.add(this.#bottom);
60
+ this.add(container);
53
61
  this.setOptions(options);
54
62
  }
63
+ setKnobColor(bgCssColor/*, fgCssColor*/) {
64
+ if (this.#checkboxElem) {
65
+ this.#checkboxElem.style = `
66
+ --range-color: ${bgCssColor};
67
+ --value-bg-color: ${bgCssColor};
68
+ `;
69
+ }
70
+ }
55
71
  updateDisplay() {
56
72
  super.updateDisplay();
57
73
  const {open} = this.#options;
@@ -3,7 +3,7 @@ import ValueController from './ValueController.js';
3
3
 
4
4
  export default class Text extends ValueController {
5
5
  constructor(object, property) {
6
- super(object, property, 'muigui-checkbox');
6
+ super(object, property, 'muigui-text');
7
7
  this.add(new TextView(this));
8
8
  this.updateDisplay();
9
9
  }
@@ -11,7 +11,7 @@ export default class TextNumber extends ValueController {
11
11
  #step;
12
12
 
13
13
  constructor(object, property, options = {}) {
14
- super(object, property, 'muigui-checkbox');
14
+ super(object, property, 'muigui-text-number');
15
15
  this.#textView = this.add(new NumberView(this, options));
16
16
  this.updateDisplay();
17
17
  }
@@ -24,6 +24,9 @@ export function createController(object, property, ...args) {
24
24
  if (Array.isArray(arg1)) {
25
25
  return new Select(object, property, {keyValues: arg1});
26
26
  }
27
+ if (arg1 && arg1.keyValues) {
28
+ return new Select(object, property, {keyValues: arg1.keyValues});
29
+ }
27
30
 
28
31
  const t = typeof object[property];
29
32
  switch (t) {
@@ -9,4 +9,12 @@ export { default as Slider } from './controllers/Slider.js';
9
9
  export { default as TextNumber } from './controllers/TextNumber.js';
10
10
  export { default as Vec2 } from './controllers/Vec2.js';
11
11
 
12
+ import {graph} from './libs/graph.js';
13
+ import {monitor} from './libs/monitor.js';
14
+
15
+ export const helpers = {
16
+ graph,
17
+ monitor,
18
+ };
19
+
12
20
  export default GUI;