@graphrefly/graphrefly 0.12.0 → 0.14.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 (69) hide show
  1. package/README.md +1 -1
  2. package/dist/{chunk-NULSP7U4.js → chunk-2ZICUAUJ.js} +4 -4
  3. package/dist/{chunk-BRPCN2HJ.js → chunk-4APC3AFN.js} +3 -3
  4. package/dist/{chunk-VQWLA6XQ.js → chunk-CRACCCJY.js} +3 -3
  5. package/dist/{chunk-JYRHO63K.js → chunk-GKRKDYNT.js} +17 -17
  6. package/dist/chunk-GKRKDYNT.js.map +1 -0
  7. package/dist/{chunk-4F2ZFD5L.js → chunk-H243FWYP.js} +50 -51
  8. package/dist/chunk-H243FWYP.js.map +1 -0
  9. package/dist/{chunk-X732W3QA.js → chunk-QVYZD65U.js} +2 -2
  10. package/dist/{chunk-6OLNYOGU.js → chunk-XQ4UMAU7.js} +2 -2
  11. package/dist/{chunk-XWMTVV2D.js → chunk-YW6LFCFS.js} +5 -5
  12. package/dist/{chunk-IXTW3BIO.js → chunk-ZHTHUX5D.js} +3 -3
  13. package/dist/compat/nestjs/index.cjs +48 -49
  14. package/dist/compat/nestjs/index.cjs.map +1 -1
  15. package/dist/compat/nestjs/index.d.cts +4 -4
  16. package/dist/compat/nestjs/index.d.ts +4 -4
  17. package/dist/compat/nestjs/index.js +7 -7
  18. package/dist/core/index.cjs +50 -51
  19. package/dist/core/index.cjs.map +1 -1
  20. package/dist/core/index.d.cts +2 -2
  21. package/dist/core/index.d.ts +2 -2
  22. package/dist/core/index.js +5 -5
  23. package/dist/extra/index.cjs +48 -49
  24. package/dist/extra/index.cjs.map +1 -1
  25. package/dist/extra/index.d.cts +4 -4
  26. package/dist/extra/index.d.ts +4 -4
  27. package/dist/extra/index.js +3 -3
  28. package/dist/graph/index.cjs +40 -37
  29. package/dist/graph/index.cjs.map +1 -1
  30. package/dist/graph/index.d.cts +3 -3
  31. package/dist/graph/index.d.ts +3 -3
  32. package/dist/graph/index.js +4 -4
  33. package/dist/{graph-DXT95WZ3.d.ts → graph-BXIK5Dq5.d.ts} +1 -1
  34. package/dist/{graph-BE10ujU9.d.cts → graph-BhADtuFU.d.cts} +1 -1
  35. package/dist/{index-QfbXNW1N.d.cts → index-BNB0KjKe.d.ts} +24 -21
  36. package/dist/{index-C0_7g9sj.d.ts → index-BkToATim.d.ts} +1 -1
  37. package/dist/{index-CiAqgfFg.d.ts → index-CKyYg4IP.d.ts} +3 -3
  38. package/dist/{index-CCvzN5GB.d.cts → index-DANO9Gg7.d.cts} +2 -2
  39. package/dist/{index-CthwPnHQ.d.cts → index-DBhLjWSV.d.cts} +3 -3
  40. package/dist/{index-Dzdm20sx.d.ts → index-DKIyo4Bq.d.cts} +24 -21
  41. package/dist/{index-53cDGX7F.d.ts → index-DSp5R3Xq.d.ts} +3 -3
  42. package/dist/{index-aBZ2RoP0.d.cts → index-Dqemj9q0.d.cts} +3 -3
  43. package/dist/{index-nRulwTr-.d.cts → index-Wa8jXne6.d.cts} +1 -1
  44. package/dist/{index-B10Q0sQB.d.ts → index-fYObbpUw.d.ts} +2 -2
  45. package/dist/index.cjs +443 -68
  46. package/dist/index.cjs.map +1 -1
  47. package/dist/index.d.cts +369 -66
  48. package/dist/index.d.ts +369 -66
  49. package/dist/index.js +397 -22
  50. package/dist/index.js.map +1 -1
  51. package/dist/{meta-BcuDhtwu.d.cts → meta-CrZUQAJ6.d.cts} +1 -1
  52. package/dist/{meta-BcuDhtwu.d.ts → meta-CrZUQAJ6.d.ts} +1 -1
  53. package/dist/patterns/reactive-layout/index.cjs +53 -50
  54. package/dist/patterns/reactive-layout/index.cjs.map +1 -1
  55. package/dist/patterns/reactive-layout/index.d.cts +3 -3
  56. package/dist/patterns/reactive-layout/index.d.ts +3 -3
  57. package/dist/patterns/reactive-layout/index.js +4 -4
  58. package/dist/{reactive-log-OULQssZg.d.cts → reactive-log-ChbpUrY2.d.cts} +2 -2
  59. package/dist/{reactive-log-Cu0VdqkT.d.ts → reactive-log-DV--7BWd.d.ts} +2 -2
  60. package/package.json +3 -1
  61. package/dist/chunk-4F2ZFD5L.js.map +0 -1
  62. package/dist/chunk-JYRHO63K.js.map +0 -1
  63. /package/dist/{chunk-NULSP7U4.js.map → chunk-2ZICUAUJ.js.map} +0 -0
  64. /package/dist/{chunk-BRPCN2HJ.js.map → chunk-4APC3AFN.js.map} +0 -0
  65. /package/dist/{chunk-VQWLA6XQ.js.map → chunk-CRACCCJY.js.map} +0 -0
  66. /package/dist/{chunk-X732W3QA.js.map → chunk-QVYZD65U.js.map} +0 -0
  67. /package/dist/{chunk-6OLNYOGU.js.map → chunk-XQ4UMAU7.js.map} +0 -0
  68. /package/dist/{chunk-XWMTVV2D.js.map → chunk-YW6LFCFS.js.map} +0 -0
  69. /package/dist/{chunk-IXTW3BIO.js.map → chunk-ZHTHUX5D.js.map} +0 -0
@@ -11,7 +11,7 @@ import {
11
11
  producer,
12
12
  state,
13
13
  wallClockNs
14
- } from "./chunk-4F2ZFD5L.js";
14
+ } from "./chunk-H243FWYP.js";
15
15
 
16
16
  // src/extra/observable.ts
17
17
  import { Observable } from "rxjs";
@@ -778,4 +778,4 @@ export {
778
778
  reactiveLog,
779
779
  logSlice
780
780
  };
781
- //# sourceMappingURL=chunk-X732W3QA.js.map
781
+ //# sourceMappingURL=chunk-QVYZD65U.js.map
@@ -2,7 +2,7 @@ import {
2
2
  DynamicNodeImpl,
3
3
  NodeImpl,
4
4
  accessHintForGuard
5
- } from "./chunk-4F2ZFD5L.js";
5
+ } from "./chunk-H243FWYP.js";
6
6
 
7
7
  // src/core/meta.ts
8
8
  function resolveDescribeFields(detail, fields) {
@@ -102,4 +102,4 @@ export {
102
102
  metaSnapshot,
103
103
  describeNode
104
104
  };
105
- //# sourceMappingURL=chunk-6OLNYOGU.js.map
105
+ //# sourceMappingURL=chunk-XQ4UMAU7.js.map
@@ -5,7 +5,7 @@ import {
5
5
  describeNode,
6
6
  metaSnapshot,
7
7
  resolveDescribeFields
8
- } from "./chunk-6OLNYOGU.js";
8
+ } from "./chunk-XQ4UMAU7.js";
9
9
  import {
10
10
  CLEANUP_RESULT,
11
11
  COMPLETE,
@@ -28,9 +28,9 @@ import {
28
28
  createVersioning,
29
29
  defaultHash,
30
30
  derived,
31
+ downWithBatch,
31
32
  dynamicNode,
32
33
  effect,
33
- emitWithBatch,
34
34
  isBatching,
35
35
  isKnownMessageType,
36
36
  isPhase2Message,
@@ -49,7 +49,7 @@ import {
49
49
  propagatesToMeta,
50
50
  state,
51
51
  wallClockNs
52
- } from "./chunk-4F2ZFD5L.js";
52
+ } from "./chunk-H243FWYP.js";
53
53
 
54
54
  // src/core/index.ts
55
55
  var core_exports = {};
@@ -78,9 +78,9 @@ __export(core_exports, {
78
78
  defaultHash: () => defaultHash,
79
79
  derived: () => derived,
80
80
  describeNode: () => describeNode,
81
+ downWithBatch: () => downWithBatch,
81
82
  dynamicNode: () => dynamicNode,
82
83
  effect: () => effect,
83
- emitWithBatch: () => emitWithBatch,
84
84
  isBatching: () => isBatching,
85
85
  isKnownMessageType: () => isKnownMessageType,
86
86
  isPhase2Message: () => isPhase2Message,
@@ -159,4 +159,4 @@ export {
159
159
  bridge,
160
160
  core_exports
161
161
  };
162
- //# sourceMappingURL=chunk-XWMTVV2D.js.map
162
+ //# sourceMappingURL=chunk-YW6LFCFS.js.map
@@ -2,10 +2,10 @@ import {
2
2
  GRAPH_META_SEGMENT,
3
3
  Graph,
4
4
  reachable
5
- } from "./chunk-VQWLA6XQ.js";
5
+ } from "./chunk-CRACCCJY.js";
6
6
  import {
7
7
  __export
8
- } from "./chunk-4F2ZFD5L.js";
8
+ } from "./chunk-H243FWYP.js";
9
9
 
10
10
  // src/graph/index.ts
11
11
  var graph_exports = {};
@@ -104,4 +104,4 @@ export {
104
104
  replayWAL,
105
105
  graph_exports
106
106
  };
107
- //# sourceMappingURL=chunk-IXTW3BIO.js.map
107
+ //# sourceMappingURL=chunk-ZHTHUX5D.js.map
@@ -375,8 +375,7 @@ function drainPending() {
375
375
  if (ownsFlush) {
376
376
  flushInProgress = true;
377
377
  }
378
- let firstError;
379
- let hasError = false;
378
+ const errors = [];
380
379
  try {
381
380
  let iterations = 0;
382
381
  while (pendingPhase2.length > 0 || pendingPhase3.length > 0) {
@@ -394,10 +393,7 @@ function drainPending() {
394
393
  try {
395
394
  run();
396
395
  } catch (e) {
397
- if (!hasError) {
398
- firstError = e;
399
- hasError = true;
400
- }
396
+ errors.push(e);
401
397
  }
402
398
  }
403
399
  }
@@ -415,10 +411,7 @@ function drainPending() {
415
411
  try {
416
412
  run();
417
413
  } catch (e) {
418
- if (!hasError) {
419
- firstError = e;
420
- hasError = true;
421
- }
414
+ errors.push(e);
422
415
  }
423
416
  }
424
417
  }
@@ -428,8 +421,11 @@ function drainPending() {
428
421
  flushInProgress = false;
429
422
  }
430
423
  }
431
- if (hasError) {
432
- throw firstError;
424
+ if (errors.length === 1) {
425
+ throw errors[0];
426
+ }
427
+ if (errors.length > 1) {
428
+ throw new AggregateError(errors, "batch drain: multiple callbacks threw");
433
429
  }
434
430
  }
435
431
  function partitionForBatch(messages) {
@@ -447,12 +443,12 @@ function partitionForBatch(messages) {
447
443
  }
448
444
  return { immediate, deferred, terminal };
449
445
  }
450
- function emitWithBatch(emit, messages, phase = 2, options) {
446
+ function downWithBatch(sink, messages, phase = 2, options) {
451
447
  if (messages.length === 0) {
452
448
  return;
453
449
  }
454
450
  if (options?.strategy === "sequential") {
455
- _emitSequential(emit, messages, phase);
451
+ _downSequential(sink, messages, phase);
456
452
  return;
457
453
  }
458
454
  const queue = phase === 3 ? pendingPhase3 : pendingPhase2;
@@ -460,61 +456,61 @@ function emitWithBatch(emit, messages, phase = 2, options) {
460
456
  const t = messages[0][0];
461
457
  if (t === DATA || t === RESOLVED) {
462
458
  if (isBatching()) {
463
- queue.push(() => emit(messages));
459
+ queue.push(() => sink(messages));
464
460
  } else {
465
- emit(messages);
461
+ sink(messages);
466
462
  }
467
463
  } else if (isTerminalMessage(t)) {
468
464
  if (isBatching()) {
469
- queue.push(() => emit(messages));
465
+ queue.push(() => sink(messages));
470
466
  } else {
471
- emit(messages);
467
+ sink(messages);
472
468
  }
473
469
  } else {
474
- emit(messages);
470
+ sink(messages);
475
471
  }
476
472
  return;
477
473
  }
478
474
  const { immediate, deferred, terminal } = partitionForBatch(messages);
479
475
  if (immediate.length > 0) {
480
- emit(immediate);
476
+ sink(immediate);
481
477
  }
482
478
  if (isBatching()) {
483
479
  if (deferred.length > 0) {
484
- queue.push(() => emit(deferred));
480
+ queue.push(() => sink(deferred));
485
481
  }
486
482
  if (terminal.length > 0) {
487
- queue.push(() => emit(terminal));
483
+ queue.push(() => sink(terminal));
488
484
  }
489
485
  } else {
490
486
  if (deferred.length > 0) {
491
- emit(deferred);
487
+ sink(deferred);
492
488
  }
493
489
  if (terminal.length > 0) {
494
- emit(terminal);
490
+ sink(terminal);
495
491
  }
496
492
  }
497
493
  }
498
- function _emitSequential(emit, messages, phase = 2) {
494
+ function _downSequential(sink, messages, phase = 2) {
499
495
  const dataQueue = phase === 3 ? pendingPhase3 : pendingPhase2;
500
496
  for (const msg of messages) {
501
497
  const tier = messageTier(msg[0]);
502
498
  if (tier === 2) {
503
499
  if (isBatching()) {
504
500
  const m = msg;
505
- dataQueue.push(() => emit([m]));
501
+ dataQueue.push(() => sink([m]));
506
502
  } else {
507
- emit([msg]);
503
+ sink([msg]);
508
504
  }
509
505
  } else if (tier >= 3) {
510
506
  if (isBatching()) {
511
507
  const m = msg;
512
- pendingPhase3.push(() => emit([m]));
508
+ pendingPhase3.push(() => sink([m]));
513
509
  } else {
514
- emit([msg]);
510
+ sink([msg]);
515
511
  }
516
512
  } else {
517
- emit([msg]);
513
+ sink([msg]);
518
514
  }
519
515
  }
520
516
  }
@@ -764,7 +760,7 @@ var NodeImpl = class {
764
760
  _singleDepSinks = /* @__PURE__ */ new WeakSet();
765
761
  _upstreamUnsubs = [];
766
762
  _actions;
767
- _boundEmitToSinks;
763
+ _boundDownToSinks;
768
764
  _inspectorHook;
769
765
  _versioning;
770
766
  _hashFn;
@@ -811,7 +807,7 @@ var NodeImpl = class {
811
807
  },
812
808
  emit(value) {
813
809
  self._manualEmitUsed = true;
814
- self._emitAutoValue(value);
810
+ self._downAutoValue(value);
815
811
  },
816
812
  up(messages) {
817
813
  self._upInternal(messages);
@@ -819,7 +815,7 @@ var NodeImpl = class {
819
815
  };
820
816
  this.down = this.down.bind(this);
821
817
  this.up = this.up.bind(this);
822
- this._boundEmitToSinks = this._emitToSinks.bind(this);
818
+ this._boundDownToSinks = this._downToSinks.bind(this);
823
819
  }
824
820
  get name() {
825
821
  return this._registryName ?? this._optsName;
@@ -925,12 +921,12 @@ var NodeImpl = class {
925
921
  if (sinkMessages[i][0] !== DIRTY) filtered.push(sinkMessages[i]);
926
922
  }
927
923
  if (filtered.length > 0) {
928
- emitWithBatch(this._boundEmitToSinks, filtered);
924
+ downWithBatch(this._boundDownToSinks, filtered);
929
925
  }
930
926
  return;
931
927
  }
932
928
  }
933
- emitWithBatch(this._boundEmitToSinks, sinkMessages);
929
+ downWithBatch(this._boundDownToSinks, sinkMessages);
934
930
  }
935
931
  subscribe(sink, hints) {
936
932
  if (hints?.actor != null && this._guard != null) {
@@ -1017,7 +1013,7 @@ var NodeImpl = class {
1017
1013
  this._disconnectUpstream();
1018
1014
  }
1019
1015
  // --- Private methods (prototype, _ prefix) ---
1020
- _emitToSinks(messages) {
1016
+ _downToSinks(messages) {
1021
1017
  if (this._sinks == null) return;
1022
1018
  if (typeof this._sinks === "function") {
1023
1019
  this._sinks(messages);
@@ -1032,6 +1028,9 @@ var NodeImpl = class {
1032
1028
  for (const m of messages) {
1033
1029
  const t = m[0];
1034
1030
  if (t === DATA) {
1031
+ if (m.length < 2) {
1032
+ continue;
1033
+ }
1035
1034
  this._cached = m[1];
1036
1035
  if (this._versioning != null) {
1037
1036
  advanceVersion(this._versioning, m[1], this._hashFn);
@@ -1079,7 +1078,7 @@ var NodeImpl = class {
1079
1078
  _canSkipDirty() {
1080
1079
  return this._sinkCount === 1 && this._singleDepSinkCount === 1;
1081
1080
  }
1082
- _emitAutoValue(value) {
1081
+ _downAutoValue(value) {
1083
1082
  const wasDirty = this._status === "dirty";
1084
1083
  let unchanged;
1085
1084
  try {
@@ -1132,7 +1131,7 @@ var NodeImpl = class {
1132
1131
  this._cleanup = out.cleanup;
1133
1132
  if (this._manualEmitUsed) return;
1134
1133
  if ("value" in out) {
1135
- this._emitAutoValue(out.value);
1134
+ this._downAutoValue(out.value);
1136
1135
  }
1137
1136
  return;
1138
1137
  }
@@ -1142,7 +1141,7 @@ var NodeImpl = class {
1142
1141
  }
1143
1142
  if (this._manualEmitUsed) return;
1144
1143
  if (out === void 0) return;
1145
- this._emitAutoValue(out);
1144
+ this._downAutoValue(out);
1146
1145
  } catch (err) {
1147
1146
  const errMsg = err instanceof Error ? err.message : String(err);
1148
1147
  const wrapped = new Error(`Node "${this.name}": fn threw: ${errMsg}`, { cause: err });
@@ -2150,7 +2149,7 @@ var DynamicNodeImpl = class {
2150
2149
  _singleDepSinks = /* @__PURE__ */ new WeakSet();
2151
2150
  // Actions object (for onMessage handler)
2152
2151
  _actions;
2153
- _boundEmitToSinks;
2152
+ _boundDownToSinks;
2154
2153
  // Mutable state
2155
2154
  _cached = NO_VALUE;
2156
2155
  _status = "disconnected";
@@ -2197,7 +2196,7 @@ var DynamicNodeImpl = class {
2197
2196
  self._downInternal(messages);
2198
2197
  },
2199
2198
  emit(value) {
2200
- self._emitAutoValue(value);
2199
+ self._downAutoValue(value);
2201
2200
  },
2202
2201
  up(messages) {
2203
2202
  for (const dep of self._deps) {
@@ -2205,7 +2204,7 @@ var DynamicNodeImpl = class {
2205
2204
  }
2206
2205
  }
2207
2206
  };
2208
- this._boundEmitToSinks = this._emitToSinks.bind(this);
2207
+ this._boundDownToSinks = this._downToSinks.bind(this);
2209
2208
  }
2210
2209
  get name() {
2211
2210
  return this._registryName ?? this._optsName;
@@ -2285,12 +2284,12 @@ var DynamicNodeImpl = class {
2285
2284
  if (sinkMessages[i][0] !== DIRTY) filtered.push(sinkMessages[i]);
2286
2285
  }
2287
2286
  if (filtered.length > 0) {
2288
- emitWithBatch(this._boundEmitToSinks, filtered);
2287
+ downWithBatch(this._boundDownToSinks, filtered);
2289
2288
  }
2290
2289
  return;
2291
2290
  }
2292
2291
  }
2293
- emitWithBatch(this._boundEmitToSinks, sinkMessages);
2292
+ downWithBatch(this._boundDownToSinks, sinkMessages);
2294
2293
  }
2295
2294
  _canSkipDirty() {
2296
2295
  return this._sinkCount === 1 && this._singleDepSinkCount === 1;
@@ -2366,7 +2365,7 @@ var DynamicNodeImpl = class {
2366
2365
  this._disconnect();
2367
2366
  }
2368
2367
  // --- Private methods ---
2369
- _emitToSinks(messages) {
2368
+ _downToSinks(messages) {
2370
2369
  if (this._sinks == null) return;
2371
2370
  if (typeof this._sinks === "function") {
2372
2371
  this._sinks(messages);
@@ -2420,7 +2419,7 @@ var DynamicNodeImpl = class {
2420
2419
  }
2421
2420
  }
2422
2421
  }
2423
- _emitAutoValue(value) {
2422
+ _downAutoValue(value) {
2424
2423
  const wasDirty = this._status === "dirty";
2425
2424
  let unchanged;
2426
2425
  try {
@@ -2480,7 +2479,7 @@ var DynamicNodeImpl = class {
2480
2479
  const result = this._fn(get);
2481
2480
  this._rewire(trackedDeps);
2482
2481
  if (result === void 0) return;
2483
- this._emitAutoValue(result);
2482
+ this._downAutoValue(result);
2484
2483
  } catch (err) {
2485
2484
  this._downInternal([[ERROR, err]]);
2486
2485
  }
@@ -2544,14 +2543,14 @@ var DynamicNodeImpl = class {
2544
2543
  this._dirtyBits.add(index);
2545
2544
  this._settledBits.delete(index);
2546
2545
  if (this._dirtyBits.size === 1) {
2547
- emitWithBatch(this._boundEmitToSinks, [[DIRTY]]);
2546
+ downWithBatch(this._boundDownToSinks, [[DIRTY]]);
2548
2547
  }
2549
2548
  continue;
2550
2549
  }
2551
2550
  if (t === DATA || t === RESOLVED) {
2552
2551
  if (!this._dirtyBits.has(index)) {
2553
2552
  this._dirtyBits.add(index);
2554
- emitWithBatch(this._boundEmitToSinks, [[DIRTY]]);
2553
+ downWithBatch(this._boundDownToSinks, [[DIRTY]]);
2555
2554
  }
2556
2555
  this._settledBits.add(index);
2557
2556
  if (this._allDirtySettled()) {