@graphrefly/graphrefly 0.20.0 → 0.21.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.
Files changed (42) hide show
  1. package/README.md +20 -3
  2. package/dist/{chunk-3N2Y6PCR.js → chunk-2UDLYZHT.js} +3 -3
  3. package/dist/{chunk-XYL3GLB3.js → chunk-4MQ2J6IG.js} +2 -2
  4. package/dist/{chunk-XYL3GLB3.js.map → chunk-4MQ2J6IG.js.map} +1 -1
  5. package/dist/{chunk-2L5J6RPM.js → chunk-7IGHIFTT.js} +2 -2
  6. package/dist/{chunk-PGEU5MEH.js → chunk-DOSLSFKL.js} +3 -3
  7. package/dist/{chunk-BJAOEU4D.js → chunk-ECN37NVS.js} +154 -196
  8. package/dist/chunk-ECN37NVS.js.map +1 -0
  9. package/dist/{chunk-R2LPZIY2.js → chunk-G66H6ZRK.js} +3 -3
  10. package/dist/{chunk-OOA2UTXF.js → chunk-VOQFK7YN.js} +2 -2
  11. package/dist/{chunk-5PSVTDNZ.js → chunk-XWBVAO2R.js} +4 -4
  12. package/dist/{chunk-IAPLC4NR.js → chunk-ZTCDY5NQ.js} +3 -3
  13. package/dist/compat/nestjs/index.cjs +1 -1
  14. package/dist/compat/nestjs/index.cjs.map +1 -1
  15. package/dist/compat/nestjs/index.js +7 -7
  16. package/dist/core/index.cjs +1 -1
  17. package/dist/core/index.cjs.map +1 -1
  18. package/dist/core/index.js +3 -3
  19. package/dist/extra/index.cjs +152 -194
  20. package/dist/extra/index.cjs.map +1 -1
  21. package/dist/extra/index.js +3 -3
  22. package/dist/graph/index.cjs +1 -1
  23. package/dist/graph/index.cjs.map +1 -1
  24. package/dist/graph/index.js +4 -4
  25. package/dist/index.cjs +312 -196
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +201 -5
  28. package/dist/index.d.ts +201 -5
  29. package/dist/index.js +173 -15
  30. package/dist/index.js.map +1 -1
  31. package/dist/patterns/reactive-layout/index.cjs +1 -1
  32. package/dist/patterns/reactive-layout/index.cjs.map +1 -1
  33. package/dist/patterns/reactive-layout/index.js +4 -4
  34. package/package.json +2 -1
  35. package/dist/chunk-BJAOEU4D.js.map +0 -1
  36. /package/dist/{chunk-3N2Y6PCR.js.map → chunk-2UDLYZHT.js.map} +0 -0
  37. /package/dist/{chunk-2L5J6RPM.js.map → chunk-7IGHIFTT.js.map} +0 -0
  38. /package/dist/{chunk-PGEU5MEH.js.map → chunk-DOSLSFKL.js.map} +0 -0
  39. /package/dist/{chunk-R2LPZIY2.js.map → chunk-G66H6ZRK.js.map} +0 -0
  40. /package/dist/{chunk-OOA2UTXF.js.map → chunk-VOQFK7YN.js.map} +0 -0
  41. /package/dist/{chunk-5PSVTDNZ.js.map → chunk-XWBVAO2R.js.map} +0 -0
  42. /package/dist/{chunk-IAPLC4NR.js.map → chunk-ZTCDY5NQ.js.map} +0 -0
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  DEFAULT_DOWN,
3
3
  bridge
4
- } from "../chunk-PGEU5MEH.js";
4
+ } from "../chunk-DOSLSFKL.js";
5
5
  import {
6
6
  ResettableTimer
7
7
  } from "../chunk-WZ2Z2CRV.js";
8
8
  import {
9
9
  resolveDescribeFields
10
- } from "../chunk-2L5J6RPM.js";
10
+ } from "../chunk-7IGHIFTT.js";
11
11
  import {
12
12
  CLEANUP_RESULT,
13
13
  COMPLETE,
@@ -52,7 +52,7 @@ import {
52
52
  propagatesToMeta,
53
53
  state,
54
54
  wallClockNs
55
- } from "../chunk-XYL3GLB3.js";
55
+ } from "../chunk-4MQ2J6IG.js";
56
56
  export {
57
57
  CLEANUP_RESULT,
58
58
  COMPLETE,
@@ -1121,7 +1121,7 @@ var NodeImpl = class extends NodeBase {
1121
1121
  try {
1122
1122
  const consumed = this._onMessage(msg, index, this._actions);
1123
1123
  if (consumed) {
1124
- if (t === START) {
1124
+ if (t === START || t === DATA || t === RESOLVED) {
1125
1125
  this._depDirtyMask.clear(index);
1126
1126
  if (this._depDirtyMask.any() && this._depSettledMask.covers(this._depDirtyMask)) {
1127
1127
  this._depDirtyMask.reset();
@@ -5664,9 +5664,11 @@ function scan(source, reducer, seed, opts) {
5664
5664
  function reduce(source, reducer, seed, opts) {
5665
5665
  let acc = seed;
5666
5666
  let sawData = false;
5667
+ let depHasData = false;
5667
5668
  return node(
5668
5669
  [source],
5669
5670
  ([v]) => {
5671
+ if (!depHasData) return void 0;
5670
5672
  sawData = true;
5671
5673
  acc = reducer(acc, v);
5672
5674
  return void 0;
@@ -5677,8 +5679,10 @@ function reduce(source, reducer, seed, opts) {
5677
5679
  onResubscribe: opts?.resubscribable === true ? () => {
5678
5680
  acc = seed;
5679
5681
  sawData = false;
5682
+ depHasData = false;
5680
5683
  } : void 0,
5681
5684
  onMessage(msg, _i, a) {
5685
+ if (msg[0] === DATA) depHasData = true;
5682
5686
  if (msg[0] === COMPLETE) {
5683
5687
  if (!sawData) acc = seed;
5684
5688
  a.emit(acc);
@@ -5797,9 +5801,11 @@ function skip(source, count, opts) {
5797
5801
  }
5798
5802
  function takeWhile(source, predicate, opts) {
5799
5803
  let done = false;
5804
+ let depHasData = false;
5800
5805
  return node(
5801
5806
  [source],
5802
5807
  ([v], a) => {
5808
+ if (!depHasData) return void 0;
5803
5809
  if (done) return void 0;
5804
5810
  if (!predicate(v)) {
5805
5811
  done = true;
@@ -5812,6 +5818,7 @@ function takeWhile(source, predicate, opts) {
5812
5818
  ...operatorOpts3(opts),
5813
5819
  completeWhenDepsComplete: false,
5814
5820
  onMessage(msg, _i, a) {
5821
+ if (msg[0] === DATA) depHasData = true;
5815
5822
  if (done) {
5816
5823
  if (msg[0] === COMPLETE) {
5817
5824
  a.down([[COMPLETE]]);
@@ -5864,9 +5871,11 @@ function last(source, options) {
5864
5871
  const useDefault = options != null && Object.hasOwn(options, "defaultValue");
5865
5872
  let lastVal;
5866
5873
  let has = false;
5874
+ let depHasData = false;
5867
5875
  return node(
5868
5876
  [source],
5869
5877
  ([v]) => {
5878
+ if (!depHasData) return void 0;
5870
5879
  lastVal = v;
5871
5880
  has = true;
5872
5881
  return void 0;
@@ -5875,6 +5884,7 @@ function last(source, options) {
5875
5884
  ...operatorOpts3(rest),
5876
5885
  completeWhenDepsComplete: false,
5877
5886
  onMessage(msg, _i, a) {
5887
+ if (msg[0] === DATA) depHasData = true;
5878
5888
  if (msg[0] === COMPLETE) {
5879
5889
  if (has) {
5880
5890
  a.emit(lastVal);
@@ -6261,120 +6271,101 @@ function forwardInner(inner, a, onInnerComplete) {
6261
6271
  function switchMap(source, project, opts) {
6262
6272
  let innerUnsub;
6263
6273
  let sourceDone = false;
6264
- let attached = false;
6265
6274
  function clearInner() {
6266
6275
  innerUnsub?.();
6267
6276
  innerUnsub = void 0;
6268
6277
  }
6269
6278
  function attach(v, a) {
6270
- attached = true;
6271
6279
  clearInner();
6272
6280
  innerUnsub = forwardInner(fromAny(project(v)), a, () => {
6273
6281
  clearInner();
6274
6282
  if (sourceDone) a.down([[COMPLETE]]);
6275
6283
  });
6276
6284
  }
6277
- return node(
6278
- [source],
6279
- ([v], a) => {
6280
- if (!attached) attach(v, a);
6281
- return clearInner;
6282
- },
6283
- {
6284
- ...operatorOpts3(opts),
6285
- completeWhenDepsComplete: false,
6286
- onMessage(msg, _i, a) {
6287
- const t = msg[0];
6288
- if (t === ERROR) {
6289
- clearInner();
6290
- a.down([msg]);
6291
- return true;
6292
- }
6293
- if (t === COMPLETE) {
6294
- sourceDone = true;
6295
- if (innerUnsub === void 0) a.down([[COMPLETE]]);
6296
- return true;
6297
- }
6298
- if (t === DIRTY) {
6299
- a.down([[DIRTY]]);
6300
- return true;
6301
- }
6302
- if (t === RESOLVED) {
6303
- a.down([[RESOLVED]]);
6304
- return true;
6305
- }
6306
- if (t === DATA) {
6307
- attach(msg[1], a);
6308
- return true;
6309
- }
6310
- return false;
6285
+ return node([source], () => clearInner, {
6286
+ ...operatorOpts3(opts),
6287
+ completeWhenDepsComplete: false,
6288
+ onMessage(msg, _i, a) {
6289
+ const t = msg[0];
6290
+ if (t === ERROR) {
6291
+ clearInner();
6292
+ a.down([msg]);
6293
+ return true;
6311
6294
  }
6295
+ if (t === COMPLETE) {
6296
+ sourceDone = true;
6297
+ if (innerUnsub === void 0) a.down([[COMPLETE]]);
6298
+ return true;
6299
+ }
6300
+ if (t === DIRTY) {
6301
+ a.down([[DIRTY]]);
6302
+ return true;
6303
+ }
6304
+ if (t === RESOLVED) {
6305
+ a.down([[RESOLVED]]);
6306
+ return true;
6307
+ }
6308
+ if (t === DATA) {
6309
+ attach(msg[1], a);
6310
+ return true;
6311
+ }
6312
+ return false;
6312
6313
  }
6313
- );
6314
+ });
6314
6315
  }
6315
6316
  function exhaustMap(source, project, opts) {
6316
6317
  let innerUnsub;
6317
6318
  let sourceDone = false;
6318
- let attached = false;
6319
6319
  function clearInner() {
6320
6320
  innerUnsub?.();
6321
6321
  innerUnsub = void 0;
6322
6322
  }
6323
6323
  function attach(v, a) {
6324
- attached = true;
6325
6324
  innerUnsub = forwardInner(fromAny(project(v)), a, () => {
6326
6325
  clearInner();
6327
6326
  if (sourceDone) a.down([[COMPLETE]]);
6328
6327
  });
6329
6328
  }
6330
- return node(
6331
- [source],
6332
- ([v], a) => {
6333
- if (!attached && innerUnsub === void 0) attach(v, a);
6334
- return clearInner;
6335
- },
6336
- {
6337
- ...operatorOpts3(opts),
6338
- completeWhenDepsComplete: false,
6339
- onMessage(msg, _i, a) {
6340
- const t = msg[0];
6341
- if (t === ERROR) {
6342
- clearInner();
6343
- a.down([msg]);
6344
- return true;
6345
- }
6346
- if (t === COMPLETE) {
6347
- sourceDone = true;
6348
- if (innerUnsub === void 0) a.down([[COMPLETE]]);
6349
- return true;
6350
- }
6351
- if (t === DIRTY) {
6352
- a.down([[DIRTY]]);
6353
- return true;
6354
- }
6355
- if (t === RESOLVED) {
6329
+ return node([source], () => clearInner, {
6330
+ ...operatorOpts3(opts),
6331
+ completeWhenDepsComplete: false,
6332
+ onMessage(msg, _i, a) {
6333
+ const t = msg[0];
6334
+ if (t === ERROR) {
6335
+ clearInner();
6336
+ a.down([msg]);
6337
+ return true;
6338
+ }
6339
+ if (t === COMPLETE) {
6340
+ sourceDone = true;
6341
+ if (innerUnsub === void 0) a.down([[COMPLETE]]);
6342
+ return true;
6343
+ }
6344
+ if (t === DIRTY) {
6345
+ a.down([[DIRTY]]);
6346
+ return true;
6347
+ }
6348
+ if (t === RESOLVED) {
6349
+ a.down([[RESOLVED]]);
6350
+ return true;
6351
+ }
6352
+ if (t === DATA) {
6353
+ if (innerUnsub !== void 0) {
6356
6354
  a.down([[RESOLVED]]);
6357
6355
  return true;
6358
6356
  }
6359
- if (t === DATA) {
6360
- if (innerUnsub !== void 0) {
6361
- a.down([[RESOLVED]]);
6362
- return true;
6363
- }
6364
- attach(msg[1], a);
6365
- return true;
6366
- }
6367
- return false;
6357
+ attach(msg[1], a);
6358
+ return true;
6368
6359
  }
6360
+ return false;
6369
6361
  }
6370
- );
6362
+ });
6371
6363
  }
6372
6364
  function concatMap(source, project, opts) {
6373
6365
  const { maxBuffer: maxBuf, ...concatNodeOpts } = opts ?? {};
6374
6366
  const queue = [];
6375
6367
  let innerUnsub;
6376
6368
  let sourceDone = false;
6377
- let attached = false;
6378
6369
  function clearInner() {
6379
6370
  innerUnsub?.();
6380
6371
  innerUnsub = void 0;
@@ -6392,49 +6383,41 @@ function concatMap(source, project, opts) {
6392
6383
  });
6393
6384
  }
6394
6385
  function enqueue(v, a) {
6395
- attached = true;
6396
6386
  if (maxBuf && maxBuf > 0 && queue.length >= maxBuf) queue.shift();
6397
6387
  queue.push(v);
6398
6388
  tryPump(a);
6399
6389
  }
6400
- return node(
6401
- [source],
6402
- ([v], a) => {
6403
- if (!attached) enqueue(v, a);
6404
- return clearInner;
6405
- },
6406
- {
6407
- ...operatorOpts3(concatNodeOpts),
6408
- completeWhenDepsComplete: false,
6409
- onMessage(msg, _i, a) {
6410
- const t = msg[0];
6411
- if (t === ERROR) {
6412
- clearInner();
6413
- queue.length = 0;
6414
- a.down([msg]);
6415
- return true;
6416
- }
6417
- if (t === COMPLETE) {
6418
- sourceDone = true;
6419
- tryPump(a);
6420
- return true;
6421
- }
6422
- if (t === DIRTY) {
6423
- a.down([[DIRTY]]);
6424
- return true;
6425
- }
6426
- if (t === RESOLVED) {
6427
- a.down([[RESOLVED]]);
6428
- return true;
6429
- }
6430
- if (t === DATA) {
6431
- enqueue(msg[1], a);
6432
- return true;
6433
- }
6434
- return false;
6390
+ return node([source], () => clearInner, {
6391
+ ...operatorOpts3(concatNodeOpts),
6392
+ completeWhenDepsComplete: false,
6393
+ onMessage(msg, _i, a) {
6394
+ const t = msg[0];
6395
+ if (t === ERROR) {
6396
+ clearInner();
6397
+ queue.length = 0;
6398
+ a.down([msg]);
6399
+ return true;
6400
+ }
6401
+ if (t === COMPLETE) {
6402
+ sourceDone = true;
6403
+ tryPump(a);
6404
+ return true;
6405
+ }
6406
+ if (t === DIRTY) {
6407
+ a.down([[DIRTY]]);
6408
+ return true;
6435
6409
  }
6410
+ if (t === RESOLVED) {
6411
+ a.down([[RESOLVED]]);
6412
+ return true;
6413
+ }
6414
+ if (t === DATA) {
6415
+ enqueue(msg[1], a);
6416
+ return true;
6417
+ }
6418
+ return false;
6436
6419
  }
6437
- );
6420
+ });
6438
6421
  }
6439
6422
  function mergeMap(source, project, opts) {
6440
6423
  const { concurrent: concurrentOpt, ...mergeNodeOpts } = opts ?? {};
@@ -6490,47 +6473,36 @@ function mergeMap(source, project, opts) {
6490
6473
  active = 0;
6491
6474
  buffer2.length = 0;
6492
6475
  }
6493
- let attached = false;
6494
- return node(
6495
- [source],
6496
- ([v], a) => {
6497
- if (!attached) {
6498
- attached = true;
6499
- enqueue(v, a);
6476
+ return node([source], () => clearAll, {
6477
+ ...operatorOpts3(mergeNodeOpts),
6478
+ completeWhenDepsComplete: false,
6479
+ onMessage(msg, _i, a) {
6480
+ const t = msg[0];
6481
+ if (t === ERROR) {
6482
+ clearAll();
6483
+ a.down([msg]);
6484
+ return true;
6500
6485
  }
6501
- return clearAll;
6502
- },
6503
- {
6504
- ...operatorOpts3(mergeNodeOpts),
6505
- completeWhenDepsComplete: false,
6506
- onMessage(msg, _i, a) {
6507
- const t = msg[0];
6508
- if (t === ERROR) {
6509
- clearAll();
6510
- a.down([msg]);
6511
- return true;
6512
- }
6513
- if (t === COMPLETE) {
6514
- sourceDone = true;
6515
- tryComplete(a);
6516
- return true;
6517
- }
6518
- if (t === DIRTY) {
6519
- a.down([[DIRTY]]);
6520
- return true;
6521
- }
6522
- if (t === RESOLVED) {
6523
- a.down([[RESOLVED]]);
6524
- return true;
6525
- }
6526
- if (t === DATA) {
6527
- enqueue(msg[1], a);
6528
- return true;
6529
- }
6530
- return false;
6486
+ if (t === COMPLETE) {
6487
+ sourceDone = true;
6488
+ tryComplete(a);
6489
+ return true;
6490
+ }
6491
+ if (t === DIRTY) {
6492
+ a.down([[DIRTY]]);
6493
+ return true;
6494
+ }
6495
+ if (t === RESOLVED) {
6496
+ a.down([[RESOLVED]]);
6497
+ return true;
6498
+ }
6499
+ if (t === DATA) {
6500
+ enqueue(msg[1], a);
6501
+ return true;
6531
6502
  }
6503
+ return false;
6532
6504
  }
6533
- );
6505
+ });
6534
6506
  }
6535
6507
  var flatMap = mergeMap;
6536
6508
  function delay(source, ms, opts) {
@@ -6849,53 +6821,39 @@ function buffer(source, notifier, opts) {
6849
6821
  function bufferCount(source, count, opts) {
6850
6822
  if (count <= 0) throw new RangeError("bufferCount expects count > 0");
6851
6823
  const buf = [];
6852
- let started = false;
6853
- return node(
6854
- [source],
6855
- ([v], a) => {
6856
- if (!started) {
6857
- started = true;
6858
- buf.push(v);
6824
+ return node([source], () => void 0, {
6825
+ ...operatorOpts3(opts),
6826
+ completeWhenDepsComplete: false,
6827
+ onMessage(msg, _i, a) {
6828
+ const t = msg[0];
6829
+ if (t === ERROR) {
6830
+ a.down([msg]);
6831
+ return true;
6832
+ }
6833
+ if (t === COMPLETE) {
6834
+ if (buf.length > 0) a.emit([...buf]);
6835
+ buf.length = 0;
6836
+ a.down([[COMPLETE]]);
6837
+ return true;
6838
+ }
6839
+ if (t === DIRTY) {
6840
+ a.down([[DIRTY]]);
6841
+ return true;
6842
+ }
6843
+ if (t === RESOLVED) {
6844
+ a.down([[RESOLVED]]);
6845
+ return true;
6846
+ }
6847
+ if (t === DATA) {
6848
+ buf.push(msg[1]);
6859
6849
  if (buf.length >= count) {
6860
6850
  a.emit(buf.splice(0, buf.length));
6861
6851
  }
6852
+ return true;
6862
6853
  }
6863
- return void 0;
6864
- },
6865
- {
6866
- ...operatorOpts3(opts),
6867
- completeWhenDepsComplete: false,
6868
- onMessage(msg, _i, a) {
6869
- const t = msg[0];
6870
- if (t === ERROR) {
6871
- a.down([msg]);
6872
- return true;
6873
- }
6874
- if (t === COMPLETE) {
6875
- if (buf.length > 0) a.emit([...buf]);
6876
- buf.length = 0;
6877
- a.down([[COMPLETE]]);
6878
- return true;
6879
- }
6880
- if (t === DIRTY) {
6881
- a.down([[DIRTY]]);
6882
- return true;
6883
- }
6884
- if (t === RESOLVED) {
6885
- a.down([[RESOLVED]]);
6886
- return true;
6887
- }
6888
- if (t === DATA) {
6889
- buf.push(msg[1]);
6890
- if (buf.length >= count) {
6891
- a.emit(buf.splice(0, buf.length));
6892
- }
6893
- return true;
6894
- }
6895
- return false;
6896
- }
6854
+ return false;
6897
6855
  }
6898
- );
6856
+ });
6899
6857
  }
6900
6858
  function windowCount(source, count, opts) {
6901
6859
  if (count <= 0) throw new RangeError("windowCount expects count > 0");