@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.d.ts CHANGED
@@ -457,6 +457,8 @@ declare global {
457
457
  children?: unknown;
458
458
  key?: unknown;
459
459
  ref?: unknown;
460
+ copy?: unknown;
461
+ /** @deprecated */
460
462
  ["static"]?: unknown;
461
463
  /** @deprecated */
462
464
  ["crank-key"]?: unknown;
package/crank.js CHANGED
@@ -22,8 +22,7 @@ function arrayify(value) {
22
22
  : typeof value === "string" ||
23
23
  typeof value[Symbol.iterator] !== "function"
24
24
  ? [value]
25
- : // TODO: inference broke in TypeScript 3.9.
26
- [...value];
25
+ : [...value];
27
26
  }
28
27
  function isIteratorLike(value) {
29
28
  return value != null && typeof value.next === "function";
@@ -899,7 +898,7 @@ class Context {
899
898
  }
900
899
  }
901
900
  finally {
902
- ctx.f &= ~IsInForOfLoop;
901
+ ctx.f &= -5;
903
902
  }
904
903
  }
905
904
  async *[Symbol.asyncIterator]() {
@@ -934,7 +933,7 @@ class Context {
934
933
  }
935
934
  }
936
935
  finally {
937
- ctx.f &= ~IsInForAwaitOfLoop;
936
+ ctx.f &= -9;
938
937
  if (ctx.onPropsRequested) {
939
938
  ctx.onPropsRequested();
940
939
  ctx.onPropsRequested = undefined;
@@ -1281,7 +1280,7 @@ function updateComponentChildren(ctx, children, hydrationData) {
1281
1280
  childValues = diffChildren(ctx.renderer, ctx.root, ctx.host, ctx, ctx.scope, ctx.ret, narrow(children), hydrationData);
1282
1281
  }
1283
1282
  finally {
1284
- ctx.f &= ~IsSyncExecuting;
1283
+ ctx.f &= -3;
1285
1284
  }
1286
1285
  if (isPromiseLike(childValues)) {
1287
1286
  ctx.ret.inflightValue = childValues.then((childValues) => commitComponent(ctx, childValues));
@@ -1346,14 +1345,14 @@ function commitComponent(ctx, values) {
1346
1345
  for (const callback of callbacks) {
1347
1346
  callback(value1);
1348
1347
  }
1349
- ctx.f &= ~IsScheduling;
1348
+ ctx.f &= -1025;
1350
1349
  // Handles an edge case where refresh() is called during a schedule().
1351
1350
  if (ctx.f & IsSchedulingRefresh) {
1352
- ctx.f &= ~IsSchedulingRefresh;
1351
+ ctx.f &= -2049;
1353
1352
  value = getValue(ctx.ret);
1354
1353
  }
1355
1354
  }
1356
- ctx.f &= ~IsUpdating;
1355
+ ctx.f &= -2;
1357
1356
  return value;
1358
1357
  }
1359
1358
  function invalidate(ctx, host) {
@@ -1520,7 +1519,7 @@ function runComponent(ctx, hydrationData) {
1520
1519
  throw err;
1521
1520
  }
1522
1521
  finally {
1523
- ctx.f &= ~IsSyncExecuting;
1522
+ ctx.f &= -3;
1524
1523
  }
1525
1524
  if (isIteratorLike(result)) {
1526
1525
  ctx.iterator = result;
@@ -1557,7 +1556,7 @@ function runComponent(ctx, hydrationData) {
1557
1556
  throw err;
1558
1557
  }
1559
1558
  finally {
1560
- ctx.f &= ~IsSyncExecuting;
1559
+ ctx.f &= -3;
1561
1560
  }
1562
1561
  if (isPromiseLike(iteration)) {
1563
1562
  ctx.f |= IsAsyncGen;
@@ -1578,7 +1577,7 @@ function runComponent(ctx, hydrationData) {
1578
1577
  throw err;
1579
1578
  }
1580
1579
  finally {
1581
- ctx.f &= ~IsSyncExecuting;
1580
+ ctx.f &= -3;
1582
1581
  }
1583
1582
  }
1584
1583
  if (isPromiseLike(iteration)) {
@@ -1589,9 +1588,9 @@ function runComponent(ctx, hydrationData) {
1589
1588
  !(ctx.f & IsUnmounted)) {
1590
1589
  console.error("Component yielded more than once in for...of loop");
1591
1590
  }
1592
- ctx.f &= ~NeedsToYield;
1591
+ ctx.f &= -17;
1593
1592
  if (iteration.done) {
1594
- ctx.f &= ~IsSyncGen;
1593
+ ctx.f &= -257;
1595
1594
  ctx.iterator = undefined;
1596
1595
  }
1597
1596
  let value;
@@ -1624,7 +1623,7 @@ function runComponent(ctx, hydrationData) {
1624
1623
  throw err;
1625
1624
  }
1626
1625
  finally {
1627
- ctx.f &= ~IsSyncExecuting;
1626
+ ctx.f &= -3;
1628
1627
  }
1629
1628
  }
1630
1629
  if (!isPromiseLike(iteration)) {
@@ -1641,7 +1640,7 @@ function runComponent(ctx, hydrationData) {
1641
1640
  console.error("Component yielded more than once in for...of loop");
1642
1641
  }
1643
1642
  }
1644
- ctx.f &= ~NeedsToYield;
1643
+ ctx.f &= -17;
1645
1644
  try {
1646
1645
  value = updateComponentChildren(ctx,
1647
1646
  // Children can be void so we eliminate that here
@@ -1773,7 +1772,7 @@ async function runAsyncGenComponent(ctx, iterationP, hydrationData, initial = fa
1773
1772
  }
1774
1773
  finally {
1775
1774
  if (done) {
1776
- ctx.f &= ~IsAsyncGen;
1775
+ ctx.f &= -513;
1777
1776
  ctx.iterator = undefined;
1778
1777
  }
1779
1778
  }
@@ -1785,7 +1784,7 @@ function resumePropsAsyncIterator(ctx) {
1785
1784
  if (ctx.onProps) {
1786
1785
  ctx.onProps(ctx.ret.el.props);
1787
1786
  ctx.onProps = undefined;
1788
- ctx.f &= ~PropsAvailable;
1787
+ ctx.f &= -33;
1789
1788
  }
1790
1789
  else {
1791
1790
  ctx.f |= PropsAvailable;
@@ -1877,7 +1876,7 @@ function returnComponent(ctx) {
1877
1876
  }
1878
1877
  }
1879
1878
  finally {
1880
- ctx.f &= ~IsSyncExecuting;
1879
+ ctx.f &= -3;
1881
1880
  }
1882
1881
  }
1883
1882
  }
@@ -1964,12 +1963,12 @@ function handleChildError(ctx, err) {
1964
1963
  throw err;
1965
1964
  }
1966
1965
  finally {
1967
- ctx.f &= ~IsSyncExecuting;
1966
+ ctx.f &= -3;
1968
1967
  }
1969
1968
  if (isPromiseLike(iteration)) {
1970
1969
  return iteration.then((iteration) => {
1971
1970
  if (iteration.done) {
1972
- ctx.f &= ~IsAsyncGen;
1971
+ ctx.f &= -513;
1973
1972
  ctx.iterator = undefined;
1974
1973
  }
1975
1974
  return updateComponentChildren(ctx, iteration.value);
@@ -1979,8 +1978,8 @@ function handleChildError(ctx, err) {
1979
1978
  });
1980
1979
  }
1981
1980
  if (iteration.done) {
1982
- ctx.f &= ~IsSyncGen;
1983
- ctx.f &= ~IsAsyncGen;
1981
+ ctx.f &= -257;
1982
+ ctx.f &= -513;
1984
1983
  ctx.iterator = undefined;
1985
1984
  }
1986
1985
  return updateComponentChildren(ctx, iteration.value);