muigui 0.0.16 → 0.0.20
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 +41 -6
- package/dist/0.x/controllers/Button.d.ts +2 -2
- package/dist/0.x/controllers/Canvas.d.ts +1 -0
- package/dist/0.x/controllers/Container.d.ts +1 -0
- package/dist/0.x/muigui.js +33 -6
- package/dist/0.x/muigui.js.map +1 -1
- package/dist/0.x/muigui.min.js +1 -1
- package/dist/0.x/muigui.min.js.map +1 -1
- package/dist/0.x/muigui.module.js +33 -6
- package/dist/0.x/muigui.module.js.map +1 -1
- package/dist/0.x/muigui.module.min.js +1 -1
- package/dist/0.x/muigui.module.min.js.map +1 -1
- package/package.json +4 -4
- package/src/controllers/Button.js +2 -0
- package/src/controllers/Canvas.js +3 -0
- package/src/controllers/Container.js +6 -0
- package/src/muigui.js +19 -4
- package/src/styles/muigui.css.js +2 -1
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "muigui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20",
|
|
4
4
|
"description": "A Simple GUI",
|
|
5
5
|
"main": "dist/0.x/muigui.js",
|
|
6
|
-
"module": "dist/0.x/muigui
|
|
6
|
+
"module": "dist/0.x/muigui.module.js",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "npm run build-normal",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"eslint-plugin-one-variable-per-var": "^0.0.3",
|
|
51
51
|
"eslint-plugin-optional-comma-spacing": "0.0.4",
|
|
52
52
|
"eslint-plugin-require-trailing-comma": "0.0.1",
|
|
53
|
-
"puppeteer": "^
|
|
53
|
+
"puppeteer": "^23.10.4",
|
|
54
54
|
"rollup": "^3.20.2",
|
|
55
|
-
"servez": "^2.
|
|
55
|
+
"servez": "^2.2.4",
|
|
56
56
|
"tslib": "^2.6.2",
|
|
57
57
|
"typescript": "5.2"
|
|
58
58
|
}
|
|
@@ -28,10 +28,12 @@ export default class Button extends Controller {
|
|
|
28
28
|
}
|
|
29
29
|
name(name) {
|
|
30
30
|
this.#buttonElem.textContent = name;
|
|
31
|
+
return this;
|
|
31
32
|
}
|
|
32
33
|
setOptions(options) {
|
|
33
34
|
copyExistingProperties(this.#options, options);
|
|
34
35
|
const {name} = this.#options;
|
|
35
36
|
this.#buttonElem.textContent = name;
|
|
37
|
+
return this;
|
|
36
38
|
}
|
|
37
39
|
}
|
package/src/muigui.js
CHANGED
|
@@ -34,11 +34,22 @@ export {
|
|
|
34
34
|
Row,
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
+
function camelCaseToSnakeCase(id) {
|
|
38
|
+
return id
|
|
39
|
+
.replace(/(.)([A-Z][a-z]+)/g, '$1_$2')
|
|
40
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1_$2')
|
|
41
|
+
.toLowerCase();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function prepName(name) {
|
|
45
|
+
return camelCaseToSnakeCase(name.toString()).replaceAll('_', ' ');
|
|
46
|
+
}
|
|
47
|
+
|
|
37
48
|
export class GUIFolder extends Folder {
|
|
38
49
|
add(object, property, ...args) {
|
|
39
50
|
const controller = object instanceof Controller
|
|
40
51
|
? object
|
|
41
|
-
: createController(object, property, ...args);
|
|
52
|
+
: createController(object, property, ...args).name(prepName(property));
|
|
42
53
|
return this.addController(controller);
|
|
43
54
|
}
|
|
44
55
|
addCanvas(name) {
|
|
@@ -47,9 +58,13 @@ export class GUIFolder extends Folder {
|
|
|
47
58
|
addColor(object, property, options = {}) {
|
|
48
59
|
const value = object[property];
|
|
49
60
|
if (hasAlpha(options.format || guessFormat(value))) {
|
|
50
|
-
return this
|
|
61
|
+
return this
|
|
62
|
+
.addController(new ColorChooser(object, property, options))
|
|
63
|
+
.name(prepName(property));
|
|
51
64
|
} else {
|
|
52
|
-
return this
|
|
65
|
+
return this
|
|
66
|
+
.addController(new Color(object, property, options))
|
|
67
|
+
.name(prepName(property));
|
|
53
68
|
}
|
|
54
69
|
}
|
|
55
70
|
addDivider() {
|
|
@@ -63,7 +78,7 @@ export class GUIFolder extends Folder {
|
|
|
63
78
|
}
|
|
64
79
|
addButton(name, fn) {
|
|
65
80
|
const o = {fn};
|
|
66
|
-
return this.add(o, 'fn').name(name);
|
|
81
|
+
return this.add(o, 'fn').name(prepName(name));
|
|
67
82
|
}
|
|
68
83
|
}
|
|
69
84
|
|
package/src/styles/muigui.css.js
CHANGED
|
@@ -84,6 +84,7 @@ export default {
|
|
|
84
84
|
font-size: var(--font-size);
|
|
85
85
|
box-sizing: border-box;
|
|
86
86
|
line-height: 100%;
|
|
87
|
+
white-space: nowrap;
|
|
87
88
|
}
|
|
88
89
|
.muigui * {
|
|
89
90
|
box-sizing: inherit;
|
|
@@ -287,7 +288,7 @@ export default {
|
|
|
287
288
|
}
|
|
288
289
|
.muigui-closed>.muigui-open-container>* {
|
|
289
290
|
transition: all 0.1s ease-out;
|
|
290
|
-
margin-top: -
|
|
291
|
+
margin-top: -1000%;
|
|
291
292
|
}
|
|
292
293
|
|
|
293
294
|
/* ---- popdown ---- */
|