perfect-gui 4.12.5 → 4.12.7

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.
@@ -1,15 +1,15 @@
1
- let F = class {
1
+ let H = class {
2
2
  constructor(t, e = {}, i) {
3
3
  this.parent = t;
4
4
  let s = "";
5
- typeof e != "string" ? typeof e == "object" && (e != null && e.hasOwnProperty("label")) ? s = e.label == "" ? " " : e.label : s = " " : s = e == "" ? " " : e;
5
+ typeof e != "string" ? typeof e == "object" && e?.hasOwnProperty("label") ? s = e.label == "" ? " " : e.label : s = " " : s = e == "" ? " " : e;
6
6
  const l = typeof e.tooltip == "string" ? e.tooltip : e.tooltip === !0 ? s : null, a = document.createElement("div");
7
7
  return a.className = "p-gui__button", a.textContent = s, l && a.setAttribute("title", l), a.addEventListener("click", () => {
8
8
  i && i(), this.parent.onUpdate ? this.parent.onUpdate() : this.parent.isFolder && this.parent.firstParent.onUpdate && this.parent.firstParent.onUpdate();
9
9
  }), typeof e.color == "string" && (a.style.setProperty("--color-accent", e.color), a.style.setProperty("--color-accent-hover", e.hoverColor || e.color)), this.parent.wrapper.append(a), a;
10
10
  }
11
11
  };
12
- class M {
12
+ class N {
13
13
  constructor(t, e = {}, i) {
14
14
  if (this.parent = t, this.propReferences = [], typeof e != "object")
15
15
  throw Error(`[GUI] slider() first parameter must be an object. Received: ${typeof e}.`);
@@ -81,7 +81,7 @@ class M {
81
81
  return e * Math.floor(t / e);
82
82
  }
83
83
  }
84
- class H {
84
+ class S {
85
85
  constructor(t, e = {}, i) {
86
86
  if (this.parent = t, typeof e != "object")
87
87
  throw Error(`[GUI] image() first parameter must be an object. Received: ${typeof e}.`);
@@ -106,7 +106,7 @@ class H {
106
106
  }), n;
107
107
  }
108
108
  }
109
- class N {
109
+ class X {
110
110
  constructor(t, e = {}, i) {
111
111
  if (this.parent = t, typeof e != "object")
112
112
  throw Error(`[GUI] toggle() first parameter must be an object. Received: ${typeof e}.`);
@@ -127,7 +127,7 @@ class N {
127
127
  let f = !0;
128
128
  h.classList.contains("p-gui__toggle-checkbox--active") && (f = !1), h.classList.toggle("p-gui__toggle-checkbox--active"), l ? o[r] = f : typeof i == "function" && i(f), this.parent.onUpdate ? this.parent.onUpdate() : this.parent.isFolder && this.parent.firstParent.onUpdate && this.parent.firstParent.onUpdate();
129
129
  });
130
- let g = (() => l ? o[r] ? " p-gui__toggle-checkbox--active" : "" : p ? " p-gui__toggle-checkbox--active" : "")();
130
+ let g = l ? o[r] ? " p-gui__toggle-checkbox--active" : "" : p ? " p-gui__toggle-checkbox--active" : "";
131
131
  const d = document.createElement("div");
132
132
  return d.className = "p-gui__toggle-checkbox" + g, n.append(d), l && Object.defineProperty(o, r, {
133
133
  set: (c) => {
@@ -137,7 +137,7 @@ class N {
137
137
  }), n;
138
138
  }
139
139
  }
140
- class X {
140
+ class W {
141
141
  constructor(t, e = {}, i) {
142
142
  if (this.parent = t, typeof e != "object")
143
143
  throw Error(`[GUI] list() first parameter must be an object. Received: ${typeof e}.`);
@@ -179,7 +179,7 @@ class X {
179
179
  }), l && Object.defineProperty(o, r, {
180
180
  set: (h) => {
181
181
  let f, b, v;
182
- n ? (v = p.find((w) => w.value == h), b = (v == null ? void 0 : v.value) || p[0].value, f = p.indexOf(v)) : (typeof h == "string" && (f = p.indexOf(h), b = h), typeof h == "number" && (f = h, b = p[h])), this.parent.propReferences[a] = n ? b : h;
182
+ n ? (v = p.find((w) => w.value == h), b = v?.value || p[0].value, f = p.indexOf(v)) : (typeof h == "string" && (f = p.indexOf(h), b = h), typeof h == "number" && (f = h, b = p[h])), this.parent.propReferences[a] = n ? b : h;
183
183
  const m = c.querySelector("[selected]");
184
184
  m && m.removeAttribute("selected"), c.querySelectorAll("option")[f].setAttribute("selected", ""), typeof i == "function" && i(n ? v : b, f);
185
185
  },
@@ -187,7 +187,7 @@ class X {
187
187
  }), d;
188
188
  }
189
189
  }
190
- class S {
190
+ class G {
191
191
  constructor(t, e = {}, i) {
192
192
  if (this.parent = t, typeof e != "object")
193
193
  throw Error(`[GUI] color() first parameter must be an object. Received: ${typeof e}.`);
@@ -216,7 +216,7 @@ class S {
216
216
  }), n;
217
217
  }
218
218
  }
219
- class W {
219
+ class Y {
220
220
  constructor(t, e = {}, i) {
221
221
  if (this.parent = t, typeof e != "object")
222
222
  throw Error(`[GUI] vector2() first parameter must be an object. Received: ${typeof e}.`);
@@ -225,453 +225,49 @@ class W {
225
225
  i = typeof i == "function" ? i : null;
226
226
  const w = document.createElement("div");
227
227
  w.className = "p-gui__vector2", w.textContent = s, m && w.setAttribute("title", m), this.parent.wrapper.append(w);
228
- const k = document.createElement("div");
229
- k.className = "p-gui__vector-value", k.textContent = d[c] + ", " + f[b], w.append(k);
228
+ const A = document.createElement("div");
229
+ A.className = "p-gui__vector-value", A.textContent = d[c] + ", " + f[b], w.append(A);
230
230
  const _ = document.createElement("div");
231
231
  _.className = "p-gui__vector2-area", w.append(_), _.addEventListener("click", (x) => {
232
- const E = parseFloat(this.parent._mapLinear(x.offsetX, 0, _.clientWidth, l, a)), j = parseFloat(this.parent._mapLinear(x.offsetY, 0, _.clientHeight, r, o));
233
- d[c] = E.toFixed(n), f[b] = j.toFixed(g), i && i(d[c], d[b]), this.parent.onUpdate ? this.parent.onUpdate() : this.parent.isFolder && this.parent.firstParent.onUpdate && this.parent.firstParent.onUpdate();
232
+ const j = parseFloat(this.parent._mapLinear(x.offsetX, 0, _.clientWidth, l, a)), I = parseFloat(this.parent._mapLinear(x.offsetY, 0, _.clientHeight, r, o));
233
+ d[c] = j.toFixed(n), f[b] = I.toFixed(g), i && i(d[c], d[b]), this.parent.onUpdate ? this.parent.onUpdate() : this.parent.isFolder && this.parent.firstParent.onUpdate && this.parent.firstParent.onUpdate();
234
234
  });
235
235
  const U = (x) => {
236
- const E = _.getBoundingClientRect(), j = x.clientX - E.left, P = x.clientY - E.top, $ = this.parent._mapLinear(j, 0, _.clientWidth, l, a), O = this.parent._mapLinear(P, 0, _.clientHeight, r, o), D = Math.max(l, Math.min(a, $)), L = Math.max(o, Math.min(r, O));
237
- d[c] = parseFloat(D.toFixed(n)), f[b] = parseFloat(L.toFixed(g)), i && i(d[c], f[b]), this.parent.onUpdate ? this.parent.onUpdate() : this.parent.isFolder && this.parent.firstParent.onUpdate && this.parent.firstParent.onUpdate();
236
+ const j = _.getBoundingClientRect(), I = x.clientX - j.left, $ = x.clientY - j.top, D = this.parent._mapLinear(I, 0, _.clientWidth, l, a), L = this.parent._mapLinear($, 0, _.clientHeight, r, o), F = Math.max(l, Math.min(a, D)), M = Math.max(o, Math.min(r, L));
237
+ d[c] = parseFloat(F.toFixed(n)), f[b] = parseFloat(M.toFixed(g)), i && i(d[c], f[b]), this.parent.onUpdate ? this.parent.onUpdate() : this.parent.isFolder && this.parent.firstParent.onUpdate && this.parent.firstParent.onUpdate();
238
238
  };
239
239
  _.addEventListener("pointerdown", (x) => {
240
240
  U(x), document.addEventListener("pointermove", U), document.addEventListener("pointerup", () => {
241
241
  document.removeEventListener("pointermove", U);
242
242
  }, { once: !0 });
243
243
  });
244
- const C = document.createElement("div");
245
- C.className = "p-gui__vector2-line p-gui__vector2-line-x", _.append(C);
246
244
  const R = document.createElement("div");
247
- R.className = "p-gui__vector2-line p-gui__vector2-line-y", _.append(R);
248
- const A = document.createElement("div");
249
- return A.className = "p-gui__vector2-dot", _.append(A), A.style.left = this.parent._mapLinear(d[c], l, a, 0, _.clientWidth) + "px", A.style.top = this.parent._mapLinear(f[b], o, r, _.clientHeight, 0) + "px", Object.defineProperty(d, c, {
245
+ R.className = "p-gui__vector2-line p-gui__vector2-line-x", _.append(R);
246
+ const P = document.createElement("div");
247
+ P.className = "p-gui__vector2-line p-gui__vector2-line-y", _.append(P);
248
+ const k = document.createElement("div");
249
+ k.className = "p-gui__vector2-dot", _.append(k);
250
+ const E = () => {
251
+ k.style.left = this.parent._mapLinear(d[c], l, a, 0, _.clientWidth) + "px", k.style.top = this.parent._mapLinear(f[b], o, r, _.clientHeight, 0) + "px";
252
+ };
253
+ return E(), new ResizeObserver(() => {
254
+ E();
255
+ }).observe(_), Object.defineProperty(d, c, {
250
256
  set: (x) => {
251
- this.parent.propReferences[h] = x, A.style.left = this.parent._mapLinear(x, l, a, 0, _.clientWidth) + "px", k.textContent = String(x) + ", " + f[b];
257
+ this.parent.propReferences[h] = x, E(), A.textContent = String(x) + ", " + f[b];
252
258
  },
253
259
  get: () => this.parent.propReferences[h]
254
260
  }), Object.defineProperty(f, b, {
255
261
  set: (x) => {
256
- this.parent.propReferences[v] = x, A.style.top = this.parent._mapLinear(x, o, r, _.clientHeight, 0) + "px", k.textContent = d[c] + ", " + String(x);
262
+ this.parent.propReferences[v] = x, E(), A.textContent = d[c] + ", " + String(x);
257
263
  },
258
264
  get: () => this.parent.propReferences[v]
259
265
  }), w;
260
266
  }
261
267
  }
262
- const G = (
263
- /* css */
264
- `
265
- .p-gui__button {
266
- background: var(--color-accent);
267
- text-align: center;
268
- color: var(--color-bg);
269
- border: none;
270
- border: 1px solid transparent;
271
- box-sizing: border-box;
272
- transition: var(--transition) background, var(--transition) border-color;
273
- }
274
-
275
- .p-gui__button:hover {
276
- background: var(--color-accent-hover);
277
- border-color: rgba(255, 255, 255, 0.2);
278
- }
279
-
280
- .p-gui__folder .p-gui__button {
281
- margin-inline: 0;
282
- }
283
- `
284
- ), Y = (
285
- /* css */
286
- `
287
- .p-gui__slider {
288
- position: relative;
289
- min-height: 14px;
290
- display: flex;
291
- align-items: center;
292
- justify-content: space-between;
293
- gap: 10px;
294
- color: var(--color-text-dark);
295
- transition: color var(--transition);
296
- padding: 3px;
297
- }
298
-
299
- .p-gui__slider:hover {
300
- color: var(--color-text-light);
301
- }
302
-
303
- .p-gui__slider-name {
304
- width: 50%;
305
- text-overflow: ellipsis;
306
- overflow: hidden;
307
- }
308
-
309
- .p-gui__slider-ctrl {
310
- -webkit-appearance: none;
311
- padding: 0;
312
- font: inherit;
313
- outline: none;
314
- box-sizing: border-box;
315
- cursor: pointer;
316
- position: relative;
317
- right: 0;
318
- height: 14px;
319
- margin: 0 0 0 auto;
320
- width: 37%;
321
- }
322
-
323
- .p-gui__slider-bar {
324
- position: absolute;
325
- top: 50%;
326
- left: 0;
327
- height: 2px;
328
- background: rgba(255, 255, 255, .2);
329
- width: 100%;
330
- transform: translateY(-50%);
331
- }
332
-
333
- .p-gui__slider-filling {
334
- position: absolute;
335
- top: -25%;
336
- left: 0;
337
- height: 100%;
338
- background: var(--color-accent);
339
- width: 0;
340
- }
341
-
342
- .p-gui__slider:hover .p-gui__slider-filling {
343
- background: var(--color-accent-hover);
344
- }
345
-
346
- .p-gui__slider-handle {
347
- width: 9px;
348
- height: 9px;
349
- position: absolute;
350
- top: 50%;
351
- left: 0;
352
- border-radius: 2px;
353
- transform: translate(-50%, -50%);
354
- pointer-events: none;
355
- background: var(--color-text-dark);
356
- box-shadow: 0 0 2px rgba(0, 0, 0, .5);
357
- }
358
-
359
- .p-gui__slider:hover .p-gui__slider-handle {
360
- background: var(--color-text-light);
361
- }
362
-
363
- .p-gui__slider-value {
364
- display: inline-block;
365
- right: 7px;
366
- width: 13%;
367
- border: none;
368
- color: white;
369
- border-radius: 2px;
370
- background: rgba(255, 255, 255, 0.1);
371
- padding: 2px 4px;
372
- color: inherit;
373
- }
374
-
375
- .p-gui__slider-value:focus {
376
- outline: none;
377
- }
378
- `
379
- ), B = (
380
- /* css */
381
- `
382
- .p-gui__list {
383
- cursor: default;
384
- color: var(--color-text-dark);
385
- transition: var(--transition) color;
386
- }
387
-
388
- .p-gui__list:hover {
389
- color: var(--color-text-light);
390
- }
391
-
392
- .p-gui__list-dropdown {
393
- background: rgba(255, 255, 255,.05);
394
- color: white;
395
- padding: 0 12px 0 5px;
396
- top: 0px;
397
- }
398
-
399
- .p-gui__list-dropdown {
400
- position: absolute;
401
- right: 5px;
402
- top: 0;
403
- bottom: 0;
404
- margin: auto;
405
- height: calc(100% - 4px);
406
- cursor: pointer;
407
- border-radius: 3px;
408
- border: 1px solid var(--color-border-2);
409
- outline: none;
410
-
411
- option {
412
- background: white;
413
- color: black;
414
- }
415
- }
416
-
417
- .p-gui__list-dropdown:hover {
418
- background: rgba(255, 255, 255, .1);
419
- }
420
- `
421
- ), z = (
422
- /* css */
423
- `
424
- .p-gui__toggle {
425
- color: var(--color-text-dark);
426
- transition: var(--transition) background, var(--transition) color;
427
- }
428
-
429
- .p-gui__toggle:hover {
430
- background: rgba(255, 255, 255, .1);
431
- color: var(--color-text-light);
432
- }
433
-
434
- .p-gui__folder .p-gui__toggle {
435
- margin-inline: 0;
436
- }
437
-
438
- .p-gui__toggle-checkbox {
439
- width: 10px;
440
- height: 10px;
441
- background-color: rgba(255, 255, 255, 0.1);
442
- position: absolute;
443
- top: 0;
444
- right: 10px;
445
- bottom: 0;
446
- margin: auto;
447
- border-radius: 2px;
448
- pointer-events: none;
449
- transition: .5s all ease;
450
- }
451
-
452
- .p-gui__toggle-checkbox--active {
453
- background-color: #ddd;
454
- box-shadow: 0 0 5px #ddd;
455
- }
456
- `
457
- ), V = (
458
- /* css */
459
- `
460
- .p-gui__color {
461
- cursor: default;
462
- color: var(--color-text-dark);
463
- transition: var(--transition) color;
464
- }
465
-
466
- .p-gui__color:hover {
467
- color: var(--color-text-light);
468
- }
469
-
470
- .p-gui__color-picker {
471
- position: absolute;
472
- right: 5px;
473
- top: 0;
474
- bottom: 0;
475
- margin: auto;
476
- height: calc(100% - 4px);
477
- cursor: pointer;
478
- border-radius: 3px;
479
- border: 1px solid var(--color-border-2);
480
- outline: none;
481
- -webkit-appearance: none;
482
- padding: 0;
483
- background-color: transparent;
484
- border: 1px solid #222222;
485
- overflow: hidden;
486
- }
487
-
488
- .p-gui__color-picker::-webkit-color-swatch-wrapper {
489
- padding: 0;
490
- }
491
- .p-gui__color-picker::-webkit-color-swatch {
492
- border: none;
493
- }
494
- `
495
- ), T = (
496
- /* css */
497
- `
498
- .p-gui__vector2 {
499
- background: transparent;
500
- aspect-ratio: 1;
501
- padding-bottom: 0;
502
- color: var(--color-text-dark);
503
- }
504
-
505
- .p-gui__vector2:hover {
506
- color: var(--color-text-light);
507
- }
508
-
509
- .p-gui__vector2-area {
510
- position: relative;
511
- background: rgba(0, 0, 0, .3);
512
- margin-top: 8px;
513
- width: 100%;
514
- height: calc(100% - 28px);
515
- touch-action: none;
516
- }
517
-
518
- .p-gui__vector2-line {
519
- position: absolute;
520
- background: white;
521
- opacity: .3;
522
- pointer-events: none;
523
- }
524
-
525
- .p-gui__vector2-line-x {
526
- width: 100%;
527
- height: 1px;
528
- left: 0;
529
- top: 50%;
530
- transform: translateY(-50%);
531
- }
532
-
533
- .p-gui__vector2-line-y {
534
- width: 1px;
535
- height: 100%;
536
- top: 0;
537
- left: 50%;
538
- transform: translateX(-50%);
539
- }
540
-
541
- .p-gui__vector2-dot {
542
- position: absolute;
543
- top: 0;
544
- left: 0;
545
- width: 8px;
546
- height: 8px;
547
- border-radius: 50%;
548
- background: #d5d5d5;
549
- border: 2px solid #ff9999;
550
- transform: translate(-50%, -50%);
551
- pointer-events: none;
552
- }
553
-
554
- .p-gui__vector-value {
555
- display: inline-block;
556
- right: 7px;
557
- position: absolute;
558
- }
559
- `
560
- ), Q = (
561
- /* css */
562
- `
563
- .p-gui__image-container {
564
- width: 100%;
565
- padding: 3px;
566
- display: flex;
567
- justify-content: flex-start;
568
- flex-wrap: wrap;
569
- box-sizing: border-box;
570
- }
571
-
572
- .p-gui__image {
573
- background-size: cover;
574
- cursor: pointer;
575
- position: relative;
576
- margin: 1px 2.5px 19px 2.5px;
577
- border-radius: var(--main-border-radius);
578
- flex: 0 0 calc(33.333% - 5px);
579
- height: 90px;
580
- background-position: center;
581
- color: var(--color-text-dark);
582
- transition: var(--transition) color;
583
- }
584
-
585
- .p-gui__image:hover {
586
- color: var(--color-text-light);
587
- }
588
-
589
- .p-gui__image::after {
590
- position: absolute;
591
- top: 0;
592
- left: 0;
593
- width: 100%;
594
- height: 100%;
595
- content: '';
596
- border: 1px solid transparent;
597
- box-sizing: border-box;
598
- border-radius: var(--main-border-radius);
599
- transition: var(--transition) border-color;
600
- }
601
- .p-gui__image--selected::after {
602
- border-color: #06FF89;
603
- }
604
-
605
- .p-gui__image-text {
606
- position: absolute;
607
- bottom: -15px;
608
- text-shadow: 0 -1px 0 #111;
609
- white-space: nowrap;
610
- width: 100%;
611
- overflow: hidden;
612
- text-overflow: ellipsis;
613
-
614
- }
615
- `
616
- ), q = (
617
- /* css */
618
- `
619
- .p-gui__folder {
620
- width: 100%;
621
- position: relative;
622
- background: var(--color-bg);
623
- overflow: auto;
624
- margin-bottom: 2px;
625
- display: flex;
626
- flex-wrap: wrap;
627
- border: 1px solid var(--color-border-2);
628
- padding: 0 2px 0 3px;
629
- border-radius: var(--main-border-radius);
630
- box-sizing: border-box;
631
- border-left: 1px solid #bbbbbb;
632
- }
633
-
634
- .p-gui__folder--first {
635
- margin-top: 0;
636
- }
637
-
638
- .p-gui__folder--closed {
639
- height: 25px;
640
- overflow: hidden;
641
- }
642
-
643
- .p-gui__folder-header {
644
- padding: 5px 3px;
645
- background-color: rgba(0, 0, 0, .5);
646
- color: white;
647
- cursor: pointer;
648
- width: 100%;
649
- margin: 0 -2px 2px -3px;
650
- }
651
-
652
- .p-gui__folder-header:hover {
653
- background-color: rgba(0, 0, 0, .75);
654
- }
655
-
656
- .p-gui__folder-arrow {
657
- width: 8px;
658
- height: 8px;
659
- display: inline-block;
660
- background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAHlBMVEUAAAD///////////////////////////////////8kfJuVAAAACXRSTlMA9Z1fCdMo1yxEJnA0AAAAK0lEQVQI12PABlRgjKkJUMZMYRhjpgqMAZSEMICSaIzpDWiKhdENhEhgAgATSg5jyWnYewAAAABJRU5ErkJggg==);
661
- background-size: contain;
662
- margin-right: 5px;
663
- transform: rotate(90deg)
664
- }
665
-
666
- .p-gui__folder--closed .p-gui__folder-arrow {
667
- transform: rotate(0deg);
668
- }
669
- `
670
- );
671
- function J(y) {
672
- return (
673
- /* css */
674
- `
268
+ const O = ".p-gui__button{background:var(--color-accent);text-align:center;color:var(--color-bg);border:none;border:1px solid transparent;box-sizing:border-box;transition:var(--transition) background,var(--transition) border-color}.p-gui__button:hover{background:var(--color-accent-hover);border-color:#fff3}.p-gui__folder .p-gui__button{margin-inline:0}", z = ".p-gui__slider{position:relative;min-height:14px;display:flex;align-items:center;justify-content:space-between;gap:10px;color:var(--color-text-dark);transition:color var(--transition);padding:3px}.p-gui__slider:hover{color:var(--color-text-light)}.p-gui__slider-name{width:50%;text-overflow:ellipsis;overflow:hidden}.p-gui__slider-ctrl{-webkit-appearance:none;padding:0;font:inherit;outline:none;box-sizing:border-box;cursor:pointer;position:relative;right:0;height:14px;margin:0 0 0 auto;width:37%}.p-gui__slider-bar{position:absolute;top:50%;left:0;height:2px;background:#fff3;width:100%;transform:translateY(-50%)}.p-gui__slider-filling{position:absolute;top:-25%;left:0;height:100%;background:var(--color-accent);width:0}.p-gui__slider:hover .p-gui__slider-filling{background:var(--color-accent-hover)}.p-gui__slider-handle{width:9px;height:9px;position:absolute;top:50%;left:0;border-radius:2px;transform:translate(-50%,-50%);pointer-events:none;background:var(--color-text-dark);box-shadow:0 0 2px #00000080}.p-gui__slider:hover .p-gui__slider-handle{background:var(--color-text-light)}.p-gui__slider-value{display:inline-block;right:7px;width:13%;border:none;color:#fff;border-radius:2px;background:#ffffff1a;padding:2px 4px;color:inherit}.p-gui__slider-value:focus{outline:none}", B = ".p-gui__list{cursor:default;color:var(--color-text-dark);transition:var(--transition) color}.p-gui__list:hover{color:var(--color-text-light)}.p-gui__list-dropdown{background:#ffffff0d;color:#fff;padding:0 12px 0 5px;top:0}.p-gui__list-dropdown{position:absolute;right:5px;top:0;bottom:0;margin:auto;height:calc(100% - 4px);cursor:pointer;border-radius:3px;border:1px solid var(--color-border-2);outline:none}.p-gui__list-dropdown option{background:#fff;color:#000}.p-gui__list-dropdown:hover{background:#ffffff1a}", V = ".p-gui__toggle{color:var(--color-text-dark);transition:var(--transition) background,var(--transition) color}.p-gui__toggle:hover{background:#ffffff1a;color:var(--color-text-light)}.p-gui__folder .p-gui__toggle{margin-inline:0}.p-gui__toggle-checkbox{width:10px;height:10px;background-color:#ffffff1a;position:absolute;top:0;right:10px;bottom:0;margin:auto;border-radius:2px;pointer-events:none;transition:.5s all ease}.p-gui__toggle-checkbox--active{background-color:#ddd;box-shadow:0 0 5px #ddd}", T = ".p-gui__color{cursor:default;color:var(--color-text-dark);transition:var(--transition) color}.p-gui__color:hover{color:var(--color-text-light)}.p-gui__color-picker{position:absolute;right:5px;top:0;bottom:0;margin:auto;height:calc(100% - 4px);cursor:pointer;border-radius:3px;border:1px solid var(--color-border-2);outline:none;-webkit-appearance:none;padding:0;background-color:transparent;border:1px solid #222222;overflow:hidden}.p-gui__color-picker::-webkit-color-swatch-wrapper{padding:0}.p-gui__color-picker::-webkit-color-swatch{border:none}", Q = ".p-gui__vector2{background:transparent;aspect-ratio:1;padding-bottom:0;color:var(--color-text-dark)}.p-gui__vector2:hover{color:var(--color-text-light)}.p-gui__vector2-area{position:relative;background:#0000004d;margin-top:8px;width:100%;height:calc(100% - 28px);touch-action:none}.p-gui__vector2-line{position:absolute;background:#fff;opacity:.3;pointer-events:none}.p-gui__vector2-line-x{width:100%;height:1px;left:0;top:50%;transform:translateY(-50%)}.p-gui__vector2-line-y{width:1px;height:100%;top:0;left:50%;transform:translate(-50%)}.p-gui__vector2-dot{position:absolute;top:0;left:0;width:8px;height:8px;border-radius:50%;background:#d5d5d5;border:2px solid #ff9999;transform:translate(-50%,-50%);pointer-events:none}.p-gui__vector-value{display:inline-block;right:7px;position:absolute}", q = '.p-gui__image-container{width:100%;padding:3px;display:flex;justify-content:flex-start;flex-wrap:wrap;box-sizing:border-box}.p-gui__image{background-size:cover;cursor:pointer;position:relative;margin:1px 2.5px 19px;border-radius:var(--main-border-radius);flex:0 0 calc(33.333% - 5px);height:90px;background-position:center;color:var(--color-text-dark);transition:var(--transition) color}.p-gui__image:hover{color:var(--color-text-light)}.p-gui__image:after{position:absolute;top:0;left:0;width:100%;height:100%;content:"";border:1px solid transparent;box-sizing:border-box;border-radius:var(--main-border-radius);transition:var(--transition) border-color}.p-gui__image--selected:after{border-color:#06ff89}.p-gui__image-text{position:absolute;bottom:-15px;text-shadow:0 -1px 0 #111;white-space:nowrap;width:100%;overflow:hidden;text-overflow:ellipsis}', J = ".p-gui__folder{width:100%;position:relative;background:var(--color-bg);overflow:auto;margin-bottom:2px;display:flex;flex-wrap:wrap;border:1px solid var(--color-border-2);padding:0 2px 0 3px;border-radius:var(--main-border-radius);box-sizing:border-box;border-left:1px solid #bbbbbb}.p-gui__folder--first{margin-top:0}.p-gui__folder--closed{height:25px;overflow:hidden}.p-gui__folder-header{padding:5px 3px;background-color:#00000080;color:#fff;cursor:pointer;width:100%;margin:0 -2px 2px -3px}.p-gui__folder-header:hover{background-color:#000000bf}.p-gui__folder-arrow{width:8px;height:8px;display:inline-block;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAHlBMVEUAAAD///////////////////////////////////8kfJuVAAAACXRSTlMA9Z1fCdMo1yxEJnA0AAAAK0lEQVQI12PABlRgjKkJUMZMYRhjpgqMAZSEMICSaIzpDWiKhdENhEhgAgATSg5jyWnYewAAAABJRU5ErkJggg==);background-size:contain;margin-right:5px;transform:rotate(90deg)}.p-gui__folder--closed .p-gui__folder-arrow{transform:rotate(0)}";
269
+ function Z(y) {
270
+ return console.log(O), `
675
271
  .p-gui {
676
272
  --main-border-radius: 3px;
677
273
  --color-bg: #161616;
@@ -799,31 +395,33 @@ function J(y) {
799
395
  border-color: rgba(255,255,255,.2);
800
396
  }
801
397
 
802
- ${G}
398
+ ${O}
803
399
 
804
- ${Q}
400
+ ${q}
805
401
 
806
402
  ${B}
807
403
 
808
- ${z}
809
-
810
- ${Y}
811
-
812
404
  ${V}
405
+
406
+ ${z}
813
407
 
814
408
  ${T}
815
409
 
816
- ${q}
817
- `
818
- );
410
+ ${Q}
411
+
412
+ ${J}
413
+ `;
819
414
  }
820
- class I {
415
+ class C {
821
416
  constructor(t = {}) {
822
- if (this.firstParent = this, t.container ? (this.container = typeof t.container == "string" ? document.querySelector(t.container) : t.container, this.position_type = "absolute") : (this.container = document.body, this.position_type = "fixed"), this.propReferences = [], this.folders = [], t.isFolder) {
417
+ if (console.log("test"), this.firstParent = this, t.container ? (this.container = typeof t.container == "string" ? document.querySelector(t.container) : t.container, this.position_type = "absolute") : (this.container = document.body, this.position_type = "fixed"), this.propReferences = [], this.folders = [], t.isFolder) {
823
418
  this._folderConstructor(t.folderOptions);
824
419
  return;
825
420
  }
826
- 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(this.container.clientHeight, window.innerHeight), 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(`${J(this.position_type)}`), this._styleInstance(), this._addWrapper(), this.wrapper.setAttribute("data-corner-x", this.screenCorner.x), this.wrapper.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();
421
+ 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(
422
+ this.container.clientHeight,
423
+ window.innerHeight
424
+ ), 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(`${Z(this.position_type)}`), this._styleInstance(), this._addWrapper(), this.wrapper.setAttribute("data-corner-x", this.screenCorner.x), this.wrapper.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();
827
425
  }
828
426
  _styleInstance() {
829
427
  let t = this._getScrollbarWidth(this.container);
@@ -857,15 +455,27 @@ class I {
857
455
  return t === document.body ? window.innerWidth - document.documentElement.clientWidth : t.offsetWidth - t.clientWidth;
858
456
  }
859
457
  _handleResize() {
860
- if (this.container == document.body ? this.maxHeight = window.innerHeight : this.maxHeight = Math.min(this.container.clientHeight, window.innerHeight), this.initMaxHeight && (this.maxHeight = Math.min(this.initMaxHeight, this.maxHeight)), this.wrapper.style.maxHeight = this.maxHeight + "px", this.hasBeenDragged)
458
+ if (this.container == document.body ? this.maxHeight = window.innerHeight : this.maxHeight = Math.min(
459
+ this.container.clientHeight,
460
+ window.innerHeight
461
+ ), this.initMaxHeight && (this.maxHeight = Math.min(this.initMaxHeight, this.maxHeight)), this.wrapper.style.maxHeight = this.maxHeight + "px", this.hasBeenDragged)
861
462
  return;
862
463
  let t = this._getScrollbarWidth(this.container);
863
464
  if (this.xOffset = this.screenCorner.x == "left" ? 0 : this.container.clientWidth - this.wrapperWidth - t, this.instanceId > 0) {
864
- let e = this.container.querySelectorAll(`.p-gui:not(#${this.wrapper.id}):not([data-dragged])`);
865
- for (let i = 0; i < e.length && !(parseInt(e[i].id.replace("p-gui-", "")) > this.instanceId); i++)
465
+ let e = this.container.querySelectorAll(
466
+ `.p-gui:not(#${this.wrapper.id}):not([data-dragged])`
467
+ );
468
+ for (let i = 0; i < e.length && !(parseInt(
469
+ e[i].id.replace("p-gui-", "")
470
+ ) > this.instanceId); i++)
866
471
  this.screenCorner.y == e[i].dataset.cornerY && (this.screenCorner.x == "left" && e[i].dataset.cornerX == "left" ? this.xOffset += e[i].offsetWidth : this.screenCorner.x == "right" && e[i].dataset.cornerX == "right" && (this.xOffset -= e[i].offsetWidth));
867
472
  }
868
- this.position = { prevX: this.xOffset, prevY: this.yOffset, x: this.xOffset, y: this.yOffset }, this.wrapper.style.transform = `translate3d(${this.position.x}px, ${this.position.y}px, 0)`;
473
+ this.position = {
474
+ prevX: this.xOffset,
475
+ prevY: this.yOffset,
476
+ x: this.xOffset,
477
+ y: this.yOffset
478
+ }, this.wrapper.style.transform = `translate3d(${this.position.x}px, ${this.position.y}px, 0)`;
869
479
  }
870
480
  _addStyles(t) {
871
481
  this.stylesheet.innerHTML += t;
@@ -876,27 +486,27 @@ class I {
876
486
  t.className = "p-gui__header-close", t.addEventListener("click", this.toggleClose.bind(this)), this.header.append(t);
877
487
  }
878
488
  button(t = {}, e) {
879
- return this.imageContainer = null, new F(this, t, e);
489
+ return this.imageContainer = null, new H(this, t, e);
880
490
  }
881
491
  image(t = {}, e) {
882
- return this.imageContainer || (this.imageContainer = document.createElement("div"), this.imageContainer.className = "p-gui__image-container", this.wrapper.append(this.imageContainer)), new H(this, t, e);
492
+ return this.imageContainer || (this.imageContainer = document.createElement("div"), this.imageContainer.className = "p-gui__image-container", this.wrapper.append(this.imageContainer)), new S(this, t, e);
883
493
  }
884
494
  slider(t = {}, e) {
885
- return this.imageContainer = null, new M(this, t, e);
495
+ return this.imageContainer = null, new N(this, t, e);
886
496
  }
887
497
  toggle(t = {}, e) {
888
498
  this.imageContainer = null;
889
- const i = new N(this, t, e);
499
+ const i = new X(this, t, e);
890
500
  return this.wrapper.append(i), i;
891
501
  }
892
502
  list(t = {}, e) {
893
- return this.imageContainer = null, new X(this, t, e);
503
+ return this.imageContainer = null, new W(this, t, e);
894
504
  }
895
505
  color(t = {}, e) {
896
- return this.imageContainer = null, new S(this, t, e);
506
+ return this.imageContainer = null, new G(this, t, e);
897
507
  }
898
508
  vector2(t = {}, e) {
899
- return this.imageContainer = null, new W(this, t, e);
509
+ return this.imageContainer = null, new Y(this, t, e);
900
510
  }
901
511
  folder(t = {}) {
902
512
  let e = typeof t.closed == "boolean" ? t.closed : !1, i = t.label || "", s = t.color || null, l = t.maxHeight || null;
@@ -911,11 +521,14 @@ class I {
911
521
  p.innerHTML = `<span class="p-gui__folder-arrow"></span>${i}`, p.className = "p-gui__folder-header", r.append(p), p.addEventListener("click", () => {
912
522
  r.classList.toggle("p-gui__folder--closed");
913
523
  });
914
- let u = new I({ isFolder: !0, folderOptions: {
915
- wrapper: r,
916
- parent: this,
917
- firstParent: this.firstParent
918
- } });
524
+ let u = new C({
525
+ isFolder: !0,
526
+ folderOptions: {
527
+ wrapper: r,
528
+ parent: this,
529
+ firstParent: this.firstParent
530
+ }
531
+ });
919
532
  return this.folders.push(u), u;
920
533
  }
921
534
  _makeDraggable() {
@@ -946,9 +559,9 @@ class I {
946
559
  }
947
560
  static registerPlugin(t) {
948
561
  for (let e in t)
949
- I.prototype[e] = t[e];
562
+ C.prototype[e] = t[e];
950
563
  }
951
564
  }
952
565
  export {
953
- I as default
566
+ C as default
954
567
  };