perfect-gui 4.12.6 → 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 M = 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 H {
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 H {
81
81
  return e * Math.floor(t / e);
82
82
  }
83
83
  }
84
- class N {
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}.`);
@@ -127,7 +127,7 @@ class X {
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 X {
137
137
  }), n;
138
138
  }
139
139
  }
140
- class S {
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 S {
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 S {
187
187
  }), d;
188
188
  }
189
189
  }
190
- class W {
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 W {
216
216
  }), n;
217
217
  }
218
218
  }
219
- class G {
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}.`);
@@ -229,16 +229,16 @@ class G {
229
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 U = parseFloat(this.parent._mapLinear(x.offsetX, 0, _.clientWidth, l, a)), I = parseFloat(this.parent._mapLinear(x.offsetY, 0, _.clientHeight, r, o));
233
- d[c] = U.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();
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
- const j = (x) => {
236
- const U = _.getBoundingClientRect(), I = x.clientX - U.left, O = x.clientY - U.top, $ = this.parent._mapLinear(I, 0, _.clientWidth, l, a), D = this.parent._mapLinear(O, 0, _.clientHeight, r, o), F = Math.max(l, Math.min(a, $)), L = Math.max(o, Math.min(r, D));
237
- d[c] = parseFloat(F.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();
235
+ const U = (x) => {
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
- j(x), document.addEventListener("pointermove", j), document.addEventListener("pointerup", () => {
241
- document.removeEventListener("pointermove", j);
240
+ U(x), document.addEventListener("pointermove", U), document.addEventListener("pointerup", () => {
241
+ document.removeEventListener("pointermove", U);
242
242
  }, { once: !0 });
243
243
  });
244
244
  const R = document.createElement("div");
@@ -265,419 +265,9 @@ class G {
265
265
  }), w;
266
266
  }
267
267
  }
268
- const Y = (
269
- /* css */
270
- `
271
- .p-gui__button {
272
- background: var(--color-accent);
273
- text-align: center;
274
- color: var(--color-bg);
275
- border: none;
276
- border: 1px solid transparent;
277
- box-sizing: border-box;
278
- transition: var(--transition) background, var(--transition) border-color;
279
- }
280
-
281
- .p-gui__button:hover {
282
- background: var(--color-accent-hover);
283
- border-color: rgba(255, 255, 255, 0.2);
284
- }
285
-
286
- .p-gui__folder .p-gui__button {
287
- margin-inline: 0;
288
- }
289
- `
290
- ), z = (
291
- /* css */
292
- `
293
- .p-gui__slider {
294
- position: relative;
295
- min-height: 14px;
296
- display: flex;
297
- align-items: center;
298
- justify-content: space-between;
299
- gap: 10px;
300
- color: var(--color-text-dark);
301
- transition: color var(--transition);
302
- padding: 3px;
303
- }
304
-
305
- .p-gui__slider:hover {
306
- color: var(--color-text-light);
307
- }
308
-
309
- .p-gui__slider-name {
310
- width: 50%;
311
- text-overflow: ellipsis;
312
- overflow: hidden;
313
- }
314
-
315
- .p-gui__slider-ctrl {
316
- -webkit-appearance: none;
317
- padding: 0;
318
- font: inherit;
319
- outline: none;
320
- box-sizing: border-box;
321
- cursor: pointer;
322
- position: relative;
323
- right: 0;
324
- height: 14px;
325
- margin: 0 0 0 auto;
326
- width: 37%;
327
- }
328
-
329
- .p-gui__slider-bar {
330
- position: absolute;
331
- top: 50%;
332
- left: 0;
333
- height: 2px;
334
- background: rgba(255, 255, 255, .2);
335
- width: 100%;
336
- transform: translateY(-50%);
337
- }
338
-
339
- .p-gui__slider-filling {
340
- position: absolute;
341
- top: -25%;
342
- left: 0;
343
- height: 100%;
344
- background: var(--color-accent);
345
- width: 0;
346
- }
347
-
348
- .p-gui__slider:hover .p-gui__slider-filling {
349
- background: var(--color-accent-hover);
350
- }
351
-
352
- .p-gui__slider-handle {
353
- width: 9px;
354
- height: 9px;
355
- position: absolute;
356
- top: 50%;
357
- left: 0;
358
- border-radius: 2px;
359
- transform: translate(-50%, -50%);
360
- pointer-events: none;
361
- background: var(--color-text-dark);
362
- box-shadow: 0 0 2px rgba(0, 0, 0, .5);
363
- }
364
-
365
- .p-gui__slider:hover .p-gui__slider-handle {
366
- background: var(--color-text-light);
367
- }
368
-
369
- .p-gui__slider-value {
370
- display: inline-block;
371
- right: 7px;
372
- width: 13%;
373
- border: none;
374
- color: white;
375
- border-radius: 2px;
376
- background: rgba(255, 255, 255, 0.1);
377
- padding: 2px 4px;
378
- color: inherit;
379
- }
380
-
381
- .p-gui__slider-value:focus {
382
- outline: none;
383
- }
384
- `
385
- ), B = (
386
- /* css */
387
- `
388
- .p-gui__list {
389
- cursor: default;
390
- color: var(--color-text-dark);
391
- transition: var(--transition) color;
392
- }
393
-
394
- .p-gui__list:hover {
395
- color: var(--color-text-light);
396
- }
397
-
398
- .p-gui__list-dropdown {
399
- background: rgba(255, 255, 255,.05);
400
- color: white;
401
- padding: 0 12px 0 5px;
402
- top: 0px;
403
- }
404
-
405
- .p-gui__list-dropdown {
406
- position: absolute;
407
- right: 5px;
408
- top: 0;
409
- bottom: 0;
410
- margin: auto;
411
- height: calc(100% - 4px);
412
- cursor: pointer;
413
- border-radius: 3px;
414
- border: 1px solid var(--color-border-2);
415
- outline: none;
416
-
417
- option {
418
- background: white;
419
- color: black;
420
- }
421
- }
422
-
423
- .p-gui__list-dropdown:hover {
424
- background: rgba(255, 255, 255, .1);
425
- }
426
- `
427
- ), V = (
428
- /* css */
429
- `
430
- .p-gui__toggle {
431
- color: var(--color-text-dark);
432
- transition: var(--transition) background, var(--transition) color;
433
- }
434
-
435
- .p-gui__toggle:hover {
436
- background: rgba(255, 255, 255, .1);
437
- color: var(--color-text-light);
438
- }
439
-
440
- .p-gui__folder .p-gui__toggle {
441
- margin-inline: 0;
442
- }
443
-
444
- .p-gui__toggle-checkbox {
445
- width: 10px;
446
- height: 10px;
447
- background-color: rgba(255, 255, 255, 0.1);
448
- position: absolute;
449
- top: 0;
450
- right: 10px;
451
- bottom: 0;
452
- margin: auto;
453
- border-radius: 2px;
454
- pointer-events: none;
455
- transition: .5s all ease;
456
- }
457
-
458
- .p-gui__toggle-checkbox--active {
459
- background-color: #ddd;
460
- box-shadow: 0 0 5px #ddd;
461
- }
462
- `
463
- ), T = (
464
- /* css */
465
- `
466
- .p-gui__color {
467
- cursor: default;
468
- color: var(--color-text-dark);
469
- transition: var(--transition) color;
470
- }
471
-
472
- .p-gui__color:hover {
473
- color: var(--color-text-light);
474
- }
475
-
476
- .p-gui__color-picker {
477
- position: absolute;
478
- right: 5px;
479
- top: 0;
480
- bottom: 0;
481
- margin: auto;
482
- height: calc(100% - 4px);
483
- cursor: pointer;
484
- border-radius: 3px;
485
- border: 1px solid var(--color-border-2);
486
- outline: none;
487
- -webkit-appearance: none;
488
- padding: 0;
489
- background-color: transparent;
490
- border: 1px solid #222222;
491
- overflow: hidden;
492
- }
493
-
494
- .p-gui__color-picker::-webkit-color-swatch-wrapper {
495
- padding: 0;
496
- }
497
- .p-gui__color-picker::-webkit-color-swatch {
498
- border: none;
499
- }
500
- `
501
- ), Q = (
502
- /* css */
503
- `
504
- .p-gui__vector2 {
505
- background: transparent;
506
- aspect-ratio: 1;
507
- padding-bottom: 0;
508
- color: var(--color-text-dark);
509
- }
510
-
511
- .p-gui__vector2:hover {
512
- color: var(--color-text-light);
513
- }
514
-
515
- .p-gui__vector2-area {
516
- position: relative;
517
- background: rgba(0, 0, 0, .3);
518
- margin-top: 8px;
519
- width: 100%;
520
- height: calc(100% - 28px);
521
- touch-action: none;
522
- }
523
-
524
- .p-gui__vector2-line {
525
- position: absolute;
526
- background: white;
527
- opacity: .3;
528
- pointer-events: none;
529
- }
530
-
531
- .p-gui__vector2-line-x {
532
- width: 100%;
533
- height: 1px;
534
- left: 0;
535
- top: 50%;
536
- transform: translateY(-50%);
537
- }
538
-
539
- .p-gui__vector2-line-y {
540
- width: 1px;
541
- height: 100%;
542
- top: 0;
543
- left: 50%;
544
- transform: translateX(-50%);
545
- }
546
-
547
- .p-gui__vector2-dot {
548
- position: absolute;
549
- top: 0;
550
- left: 0;
551
- width: 8px;
552
- height: 8px;
553
- border-radius: 50%;
554
- background: #d5d5d5;
555
- border: 2px solid #ff9999;
556
- transform: translate(-50%, -50%);
557
- pointer-events: none;
558
- }
559
-
560
- .p-gui__vector-value {
561
- display: inline-block;
562
- right: 7px;
563
- position: absolute;
564
- }
565
- `
566
- ), q = (
567
- /* css */
568
- `
569
- .p-gui__image-container {
570
- width: 100%;
571
- padding: 3px;
572
- display: flex;
573
- justify-content: flex-start;
574
- flex-wrap: wrap;
575
- box-sizing: border-box;
576
- }
577
-
578
- .p-gui__image {
579
- background-size: cover;
580
- cursor: pointer;
581
- position: relative;
582
- margin: 1px 2.5px 19px 2.5px;
583
- border-radius: var(--main-border-radius);
584
- flex: 0 0 calc(33.333% - 5px);
585
- height: 90px;
586
- background-position: center;
587
- color: var(--color-text-dark);
588
- transition: var(--transition) color;
589
- }
590
-
591
- .p-gui__image:hover {
592
- color: var(--color-text-light);
593
- }
594
-
595
- .p-gui__image::after {
596
- position: absolute;
597
- top: 0;
598
- left: 0;
599
- width: 100%;
600
- height: 100%;
601
- content: '';
602
- border: 1px solid transparent;
603
- box-sizing: border-box;
604
- border-radius: var(--main-border-radius);
605
- transition: var(--transition) border-color;
606
- }
607
- .p-gui__image--selected::after {
608
- border-color: #06FF89;
609
- }
610
-
611
- .p-gui__image-text {
612
- position: absolute;
613
- bottom: -15px;
614
- text-shadow: 0 -1px 0 #111;
615
- white-space: nowrap;
616
- width: 100%;
617
- overflow: hidden;
618
- text-overflow: ellipsis;
619
-
620
- }
621
- `
622
- ), J = (
623
- /* css */
624
- `
625
- .p-gui__folder {
626
- width: 100%;
627
- position: relative;
628
- background: var(--color-bg);
629
- overflow: auto;
630
- margin-bottom: 2px;
631
- display: flex;
632
- flex-wrap: wrap;
633
- border: 1px solid var(--color-border-2);
634
- padding: 0 2px 0 3px;
635
- border-radius: var(--main-border-radius);
636
- box-sizing: border-box;
637
- border-left: 1px solid #bbbbbb;
638
- }
639
-
640
- .p-gui__folder--first {
641
- margin-top: 0;
642
- }
643
-
644
- .p-gui__folder--closed {
645
- height: 25px;
646
- overflow: hidden;
647
- }
648
-
649
- .p-gui__folder-header {
650
- padding: 5px 3px;
651
- background-color: rgba(0, 0, 0, .5);
652
- color: white;
653
- cursor: pointer;
654
- width: 100%;
655
- margin: 0 -2px 2px -3px;
656
- }
657
-
658
- .p-gui__folder-header:hover {
659
- background-color: rgba(0, 0, 0, .75);
660
- }
661
-
662
- .p-gui__folder-arrow {
663
- width: 8px;
664
- height: 8px;
665
- display: inline-block;
666
- background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAHlBMVEUAAAD///////////////////////////////////8kfJuVAAAACXRSTlMA9Z1fCdMo1yxEJnA0AAAAK0lEQVQI12PABlRgjKkJUMZMYRhjpgqMAZSEMICSaIzpDWiKhdENhEhgAgATSg5jyWnYewAAAABJRU5ErkJggg==);
667
- background-size: contain;
668
- margin-right: 5px;
669
- transform: rotate(90deg)
670
- }
671
-
672
- .p-gui__folder--closed .p-gui__folder-arrow {
673
- transform: rotate(0deg);
674
- }
675
- `
676
- );
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)}";
677
269
  function Z(y) {
678
- return (
679
- /* css */
680
- `
270
+ return console.log(O), `
681
271
  .p-gui {
682
272
  --main-border-radius: 3px;
683
273
  --color-bg: #161616;
@@ -805,7 +395,7 @@ function Z(y) {
805
395
  border-color: rgba(255,255,255,.2);
806
396
  }
807
397
 
808
- ${Y}
398
+ ${O}
809
399
 
810
400
  ${q}
811
401
 
@@ -820,16 +410,18 @@ function Z(y) {
820
410
  ${Q}
821
411
 
822
412
  ${J}
823
- `
824
- );
413
+ `;
825
414
  }
826
415
  class C {
827
416
  constructor(t = {}) {
828
- 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) {
829
418
  this._folderConstructor(t.folderOptions);
830
419
  return;
831
420
  }
832
- 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(`${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();
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();
833
425
  }
834
426
  _styleInstance() {
835
427
  let t = this._getScrollbarWidth(this.container);
@@ -863,15 +455,27 @@ class C {
863
455
  return t === document.body ? window.innerWidth - document.documentElement.clientWidth : t.offsetWidth - t.clientWidth;
864
456
  }
865
457
  _handleResize() {
866
- 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)
867
462
  return;
868
463
  let t = this._getScrollbarWidth(this.container);
869
464
  if (this.xOffset = this.screenCorner.x == "left" ? 0 : this.container.clientWidth - this.wrapperWidth - t, this.instanceId > 0) {
870
- let e = this.container.querySelectorAll(`.p-gui:not(#${this.wrapper.id}):not([data-dragged])`);
871
- 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++)
872
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));
873
472
  }
874
- 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)`;
875
479
  }
876
480
  _addStyles(t) {
877
481
  this.stylesheet.innerHTML += t;
@@ -882,13 +486,13 @@ class C {
882
486
  t.className = "p-gui__header-close", t.addEventListener("click", this.toggleClose.bind(this)), this.header.append(t);
883
487
  }
884
488
  button(t = {}, e) {
885
- return this.imageContainer = null, new M(this, t, e);
489
+ return this.imageContainer = null, new H(this, t, e);
886
490
  }
887
491
  image(t = {}, e) {
888
- return this.imageContainer || (this.imageContainer = document.createElement("div"), this.imageContainer.className = "p-gui__image-container", this.wrapper.append(this.imageContainer)), new N(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);
889
493
  }
890
494
  slider(t = {}, e) {
891
- return this.imageContainer = null, new H(this, t, e);
495
+ return this.imageContainer = null, new N(this, t, e);
892
496
  }
893
497
  toggle(t = {}, e) {
894
498
  this.imageContainer = null;
@@ -896,13 +500,13 @@ class C {
896
500
  return this.wrapper.append(i), i;
897
501
  }
898
502
  list(t = {}, e) {
899
- return this.imageContainer = null, new S(this, t, e);
503
+ return this.imageContainer = null, new W(this, t, e);
900
504
  }
901
505
  color(t = {}, e) {
902
- return this.imageContainer = null, new W(this, t, e);
506
+ return this.imageContainer = null, new G(this, t, e);
903
507
  }
904
508
  vector2(t = {}, e) {
905
- return this.imageContainer = null, new G(this, t, e);
509
+ return this.imageContainer = null, new Y(this, t, e);
906
510
  }
907
511
  folder(t = {}) {
908
512
  let e = typeof t.closed == "boolean" ? t.closed : !1, i = t.label || "", s = t.color || null, l = t.maxHeight || null;
@@ -917,11 +521,14 @@ class C {
917
521
  p.innerHTML = `<span class="p-gui__folder-arrow"></span>${i}`, p.className = "p-gui__folder-header", r.append(p), p.addEventListener("click", () => {
918
522
  r.classList.toggle("p-gui__folder--closed");
919
523
  });
920
- let u = new C({ isFolder: !0, folderOptions: {
921
- wrapper: r,
922
- parent: this,
923
- firstParent: this.firstParent
924
- } });
524
+ let u = new C({
525
+ isFolder: !0,
526
+ folderOptions: {
527
+ wrapper: r,
528
+ parent: this,
529
+ firstParent: this.firstParent
530
+ }
531
+ });
925
532
  return this.folders.push(u), u;
926
533
  }
927
534
  _makeDraggable() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "perfect-gui",
3
3
  "type": "module",
4
- "version": "4.12.6",
4
+ "version": "4.12.7",
5
5
  "description": "GUI for JavaScript",
6
6
  "main": "src/index.js",
7
7
  "scripts": {
@@ -21,6 +21,6 @@
21
21
  },
22
22
  "homepage": "https://thibka.github.io/perfect-gui/public/",
23
23
  "devDependencies": {
24
- "vite": "^4.5.0"
24
+ "vite": "^7.3.1"
25
25
  }
26
26
  }