@movable/studio-framework 3.0.0-esmodules.0 → 3.0.0-esmodules.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.
Files changed (3) hide show
  1. package/dist/index.es.js +108 -239
  2. package/dist/index.js +108 -239
  3. package/package.json +4 -5
package/dist/index.es.js CHANGED
@@ -10,39 +10,6 @@ if (typeof Object.entries === 'undefined') {
10
10
  };
11
11
  }
12
12
 
13
- function _defineProperty(obj, key, value) {
14
- if (key in obj) {
15
- Object.defineProperty(obj, key, {
16
- value: value,
17
- enumerable: true,
18
- configurable: true,
19
- writable: true
20
- });
21
- } else {
22
- obj[key] = value;
23
- }
24
-
25
- return obj;
26
- }
27
-
28
- function _extends() {
29
- _extends = Object.assign || function (target) {
30
- for (var i = 1; i < arguments.length; i++) {
31
- var source = arguments[i];
32
-
33
- for (var key in source) {
34
- if (Object.prototype.hasOwnProperty.call(source, key)) {
35
- target[key] = source[key];
36
- }
37
- }
38
- }
39
-
40
- return target;
41
- };
42
-
43
- return _extends.apply(this, arguments);
44
- }
45
-
46
13
  const {
47
14
  entries: entries$2
48
15
  } = Object;
@@ -170,10 +137,6 @@ class StyledElement extends React.Component {
170
137
  constructor(props) {
171
138
  super(props);
172
139
 
173
- _defineProperty(this, "styleElementRef", void 0);
174
-
175
- _defineProperty(this, "setStyleElementRef", void 0);
176
-
177
140
  this.setStyleElementRef = element => {
178
141
  this.styleElementRef = element;
179
142
  };
@@ -355,26 +318,6 @@ class BaseStudioError extends Error {
355
318
  constructor(message, sourceError, errorType) {
356
319
  super(message);
357
320
 
358
- _defineProperty(this, "errorType", void 0);
359
-
360
- _defineProperty(this, "tag", void 0);
361
-
362
- _defineProperty(this, "sourceType", void 0);
363
-
364
- _defineProperty(this, "sourceError", void 0);
365
-
366
- _defineProperty(this, "sourceDynamicProperty", void 0);
367
-
368
- _defineProperty(this, "entryDynamicProperty", void 0);
369
-
370
- _defineProperty(this, "canvas", void 0);
371
-
372
- _defineProperty(this, "data", void 0);
373
-
374
- _defineProperty(this, "status", void 0);
375
-
376
- _defineProperty(this, "uuid", void 0);
377
-
378
321
  if (sourceError) {
379
322
  this.sourceError = sourceError;
380
323
  }
@@ -431,6 +374,11 @@ function getStateTuple(prop, resolver) {
431
374
  }
432
375
 
433
376
  class TagComponent extends React.Component {
377
+ state = {
378
+ StudioTool: null,
379
+ readyToRender: false
380
+ };
381
+
434
382
  static getDerivedStateFromProps(props) {
435
383
  const {
436
384
  tag,
@@ -501,12 +449,6 @@ class TagComponent extends React.Component {
501
449
 
502
450
  constructor(props) {
503
451
  super(props);
504
-
505
- _defineProperty(this, "state", {
506
- StudioTool: null,
507
- readyToRender: false
508
- });
509
-
510
452
  this.getPropertyState = this.getPropertyState.bind(this);
511
453
  this.getPropertyWithFallback = this.getPropertyWithFallback.bind(this);
512
454
  }
@@ -590,10 +532,6 @@ class SizeContainer extends React.Component {
590
532
  constructor(props) {
591
533
  super(props);
592
534
 
593
- _defineProperty(this, "containerElementRef", void 0);
594
-
595
- _defineProperty(this, "setContainerElementRef", void 0);
596
-
597
535
  this.setContainerElementRef = element => {
598
536
  this.containerElementRef = element;
599
537
  };
@@ -625,13 +563,9 @@ class SizeContainer extends React.Component {
625
563
  }
626
564
 
627
565
  class Resolver {
628
- constructor() {
629
- _defineProperty(this, "componentContainer", new Map());
630
-
631
- _defineProperty(this, "elementModifierContainer", new Map());
632
-
633
- _defineProperty(this, "propertyModifierContainer", new Map());
634
- }
566
+ componentContainer = new Map();
567
+ elementModifierContainer = new Map();
568
+ propertyModifierContainer = new Map();
635
569
 
636
570
  registerComponent(path, registryItem) {
637
571
  this.componentContainer.set(path, registryItem);
@@ -695,31 +629,19 @@ function contextAccessor(context, cb) {
695
629
  return freeze(wrappedContext);
696
630
  }
697
631
 
698
- let _Symbol$iterator;
699
-
700
632
  const ERROR_KEY = Symbol('error');
701
633
 
702
634
  function isError(t) {
703
635
  return t && typeof t === 'object' && ERROR_KEY in t;
704
636
  }
705
637
 
706
- _Symbol$iterator = Symbol.iterator;
707
638
  class CacheMap {
708
- constructor() {
709
- _defineProperty(this, "contextKeys", new Set());
710
-
711
- _defineProperty(this, "cache", new Map());
712
-
713
- _defineProperty(this, "reverseContext", new Map());
714
-
715
- _defineProperty(this, "keyCache", new WeakMap());
716
-
717
- _defineProperty(this, "acceptingKeys", true);
718
-
719
- _defineProperty(this, "tempContext", void 0);
720
-
721
- _defineProperty(this, "tempStorageKey", context => JSON.stringify(context));
722
- }
639
+ contextKeys = new Set();
640
+ cache = new Map();
641
+ reverseContext = new Map();
642
+ keyCache = new WeakMap();
643
+ acceptingKeys = true;
644
+ tempStorageKey = context => JSON.stringify(context);
723
645
 
724
646
  get(context) {
725
647
  const result = this.cache.get(this.cacheKeyFor(context));
@@ -739,7 +661,7 @@ class CacheMap {
739
661
  this.cache.delete(this.cacheKeyFor(context));
740
662
  }
741
663
 
742
- *[_Symbol$iterator]() {
664
+ *[Symbol.iterator]() {
743
665
  for (const [key, value] of this.cache) {
744
666
  if (typeof key === 'string') {
745
667
  const context = this.reverseContext.get(key);
@@ -818,15 +740,11 @@ function defer() {
818
740
  }
819
741
 
820
742
  class ComputeThrottler {
821
- constructor(afterFirst) {
822
- _defineProperty(this, "queue", []);
823
-
824
- _defineProperty(this, "hasSuccessfullyComputed", false);
825
-
826
- _defineProperty(this, "isPending", false);
827
-
828
- _defineProperty(this, "afterFirst", void 0);
743
+ queue = [];
744
+ hasSuccessfullyComputed = false;
745
+ isPending = false;
829
746
 
747
+ constructor(afterFirst) {
830
748
  this.afterFirst = afterFirst;
831
749
  }
832
750
 
@@ -1012,21 +930,10 @@ class InertEvent {
1012
930
  }
1013
931
 
1014
932
  class ActiveEvent {
1015
- constructor(type, dynamicProperty) {
1016
- _defineProperty(this, "id", void 0);
1017
-
1018
- _defineProperty(this, "createdAt", void 0);
1019
-
1020
- _defineProperty(this, "type", void 0);
1021
-
1022
- _defineProperty(this, "dynamicProperty", void 0);
1023
-
1024
- _defineProperty(this, "value", null);
1025
-
1026
- _defineProperty(this, "error", void 0);
1027
-
1028
- _defineProperty(this, "childEvents", []);
933
+ value = null;
934
+ childEvents = [];
1029
935
 
936
+ constructor(type, dynamicProperty) {
1030
937
  this.type = type;
1031
938
  this.dynamicProperty = dynamicProperty;
1032
939
  this.id = generateV4Uuid();
@@ -1061,8 +968,6 @@ function deprecateGetContext(key) {
1061
968
 
1062
969
  class PromiseException {
1063
970
  constructor(promise) {
1064
- _defineProperty(this, "promise", void 0);
1065
-
1066
971
  this.promise = promise;
1067
972
  }
1068
973
 
@@ -1071,23 +976,11 @@ class PromiseException {
1071
976
  const DEFAULT_OVERRIDE = value => value;
1072
977
 
1073
978
  class Property {
1074
- constructor(computeFn, computed, grouping, propertyKey, overrideFn = DEFAULT_OVERRIDE) {
1075
- _defineProperty(this, "computeFn", void 0);
1076
-
1077
- _defineProperty(this, "propertyKey", void 0);
1078
-
1079
- _defineProperty(this, "grouping", void 0);
1080
-
1081
- _defineProperty(this, "dependentProperties", new Set());
1082
-
1083
- _defineProperty(this, "firstCompute", new ComputeThrottler(() => this.finalizeCache()));
1084
-
1085
- _defineProperty(this, "memoizeCache", new CacheMap());
1086
-
1087
- _defineProperty(this, "computed", void 0);
1088
-
1089
- _defineProperty(this, "overrideFn", void 0);
979
+ dependentProperties = new Set();
980
+ firstCompute = new ComputeThrottler(() => this.finalizeCache());
981
+ memoizeCache = new CacheMap();
1090
982
 
983
+ constructor(computeFn, computed, grouping, propertyKey, overrideFn = DEFAULT_OVERRIDE) {
1091
984
  this.computed = computed;
1092
985
  this.computeFn = computeFn;
1093
986
  this.grouping = grouping;
@@ -1407,13 +1300,9 @@ function getPartsFromGroupingKey(groupingKey) {
1407
1300
  }
1408
1301
 
1409
1302
  class GroupedRegistry {
1410
- constructor() {
1411
- _defineProperty(this, "fallbackMap", new Map());
1412
-
1413
- _defineProperty(this, "globalMap", new Map());
1414
-
1415
- _defineProperty(this, "groupingMap", new Map());
1416
- }
1303
+ fallbackMap = new Map();
1304
+ globalMap = new Map();
1305
+ groupingMap = new Map();
1417
1306
 
1418
1307
  get(grouping, path, allowFallback = true) {
1419
1308
  const groupingKey = generateGroupingKey(grouping, path);
@@ -1482,17 +1371,11 @@ function isComputeFn(fn) {
1482
1371
  }
1483
1372
 
1484
1373
  class AsyncComputed {
1485
- constructor() {
1486
- _defineProperty(this, "propertyRegistry", new GroupedRegistry());
1487
-
1488
- _defineProperty(this, "propertyOverridesBuffer", new GroupedRegistry());
1489
-
1490
- _defineProperty(this, "globProperties", new GroupedRegistry());
1491
-
1492
- _defineProperty(this, "eventsEnabled", false);
1493
-
1494
- _defineProperty(this, "eventsTree", []);
1495
- }
1374
+ propertyRegistry = new GroupedRegistry();
1375
+ propertyOverridesBuffer = new GroupedRegistry();
1376
+ globProperties = new GroupedRegistry();
1377
+ eventsEnabled = false;
1378
+ eventsTree = [];
1496
1379
 
1497
1380
  enableEvents() {
1498
1381
  this.eventsEnabled = true;
@@ -1700,6 +1583,24 @@ class AsyncComputed {
1700
1583
 
1701
1584
  const ShapeTag = () => /*#__PURE__*/React.createElement("div", null);
1702
1585
 
1586
+ function _extends() {
1587
+ _extends = Object.assign || function (target) {
1588
+ for (var i = 1; i < arguments.length; i++) {
1589
+ var source = arguments[i];
1590
+
1591
+ for (var key in source) {
1592
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1593
+ target[key] = source[key];
1594
+ }
1595
+ }
1596
+ }
1597
+
1598
+ return target;
1599
+ };
1600
+
1601
+ return _extends.apply(this, arguments);
1602
+ }
1603
+
1703
1604
  class StudioTool extends React.Component {
1704
1605
  // TODO: We need to be able to extend StudioTool and create a new call signature for dynamicProperties
1705
1606
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -2012,17 +1913,10 @@ const mapSpans = (spans, fitToOneLine) => spans.map((span, n) => isNewLine(span)
2012
1913
  })));
2013
1914
 
2014
1915
  class RichTextElement extends StudioTool {
2015
- constructor(...args) {
2016
- super(...args);
2017
-
2018
- _defineProperty(this, "lastRichText", void 0);
2019
-
2020
- _defineProperty(this, "state", {
2021
- didOverflow: false
2022
- });
2023
-
2024
- _defineProperty(this, "elementRef", /*#__PURE__*/React.createRef());
2025
- }
1916
+ state = {
1917
+ didOverflow: false
1918
+ };
1919
+ elementRef = /*#__PURE__*/React.createRef();
2026
1920
 
2027
1921
  static dynamicProperties(tag) {
2028
1922
  return getDynamicTokens(tag.richText);
@@ -2261,22 +2155,19 @@ var bootstrapApp = (resolver => {
2261
2155
  });
2262
2156
 
2263
2157
  class App extends React.Component {
2158
+ dimensionsDefault = {
2159
+ width: 400,
2160
+ height: 300
2161
+ };
2162
+ pendingProperties = new Set();
2163
+ onPendingPromise = promises => {
2164
+ for (const promise of promises) {
2165
+ this.pendingProperties.add(promise);
2166
+ }
2167
+ };
2168
+
2264
2169
  constructor(props) {
2265
2170
  super(props);
2266
-
2267
- _defineProperty(this, "dimensionsDefault", {
2268
- width: 400,
2269
- height: 300
2270
- });
2271
-
2272
- _defineProperty(this, "pendingProperties", new Set());
2273
-
2274
- _defineProperty(this, "onPendingPromise", promises => {
2275
- for (const promise of promises) {
2276
- this.pendingProperties.add(promise);
2277
- }
2278
- });
2279
-
2280
2171
  const {
2281
2172
  asyncComputed,
2282
2173
  resolver
@@ -2669,63 +2560,45 @@ const areAttributesStatic = attributes => {
2669
2560
  };
2670
2561
 
2671
2562
  class StudioFramework {
2672
- constructor(opts = setupAppDefaults()) {
2673
- _defineProperty(this, "currentGrouping", false);
2674
-
2675
- _defineProperty(this, "asyncComputed", new AsyncComputed());
2676
-
2677
- _defineProperty(this, "resolver", new Resolver());
2678
-
2679
- _defineProperty(this, "canvases", void 0);
2680
-
2681
- _defineProperty(this, "customProps", void 0);
2682
-
2683
- _defineProperty(this, "customTools", void 0);
2684
-
2685
- _defineProperty(this, "modifiedProps", void 0);
2686
-
2687
- _defineProperty(this, "appComponent", void 0);
2688
-
2689
- _defineProperty(this, "options", void 0);
2690
-
2691
- _defineProperty(this, "namespacedOptions", void 0);
2692
-
2693
- _defineProperty(this, "debug", {
2694
- CD,
2695
- enableDebugMode: () => {
2696
- this.asyncComputed.enableEvents();
2697
- },
2698
- getAllProperties: () => this.asyncComputed.dumpState(),
2699
- getPropertyEvents: () => {
2700
- console.warn('`app.debug.getPropertyEvents()` is deprecated. Please use `app.meta.enableEvents()` and `app.meta.getEvents([consoleLog])`.');
2701
- return this.asyncComputed.propertyEvents;
2702
- },
2703
- logProperties: () => {
2704
- const state = this.asyncComputed.dumpState();
2705
- console.warn('`app.debug.logProperties()` is deprecated. Please use `app.meta.enableEvents` and `app.meta.getEvents([consoleLog])`.');
2706
- console.log(JSON.stringify(state, null, 2));
2707
- },
2708
- logPropertyTree: () => {
2709
- const events = this.asyncComputed.propertyEvents;
2710
- console.log(JSON.stringify(events, null, 2));
2711
- }
2712
- });
2713
-
2714
- _defineProperty(this, "meta", {
2715
- eventsEnabled: false,
2716
- enableEvents: () => {
2717
- // tbd: options for pruning which events are captured
2718
- this.meta.eventsEnabled = true;
2719
- this.asyncComputed.enableEvents();
2720
- },
2721
- getEvents: consoleLog => {
2722
- if (!this.meta.eventsEnabled) console.warn('`app.metadata.getEvents()` was called, however `app.metadata.enableEvents([...options])` was not set first. No events will be returned.');
2723
- const events = this.asyncComputed.propertyEvents;
2724
- if (consoleLog) console.log(JSON.stringify(events, null, 2));
2725
- return events;
2726
- }
2727
- });
2563
+ currentGrouping = false;
2564
+ asyncComputed = new AsyncComputed();
2565
+ resolver = new Resolver();
2566
+ debug = {
2567
+ CD,
2568
+ enableDebugMode: () => {
2569
+ this.asyncComputed.enableEvents();
2570
+ },
2571
+ getAllProperties: () => this.asyncComputed.dumpState(),
2572
+ getPropertyEvents: () => {
2573
+ console.warn('`app.debug.getPropertyEvents()` is deprecated. Please use `app.meta.enableEvents()` and `app.meta.getEvents([consoleLog])`.');
2574
+ return this.asyncComputed.propertyEvents;
2575
+ },
2576
+ logProperties: () => {
2577
+ const state = this.asyncComputed.dumpState();
2578
+ console.warn('`app.debug.logProperties()` is deprecated. Please use `app.meta.enableEvents` and `app.meta.getEvents([consoleLog])`.');
2579
+ console.log(JSON.stringify(state, null, 2));
2580
+ },
2581
+ logPropertyTree: () => {
2582
+ const events = this.asyncComputed.propertyEvents;
2583
+ console.log(JSON.stringify(events, null, 2));
2584
+ }
2585
+ };
2586
+ meta = {
2587
+ eventsEnabled: false,
2588
+ enableEvents: () => {
2589
+ // tbd: options for pruning which events are captured
2590
+ this.meta.eventsEnabled = true;
2591
+ this.asyncComputed.enableEvents();
2592
+ },
2593
+ getEvents: consoleLog => {
2594
+ if (!this.meta.eventsEnabled) console.warn('`app.metadata.getEvents()` was called, however `app.metadata.enableEvents([...options])` was not set first. No events will be returned.');
2595
+ const events = this.asyncComputed.propertyEvents;
2596
+ if (consoleLog) console.log(JSON.stringify(events, null, 2));
2597
+ return events;
2598
+ }
2599
+ };
2728
2600
 
2601
+ constructor(opts = setupAppDefaults()) {
2729
2602
  const {
2730
2603
  canvases = [],
2731
2604
  customProps = [],
@@ -3325,11 +3198,9 @@ let ConsoleMethods;
3325
3198
  })(ConsoleMethods || (ConsoleMethods = {}));
3326
3199
 
3327
3200
  class Console {
3328
- constructor() {
3329
- _defineProperty(this, "selectedLogLevel", 'debug');
3330
-
3331
- _defineProperty(this, "console", Console.originalConsole);
3332
- }
3201
+ selectedLogLevel = 'debug';
3202
+ static originalConsole = console;
3203
+ console = Console.originalConsole;
3333
3204
 
3334
3205
  static install() {
3335
3206
  // eslint-disable-next-line
@@ -3506,8 +3377,6 @@ class Console {
3506
3377
 
3507
3378
  }
3508
3379
 
3509
- _defineProperty(Console, "originalConsole", console);
3510
-
3511
3380
  if (window.MICapture && window.MICapture.captureAppLog) {
3512
3381
  Console.install();
3513
3382
  }
package/dist/index.js CHANGED
@@ -20,39 +20,6 @@ if (typeof Object.entries === 'undefined') {
20
20
  };
21
21
  }
22
22
 
23
- function _defineProperty(obj, key, value) {
24
- if (key in obj) {
25
- Object.defineProperty(obj, key, {
26
- value: value,
27
- enumerable: true,
28
- configurable: true,
29
- writable: true
30
- });
31
- } else {
32
- obj[key] = value;
33
- }
34
-
35
- return obj;
36
- }
37
-
38
- function _extends() {
39
- _extends = Object.assign || function (target) {
40
- for (var i = 1; i < arguments.length; i++) {
41
- var source = arguments[i];
42
-
43
- for (var key in source) {
44
- if (Object.prototype.hasOwnProperty.call(source, key)) {
45
- target[key] = source[key];
46
- }
47
- }
48
- }
49
-
50
- return target;
51
- };
52
-
53
- return _extends.apply(this, arguments);
54
- }
55
-
56
23
  const {
57
24
  entries: entries$2
58
25
  } = Object;
@@ -180,10 +147,6 @@ class StyledElement extends React__default['default'].Component {
180
147
  constructor(props) {
181
148
  super(props);
182
149
 
183
- _defineProperty(this, "styleElementRef", void 0);
184
-
185
- _defineProperty(this, "setStyleElementRef", void 0);
186
-
187
150
  this.setStyleElementRef = element => {
188
151
  this.styleElementRef = element;
189
152
  };
@@ -365,26 +328,6 @@ class BaseStudioError extends Error {
365
328
  constructor(message, sourceError, errorType) {
366
329
  super(message);
367
330
 
368
- _defineProperty(this, "errorType", void 0);
369
-
370
- _defineProperty(this, "tag", void 0);
371
-
372
- _defineProperty(this, "sourceType", void 0);
373
-
374
- _defineProperty(this, "sourceError", void 0);
375
-
376
- _defineProperty(this, "sourceDynamicProperty", void 0);
377
-
378
- _defineProperty(this, "entryDynamicProperty", void 0);
379
-
380
- _defineProperty(this, "canvas", void 0);
381
-
382
- _defineProperty(this, "data", void 0);
383
-
384
- _defineProperty(this, "status", void 0);
385
-
386
- _defineProperty(this, "uuid", void 0);
387
-
388
331
  if (sourceError) {
389
332
  this.sourceError = sourceError;
390
333
  }
@@ -441,6 +384,11 @@ function getStateTuple(prop, resolver) {
441
384
  }
442
385
 
443
386
  class TagComponent extends React__default['default'].Component {
387
+ state = {
388
+ StudioTool: null,
389
+ readyToRender: false
390
+ };
391
+
444
392
  static getDerivedStateFromProps(props) {
445
393
  const {
446
394
  tag,
@@ -511,12 +459,6 @@ class TagComponent extends React__default['default'].Component {
511
459
 
512
460
  constructor(props) {
513
461
  super(props);
514
-
515
- _defineProperty(this, "state", {
516
- StudioTool: null,
517
- readyToRender: false
518
- });
519
-
520
462
  this.getPropertyState = this.getPropertyState.bind(this);
521
463
  this.getPropertyWithFallback = this.getPropertyWithFallback.bind(this);
522
464
  }
@@ -600,10 +542,6 @@ class SizeContainer extends React__default['default'].Component {
600
542
  constructor(props) {
601
543
  super(props);
602
544
 
603
- _defineProperty(this, "containerElementRef", void 0);
604
-
605
- _defineProperty(this, "setContainerElementRef", void 0);
606
-
607
545
  this.setContainerElementRef = element => {
608
546
  this.containerElementRef = element;
609
547
  };
@@ -635,13 +573,9 @@ class SizeContainer extends React__default['default'].Component {
635
573
  }
636
574
 
637
575
  class Resolver {
638
- constructor() {
639
- _defineProperty(this, "componentContainer", new Map());
640
-
641
- _defineProperty(this, "elementModifierContainer", new Map());
642
-
643
- _defineProperty(this, "propertyModifierContainer", new Map());
644
- }
576
+ componentContainer = new Map();
577
+ elementModifierContainer = new Map();
578
+ propertyModifierContainer = new Map();
645
579
 
646
580
  registerComponent(path, registryItem) {
647
581
  this.componentContainer.set(path, registryItem);
@@ -705,31 +639,19 @@ function contextAccessor(context, cb) {
705
639
  return freeze(wrappedContext);
706
640
  }
707
641
 
708
- let _Symbol$iterator;
709
-
710
642
  const ERROR_KEY = Symbol('error');
711
643
 
712
644
  function isError(t) {
713
645
  return t && typeof t === 'object' && ERROR_KEY in t;
714
646
  }
715
647
 
716
- _Symbol$iterator = Symbol.iterator;
717
648
  class CacheMap {
718
- constructor() {
719
- _defineProperty(this, "contextKeys", new Set());
720
-
721
- _defineProperty(this, "cache", new Map());
722
-
723
- _defineProperty(this, "reverseContext", new Map());
724
-
725
- _defineProperty(this, "keyCache", new WeakMap());
726
-
727
- _defineProperty(this, "acceptingKeys", true);
728
-
729
- _defineProperty(this, "tempContext", void 0);
730
-
731
- _defineProperty(this, "tempStorageKey", context => JSON.stringify(context));
732
- }
649
+ contextKeys = new Set();
650
+ cache = new Map();
651
+ reverseContext = new Map();
652
+ keyCache = new WeakMap();
653
+ acceptingKeys = true;
654
+ tempStorageKey = context => JSON.stringify(context);
733
655
 
734
656
  get(context) {
735
657
  const result = this.cache.get(this.cacheKeyFor(context));
@@ -749,7 +671,7 @@ class CacheMap {
749
671
  this.cache.delete(this.cacheKeyFor(context));
750
672
  }
751
673
 
752
- *[_Symbol$iterator]() {
674
+ *[Symbol.iterator]() {
753
675
  for (const [key, value] of this.cache) {
754
676
  if (typeof key === 'string') {
755
677
  const context = this.reverseContext.get(key);
@@ -828,15 +750,11 @@ function defer() {
828
750
  }
829
751
 
830
752
  class ComputeThrottler {
831
- constructor(afterFirst) {
832
- _defineProperty(this, "queue", []);
833
-
834
- _defineProperty(this, "hasSuccessfullyComputed", false);
835
-
836
- _defineProperty(this, "isPending", false);
837
-
838
- _defineProperty(this, "afterFirst", void 0);
753
+ queue = [];
754
+ hasSuccessfullyComputed = false;
755
+ isPending = false;
839
756
 
757
+ constructor(afterFirst) {
840
758
  this.afterFirst = afterFirst;
841
759
  }
842
760
 
@@ -1022,21 +940,10 @@ class InertEvent {
1022
940
  }
1023
941
 
1024
942
  class ActiveEvent {
1025
- constructor(type, dynamicProperty) {
1026
- _defineProperty(this, "id", void 0);
1027
-
1028
- _defineProperty(this, "createdAt", void 0);
1029
-
1030
- _defineProperty(this, "type", void 0);
1031
-
1032
- _defineProperty(this, "dynamicProperty", void 0);
1033
-
1034
- _defineProperty(this, "value", null);
1035
-
1036
- _defineProperty(this, "error", void 0);
1037
-
1038
- _defineProperty(this, "childEvents", []);
943
+ value = null;
944
+ childEvents = [];
1039
945
 
946
+ constructor(type, dynamicProperty) {
1040
947
  this.type = type;
1041
948
  this.dynamicProperty = dynamicProperty;
1042
949
  this.id = generateV4Uuid();
@@ -1071,8 +978,6 @@ function deprecateGetContext(key) {
1071
978
 
1072
979
  class PromiseException {
1073
980
  constructor(promise) {
1074
- _defineProperty(this, "promise", void 0);
1075
-
1076
981
  this.promise = promise;
1077
982
  }
1078
983
 
@@ -1081,23 +986,11 @@ class PromiseException {
1081
986
  const DEFAULT_OVERRIDE = value => value;
1082
987
 
1083
988
  class Property {
1084
- constructor(computeFn, computed, grouping, propertyKey, overrideFn = DEFAULT_OVERRIDE) {
1085
- _defineProperty(this, "computeFn", void 0);
1086
-
1087
- _defineProperty(this, "propertyKey", void 0);
1088
-
1089
- _defineProperty(this, "grouping", void 0);
1090
-
1091
- _defineProperty(this, "dependentProperties", new Set());
1092
-
1093
- _defineProperty(this, "firstCompute", new ComputeThrottler(() => this.finalizeCache()));
1094
-
1095
- _defineProperty(this, "memoizeCache", new CacheMap());
1096
-
1097
- _defineProperty(this, "computed", void 0);
1098
-
1099
- _defineProperty(this, "overrideFn", void 0);
989
+ dependentProperties = new Set();
990
+ firstCompute = new ComputeThrottler(() => this.finalizeCache());
991
+ memoizeCache = new CacheMap();
1100
992
 
993
+ constructor(computeFn, computed, grouping, propertyKey, overrideFn = DEFAULT_OVERRIDE) {
1101
994
  this.computed = computed;
1102
995
  this.computeFn = computeFn;
1103
996
  this.grouping = grouping;
@@ -1417,13 +1310,9 @@ function getPartsFromGroupingKey(groupingKey) {
1417
1310
  }
1418
1311
 
1419
1312
  class GroupedRegistry {
1420
- constructor() {
1421
- _defineProperty(this, "fallbackMap", new Map());
1422
-
1423
- _defineProperty(this, "globalMap", new Map());
1424
-
1425
- _defineProperty(this, "groupingMap", new Map());
1426
- }
1313
+ fallbackMap = new Map();
1314
+ globalMap = new Map();
1315
+ groupingMap = new Map();
1427
1316
 
1428
1317
  get(grouping, path, allowFallback = true) {
1429
1318
  const groupingKey = generateGroupingKey(grouping, path);
@@ -1492,17 +1381,11 @@ function isComputeFn(fn) {
1492
1381
  }
1493
1382
 
1494
1383
  class AsyncComputed {
1495
- constructor() {
1496
- _defineProperty(this, "propertyRegistry", new GroupedRegistry());
1497
-
1498
- _defineProperty(this, "propertyOverridesBuffer", new GroupedRegistry());
1499
-
1500
- _defineProperty(this, "globProperties", new GroupedRegistry());
1501
-
1502
- _defineProperty(this, "eventsEnabled", false);
1503
-
1504
- _defineProperty(this, "eventsTree", []);
1505
- }
1384
+ propertyRegistry = new GroupedRegistry();
1385
+ propertyOverridesBuffer = new GroupedRegistry();
1386
+ globProperties = new GroupedRegistry();
1387
+ eventsEnabled = false;
1388
+ eventsTree = [];
1506
1389
 
1507
1390
  enableEvents() {
1508
1391
  this.eventsEnabled = true;
@@ -1710,6 +1593,24 @@ class AsyncComputed {
1710
1593
 
1711
1594
  const ShapeTag = () => /*#__PURE__*/React__default['default'].createElement("div", null);
1712
1595
 
1596
+ function _extends() {
1597
+ _extends = Object.assign || function (target) {
1598
+ for (var i = 1; i < arguments.length; i++) {
1599
+ var source = arguments[i];
1600
+
1601
+ for (var key in source) {
1602
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1603
+ target[key] = source[key];
1604
+ }
1605
+ }
1606
+ }
1607
+
1608
+ return target;
1609
+ };
1610
+
1611
+ return _extends.apply(this, arguments);
1612
+ }
1613
+
1713
1614
  class StudioTool extends React__default['default'].Component {
1714
1615
  // TODO: We need to be able to extend StudioTool and create a new call signature for dynamicProperties
1715
1616
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -2022,17 +1923,10 @@ const mapSpans = (spans, fitToOneLine) => spans.map((span, n) => isNewLine(span)
2022
1923
  })));
2023
1924
 
2024
1925
  class RichTextElement extends StudioTool {
2025
- constructor(...args) {
2026
- super(...args);
2027
-
2028
- _defineProperty(this, "lastRichText", void 0);
2029
-
2030
- _defineProperty(this, "state", {
2031
- didOverflow: false
2032
- });
2033
-
2034
- _defineProperty(this, "elementRef", /*#__PURE__*/React__default['default'].createRef());
2035
- }
1926
+ state = {
1927
+ didOverflow: false
1928
+ };
1929
+ elementRef = /*#__PURE__*/React__default['default'].createRef();
2036
1930
 
2037
1931
  static dynamicProperties(tag) {
2038
1932
  return getDynamicTokens(tag.richText);
@@ -2271,22 +2165,19 @@ var bootstrapApp = (resolver => {
2271
2165
  });
2272
2166
 
2273
2167
  class App extends React__default['default'].Component {
2168
+ dimensionsDefault = {
2169
+ width: 400,
2170
+ height: 300
2171
+ };
2172
+ pendingProperties = new Set();
2173
+ onPendingPromise = promises => {
2174
+ for (const promise of promises) {
2175
+ this.pendingProperties.add(promise);
2176
+ }
2177
+ };
2178
+
2274
2179
  constructor(props) {
2275
2180
  super(props);
2276
-
2277
- _defineProperty(this, "dimensionsDefault", {
2278
- width: 400,
2279
- height: 300
2280
- });
2281
-
2282
- _defineProperty(this, "pendingProperties", new Set());
2283
-
2284
- _defineProperty(this, "onPendingPromise", promises => {
2285
- for (const promise of promises) {
2286
- this.pendingProperties.add(promise);
2287
- }
2288
- });
2289
-
2290
2181
  const {
2291
2182
  asyncComputed,
2292
2183
  resolver
@@ -2679,63 +2570,45 @@ const areAttributesStatic = attributes => {
2679
2570
  };
2680
2571
 
2681
2572
  class StudioFramework {
2682
- constructor(opts = setupAppDefaults()) {
2683
- _defineProperty(this, "currentGrouping", false);
2684
-
2685
- _defineProperty(this, "asyncComputed", new AsyncComputed());
2686
-
2687
- _defineProperty(this, "resolver", new Resolver());
2688
-
2689
- _defineProperty(this, "canvases", void 0);
2690
-
2691
- _defineProperty(this, "customProps", void 0);
2692
-
2693
- _defineProperty(this, "customTools", void 0);
2694
-
2695
- _defineProperty(this, "modifiedProps", void 0);
2696
-
2697
- _defineProperty(this, "appComponent", void 0);
2698
-
2699
- _defineProperty(this, "options", void 0);
2700
-
2701
- _defineProperty(this, "namespacedOptions", void 0);
2702
-
2703
- _defineProperty(this, "debug", {
2704
- CD: CD__default['default'],
2705
- enableDebugMode: () => {
2706
- this.asyncComputed.enableEvents();
2707
- },
2708
- getAllProperties: () => this.asyncComputed.dumpState(),
2709
- getPropertyEvents: () => {
2710
- console.warn('`app.debug.getPropertyEvents()` is deprecated. Please use `app.meta.enableEvents()` and `app.meta.getEvents([consoleLog])`.');
2711
- return this.asyncComputed.propertyEvents;
2712
- },
2713
- logProperties: () => {
2714
- const state = this.asyncComputed.dumpState();
2715
- console.warn('`app.debug.logProperties()` is deprecated. Please use `app.meta.enableEvents` and `app.meta.getEvents([consoleLog])`.');
2716
- console.log(JSON.stringify(state, null, 2));
2717
- },
2718
- logPropertyTree: () => {
2719
- const events = this.asyncComputed.propertyEvents;
2720
- console.log(JSON.stringify(events, null, 2));
2721
- }
2722
- });
2723
-
2724
- _defineProperty(this, "meta", {
2725
- eventsEnabled: false,
2726
- enableEvents: () => {
2727
- // tbd: options for pruning which events are captured
2728
- this.meta.eventsEnabled = true;
2729
- this.asyncComputed.enableEvents();
2730
- },
2731
- getEvents: consoleLog => {
2732
- if (!this.meta.eventsEnabled) console.warn('`app.metadata.getEvents()` was called, however `app.metadata.enableEvents([...options])` was not set first. No events will be returned.');
2733
- const events = this.asyncComputed.propertyEvents;
2734
- if (consoleLog) console.log(JSON.stringify(events, null, 2));
2735
- return events;
2736
- }
2737
- });
2573
+ currentGrouping = false;
2574
+ asyncComputed = new AsyncComputed();
2575
+ resolver = new Resolver();
2576
+ debug = {
2577
+ CD: CD__default['default'],
2578
+ enableDebugMode: () => {
2579
+ this.asyncComputed.enableEvents();
2580
+ },
2581
+ getAllProperties: () => this.asyncComputed.dumpState(),
2582
+ getPropertyEvents: () => {
2583
+ console.warn('`app.debug.getPropertyEvents()` is deprecated. Please use `app.meta.enableEvents()` and `app.meta.getEvents([consoleLog])`.');
2584
+ return this.asyncComputed.propertyEvents;
2585
+ },
2586
+ logProperties: () => {
2587
+ const state = this.asyncComputed.dumpState();
2588
+ console.warn('`app.debug.logProperties()` is deprecated. Please use `app.meta.enableEvents` and `app.meta.getEvents([consoleLog])`.');
2589
+ console.log(JSON.stringify(state, null, 2));
2590
+ },
2591
+ logPropertyTree: () => {
2592
+ const events = this.asyncComputed.propertyEvents;
2593
+ console.log(JSON.stringify(events, null, 2));
2594
+ }
2595
+ };
2596
+ meta = {
2597
+ eventsEnabled: false,
2598
+ enableEvents: () => {
2599
+ // tbd: options for pruning which events are captured
2600
+ this.meta.eventsEnabled = true;
2601
+ this.asyncComputed.enableEvents();
2602
+ },
2603
+ getEvents: consoleLog => {
2604
+ if (!this.meta.eventsEnabled) console.warn('`app.metadata.getEvents()` was called, however `app.metadata.enableEvents([...options])` was not set first. No events will be returned.');
2605
+ const events = this.asyncComputed.propertyEvents;
2606
+ if (consoleLog) console.log(JSON.stringify(events, null, 2));
2607
+ return events;
2608
+ }
2609
+ };
2738
2610
 
2611
+ constructor(opts = setupAppDefaults()) {
2739
2612
  const {
2740
2613
  canvases = [],
2741
2614
  customProps = [],
@@ -3335,11 +3208,9 @@ let ConsoleMethods;
3335
3208
  })(ConsoleMethods || (ConsoleMethods = {}));
3336
3209
 
3337
3210
  class Console {
3338
- constructor() {
3339
- _defineProperty(this, "selectedLogLevel", 'debug');
3340
-
3341
- _defineProperty(this, "console", Console.originalConsole);
3342
- }
3211
+ selectedLogLevel = 'debug';
3212
+ static originalConsole = console;
3213
+ console = Console.originalConsole;
3343
3214
 
3344
3215
  static install() {
3345
3216
  // eslint-disable-next-line
@@ -3516,8 +3387,6 @@ class Console {
3516
3387
 
3517
3388
  }
3518
3389
 
3519
- _defineProperty(Console, "originalConsole", console);
3520
-
3521
3390
  if (window.MICapture && window.MICapture.captureAppLog) {
3522
3391
  Console.install();
3523
3392
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movable/studio-framework",
3
- "version": "3.0.0-esmodules.0",
3
+ "version": "3.0.0-esmodules.1",
4
4
  "description": "A Component library for reactive Studio apps.",
5
5
  "author": "Movable Ink",
6
6
  "repository": "movableink/studio-framework",
@@ -27,13 +27,12 @@
27
27
  },
28
28
  "devDependencies": {
29
29
  "@babel/core": "^7.14.0",
30
- "@babel/plugin-proposal-class-properties": "^7.13.0",
31
30
  "@babel/preset-env": "^7.20.2",
32
31
  "@babel/preset-react": "^7.14.5",
33
32
  "@babel/preset-typescript": "^7.13.0",
34
33
  "@movable/eslint-config-react": "^1.0.1",
35
- "@movable/framework-types": "^3.0.0-esmodules.0",
36
- "@movable/studio-framework-test-helpers": "^3.0.0-esmodules.0",
34
+ "@movable/framework-types": "^3.0.0-esmodules.1",
35
+ "@movable/studio-framework-test-helpers": "^3.0.0-esmodules.1",
37
36
  "@types/qunit": "^2.11.1",
38
37
  "@types/qunit-dom": "^0.7.0",
39
38
  "@types/react": "^17.0.6",
@@ -65,5 +64,5 @@
65
64
  "volta": {
66
65
  "extends": "../../package.json"
67
66
  },
68
- "gitHead": "70ac10408686fdf679ee04cde278285f7778eaf1"
67
+ "gitHead": "ea2420f0db42b95a3e1e877da7f2a0c6ac4b0240"
69
68
  }