@valbuild/react 0.41.0 → 0.42.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.
@@ -478,21 +478,23 @@ var ValStore = /*#__PURE__*/function () {
478
478
  this.subscribers = new Map();
479
479
  this.listeners = {};
480
480
  }
481
-
482
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
483
481
  _createClass(ValStore, [{
484
482
  key: "update",
485
483
  value: function () {
486
484
  var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(moduleIds) {
485
+ var _this2 = this;
487
486
  return _regeneratorRuntime().wrap(function _callee$(_context) {
488
487
  while (1) switch (_context.prev = _context.next) {
489
488
  case 0:
490
- return _context.abrupt("return", this.updateAll());
491
- case 1:
489
+ _context.next = 2;
490
+ return Promise.all(moduleIds.map(function (moduleId) {
491
+ return _this2.updateTree(moduleId);
492
+ }));
493
+ case 2:
492
494
  case "end":
493
495
  return _context.stop();
494
496
  }
495
- }, _callee, this);
497
+ }, _callee);
496
498
  }));
497
499
  function update(_x) {
498
500
  return _update.apply(this, arguments);
@@ -503,27 +505,48 @@ var ValStore = /*#__PURE__*/function () {
503
505
  key: "updateAll",
504
506
  value: function () {
505
507
  var _updateAll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
508
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
509
+ while (1) switch (_context2.prev = _context2.next) {
510
+ case 0:
511
+ _context2.next = 2;
512
+ return this.updateTree();
513
+ case 2:
514
+ case "end":
515
+ return _context2.stop();
516
+ }
517
+ }, _callee2, this);
518
+ }));
519
+ function updateAll() {
520
+ return _updateAll.apply(this, arguments);
521
+ }
522
+ return updateAll;
523
+ }()
524
+ }, {
525
+ key: "updateTree",
526
+ value: function () {
527
+ var _updateTree = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(treePath) {
506
528
  var data, updatedSubscriberIds, subscriberIds, _loop, _i, _arr, _i2, _Array$from, _Array$from$_i, updatedSubscriberId, moduleIds, subscriberModules;
507
- return _regeneratorRuntime().wrap(function _callee2$(_context3) {
508
- while (1) switch (_context3.prev = _context3.next) {
529
+ return _regeneratorRuntime().wrap(function _callee3$(_context4) {
530
+ while (1) switch (_context4.prev = _context4.next) {
509
531
  case 0:
510
- _context3.next = 2;
532
+ _context4.next = 2;
511
533
  return this.api.getTree({
534
+ treePath: treePath,
512
535
  patch: true,
513
536
  includeSource: true
514
537
  });
515
538
  case 2:
516
- data = _context3.sent;
539
+ data = _context4.sent;
517
540
  if (!fp.result.isOk(data)) {
518
- _context3.next = 16;
541
+ _context4.next = 16;
519
542
  break;
520
543
  }
521
544
  updatedSubscriberIds = new Map();
522
545
  subscriberIds = Array.from(this.subscribers.keys()); // Figure out which modules have been updated and map to updated subscribed id
523
546
  _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
524
547
  var moduleId, source, updatedSubscriberId;
525
- return _regeneratorRuntime().wrap(function _loop$(_context2) {
526
- while (1) switch (_context2.prev = _context2.next) {
548
+ return _regeneratorRuntime().wrap(function _loop$(_context3) {
549
+ while (1) switch (_context3.prev = _context3.next) {
527
550
  case 0:
528
551
  moduleId = _arr[_i];
529
552
  source = data.value.modules[moduleId].source;
@@ -539,20 +562,20 @@ var ValStore = /*#__PURE__*/function () {
539
562
  }
540
563
  case 3:
541
564
  case "end":
542
- return _context2.stop();
565
+ return _context3.stop();
543
566
  }
544
567
  }, _loop);
545
568
  });
546
569
  _i = 0, _arr = Object.keys(data.value.modules);
547
570
  case 8:
548
571
  if (!(_i < _arr.length)) {
549
- _context3.next = 13;
572
+ _context4.next = 13;
550
573
  break;
551
574
  }
552
- return _context3.delegateYield(_loop(), "t0", 10);
575
+ return _context4.delegateYield(_loop(), "t0", 10);
553
576
  case 10:
554
577
  _i++;
555
- _context3.next = 8;
578
+ _context4.next = 8;
556
579
  break;
557
580
  case 13:
558
581
  // For all updated subscribers: set new module data and emit change
@@ -568,20 +591,20 @@ var ValStore = /*#__PURE__*/function () {
568
591
  this.subscribers.set(updatedSubscriberId, subscriberModules);
569
592
  this.emitChange(updatedSubscriberId);
570
593
  }
571
- _context3.next = 17;
594
+ _context4.next = 17;
572
595
  break;
573
596
  case 16:
574
597
  console.error("Val: failed to update modules", data.error);
575
598
  case 17:
576
599
  case "end":
577
- return _context3.stop();
600
+ return _context4.stop();
578
601
  }
579
- }, _callee2, this);
602
+ }, _callee3, this);
580
603
  }));
581
- function updateAll() {
582
- return _updateAll.apply(this, arguments);
604
+ function updateTree(_x2) {
605
+ return _updateTree.apply(this, arguments);
583
606
  }
584
- return updateAll;
607
+ return updateTree;
585
608
  }()
586
609
  }, {
587
610
  key: "emitChange",
@@ -623,7 +646,7 @@ var ValContext = typeof window !== "undefined" ? /*#__PURE__*/React__default["de
623
646
  valApi: undefined
624
647
  }) : undefined;
625
648
  var ValUI = /*#__PURE__*/React.lazy(function () {
626
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('./ValUI-3a6c5666.cjs.dev.js')); });
649
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('./ValUI-ec9857f2.cjs.dev.js')); });
627
650
  });
628
651
  function ValProvider(_ref) {
629
652
  var children = _ref.children,
@@ -452,21 +452,23 @@ var ValStore = /*#__PURE__*/function () {
452
452
  this.subscribers = new Map();
453
453
  this.listeners = {};
454
454
  }
455
-
456
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
457
455
  _createClass(ValStore, [{
458
456
  key: "update",
459
457
  value: function () {
460
458
  var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(moduleIds) {
459
+ var _this2 = this;
461
460
  return _regeneratorRuntime().wrap(function _callee$(_context) {
462
461
  while (1) switch (_context.prev = _context.next) {
463
462
  case 0:
464
- return _context.abrupt("return", this.updateAll());
465
- case 1:
463
+ _context.next = 2;
464
+ return Promise.all(moduleIds.map(function (moduleId) {
465
+ return _this2.updateTree(moduleId);
466
+ }));
467
+ case 2:
466
468
  case "end":
467
469
  return _context.stop();
468
470
  }
469
- }, _callee, this);
471
+ }, _callee);
470
472
  }));
471
473
  function update(_x) {
472
474
  return _update.apply(this, arguments);
@@ -477,27 +479,48 @@ var ValStore = /*#__PURE__*/function () {
477
479
  key: "updateAll",
478
480
  value: function () {
479
481
  var _updateAll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
482
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
483
+ while (1) switch (_context2.prev = _context2.next) {
484
+ case 0:
485
+ _context2.next = 2;
486
+ return this.updateTree();
487
+ case 2:
488
+ case "end":
489
+ return _context2.stop();
490
+ }
491
+ }, _callee2, this);
492
+ }));
493
+ function updateAll() {
494
+ return _updateAll.apply(this, arguments);
495
+ }
496
+ return updateAll;
497
+ }()
498
+ }, {
499
+ key: "updateTree",
500
+ value: function () {
501
+ var _updateTree = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(treePath) {
480
502
  var data, updatedSubscriberIds, subscriberIds, _loop, _i, _arr, _i2, _Array$from, _Array$from$_i, updatedSubscriberId, moduleIds, subscriberModules;
481
- return _regeneratorRuntime().wrap(function _callee2$(_context3) {
482
- while (1) switch (_context3.prev = _context3.next) {
503
+ return _regeneratorRuntime().wrap(function _callee3$(_context4) {
504
+ while (1) switch (_context4.prev = _context4.next) {
483
505
  case 0:
484
- _context3.next = 2;
506
+ _context4.next = 2;
485
507
  return this.api.getTree({
508
+ treePath: treePath,
486
509
  patch: true,
487
510
  includeSource: true
488
511
  });
489
512
  case 2:
490
- data = _context3.sent;
513
+ data = _context4.sent;
491
514
  if (!result.isOk(data)) {
492
- _context3.next = 16;
515
+ _context4.next = 16;
493
516
  break;
494
517
  }
495
518
  updatedSubscriberIds = new Map();
496
519
  subscriberIds = Array.from(this.subscribers.keys()); // Figure out which modules have been updated and map to updated subscribed id
497
520
  _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
498
521
  var moduleId, source, updatedSubscriberId;
499
- return _regeneratorRuntime().wrap(function _loop$(_context2) {
500
- while (1) switch (_context2.prev = _context2.next) {
522
+ return _regeneratorRuntime().wrap(function _loop$(_context3) {
523
+ while (1) switch (_context3.prev = _context3.next) {
501
524
  case 0:
502
525
  moduleId = _arr[_i];
503
526
  source = data.value.modules[moduleId].source;
@@ -513,20 +536,20 @@ var ValStore = /*#__PURE__*/function () {
513
536
  }
514
537
  case 3:
515
538
  case "end":
516
- return _context2.stop();
539
+ return _context3.stop();
517
540
  }
518
541
  }, _loop);
519
542
  });
520
543
  _i = 0, _arr = Object.keys(data.value.modules);
521
544
  case 8:
522
545
  if (!(_i < _arr.length)) {
523
- _context3.next = 13;
546
+ _context4.next = 13;
524
547
  break;
525
548
  }
526
- return _context3.delegateYield(_loop(), "t0", 10);
549
+ return _context4.delegateYield(_loop(), "t0", 10);
527
550
  case 10:
528
551
  _i++;
529
- _context3.next = 8;
552
+ _context4.next = 8;
530
553
  break;
531
554
  case 13:
532
555
  // For all updated subscribers: set new module data and emit change
@@ -542,20 +565,20 @@ var ValStore = /*#__PURE__*/function () {
542
565
  this.subscribers.set(updatedSubscriberId, subscriberModules);
543
566
  this.emitChange(updatedSubscriberId);
544
567
  }
545
- _context3.next = 17;
568
+ _context4.next = 17;
546
569
  break;
547
570
  case 16:
548
571
  console.error("Val: failed to update modules", data.error);
549
572
  case 17:
550
573
  case "end":
551
- return _context3.stop();
574
+ return _context4.stop();
552
575
  }
553
- }, _callee2, this);
576
+ }, _callee3, this);
554
577
  }));
555
- function updateAll() {
556
- return _updateAll.apply(this, arguments);
578
+ function updateTree(_x2) {
579
+ return _updateTree.apply(this, arguments);
557
580
  }
558
- return updateAll;
581
+ return updateTree;
559
582
  }()
560
583
  }, {
561
584
  key: "emitChange",
@@ -597,7 +620,7 @@ var ValContext = typeof window !== "undefined" ? /*#__PURE__*/React.createContex
597
620
  valApi: undefined
598
621
  }) : undefined;
599
622
  var ValUI = /*#__PURE__*/lazy(function () {
600
- return import('./ValUI-0091169b.esm.js');
623
+ return import('./ValUI-d0e6ed41.esm.js');
601
624
  });
602
625
  function ValProvider(_ref) {
603
626
  var children = _ref.children,
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./ValProvider-8d8e3678.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./ValProvider-8d8e3678.cjs.dev.js");
7
+ }
@@ -478,21 +478,23 @@ var ValStore = /*#__PURE__*/function () {
478
478
  this.subscribers = new Map();
479
479
  this.listeners = {};
480
480
  }
481
-
482
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
483
481
  _createClass(ValStore, [{
484
482
  key: "update",
485
483
  value: function () {
486
484
  var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(moduleIds) {
485
+ var _this2 = this;
487
486
  return _regeneratorRuntime().wrap(function _callee$(_context) {
488
487
  while (1) switch (_context.prev = _context.next) {
489
488
  case 0:
490
- return _context.abrupt("return", this.updateAll());
491
- case 1:
489
+ _context.next = 2;
490
+ return Promise.all(moduleIds.map(function (moduleId) {
491
+ return _this2.updateTree(moduleId);
492
+ }));
493
+ case 2:
492
494
  case "end":
493
495
  return _context.stop();
494
496
  }
495
- }, _callee, this);
497
+ }, _callee);
496
498
  }));
497
499
  function update(_x) {
498
500
  return _update.apply(this, arguments);
@@ -503,27 +505,48 @@ var ValStore = /*#__PURE__*/function () {
503
505
  key: "updateAll",
504
506
  value: function () {
505
507
  var _updateAll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
508
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
509
+ while (1) switch (_context2.prev = _context2.next) {
510
+ case 0:
511
+ _context2.next = 2;
512
+ return this.updateTree();
513
+ case 2:
514
+ case "end":
515
+ return _context2.stop();
516
+ }
517
+ }, _callee2, this);
518
+ }));
519
+ function updateAll() {
520
+ return _updateAll.apply(this, arguments);
521
+ }
522
+ return updateAll;
523
+ }()
524
+ }, {
525
+ key: "updateTree",
526
+ value: function () {
527
+ var _updateTree = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(treePath) {
506
528
  var data, updatedSubscriberIds, subscriberIds, _loop, _i, _arr, _i2, _Array$from, _Array$from$_i, updatedSubscriberId, moduleIds, subscriberModules;
507
- return _regeneratorRuntime().wrap(function _callee2$(_context3) {
508
- while (1) switch (_context3.prev = _context3.next) {
529
+ return _regeneratorRuntime().wrap(function _callee3$(_context4) {
530
+ while (1) switch (_context4.prev = _context4.next) {
509
531
  case 0:
510
- _context3.next = 2;
532
+ _context4.next = 2;
511
533
  return this.api.getTree({
534
+ treePath: treePath,
512
535
  patch: true,
513
536
  includeSource: true
514
537
  });
515
538
  case 2:
516
- data = _context3.sent;
539
+ data = _context4.sent;
517
540
  if (!fp.result.isOk(data)) {
518
- _context3.next = 16;
541
+ _context4.next = 16;
519
542
  break;
520
543
  }
521
544
  updatedSubscriberIds = new Map();
522
545
  subscriberIds = Array.from(this.subscribers.keys()); // Figure out which modules have been updated and map to updated subscribed id
523
546
  _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
524
547
  var moduleId, source, updatedSubscriberId;
525
- return _regeneratorRuntime().wrap(function _loop$(_context2) {
526
- while (1) switch (_context2.prev = _context2.next) {
548
+ return _regeneratorRuntime().wrap(function _loop$(_context3) {
549
+ while (1) switch (_context3.prev = _context3.next) {
527
550
  case 0:
528
551
  moduleId = _arr[_i];
529
552
  source = data.value.modules[moduleId].source;
@@ -539,20 +562,20 @@ var ValStore = /*#__PURE__*/function () {
539
562
  }
540
563
  case 3:
541
564
  case "end":
542
- return _context2.stop();
565
+ return _context3.stop();
543
566
  }
544
567
  }, _loop);
545
568
  });
546
569
  _i = 0, _arr = Object.keys(data.value.modules);
547
570
  case 8:
548
571
  if (!(_i < _arr.length)) {
549
- _context3.next = 13;
572
+ _context4.next = 13;
550
573
  break;
551
574
  }
552
- return _context3.delegateYield(_loop(), "t0", 10);
575
+ return _context4.delegateYield(_loop(), "t0", 10);
553
576
  case 10:
554
577
  _i++;
555
- _context3.next = 8;
578
+ _context4.next = 8;
556
579
  break;
557
580
  case 13:
558
581
  // For all updated subscribers: set new module data and emit change
@@ -568,20 +591,20 @@ var ValStore = /*#__PURE__*/function () {
568
591
  this.subscribers.set(updatedSubscriberId, subscriberModules);
569
592
  this.emitChange(updatedSubscriberId);
570
593
  }
571
- _context3.next = 17;
594
+ _context4.next = 17;
572
595
  break;
573
596
  case 16:
574
597
  console.error("Val: failed to update modules", data.error);
575
598
  case 17:
576
599
  case "end":
577
- return _context3.stop();
600
+ return _context4.stop();
578
601
  }
579
- }, _callee2, this);
602
+ }, _callee3, this);
580
603
  }));
581
- function updateAll() {
582
- return _updateAll.apply(this, arguments);
604
+ function updateTree(_x2) {
605
+ return _updateTree.apply(this, arguments);
583
606
  }
584
- return updateAll;
607
+ return updateTree;
585
608
  }()
586
609
  }, {
587
610
  key: "emitChange",
@@ -623,7 +646,7 @@ var ValContext = typeof window !== "undefined" ? /*#__PURE__*/React__default["de
623
646
  valApi: undefined
624
647
  }) : undefined;
625
648
  var ValUI = /*#__PURE__*/React.lazy(function () {
626
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('./ValUI-41cd1ce0.cjs.prod.js')); });
649
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('./ValUI-0f2e6b7d.cjs.prod.js')); });
627
650
  });
628
651
  function ValProvider(_ref) {
629
652
  var children = _ref.children,
@@ -452,21 +452,23 @@ var ValStore = /*#__PURE__*/function () {
452
452
  this.subscribers = new Map();
453
453
  this.listeners = {};
454
454
  }
455
-
456
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
457
455
  _createClass(ValStore, [{
458
456
  key: "update",
459
457
  value: function () {
460
458
  var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(moduleIds) {
459
+ var _this2 = this;
461
460
  return _regeneratorRuntime().wrap(function _callee$(_context) {
462
461
  while (1) switch (_context.prev = _context.next) {
463
462
  case 0:
464
- return _context.abrupt("return", this.updateAll());
465
- case 1:
463
+ _context.next = 2;
464
+ return Promise.all(moduleIds.map(function (moduleId) {
465
+ return _this2.updateTree(moduleId);
466
+ }));
467
+ case 2:
466
468
  case "end":
467
469
  return _context.stop();
468
470
  }
469
- }, _callee, this);
471
+ }, _callee);
470
472
  }));
471
473
  function update(_x) {
472
474
  return _update.apply(this, arguments);
@@ -477,27 +479,48 @@ var ValStore = /*#__PURE__*/function () {
477
479
  key: "updateAll",
478
480
  value: function () {
479
481
  var _updateAll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
482
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
483
+ while (1) switch (_context2.prev = _context2.next) {
484
+ case 0:
485
+ _context2.next = 2;
486
+ return this.updateTree();
487
+ case 2:
488
+ case "end":
489
+ return _context2.stop();
490
+ }
491
+ }, _callee2, this);
492
+ }));
493
+ function updateAll() {
494
+ return _updateAll.apply(this, arguments);
495
+ }
496
+ return updateAll;
497
+ }()
498
+ }, {
499
+ key: "updateTree",
500
+ value: function () {
501
+ var _updateTree = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(treePath) {
480
502
  var data, updatedSubscriberIds, subscriberIds, _loop, _i, _arr, _i2, _Array$from, _Array$from$_i, updatedSubscriberId, moduleIds, subscriberModules;
481
- return _regeneratorRuntime().wrap(function _callee2$(_context3) {
482
- while (1) switch (_context3.prev = _context3.next) {
503
+ return _regeneratorRuntime().wrap(function _callee3$(_context4) {
504
+ while (1) switch (_context4.prev = _context4.next) {
483
505
  case 0:
484
- _context3.next = 2;
506
+ _context4.next = 2;
485
507
  return this.api.getTree({
508
+ treePath: treePath,
486
509
  patch: true,
487
510
  includeSource: true
488
511
  });
489
512
  case 2:
490
- data = _context3.sent;
513
+ data = _context4.sent;
491
514
  if (!result.isOk(data)) {
492
- _context3.next = 16;
515
+ _context4.next = 16;
493
516
  break;
494
517
  }
495
518
  updatedSubscriberIds = new Map();
496
519
  subscriberIds = Array.from(this.subscribers.keys()); // Figure out which modules have been updated and map to updated subscribed id
497
520
  _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
498
521
  var moduleId, source, updatedSubscriberId;
499
- return _regeneratorRuntime().wrap(function _loop$(_context2) {
500
- while (1) switch (_context2.prev = _context2.next) {
522
+ return _regeneratorRuntime().wrap(function _loop$(_context3) {
523
+ while (1) switch (_context3.prev = _context3.next) {
501
524
  case 0:
502
525
  moduleId = _arr[_i];
503
526
  source = data.value.modules[moduleId].source;
@@ -513,20 +536,20 @@ var ValStore = /*#__PURE__*/function () {
513
536
  }
514
537
  case 3:
515
538
  case "end":
516
- return _context2.stop();
539
+ return _context3.stop();
517
540
  }
518
541
  }, _loop);
519
542
  });
520
543
  _i = 0, _arr = Object.keys(data.value.modules);
521
544
  case 8:
522
545
  if (!(_i < _arr.length)) {
523
- _context3.next = 13;
546
+ _context4.next = 13;
524
547
  break;
525
548
  }
526
- return _context3.delegateYield(_loop(), "t0", 10);
549
+ return _context4.delegateYield(_loop(), "t0", 10);
527
550
  case 10:
528
551
  _i++;
529
- _context3.next = 8;
552
+ _context4.next = 8;
530
553
  break;
531
554
  case 13:
532
555
  // For all updated subscribers: set new module data and emit change
@@ -542,20 +565,20 @@ var ValStore = /*#__PURE__*/function () {
542
565
  this.subscribers.set(updatedSubscriberId, subscriberModules);
543
566
  this.emitChange(updatedSubscriberId);
544
567
  }
545
- _context3.next = 17;
568
+ _context4.next = 17;
546
569
  break;
547
570
  case 16:
548
571
  console.error("Val: failed to update modules", data.error);
549
572
  case 17:
550
573
  case "end":
551
- return _context3.stop();
574
+ return _context4.stop();
552
575
  }
553
- }, _callee2, this);
576
+ }, _callee3, this);
554
577
  }));
555
- function updateAll() {
556
- return _updateAll.apply(this, arguments);
578
+ function updateTree(_x2) {
579
+ return _updateTree.apply(this, arguments);
557
580
  }
558
- return updateAll;
581
+ return updateTree;
559
582
  }()
560
583
  }, {
561
584
  key: "emitChange",
@@ -597,7 +620,7 @@ var ValContext = /*#__PURE__*/React.createContext({
597
620
  valApi: undefined
598
621
  }) ;
599
622
  var ValUI = /*#__PURE__*/lazy(function () {
600
- return import('./ValUI-053ef45d.browser.esm.js');
623
+ return import('./ValUI-4d8bf402.browser.esm.js');
601
624
  });
602
625
  function ValProvider(_ref) {
603
626
  var children = _ref.children,
@@ -452,21 +452,23 @@ var ValStore = /*#__PURE__*/function () {
452
452
  this.subscribers = new Map();
453
453
  this.listeners = {};
454
454
  }
455
-
456
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
457
455
  _createClass(ValStore, [{
458
456
  key: "update",
459
457
  value: function () {
460
458
  var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(moduleIds) {
459
+ var _this2 = this;
461
460
  return _regeneratorRuntime().wrap(function _callee$(_context) {
462
461
  while (1) switch (_context.prev = _context.next) {
463
462
  case 0:
464
- return _context.abrupt("return", this.updateAll());
465
- case 1:
463
+ _context.next = 2;
464
+ return Promise.all(moduleIds.map(function (moduleId) {
465
+ return _this2.updateTree(moduleId);
466
+ }));
467
+ case 2:
466
468
  case "end":
467
469
  return _context.stop();
468
470
  }
469
- }, _callee, this);
471
+ }, _callee);
470
472
  }));
471
473
  function update(_x) {
472
474
  return _update.apply(this, arguments);
@@ -477,27 +479,48 @@ var ValStore = /*#__PURE__*/function () {
477
479
  key: "updateAll",
478
480
  value: function () {
479
481
  var _updateAll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
482
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
483
+ while (1) switch (_context2.prev = _context2.next) {
484
+ case 0:
485
+ _context2.next = 2;
486
+ return this.updateTree();
487
+ case 2:
488
+ case "end":
489
+ return _context2.stop();
490
+ }
491
+ }, _callee2, this);
492
+ }));
493
+ function updateAll() {
494
+ return _updateAll.apply(this, arguments);
495
+ }
496
+ return updateAll;
497
+ }()
498
+ }, {
499
+ key: "updateTree",
500
+ value: function () {
501
+ var _updateTree = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(treePath) {
480
502
  var data, updatedSubscriberIds, subscriberIds, _loop, _i, _arr, _i2, _Array$from, _Array$from$_i, updatedSubscriberId, moduleIds, subscriberModules;
481
- return _regeneratorRuntime().wrap(function _callee2$(_context3) {
482
- while (1) switch (_context3.prev = _context3.next) {
503
+ return _regeneratorRuntime().wrap(function _callee3$(_context4) {
504
+ while (1) switch (_context4.prev = _context4.next) {
483
505
  case 0:
484
- _context3.next = 2;
506
+ _context4.next = 2;
485
507
  return this.api.getTree({
508
+ treePath: treePath,
486
509
  patch: true,
487
510
  includeSource: true
488
511
  });
489
512
  case 2:
490
- data = _context3.sent;
513
+ data = _context4.sent;
491
514
  if (!result.isOk(data)) {
492
- _context3.next = 16;
515
+ _context4.next = 16;
493
516
  break;
494
517
  }
495
518
  updatedSubscriberIds = new Map();
496
519
  subscriberIds = Array.from(this.subscribers.keys()); // Figure out which modules have been updated and map to updated subscribed id
497
520
  _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
498
521
  var moduleId, source, updatedSubscriberId;
499
- return _regeneratorRuntime().wrap(function _loop$(_context2) {
500
- while (1) switch (_context2.prev = _context2.next) {
522
+ return _regeneratorRuntime().wrap(function _loop$(_context3) {
523
+ while (1) switch (_context3.prev = _context3.next) {
501
524
  case 0:
502
525
  moduleId = _arr[_i];
503
526
  source = data.value.modules[moduleId].source;
@@ -513,20 +536,20 @@ var ValStore = /*#__PURE__*/function () {
513
536
  }
514
537
  case 3:
515
538
  case "end":
516
- return _context2.stop();
539
+ return _context3.stop();
517
540
  }
518
541
  }, _loop);
519
542
  });
520
543
  _i = 0, _arr = Object.keys(data.value.modules);
521
544
  case 8:
522
545
  if (!(_i < _arr.length)) {
523
- _context3.next = 13;
546
+ _context4.next = 13;
524
547
  break;
525
548
  }
526
- return _context3.delegateYield(_loop(), "t0", 10);
549
+ return _context4.delegateYield(_loop(), "t0", 10);
527
550
  case 10:
528
551
  _i++;
529
- _context3.next = 8;
552
+ _context4.next = 8;
530
553
  break;
531
554
  case 13:
532
555
  // For all updated subscribers: set new module data and emit change
@@ -542,20 +565,20 @@ var ValStore = /*#__PURE__*/function () {
542
565
  this.subscribers.set(updatedSubscriberId, subscriberModules);
543
566
  this.emitChange(updatedSubscriberId);
544
567
  }
545
- _context3.next = 17;
568
+ _context4.next = 17;
546
569
  break;
547
570
  case 16:
548
571
  console.error("Val: failed to update modules", data.error);
549
572
  case 17:
550
573
  case "end":
551
- return _context3.stop();
574
+ return _context4.stop();
552
575
  }
553
- }, _callee2, this);
576
+ }, _callee3, this);
554
577
  }));
555
- function updateAll() {
556
- return _updateAll.apply(this, arguments);
578
+ function updateTree(_x2) {
579
+ return _updateTree.apply(this, arguments);
557
580
  }
558
- return updateAll;
581
+ return updateTree;
559
582
  }()
560
583
  }, {
561
584
  key: "emitChange",
@@ -592,7 +615,7 @@ var useValApi = function useValApi() {
592
615
  };
593
616
  var ValContext = undefined;
594
617
  var ValUI = /*#__PURE__*/lazy(function () {
595
- return import('./ValUI-400cffb5.worker.esm.js');
618
+ return import('./ValUI-3fac1b71.worker.esm.js');
596
619
  });
597
620
  function ValProvider(_ref) {
598
621
  var children = _ref.children,
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./ValUI-0f2e6b7d.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./ValUI-0f2e6b7d.cjs.dev.js");
7
+ }
@@ -8,7 +8,7 @@ var slicedToArray = require('./slicedToArray-a2a426c7.cjs.prod.js');
8
8
  var React = require('react');
9
9
  var reactDom = require('react-dom');
10
10
  var ReactJSXRuntime = require('react/jsx-runtime');
11
- var ValProvider = require('./ValProvider-d9e0b778.cjs.prod.js');
11
+ var ValProvider = require('./ValProvider-8d8e3678.cjs.prod.js');
12
12
 
13
13
  function ShadowContent(_ref) {
14
14
  var root = _ref.root,
@@ -74,7 +74,7 @@ function ValUI(props) {
74
74
  href: "https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;1,100;1,300;1,400;1,500;1,700&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap",
75
75
  rel: "stylesheet"
76
76
  }), /*#__PURE__*/ReactJSXRuntime.jsx(ui.Style, {
77
- route: props === null || props === void 0 ? void 0 : props.host
77
+ route: props.host
78
78
  }), /*#__PURE__*/ReactJSXRuntime.jsx(ui.ValOverlay, {
79
79
  api: api,
80
80
  store: store,
@@ -4,7 +4,7 @@ import { _ as _slicedToArray } from './slicedToArray-d4c4a4ed.worker.esm.js';
4
4
  import { useRef, useState, useLayoutEffect } from 'react';
5
5
  import { createPortal } from 'react-dom';
6
6
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
7
- import { useValApi, useValStore } from './ValProvider-e745414d.worker.esm.js';
7
+ import { useValApi, useValStore } from './ValProvider-e21d3e7d.worker.esm.js';
8
8
 
9
9
  function ShadowContent(_ref) {
10
10
  var root = _ref.root,
@@ -70,7 +70,7 @@ function ValUI(props) {
70
70
  href: "https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;1,100;1,300;1,400;1,500;1,700&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap",
71
71
  rel: "stylesheet"
72
72
  }), /*#__PURE__*/jsx(Style, {
73
- route: props === null || props === void 0 ? void 0 : props.host
73
+ route: props.host
74
74
  }), /*#__PURE__*/jsx(ValOverlay, {
75
75
  api: api,
76
76
  store: store,
@@ -4,7 +4,7 @@ import { _ as _slicedToArray } from './slicedToArray-85f6bb43.browser.esm.js';
4
4
  import { useRef, useState, useLayoutEffect } from 'react';
5
5
  import { createPortal } from 'react-dom';
6
6
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
7
- import { useValApi, useValStore } from './ValProvider-9be9362b.browser.esm.js';
7
+ import { useValApi, useValStore } from './ValProvider-9a2431d9.browser.esm.js';
8
8
 
9
9
  function ShadowContent(_ref) {
10
10
  var root = _ref.root,
@@ -70,7 +70,7 @@ function ValUI(props) {
70
70
  href: "https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;1,100;1,300;1,400;1,500;1,700&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap",
71
71
  rel: "stylesheet"
72
72
  }), /*#__PURE__*/jsx(Style, {
73
- route: props === null || props === void 0 ? void 0 : props.host
73
+ route: props.host
74
74
  }), /*#__PURE__*/jsx(ValOverlay, {
75
75
  api: api,
76
76
  store: store,
@@ -4,7 +4,7 @@ import { _ as _slicedToArray } from './slicedToArray-331bebbb.esm.js';
4
4
  import { useRef, useState, useLayoutEffect } from 'react';
5
5
  import { createPortal } from 'react-dom';
6
6
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
7
- import { useValApi, useValStore } from './ValProvider-05e0ada2.esm.js';
7
+ import { useValApi, useValStore } from './ValProvider-52a0ce49.esm.js';
8
8
 
9
9
  function ShadowContent(_ref) {
10
10
  var root = _ref.root,
@@ -70,7 +70,7 @@ function ValUI(props) {
70
70
  href: "https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;1,100;1,300;1,400;1,500;1,700&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap",
71
71
  rel: "stylesheet"
72
72
  }), /*#__PURE__*/jsx(Style, {
73
- route: props === null || props === void 0 ? void 0 : props.host
73
+ route: props.host
74
74
  }), /*#__PURE__*/jsx(ValOverlay, {
75
75
  api: api,
76
76
  store: store,
@@ -8,7 +8,7 @@ var slicedToArray = require('./slicedToArray-a9d0d9cd.cjs.dev.js');
8
8
  var React = require('react');
9
9
  var reactDom = require('react-dom');
10
10
  var ReactJSXRuntime = require('react/jsx-runtime');
11
- var ValProvider = require('./ValProvider-396d7da7.cjs.dev.js');
11
+ var ValProvider = require('./ValProvider-387a3070.cjs.dev.js');
12
12
 
13
13
  function ShadowContent(_ref) {
14
14
  var root = _ref.root,
@@ -74,7 +74,7 @@ function ValUI(props) {
74
74
  href: "https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;1,100;1,300;1,400;1,500;1,700&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap",
75
75
  rel: "stylesheet"
76
76
  }), /*#__PURE__*/ReactJSXRuntime.jsx(ui.Style, {
77
- route: props === null || props === void 0 ? void 0 : props.host
77
+ route: props.host
78
78
  }), /*#__PURE__*/ReactJSXRuntime.jsx(ui.ValOverlay, {
79
79
  api: api,
80
80
  store: store,
@@ -7,6 +7,7 @@ export declare class ValStore implements IValStore {
7
7
  constructor(api: ValApi);
8
8
  update(moduleIds: ModuleId[]): Promise<void>;
9
9
  updateAll(): Promise<void>;
10
+ updateTree(treePath?: string): Promise<void>;
10
11
  subscribe: (moduleIds: ModuleId[]) => (listener: () => void) => () => void;
11
12
  private emitChange;
12
13
  getSnapshot: (moduleIds: ModuleId[]) => () => Record<ModuleId, Json> | undefined;
@@ -1,4 +1,4 @@
1
- export { ValProvider, useValApi, useValStore } from '../../dist/ValProvider-9be9362b.browser.esm.js';
1
+ export { ValProvider, useValApi, useValStore } from '../../dist/ValProvider-9a2431d9.browser.esm.js';
2
2
  import React from 'react';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ValProvider = require('../../dist/ValProvider-396d7da7.cjs.dev.js');
5
+ var ValProvider = require('../../dist/ValProvider-387a3070.cjs.dev.js');
6
6
  var React = require('react');
7
7
  var ReactJSXRuntime = require('react/jsx-runtime');
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ValProvider = require('../../dist/ValProvider-d9e0b778.cjs.prod.js');
5
+ var ValProvider = require('../../dist/ValProvider-8d8e3678.cjs.prod.js');
6
6
  var React = require('react');
7
7
  var ReactJSXRuntime = require('react/jsx-runtime');
8
8
 
@@ -1,4 +1,4 @@
1
- export { ValProvider, useValApi, useValStore } from '../../dist/ValProvider-05e0ada2.esm.js';
1
+ export { ValProvider, useValApi, useValStore } from '../../dist/ValProvider-52a0ce49.esm.js';
2
2
  import React from 'react';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
@@ -1,4 +1,4 @@
1
- export { ValProvider, useValApi, useValStore } from '../../dist/ValProvider-e745414d.worker.esm.js';
1
+ export { ValProvider, useValApi, useValStore } from '../../dist/ValProvider-e21d3e7d.worker.esm.js';
2
2
  import React from 'react';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/react",
3
- "version": "0.41.0",
3
+ "version": "0.42.0",
4
4
  "private": false,
5
5
  "description": "Val - React internal helpers",
6
6
  "sideEffects": false,
@@ -9,9 +9,9 @@
9
9
  "test": "jest"
10
10
  },
11
11
  "dependencies": {
12
- "@valbuild/core": "~0.41.0",
13
- "@valbuild/shared": "~0.41.0",
14
- "@valbuild/ui": "~0.41.0",
12
+ "@valbuild/core": "~0.42.0",
13
+ "@valbuild/shared": "~0.42.0",
14
+ "@valbuild/ui": "~0.42.0",
15
15
  "@vercel/stega": "^0.1.0",
16
16
  "base64-arraybuffer": "^1.0.2",
17
17
  "style-to-object": "^0.4.1"
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- if (process.env.NODE_ENV === "production") {
4
- module.exports = require("./ValProvider-d9e0b778.cjs.prod.js");
5
- } else {
6
- module.exports = require("./ValProvider-d9e0b778.cjs.dev.js");
7
- }
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- if (process.env.NODE_ENV === "production") {
4
- module.exports = require("./ValUI-41cd1ce0.cjs.prod.js");
5
- } else {
6
- module.exports = require("./ValUI-41cd1ce0.cjs.dev.js");
7
- }