@b9g/crank 0.6.0 → 0.6.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/crank.cjs CHANGED
@@ -25,8 +25,7 @@ function arrayify(value) {
25
25
  : typeof value === "string" ||
26
26
  typeof value[Symbol.iterator] !== "function"
27
27
  ? [value]
28
- : // TODO: inference broke in TypeScript 3.9.
29
- [...value];
28
+ : [...value];
30
29
  }
31
30
  function isIteratorLike(value) {
32
31
  return value != null && typeof value.next === "function";
@@ -902,7 +901,7 @@ class Context {
902
901
  }
903
902
  }
904
903
  finally {
905
- ctx.f &= ~IsInForOfLoop;
904
+ ctx.f &= -5;
906
905
  }
907
906
  }
908
907
  async *[Symbol.asyncIterator]() {
@@ -937,7 +936,7 @@ class Context {
937
936
  }
938
937
  }
939
938
  finally {
940
- ctx.f &= ~IsInForAwaitOfLoop;
939
+ ctx.f &= -9;
941
940
  if (ctx.onPropsRequested) {
942
941
  ctx.onPropsRequested();
943
942
  ctx.onPropsRequested = undefined;
@@ -1284,7 +1283,7 @@ function updateComponentChildren(ctx, children, hydrationData) {
1284
1283
  childValues = diffChildren(ctx.renderer, ctx.root, ctx.host, ctx, ctx.scope, ctx.ret, narrow(children), hydrationData);
1285
1284
  }
1286
1285
  finally {
1287
- ctx.f &= ~IsSyncExecuting;
1286
+ ctx.f &= -3;
1288
1287
  }
1289
1288
  if (isPromiseLike(childValues)) {
1290
1289
  ctx.ret.inflightValue = childValues.then((childValues) => commitComponent(ctx, childValues));
@@ -1349,14 +1348,14 @@ function commitComponent(ctx, values) {
1349
1348
  for (const callback of callbacks) {
1350
1349
  callback(value1);
1351
1350
  }
1352
- ctx.f &= ~IsScheduling;
1351
+ ctx.f &= -1025;
1353
1352
  // Handles an edge case where refresh() is called during a schedule().
1354
1353
  if (ctx.f & IsSchedulingRefresh) {
1355
- ctx.f &= ~IsSchedulingRefresh;
1354
+ ctx.f &= -2049;
1356
1355
  value = getValue(ctx.ret);
1357
1356
  }
1358
1357
  }
1359
- ctx.f &= ~IsUpdating;
1358
+ ctx.f &= -2;
1360
1359
  return value;
1361
1360
  }
1362
1361
  function invalidate(ctx, host) {
@@ -1523,7 +1522,7 @@ function runComponent(ctx, hydrationData) {
1523
1522
  throw err;
1524
1523
  }
1525
1524
  finally {
1526
- ctx.f &= ~IsSyncExecuting;
1525
+ ctx.f &= -3;
1527
1526
  }
1528
1527
  if (isIteratorLike(result)) {
1529
1528
  ctx.iterator = result;
@@ -1560,7 +1559,7 @@ function runComponent(ctx, hydrationData) {
1560
1559
  throw err;
1561
1560
  }
1562
1561
  finally {
1563
- ctx.f &= ~IsSyncExecuting;
1562
+ ctx.f &= -3;
1564
1563
  }
1565
1564
  if (isPromiseLike(iteration)) {
1566
1565
  ctx.f |= IsAsyncGen;
@@ -1581,7 +1580,7 @@ function runComponent(ctx, hydrationData) {
1581
1580
  throw err;
1582
1581
  }
1583
1582
  finally {
1584
- ctx.f &= ~IsSyncExecuting;
1583
+ ctx.f &= -3;
1585
1584
  }
1586
1585
  }
1587
1586
  if (isPromiseLike(iteration)) {
@@ -1592,9 +1591,9 @@ function runComponent(ctx, hydrationData) {
1592
1591
  !(ctx.f & IsUnmounted)) {
1593
1592
  console.error("Component yielded more than once in for...of loop");
1594
1593
  }
1595
- ctx.f &= ~NeedsToYield;
1594
+ ctx.f &= -17;
1596
1595
  if (iteration.done) {
1597
- ctx.f &= ~IsSyncGen;
1596
+ ctx.f &= -257;
1598
1597
  ctx.iterator = undefined;
1599
1598
  }
1600
1599
  let value;
@@ -1627,7 +1626,7 @@ function runComponent(ctx, hydrationData) {
1627
1626
  throw err;
1628
1627
  }
1629
1628
  finally {
1630
- ctx.f &= ~IsSyncExecuting;
1629
+ ctx.f &= -3;
1631
1630
  }
1632
1631
  }
1633
1632
  if (!isPromiseLike(iteration)) {
@@ -1644,7 +1643,7 @@ function runComponent(ctx, hydrationData) {
1644
1643
  console.error("Component yielded more than once in for...of loop");
1645
1644
  }
1646
1645
  }
1647
- ctx.f &= ~NeedsToYield;
1646
+ ctx.f &= -17;
1648
1647
  try {
1649
1648
  value = updateComponentChildren(ctx,
1650
1649
  // Children can be void so we eliminate that here
@@ -1776,7 +1775,7 @@ async function runAsyncGenComponent(ctx, iterationP, hydrationData, initial = fa
1776
1775
  }
1777
1776
  finally {
1778
1777
  if (done) {
1779
- ctx.f &= ~IsAsyncGen;
1778
+ ctx.f &= -513;
1780
1779
  ctx.iterator = undefined;
1781
1780
  }
1782
1781
  }
@@ -1788,7 +1787,7 @@ function resumePropsAsyncIterator(ctx) {
1788
1787
  if (ctx.onProps) {
1789
1788
  ctx.onProps(ctx.ret.el.props);
1790
1789
  ctx.onProps = undefined;
1791
- ctx.f &= ~PropsAvailable;
1790
+ ctx.f &= -33;
1792
1791
  }
1793
1792
  else {
1794
1793
  ctx.f |= PropsAvailable;
@@ -1880,7 +1879,7 @@ function returnComponent(ctx) {
1880
1879
  }
1881
1880
  }
1882
1881
  finally {
1883
- ctx.f &= ~IsSyncExecuting;
1882
+ ctx.f &= -3;
1884
1883
  }
1885
1884
  }
1886
1885
  }
@@ -1967,12 +1966,12 @@ function handleChildError(ctx, err) {
1967
1966
  throw err;
1968
1967
  }
1969
1968
  finally {
1970
- ctx.f &= ~IsSyncExecuting;
1969
+ ctx.f &= -3;
1971
1970
  }
1972
1971
  if (isPromiseLike(iteration)) {
1973
1972
  return iteration.then((iteration) => {
1974
1973
  if (iteration.done) {
1975
- ctx.f &= ~IsAsyncGen;
1974
+ ctx.f &= -513;
1976
1975
  ctx.iterator = undefined;
1977
1976
  }
1978
1977
  return updateComponentChildren(ctx, iteration.value);
@@ -1982,8 +1981,8 @@ function handleChildError(ctx, err) {
1982
1981
  });
1983
1982
  }
1984
1983
  if (iteration.done) {
1985
- ctx.f &= ~IsSyncGen;
1986
- ctx.f &= ~IsAsyncGen;
1984
+ ctx.f &= -257;
1985
+ ctx.f &= -513;
1987
1986
  ctx.iterator = undefined;
1988
1987
  }
1989
1988
  return updateComponentChildren(ctx, iteration.value);