@next-core/brick-kit 2.202.0 → 2.203.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.
package/dist/index.esm.js CHANGED
@@ -1448,11 +1448,22 @@ function StoryboardFunctionRegistryFactory() {
1448
1448
  for (var fn of functions) {
1449
1449
  registeredFunctions.set(fn.name, {
1450
1450
  source: fn.source,
1451
- typescript: fn.typescript
1451
+ typescript: fn.typescript,
1452
+ transformed: fn.transformed
1452
1453
  });
1453
1454
  }
1454
1455
  }
1455
1456
  }
1457
+ function getGlobalVariables(globals) {
1458
+ return supply(globals, getGeneralGlobals(globals, {
1459
+ collectCoverage,
1460
+ widgetId,
1461
+ widgetVersion,
1462
+ app: currentApp,
1463
+ storyboardFunctions,
1464
+ isStoryboardFunction: true
1465
+ }), !!collectCoverage);
1466
+ }
1456
1467
  function getStoryboardFunction(name) {
1457
1468
  var fn = registeredFunctions.get(name);
1458
1469
  if (!fn) {
@@ -1465,35 +1476,39 @@ function StoryboardFunctionRegistryFactory() {
1465
1476
  if (collectCoverage) {
1466
1477
  collector = collectCoverage.createCollector(name);
1467
1478
  }
1468
- var precooked = precookFunction(fn.source, {
1469
- cacheKey: fn,
1470
- typescript: fn.typescript,
1471
- hooks: collector && {
1472
- beforeVisit: collector.beforeVisit
1473
- }
1474
- });
1475
- fn.cooked = cook(precooked.function, fn.source, {
1476
- rules: {
1477
- noVar: true
1478
- },
1479
- globalVariables: supply(precooked.attemptToVisitGlobals, getGeneralGlobals(precooked.attemptToVisitGlobals, {
1480
- collectCoverage,
1481
- widgetId,
1482
- widgetVersion,
1483
- app: currentApp,
1484
- storyboardFunctions,
1485
- isStoryboardFunction: true
1486
- }), !!collectCoverage),
1487
- hooks: _objectSpread({
1488
- perfCall: needPerf ? duration => {
1489
- perf(name, fn.source, duration);
1490
- } : undefined
1491
- }, collector ? {
1492
- beforeEvaluate: collector.beforeEvaluate,
1493
- beforeCall: collector.beforeCall,
1494
- beforeBranch: collector.beforeBranch
1495
- } : null)
1496
- });
1479
+
1480
+ // Do not use transformed functions when collecting coverage.
1481
+ var transformed = !collector && fn.transformed;
1482
+ if (transformed) {
1483
+ var globalVariables = getGlobalVariables(transformed.globals);
1484
+ // Spread globals as params to prevent accessing forbidden globals.
1485
+ // NOTE: in native mode, forbidden globals are declared as `undefined`,
1486
+ // thus accessing them will not throw a ReferenceError.
1487
+ fn.cooked = new Function(...transformed.globals, "\"use strict\";return (".concat(transformed.source, ")"))(...transformed.globals.map(key => hasOwnProperty(globalVariables, key) ? globalVariables[key] : undefined));
1488
+ } else {
1489
+ var precooked = precookFunction(fn.source, {
1490
+ cacheKey: fn,
1491
+ typescript: fn.typescript,
1492
+ hooks: collector && {
1493
+ beforeVisit: collector.beforeVisit
1494
+ }
1495
+ });
1496
+ fn.cooked = cook(precooked.function, fn.source, {
1497
+ rules: {
1498
+ noVar: true
1499
+ },
1500
+ globalVariables: getGlobalVariables(precooked.attemptToVisitGlobals),
1501
+ hooks: _objectSpread({
1502
+ perfCall: needPerf ? duration => {
1503
+ perf(name, fn.source, duration);
1504
+ } : undefined
1505
+ }, collector ? {
1506
+ beforeEvaluate: collector.beforeEvaluate,
1507
+ beforeCall: collector.beforeCall,
1508
+ beforeBranch: collector.beforeBranch
1509
+ } : null)
1510
+ });
1511
+ }
1497
1512
  fn.processed = true;
1498
1513
  return fn.cooked;
1499
1514
  }
@@ -1503,7 +1518,8 @@ function StoryboardFunctionRegistryFactory() {
1503
1518
  updateStoryboardFunction(name, data) {
1504
1519
  registeredFunctions.set(name, {
1505
1520
  source: data.source,
1506
- typescript: data.typescript
1521
+ typescript: data.typescript,
1522
+ transformed: data.transformed
1507
1523
  });
1508
1524
  }
1509
1525
  };
@@ -11795,6 +11811,12 @@ class FormElement extends HTMLElement {
11795
11811
  }
11796
11812
  _classPrivateMethodGet(this, _proxyFormMethod, _proxyFormMethod2).call(this, "resetFields", args);
11797
11813
  }
11814
+ getFieldsValue() {
11815
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
11816
+ args[_key3] = arguments[_key3];
11817
+ }
11818
+ return _classPrivateMethodGet(this, _proxyFormMethod, _proxyFormMethod2).call(this, "getFieldsValue", args);
11819
+ }
11798
11820
  }
11799
11821
  function _proxyFormMethod2(method) {
11800
11822
  var _this$firstElementChi, _containerElement$tag;
@@ -11802,7 +11824,7 @@ function _proxyFormMethod2(method) {
11802
11824
  var containerElement = this.renderRoot !== false ? (_this$firstElementChi = this.firstElementChild) === null || _this$firstElementChi === void 0 ? void 0 : _this$firstElementChi.firstElementChild : this.firstElementChild;
11803
11825
  var tagName = containerElement === null || containerElement === void 0 ? void 0 : (_containerElement$tag = containerElement.tagName) === null || _containerElement$tag === void 0 ? void 0 : _containerElement$tag.toLowerCase();
11804
11826
  if (formContainers.includes(tagName)) {
11805
- containerElement[method](...args);
11827
+ return containerElement[method](...args);
11806
11828
  } else {
11807
11829
  // eslint-disable-next-line no-console
11808
11830
  console.error("no ".concat(method, " method in the container element"), {