muigui 0.0.17 → 0.0.21

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,4 +1,4 @@
1
- /* muigui@0.0.17, license MIT */
1
+ /* muigui@0.0.21, license MIT */
2
2
  var css = {
3
3
  default: `
4
4
  .muigui {
@@ -85,6 +85,7 @@ var css = {
85
85
  font-size: var(--font-size);
86
86
  box-sizing: border-box;
87
87
  line-height: 100%;
88
+ white-space: nowrap;
88
89
  }
89
90
  .muigui * {
90
91
  box-sizing: inherit;
@@ -150,6 +151,10 @@ var css = {
150
151
  --value-color: var(--disabled-color) !important;
151
152
  --range-left-color: var(--disabled-color) !important;
152
153
  }
154
+ /* this shouldn't be needed! */
155
+ .muigui-disabled label {
156
+ color: var(--disabled-color)
157
+ }
153
158
 
154
159
  .muigui canvas,
155
160
  .muigui svg {
@@ -288,7 +293,7 @@ var css = {
288
293
  }
289
294
  .muigui-closed>.muigui-open-container>* {
290
295
  transition: all 0.1s ease-out;
291
- margin-top: -100%;
296
+ margin-top: -1000%;
292
297
  }
293
298
 
294
299
  /* ---- popdown ---- */
@@ -1208,11 +1213,13 @@ class Button extends Controller {
1208
1213
  }
1209
1214
  name(name) {
1210
1215
  this.#buttonElem.textContent = name;
1216
+ return this;
1211
1217
  }
1212
1218
  setOptions(options) {
1213
1219
  copyExistingProperties(this.#options, options);
1214
1220
  const {name} = this.#options;
1215
1221
  this.#buttonElem.textContent = name;
1222
+ return this;
1216
1223
  }
1217
1224
  }
1218
1225
 
@@ -2620,6 +2627,9 @@ class Canvas extends LabelController {
2620
2627
  get canvas() {
2621
2628
  return this.#canvasElem;
2622
2629
  }
2630
+ listen() {
2631
+ return this;
2632
+ }
2623
2633
  }
2624
2634
 
2625
2635
  class ColorView extends EditView {
@@ -2761,6 +2771,12 @@ class Container extends Controller {
2761
2771
  this.#childDestController = this.#childDestController.parent;
2762
2772
  return this;
2763
2773
  }
2774
+ listen() {
2775
+ this.#controllers.forEach(c => {
2776
+ c.listen();
2777
+ });
2778
+ return this;
2779
+ }
2764
2780
  }
2765
2781
 
2766
2782
  class Folder extends Container {
@@ -3269,11 +3285,22 @@ class Row extends Layout {
3269
3285
  }
3270
3286
  }
3271
3287
 
3288
+ function camelCaseToSnakeCase(id) {
3289
+ return id
3290
+ .replace(/(.)([A-Z][a-z]+)/g, '$1_$2')
3291
+ .replace(/([a-z0-9])([A-Z])/g, '$1_$2')
3292
+ .toLowerCase();
3293
+ }
3294
+
3295
+ function prepName(name) {
3296
+ return camelCaseToSnakeCase(name.toString()).replaceAll('_', ' ');
3297
+ }
3298
+
3272
3299
  class GUIFolder extends Folder {
3273
3300
  add(object, property, ...args) {
3274
3301
  const controller = object instanceof Controller
3275
3302
  ? object
3276
- : createController(object, property, ...args);
3303
+ : createController(object, property, ...args).name(prepName(property));
3277
3304
  return this.addController(controller);
3278
3305
  }
3279
3306
  addCanvas(name) {
@@ -3282,9 +3309,13 @@ class GUIFolder extends Folder {
3282
3309
  addColor(object, property, options = {}) {
3283
3310
  const value = object[property];
3284
3311
  if (hasAlpha(options.format || guessFormat(value))) {
3285
- return this.addController(new ColorChooser(object, property, options));
3312
+ return this
3313
+ .addController(new ColorChooser(object, property, options))
3314
+ .name(prepName(property));
3286
3315
  } else {
3287
- return this.addController(new Color(object, property, options));
3316
+ return this
3317
+ .addController(new Color(object, property, options))
3318
+ .name(prepName(property));
3288
3319
  }
3289
3320
  }
3290
3321
  addDivider() {
@@ -3298,7 +3329,7 @@ class GUIFolder extends Folder {
3298
3329
  }
3299
3330
  addButton(name, fn) {
3300
3331
  const o = {fn};
3301
- return this.add(o, 'fn').name(name);
3332
+ return this.add(o, 'fn').name(prepName(name));
3302
3333
  }
3303
3334
  }
3304
3335