perfect-gui 5.1.0 → 5.1.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
@@ -13,6 +13,7 @@
13
13
  - **Modern UI**: Clean, customizable, and polished design right out of the box.
14
14
  - **Rich Inputs**: Support for sliders, buttons, color pickers, vectors, images, lists, and toggles.
15
15
  - **Folders**: Easily group and organize your controls in collapsible sections.
16
+ - **Tabs**: Create tabbed interfaces to organize content in separate panels.
16
17
  - **Draggable & Auto-positioned**: Snap it to screen edges or let the user drag it anywhere.
17
18
  - **Data Binding**: Automatically sync your controls with object properties.
18
19
  - **Zero Dependencies**: Lightweight and built with vanilla JavaScript.
@@ -110,4 +111,5 @@ See the [Documentation](https://thibka.github.io/perfect-gui/) for a comprehensi
110
111
  - [`color()`](https://thibka.github.io/perfect-gui/public/#color)
111
112
  - [`vector2()`](https://thibka.github.io/perfect-gui/public/#vector2)
112
113
  - [`folder()`](https://thibka.github.io/perfect-gui/public/#folder)
114
+ - [`tabs()`](https://thibka.github.io/perfect-gui/public/#tabs)
113
115
  - [`toggleClose()`](https://thibka.github.io/perfect-gui/public)
@@ -543,7 +543,7 @@ class C {
543
543
  typeof t.onUpdate == "function" && (this.onUpdate = t.onUpdate), this.label = t != null && typeof t.label == "string" ? t.label : "", this.backgroundColor = t.color || null, this.opacity = t.opacity || 1, this.container == document.body ? this.maxHeight = window.innerHeight : this.maxHeight = Math.min(
544
544
  this.container.clientHeight,
545
545
  window.innerHeight
546
- ), t.maxHeight && (this.initMaxHeight = t.maxHeight, this.maxHeight = Math.min(this.initMaxHeight, this.maxHeight)), this.screenCorner = this._parseScreenCorner(t.position), window.perfectGUI || (window.perfectGUI = {}), window.perfectGUI.instanceCounter == null ? window.perfectGUI.instanceCounter = 0 : window.perfectGUI.instanceCounter++, this.instanceId = window.perfectGUI.instanceCounter, this.wrapperWidth = t.width || 290, this.stylesheet = document.createElement("style"), this.stylesheet.setAttribute("type", "text/css"), this.stylesheet.setAttribute("id", "lm-gui-stylesheet"), document.head.append(this.stylesheet), this.instanceId == 0 && this._addStyles(`${oe(this.position_type)}`), this._styleInstance(), this._addWrapper(), this.domElement.setAttribute("data-corner-x", this.screenCorner.x), this.domElement.setAttribute("data-corner-y", this.screenCorner.y), t.autoRepositioning != !1 && window.addEventListener("resize", this._handleResize.bind(this)), this._handleResize(), this.hasBeenDragged = !1, t.draggable == !0 && this._makeDraggable(), this.closed = !1, t.closed && this.toggleClose();
546
+ ), t.maxHeight && (this.initMaxHeight = t.maxHeight, this.maxHeight = Math.min(this.initMaxHeight, this.maxHeight)), this.screenCorner = this._parseScreenCorner(t.position), window.perfectGUI || (window.perfectGUI = {}), window.perfectGUI.instanceCounter == null ? window.perfectGUI.instanceCounter = 0 : window.perfectGUI.instanceCounter++, this.instanceId = window.perfectGUI.instanceCounter, this.wrapperWidth = t.width || 290, this.stylesheet = document.createElement("style"), this.stylesheet.setAttribute("type", "text/css"), this.stylesheet.setAttribute("id", "lm-gui-stylesheet"), document.head.append(this.stylesheet), this.instanceId == 0 && this._addStyles(`${oe(this.position_type)}`), this._styleInstance(), this.closed = !!t.closed, this._addWrapper(), this.domElement.setAttribute("data-corner-x", this.screenCorner.x), this.domElement.setAttribute("data-corner-y", this.screenCorner.y), t.autoRepositioning != !1 && window.addEventListener("resize", this._handleResize.bind(this)), this._handleResize(), this.hasBeenDragged = !1, t.draggable == !0 && this._makeDraggable();
547
547
  }
548
548
  _styleInstance() {
549
549
  let t = this._getScrollbarWidth(this.container);
@@ -603,7 +603,7 @@ class C {
603
603
  this.stylesheet.innerHTML += t;
604
604
  }
605
605
  _addWrapper() {
606
- this.domElement = document.createElement("div"), this.domElement.id = "p-gui-" + this.instanceId, this.domElement.className = "p-gui", this.domElement.setAttribute("data-lenis-prevent", ""), this.container.append(this.domElement), this.header = document.createElement("div"), this.header.className = "p-gui__header", this.header.textContent = this.label, this.header.style = `${this.backgroundColor ? "border-color: " + this.backgroundColor + ";" : ""}`, this.domElement.append(this.header);
606
+ this.domElement = document.createElement("div"), this.domElement.id = "p-gui-" + this.instanceId, this.domElement.className = "p-gui" + (this.closed ? " p-gui--collapsed" : ""), this.domElement.setAttribute("data-lenis-prevent", ""), this.container.append(this.domElement), this.header = document.createElement("div"), this.header.className = "p-gui__header", this.header.textContent = this.label, this.header.style = `${this.backgroundColor ? "border-color: " + this.backgroundColor + ";" : ""}`, this.domElement.append(this.header);
607
607
  const t = document.createElement("div");
608
608
  t.className = "p-gui__header-close", t.addEventListener("click", this.toggleClose.bind(this)), this.header.append(t);
609
609
  const e = document.createElement("div");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "perfect-gui",
3
3
  "type": "module",
4
- "version": "5.1.0",
4
+ "version": "5.1.1",
5
5
  "description": "GUI for JavaScript",
6
6
  "main": "dist/perfect-gui.js",
7
7
  "module": "dist/perfect-gui.js",
package/src/index.js CHANGED
@@ -81,6 +81,7 @@ export default class GUI {
81
81
  // Instance specific styles
82
82
  this._styleInstance();
83
83
 
84
+ this.closed = !!options.closed;
84
85
  this._addWrapper();
85
86
  this.domElement.setAttribute('data-corner-x', this.screenCorner.x);
86
87
  this.domElement.setAttribute('data-corner-y', this.screenCorner.y);
@@ -92,9 +93,6 @@ export default class GUI {
92
93
 
93
94
  this.hasBeenDragged = false;
94
95
  if (options.draggable == true) this._makeDraggable();
95
-
96
- this.closed = false;
97
- if (options.closed) this.toggleClose();
98
96
  }
99
97
 
100
98
  _styleInstance() {
@@ -245,7 +243,7 @@ export default class GUI {
245
243
  _addWrapper() {
246
244
  this.domElement = document.createElement('div');
247
245
  this.domElement.id = 'p-gui-' + this.instanceId;
248
- this.domElement.className = 'p-gui';
246
+ this.domElement.className = 'p-gui' + (this.closed ? ' p-gui--collapsed' : '');
249
247
  this.domElement.setAttribute('data-lenis-prevent', '');
250
248
  this.container.append(this.domElement);
251
249