perfect-gui 4.12.0 → 4.12.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/package.json +1 -1
- package/src/index.js +8 -8
- package/src/styles/_folder.css.js +1 -1
- package/src/styles/_slider.css.js +3 -3
- package/src/styles/_toggle.css.js +34 -0
- package/src/styles/styles.js +5 -5
- package/src/styles/_switch.css.js +0 -35
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -389,7 +389,7 @@ export default class GUI {
|
|
|
389
389
|
|
|
390
390
|
const container = document.createElement('div');
|
|
391
391
|
container.textContent = label;
|
|
392
|
-
container.className = 'p-
|
|
392
|
+
container.className = 'p-gui__toggle';
|
|
393
393
|
if ( tooltip ) {
|
|
394
394
|
container.setAttribute('title', tooltip);
|
|
395
395
|
}
|
|
@@ -400,11 +400,11 @@ export default class GUI {
|
|
|
400
400
|
|
|
401
401
|
let value = true;
|
|
402
402
|
|
|
403
|
-
if (checkbox.classList.contains('p-
|
|
403
|
+
if (checkbox.classList.contains('p-gui__toggle-checkbox--active')) {
|
|
404
404
|
value = false;
|
|
405
405
|
}
|
|
406
406
|
|
|
407
|
-
checkbox.classList.toggle('p-
|
|
407
|
+
checkbox.classList.toggle('p-gui__toggle-checkbox--active');
|
|
408
408
|
|
|
409
409
|
if ( isObject ) {
|
|
410
410
|
obj[prop] = value;
|
|
@@ -425,14 +425,14 @@ export default class GUI {
|
|
|
425
425
|
|
|
426
426
|
let activeClass = (() => {
|
|
427
427
|
if (!isObject) {
|
|
428
|
-
return value ? ' p-
|
|
428
|
+
return value ? ' p-gui__toggle-checkbox--active' : '';
|
|
429
429
|
} else {
|
|
430
|
-
return obj[prop] ? ' p-
|
|
430
|
+
return obj[prop] ? ' p-gui__toggle-checkbox--active' : '';
|
|
431
431
|
}
|
|
432
432
|
})();
|
|
433
433
|
|
|
434
434
|
const checkbox = document.createElement('div');
|
|
435
|
-
checkbox.className = 'p-
|
|
435
|
+
checkbox.className = 'p-gui__toggle-checkbox' + activeClass;
|
|
436
436
|
container.append(checkbox);
|
|
437
437
|
|
|
438
438
|
if ( isObject ) {
|
|
@@ -441,9 +441,9 @@ export default class GUI {
|
|
|
441
441
|
this.propReferences[propReferenceIndex] = val;
|
|
442
442
|
|
|
443
443
|
if (val) {
|
|
444
|
-
checkbox.classList.add('p-
|
|
444
|
+
checkbox.classList.add('p-gui__toggle-checkbox--active');
|
|
445
445
|
} else {
|
|
446
|
-
checkbox.classList.remove('p-
|
|
446
|
+
checkbox.classList.remove('p-gui__toggle-checkbox--active');
|
|
447
447
|
}
|
|
448
448
|
|
|
449
449
|
if (typeof callback == 'function') {
|
|
@@ -49,7 +49,7 @@ export default /* css */ `
|
|
|
49
49
|
position: absolute;
|
|
50
50
|
top: -25%;
|
|
51
51
|
left: 0;
|
|
52
|
-
height:
|
|
52
|
+
height: 100%;
|
|
53
53
|
background: var(--color-accent);
|
|
54
54
|
width: 0;
|
|
55
55
|
}
|
|
@@ -59,8 +59,8 @@ export default /* css */ `
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
.p-gui__slider-handle {
|
|
62
|
-
width:
|
|
63
|
-
height:
|
|
62
|
+
width: 9px;
|
|
63
|
+
height: 9px;
|
|
64
64
|
position: absolute;
|
|
65
65
|
top: 50%;
|
|
66
66
|
left: 0;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export default /* css */ `
|
|
2
|
+
.p-gui__toggle {
|
|
3
|
+
color: var(--color-text-dark);
|
|
4
|
+
transition: var(--transition) background, var(--transition) color;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.p-gui__toggle:hover {
|
|
8
|
+
background: rgba(255, 255, 255, .1);
|
|
9
|
+
color: var(--color-text-light);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.p-gui__folder .p-gui__toggle {
|
|
13
|
+
margin-inline: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.p-gui__toggle-checkbox {
|
|
17
|
+
width: 10px;
|
|
18
|
+
height: 10px;
|
|
19
|
+
background-color: rgba(255, 255, 255, 0.1);
|
|
20
|
+
position: absolute;
|
|
21
|
+
top: 0;
|
|
22
|
+
right: 10px;
|
|
23
|
+
bottom: 0;
|
|
24
|
+
margin: auto;
|
|
25
|
+
border-radius: 2px;
|
|
26
|
+
pointer-events: none;
|
|
27
|
+
transition: .5s all ease;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.p-gui__toggle-checkbox--active {
|
|
31
|
+
background-color: #ddd;
|
|
32
|
+
box-shadow: 0 0 7px #ddd;
|
|
33
|
+
}
|
|
34
|
+
`;
|
package/src/styles/styles.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _button from "./_button.css.js"
|
|
2
2
|
import _slider from "./_slider.css.js"
|
|
3
3
|
import _list from "./_list.css.js"
|
|
4
|
-
import
|
|
4
|
+
import _toggle from "./_toggle.css.js"
|
|
5
5
|
import _color from "./_color.css.js"
|
|
6
6
|
import _vector2 from "./_vector2.css.js"
|
|
7
7
|
import _image from "./_image.css.js"
|
|
@@ -16,7 +16,7 @@ export default function( position_type ) {
|
|
|
16
16
|
return /* css */`
|
|
17
17
|
.p-gui {
|
|
18
18
|
--main-border-radius: 3px;
|
|
19
|
-
--color-bg: #
|
|
19
|
+
--color-bg: #161616;
|
|
20
20
|
--color-border: #222222;
|
|
21
21
|
--color-border-2: transparent;
|
|
22
22
|
--color-text-light: #ffffff;
|
|
@@ -117,7 +117,7 @@ export default function( position_type ) {
|
|
|
117
117
|
|
|
118
118
|
.p-gui__slider,
|
|
119
119
|
.p-gui__button,
|
|
120
|
-
.p-
|
|
120
|
+
.p-gui__toggle,
|
|
121
121
|
.p-gui__list,
|
|
122
122
|
.p-gui__vector2,
|
|
123
123
|
.p-gui__color {
|
|
@@ -134,7 +134,7 @@ export default function( position_type ) {
|
|
|
134
134
|
|
|
135
135
|
.p-gui__slider:hover,
|
|
136
136
|
.p-gui__button:hover,
|
|
137
|
-
.p-
|
|
137
|
+
.p-gui__toggle:hover,
|
|
138
138
|
.p-gui__list:hover,
|
|
139
139
|
.p-gui__vector2:hover,
|
|
140
140
|
.p-gui__color:hover {
|
|
@@ -147,7 +147,7 @@ export default function( position_type ) {
|
|
|
147
147
|
|
|
148
148
|
${ _list }
|
|
149
149
|
|
|
150
|
-
${
|
|
150
|
+
${ _toggle }
|
|
151
151
|
|
|
152
152
|
${ _slider }
|
|
153
153
|
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export default /* css */ `
|
|
2
|
-
.p-gui__switch {
|
|
3
|
-
background: rgba(255, 255, 255, .05);
|
|
4
|
-
color: var(--color-text-dark);
|
|
5
|
-
transition: var(--transition) background, var(--transition) color;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.p-gui__switch:hover {
|
|
9
|
-
background: rgba(255, 255, 255, .1);
|
|
10
|
-
color: var(--color-text-light);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.p-gui__folder .p-gui__switch {
|
|
14
|
-
margin-inline: 0;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.p-gui__switch-checkbox {
|
|
18
|
-
width: 5px;
|
|
19
|
-
height: 5px;
|
|
20
|
-
background-color: rgba(0, 0, 0, .5);
|
|
21
|
-
border: 1px solid grey;
|
|
22
|
-
position: absolute;
|
|
23
|
-
top: 0;
|
|
24
|
-
right: 10px;
|
|
25
|
-
bottom: 0;
|
|
26
|
-
margin: auto;
|
|
27
|
-
border-radius: 50%;
|
|
28
|
-
pointer-events: none;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.p-gui__switch-checkbox--active {
|
|
32
|
-
background-color: #00ff89;
|
|
33
|
-
box-shadow: 0 0 7px #00ff89;
|
|
34
|
-
}
|
|
35
|
-
`;
|