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,7 +1,7 @@
1
1
  export default class Button extends Controller {
2
2
  constructor(object: any, property: any, options?: {});
3
- name(name: any): void;
4
- setOptions(options: any): void;
3
+ name(name: any): this;
4
+ setOptions(options: any): this;
5
5
  #private;
6
6
  }
7
7
  import Controller from './Controller.js';
@@ -1,6 +1,7 @@
1
1
  export default class Canvas extends LabelController {
2
2
  constructor(name: any);
3
3
  get canvas(): HTMLElement;
4
+ listen(): this;
4
5
  #private;
5
6
  }
6
7
  import LabelController from './LabelController.js';
@@ -8,6 +8,7 @@ export default class Container extends Controller {
8
8
  addController(controller: any): any;
9
9
  pushContainer(container: any): any;
10
10
  popContainer(): this;
11
+ listen(): this;
11
12
  #private;
12
13
  }
13
14
  import Controller from './Controller.js';
@@ -1,4 +1,4 @@
1
- /* muigui@0.0.17, license MIT */
1
+ /* muigui@0.0.21, license MIT */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -91,6 +91,7 @@
91
91
  font-size: var(--font-size);
92
92
  box-sizing: border-box;
93
93
  line-height: 100%;
94
+ white-space: nowrap;
94
95
  }
95
96
  .muigui * {
96
97
  box-sizing: inherit;
@@ -156,6 +157,10 @@
156
157
  --value-color: var(--disabled-color) !important;
157
158
  --range-left-color: var(--disabled-color) !important;
158
159
  }
160
+ /* this shouldn't be needed! */
161
+ .muigui-disabled label {
162
+ color: var(--disabled-color)
163
+ }
159
164
 
160
165
  .muigui canvas,
161
166
  .muigui svg {
@@ -294,7 +299,7 @@
294
299
  }
295
300
  .muigui-closed>.muigui-open-container>* {
296
301
  transition: all 0.1s ease-out;
297
- margin-top: -100%;
302
+ margin-top: -1000%;
298
303
  }
299
304
 
300
305
  /* ---- popdown ---- */
@@ -1214,11 +1219,13 @@
1214
1219
  }
1215
1220
  name(name) {
1216
1221
  this.#buttonElem.textContent = name;
1222
+ return this;
1217
1223
  }
1218
1224
  setOptions(options) {
1219
1225
  copyExistingProperties(this.#options, options);
1220
1226
  const {name} = this.#options;
1221
1227
  this.#buttonElem.textContent = name;
1228
+ return this;
1222
1229
  }
1223
1230
  }
1224
1231
 
@@ -2626,6 +2633,9 @@
2626
2633
  get canvas() {
2627
2634
  return this.#canvasElem;
2628
2635
  }
2636
+ listen() {
2637
+ return this;
2638
+ }
2629
2639
  }
2630
2640
 
2631
2641
  class ColorView extends EditView {
@@ -2767,6 +2777,12 @@
2767
2777
  this.#childDestController = this.#childDestController.parent;
2768
2778
  return this;
2769
2779
  }
2780
+ listen() {
2781
+ this.#controllers.forEach(c => {
2782
+ c.listen();
2783
+ });
2784
+ return this;
2785
+ }
2770
2786
  }
2771
2787
 
2772
2788
  class Folder extends Container {
@@ -3275,11 +3291,22 @@
3275
3291
  }
3276
3292
  }
3277
3293
 
3294
+ function camelCaseToSnakeCase(id) {
3295
+ return id
3296
+ .replace(/(.)([A-Z][a-z]+)/g, '$1_$2')
3297
+ .replace(/([a-z0-9])([A-Z])/g, '$1_$2')
3298
+ .toLowerCase();
3299
+ }
3300
+
3301
+ function prepName(name) {
3302
+ return camelCaseToSnakeCase(name.toString()).replaceAll('_', ' ');
3303
+ }
3304
+
3278
3305
  class GUIFolder extends Folder {
3279
3306
  add(object, property, ...args) {
3280
3307
  const controller = object instanceof Controller
3281
3308
  ? object
3282
- : createController(object, property, ...args);
3309
+ : createController(object, property, ...args).name(prepName(property));
3283
3310
  return this.addController(controller);
3284
3311
  }
3285
3312
  addCanvas(name) {
@@ -3288,9 +3315,13 @@
3288
3315
  addColor(object, property, options = {}) {
3289
3316
  const value = object[property];
3290
3317
  if (hasAlpha(options.format || guessFormat(value))) {
3291
- return this.addController(new ColorChooser(object, property, options));
3318
+ return this
3319
+ .addController(new ColorChooser(object, property, options))
3320
+ .name(prepName(property));
3292
3321
  } else {
3293
- return this.addController(new Color(object, property, options));
3322
+ return this
3323
+ .addController(new Color(object, property, options))
3324
+ .name(prepName(property));
3294
3325
  }
3295
3326
  }
3296
3327
  addDivider() {
@@ -3304,7 +3335,7 @@
3304
3335
  }
3305
3336
  addButton(name, fn) {
3306
3337
  const o = {fn};
3307
- return this.add(o, 'fn').name(name);
3338
+ return this.add(o, 'fn').name(prepName(name));
3308
3339
  }
3309
3340
  }
3310
3341