perfect-gui 4.12.10 → 5.0.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/README.md CHANGED
@@ -42,7 +42,7 @@ For a quick setup without build tools, use an import map:
42
42
  import GUI from 'perfect-gui';
43
43
 
44
44
  const gui = new GUI();
45
- gui.button('Click me!', () => alert('Hello world!'));
45
+ gui.button({ label: 'Click me' }).onClick(() => alert('Hello world!'));
46
46
  </script>
47
47
  ```
48
48
 
@@ -60,13 +60,13 @@ const gui = new GUI({
60
60
  });
61
61
 
62
62
  // 2. Add a simple button
63
- gui.button('Click me', () => {
63
+ gui.button({ label: 'Click me' }).onClick(() => {
64
64
  console.log('Button clicked!');
65
65
  });
66
66
 
67
67
  // 3. Add a slider connected to an object value natively
68
68
  const params = { opacity: 0.5 };
69
- gui.slider({ obj: params, prop: 'opacity', min: 0, max: 1 }, (val) => {
69
+ gui.slider(params, 'opacity', { min: 0, max: 1 }).onChange((val) => {
70
70
  document.body.style.opacity = val;
71
71
  });
72
72