perfect-gui 2.5.2 → 2.6.0
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 +8 -3
- package/package.json +1 -1
- package/src/index.js +24 -16
- package/src/styles.js +5 -3
- package/test/build/bundle.js +1 -1
- package/test/build/index.html +150 -4
- package/test/build/main.css +83 -330
- package/test/package-lock.json +2331 -10957
- package/test/package.json +10 -22
- package/test/src/index.html +148 -2
- package/test/src/index.js +12 -174
- package/test/src/js/basics.js +49 -0
- package/test/src/js/folders.js +23 -0
- package/test/src/js/full_featured.js +84 -0
- package/test/src/js/getRandomColor.js +8 -0
- package/test/src/js/multiple.js +40 -0
- package/test/src/js/other.js +34 -0
- package/test/src/styles/main.scss +58 -3
- package/test/webpack.config.js +2 -38
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import perfectGUI from '../../../src/index';
|
|
2
|
+
import getRandomColor from './getRandomColor';
|
|
3
|
+
|
|
4
|
+
export default function multiple() {
|
|
5
|
+
const element = document.querySelector('#container-2 .element');
|
|
6
|
+
|
|
7
|
+
const gui_1 = new perfectGUI({
|
|
8
|
+
name: 'GUI 1',
|
|
9
|
+
width: 200,
|
|
10
|
+
container: '#container-2'
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
gui_1.addButton('By the way, buttons can handle multiple lines of text.', () => {
|
|
14
|
+
element.style.backgroundColor = getRandomColor();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const gui_2 = new perfectGUI({
|
|
18
|
+
name: 'GUI 2',
|
|
19
|
+
width: 200,
|
|
20
|
+
container: '#container-2'
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
gui_2.addButton('Button', () => element.style.backgroundColor = getRandomColor() );
|
|
24
|
+
|
|
25
|
+
const gui_3 = new perfectGUI({
|
|
26
|
+
name: 'GUI 3',
|
|
27
|
+
position: 'top right',
|
|
28
|
+
container: '#container-2'
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
gui_3.addButton('Button', () => element.style.backgroundColor = getRandomColor() );
|
|
32
|
+
|
|
33
|
+
const gui_4 = new perfectGUI({
|
|
34
|
+
name: 'GUI 4',
|
|
35
|
+
position: 'right bottom',
|
|
36
|
+
container: '#container-2'
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
gui_4.addButton('Button', () => element.style.backgroundColor = getRandomColor() );
|
|
40
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import getRandomColor from './getRandomColor';
|
|
2
|
+
import perfectGUI from '../../../src/index';
|
|
3
|
+
|
|
4
|
+
export default function other() {
|
|
5
|
+
const gui_1 = new perfectGUI({
|
|
6
|
+
container: '#container-4',
|
|
7
|
+
name: 'GUI 1 (drag me!)',
|
|
8
|
+
width: 500,
|
|
9
|
+
draggable: true
|
|
10
|
+
});
|
|
11
|
+
gui_1.addButton('Custom width using the `width` option', () => {});
|
|
12
|
+
|
|
13
|
+
const gui_2 = new perfectGUI({
|
|
14
|
+
container: '#container-4',
|
|
15
|
+
name: 'GUI 2 (drag me!)',
|
|
16
|
+
close: true,
|
|
17
|
+
draggable: true,
|
|
18
|
+
position: 'bottom left'
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
gui_2.addButton('gui_1.toggleClose();', () => {
|
|
22
|
+
gui_1.toggleClose();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const gui_3 = new perfectGUI({
|
|
26
|
+
container: '#container-4',
|
|
27
|
+
name: 'GUI 3 (closed)',
|
|
28
|
+
closed: true,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
gui_3.addButton('gui_2.toggleClose();', () => {
|
|
32
|
+
gui_2.toggleClose();
|
|
33
|
+
});
|
|
34
|
+
}
|
|
@@ -1,17 +1,65 @@
|
|
|
1
|
+
@import url('https://fonts.googleapis.com/css2?family=Montserrat&display=swap');
|
|
1
2
|
html, body {
|
|
2
3
|
height: 100%;
|
|
3
4
|
}
|
|
4
5
|
|
|
5
6
|
body {
|
|
6
|
-
overflow: hidden;
|
|
7
7
|
margin: 0;
|
|
8
|
+
background-color: white;
|
|
9
|
+
color: black;
|
|
10
|
+
font-family: Arial, sans-serif;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.wrapper {
|
|
14
|
+
width: 800px;
|
|
15
|
+
margin: 0 auto;
|
|
16
|
+
padding-bottom: 100px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
h1, h2 {
|
|
20
|
+
font-family: 'Montserrat', sans-serif;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
h1 {
|
|
24
|
+
margin: 80px 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
h2 {
|
|
28
|
+
margin-top: 80px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.code {
|
|
32
|
+
font-family: monospace;
|
|
8
33
|
background-color: black;
|
|
34
|
+
color: #a6e22e;
|
|
35
|
+
padding: 3px 6px;
|
|
36
|
+
border-radius: 3px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
div:has(pre) {
|
|
40
|
+
border-radius: 5px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
pre {
|
|
44
|
+
padding: 20px;
|
|
45
|
+
border-radius: 5px;
|
|
46
|
+
font-size: 1.2em;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.container {
|
|
50
|
+
background-color: #111;
|
|
9
51
|
transition: .3s all ease;
|
|
10
52
|
background-position: center;
|
|
11
53
|
background-size: cover;
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
position: relative;
|
|
56
|
+
height: 400px;
|
|
57
|
+
width: 100%;
|
|
58
|
+
margin: 20px auto 20px auto;
|
|
59
|
+
border-radius: 5px;
|
|
12
60
|
}
|
|
13
61
|
|
|
14
|
-
|
|
62
|
+
.element {
|
|
15
63
|
width: 100px;
|
|
16
64
|
height: 100px;
|
|
17
65
|
position: absolute;
|
|
@@ -21,11 +69,18 @@ body {
|
|
|
21
69
|
bottom: 0;
|
|
22
70
|
margin: auto;
|
|
23
71
|
background-color: red;
|
|
72
|
+
background-size: cover;
|
|
73
|
+
background-position: center;
|
|
74
|
+
background-repeat: no-repeat;
|
|
24
75
|
border: 1px solid black;
|
|
25
76
|
transition: .1s transform ease, .3s border-radius ease, .3s background-color linear;
|
|
26
77
|
}
|
|
27
78
|
|
|
28
|
-
|
|
79
|
+
.element.round {
|
|
80
|
+
border-radius: 50%;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.note {
|
|
29
84
|
position: absolute;
|
|
30
85
|
bottom: 10px;
|
|
31
86
|
left: 20px;
|
package/test/webpack.config.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
|
|
3
2
|
const webpack = require('webpack');
|
|
4
3
|
const path = require('path');
|
|
5
4
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
@@ -16,54 +15,19 @@ let config = {
|
|
|
16
15
|
module: {
|
|
17
16
|
rules: [
|
|
18
17
|
{
|
|
19
|
-
test: /\.(
|
|
20
|
-
|
|
21
|
-
'file-loader'
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
test: /\.(svg)$/i,
|
|
26
|
-
use: [
|
|
27
|
-
'file-loader',
|
|
28
|
-
{
|
|
29
|
-
loader: 'image-webpack-loader',
|
|
30
|
-
options: {
|
|
31
|
-
bypassOnDebug: true,
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
],
|
|
18
|
+
test: /\.(jpe?g|gif|svg|png|mp3|mp4|woff|woff2|eot|ttf|otf|obj|json)$/,
|
|
19
|
+
type: 'asset/resource'
|
|
35
20
|
},
|
|
36
21
|
{
|
|
37
22
|
test: /\.s?css$/,
|
|
38
23
|
use: [
|
|
39
24
|
MiniCssExtractPlugin.loader,
|
|
40
25
|
"css-loader",
|
|
41
|
-
"sass-loader"
|
|
42
26
|
]
|
|
43
27
|
},
|
|
44
|
-
{
|
|
45
|
-
type: 'javascript/auto',
|
|
46
|
-
test: /\.json$/,
|
|
47
|
-
loader: 'file-loader',
|
|
48
|
-
options: {
|
|
49
|
-
name: '[name].[ext]'
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
test: /\.m?js$/,
|
|
54
|
-
exclude: /(node_modules)/,
|
|
55
|
-
use: {
|
|
56
|
-
loader: 'babel-loader',
|
|
57
|
-
options: {
|
|
58
|
-
presets: ['@babel/preset-env']
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
28
|
]
|
|
63
29
|
},
|
|
64
30
|
devServer: {
|
|
65
|
-
contentBase: path.join(__dirname, 'public'),
|
|
66
|
-
watchContentBase: true,
|
|
67
31
|
port: 8000
|
|
68
32
|
},
|
|
69
33
|
plugins: [
|