@graphrefly/graphrefly 0.7.0 → 0.8.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 (65) hide show
  1. package/dist/{chunk-L4J2K2RT.js → chunk-A2AJJOSJ.js} +3 -3
  2. package/dist/{chunk-ISGMZ2T3.js → chunk-E7OH6ZAZ.js} +3 -3
  3. package/dist/{chunk-47YJEZUJ.js → chunk-LR2CLSEF.js} +2 -2
  4. package/dist/{chunk-3EVXOI5C.js → chunk-QTZSBQGJ.js} +35 -21
  5. package/dist/chunk-QTZSBQGJ.js.map +1 -0
  6. package/dist/{chunk-ONLYF6GA.js → chunk-TZLX4KIT.js} +3 -3
  7. package/dist/{chunk-FGLZ5QID.js → chunk-UCW3VWMN.js} +4 -4
  8. package/dist/{chunk-BLCXEMAD.js → chunk-WYI7YW54.js} +16 -8
  9. package/dist/chunk-WYI7YW54.js.map +1 -0
  10. package/dist/{chunk-OSR3G3DP.js → chunk-XCZPGOVP.js} +3 -3
  11. package/dist/{chunk-PEBORXRA.js → chunk-YWTP2XRJ.js} +2 -2
  12. package/dist/compat/nestjs/index.cjs +47 -25
  13. package/dist/compat/nestjs/index.cjs.map +1 -1
  14. package/dist/compat/nestjs/index.d.cts +3 -3
  15. package/dist/compat/nestjs/index.d.ts +3 -3
  16. package/dist/compat/nestjs/index.js +7 -7
  17. package/dist/core/index.cjs +34 -20
  18. package/dist/core/index.cjs.map +1 -1
  19. package/dist/core/index.d.cts +1 -1
  20. package/dist/core/index.d.ts +1 -1
  21. package/dist/core/index.js +3 -3
  22. package/dist/extra/index.cjs +34 -20
  23. package/dist/extra/index.cjs.map +1 -1
  24. package/dist/extra/index.d.cts +3 -3
  25. package/dist/extra/index.d.ts +3 -3
  26. package/dist/extra/index.js +3 -3
  27. package/dist/graph/index.cjs +47 -25
  28. package/dist/graph/index.cjs.map +1 -1
  29. package/dist/graph/index.d.cts +2 -2
  30. package/dist/graph/index.d.ts +2 -2
  31. package/dist/graph/index.js +4 -4
  32. package/dist/{graph-B3BoJjcb.d.cts → graph-DqTICAY2.d.cts} +11 -5
  33. package/dist/{graph-CmiUuhaN.d.ts → graph-X9uwnD_z.d.ts} +11 -5
  34. package/dist/{index-D0cx-Yht.d.cts → index-3U0WxdD-.d.cts} +1 -1
  35. package/dist/{index-D1hgSTzr.d.cts → index-BP1t_38S.d.cts} +2 -2
  36. package/dist/{index-CsUq2rrK.d.ts → index-BPCeYDS4.d.ts} +1 -1
  37. package/dist/{index-BrgtEG-C.d.ts → index-BVG5pjin.d.ts} +3 -1
  38. package/dist/{index-D8NIq6om.d.cts → index-BYEgosAX.d.cts} +3 -1
  39. package/dist/{index-BsuKSs4L.d.cts → index-BYa2YMat.d.cts} +2 -2
  40. package/dist/{index-DFFNKYig.d.ts → index-DLO8wnYU.d.ts} +2 -2
  41. package/dist/{index-Bf2X1YSI.d.ts → index-DMv1Etbi.d.ts} +1 -1
  42. package/dist/{index-Bl7hJcc3.d.cts → index-DbwgQ4Cw.d.cts} +1 -1
  43. package/dist/{index-Pm68AYPh.d.ts → index-a5gHmH5b.d.ts} +2 -2
  44. package/dist/index.cjs +47 -25
  45. package/dist/index.cjs.map +1 -1
  46. package/dist/index.d.cts +10 -10
  47. package/dist/index.d.ts +10 -10
  48. package/dist/index.js +16 -16
  49. package/dist/patterns/reactive-layout/index.cjs +47 -25
  50. package/dist/patterns/reactive-layout/index.cjs.map +1 -1
  51. package/dist/patterns/reactive-layout/index.d.cts +2 -2
  52. package/dist/patterns/reactive-layout/index.d.ts +2 -2
  53. package/dist/patterns/reactive-layout/index.js +4 -4
  54. package/dist/{reactive-log-CAXzJ7hw.d.cts → reactive-log-BfX6bOSZ.d.cts} +1 -1
  55. package/dist/{reactive-log-DwNhOe0g.d.ts → reactive-log-RhgIog2Z.d.ts} +1 -1
  56. package/package.json +1 -1
  57. package/dist/chunk-3EVXOI5C.js.map +0 -1
  58. package/dist/chunk-BLCXEMAD.js.map +0 -1
  59. /package/dist/{chunk-L4J2K2RT.js.map → chunk-A2AJJOSJ.js.map} +0 -0
  60. /package/dist/{chunk-ISGMZ2T3.js.map → chunk-E7OH6ZAZ.js.map} +0 -0
  61. /package/dist/{chunk-47YJEZUJ.js.map → chunk-LR2CLSEF.js.map} +0 -0
  62. /package/dist/{chunk-ONLYF6GA.js.map → chunk-TZLX4KIT.js.map} +0 -0
  63. /package/dist/{chunk-FGLZ5QID.js.map → chunk-UCW3VWMN.js.map} +0 -0
  64. /package/dist/{chunk-OSR3G3DP.js.map → chunk-XCZPGOVP.js.map} +0 -0
  65. /package/dist/{chunk-PEBORXRA.js.map → chunk-YWTP2XRJ.js.map} +0 -0
@@ -1,2 +1,2 @@
1
1
  export { A as Actor, C as COMPLETE, D as DATA, d as DEFAULT_ACTOR, e as DIRTY, f as DescribeDetail, g as DescribeField, h as DescribeNodeOutput, E as ERROR, G as GuardAction, i as GuardDenied, j as GuardDeniedDetails, H as HashFn, I as INVALIDATE, M as Message, k as Messages, N as Node, b as NodeActions, l as NodeDescribeKind, c as NodeFn, m as NodeGuard, a as NodeOptions, n as NodeSink, o as NodeStatus, p as NodeTransportOptions, q as NodeVersionInfo, O as OnMessageHandler, P as PAUSE, r as PolicyAllow, s as PolicyDeny, t as PolicyRuleData, R as RESOLVED, u as RESUME, S as SubscribeHints, T as TEARDOWN, V as V0, v as V1, w as VersioningLevel, x as VersioningOptions, y as accessHintForGuard, z as advanceVersion, B as createVersioning, F as defaultHash, J as describeNode, K as isKnownMessageType, L as isPhase2Message, Q as isTerminalMessage, U as isV1, W as knownMessageTypes, X as messageTier, Y as metaSnapshot, Z as node, _ as normalizeActor, $ as policy, a0 as policyFromRules, a1 as propagatesToMeta, a2 as resolveDescribeFields } from '../meta-BJEU8fYz.cjs';
2
- export { D as DynGet, a as DynamicNodeFn, b as DynamicNodeImpl, c as DynamicNodeOptions, P as PipeOperator, R as ResettableTimer, d as batch, e as derived, f as dynamicNode, g as effect, h as emitWithBatch, j as isBatching, m as monotonicNs, p as partitionForBatch, k as pipe, l as producer, s as state, w as wallClockNs } from '../index-D8NIq6om.cjs';
2
+ export { D as DynGet, a as DynamicNodeFn, b as DynamicNodeImpl, c as DynamicNodeOptions, P as PipeOperator, R as ResettableTimer, d as batch, e as derived, f as dynamicNode, g as effect, h as emitWithBatch, j as isBatching, m as monotonicNs, p as partitionForBatch, k as pipe, l as producer, s as state, w as wallClockNs } from '../index-BYEgosAX.cjs';
@@ -1,2 +1,2 @@
1
1
  export { A as Actor, C as COMPLETE, D as DATA, d as DEFAULT_ACTOR, e as DIRTY, f as DescribeDetail, g as DescribeField, h as DescribeNodeOutput, E as ERROR, G as GuardAction, i as GuardDenied, j as GuardDeniedDetails, H as HashFn, I as INVALIDATE, M as Message, k as Messages, N as Node, b as NodeActions, l as NodeDescribeKind, c as NodeFn, m as NodeGuard, a as NodeOptions, n as NodeSink, o as NodeStatus, p as NodeTransportOptions, q as NodeVersionInfo, O as OnMessageHandler, P as PAUSE, r as PolicyAllow, s as PolicyDeny, t as PolicyRuleData, R as RESOLVED, u as RESUME, S as SubscribeHints, T as TEARDOWN, V as V0, v as V1, w as VersioningLevel, x as VersioningOptions, y as accessHintForGuard, z as advanceVersion, B as createVersioning, F as defaultHash, J as describeNode, K as isKnownMessageType, L as isPhase2Message, Q as isTerminalMessage, U as isV1, W as knownMessageTypes, X as messageTier, Y as metaSnapshot, Z as node, _ as normalizeActor, $ as policy, a0 as policyFromRules, a1 as propagatesToMeta, a2 as resolveDescribeFields } from '../meta-BJEU8fYz.js';
2
- export { D as DynGet, a as DynamicNodeFn, b as DynamicNodeImpl, c as DynamicNodeOptions, P as PipeOperator, R as ResettableTimer, d as batch, e as derived, f as dynamicNode, g as effect, h as emitWithBatch, j as isBatching, m as monotonicNs, p as partitionForBatch, k as pipe, l as producer, s as state, w as wallClockNs } from '../index-BrgtEG-C.js';
2
+ export { D as DynGet, a as DynamicNodeFn, b as DynamicNodeImpl, c as DynamicNodeOptions, P as PipeOperator, R as ResettableTimer, d as batch, e as derived, f as dynamicNode, g as effect, h as emitWithBatch, j as isBatching, m as monotonicNs, p as partitionForBatch, k as pipe, l as producer, s as state, w as wallClockNs } from '../index-BVG5pjin.js';
@@ -1,4 +1,4 @@
1
- import "../chunk-ISGMZ2T3.js";
1
+ import "../chunk-E7OH6ZAZ.js";
2
2
  import {
3
3
  ResettableTimer
4
4
  } from "../chunk-WZ2Z2CRV.js";
@@ -6,7 +6,7 @@ import {
6
6
  describeNode,
7
7
  metaSnapshot,
8
8
  resolveDescribeFields
9
- } from "../chunk-47YJEZUJ.js";
9
+ } from "../chunk-LR2CLSEF.js";
10
10
  import {
11
11
  COMPLETE,
12
12
  DATA,
@@ -47,7 +47,7 @@ import {
47
47
  propagatesToMeta,
48
48
  state,
49
49
  wallClockNs
50
- } from "../chunk-3EVXOI5C.js";
50
+ } from "../chunk-QTZSBQGJ.js";
51
51
  export {
52
52
  COMPLETE,
53
53
  DATA,
@@ -508,6 +508,7 @@ function advanceVersion(info, newValue, hashFn) {
508
508
  }
509
509
 
510
510
  // src/core/node.ts
511
+ var NO_VALUE = /* @__PURE__ */ Symbol.for("graphrefly/NO_VALUE");
511
512
  function createIntBitSet() {
512
513
  let bits = 0;
513
514
  return {
@@ -608,7 +609,6 @@ var NodeImpl = class {
608
609
  _producerStarted = false;
609
610
  _connecting = false;
610
611
  _manualEmitUsed = false;
611
- _hasEmittedData = false;
612
612
  _sinkCount = 0;
613
613
  _singleDepSinkCount = 0;
614
614
  // --- Object/collection state ---
@@ -638,10 +638,10 @@ var NodeImpl = class {
638
638
  this._hasDeps = deps.length > 0;
639
639
  this._autoComplete = opts.completeWhenDepsComplete ?? true;
640
640
  this._isSingleDep = deps.length === 1 && fn != null;
641
- this._cached = opts.initial;
641
+ this._cached = "initial" in opts ? opts.initial : NO_VALUE;
642
642
  this._status = this._hasDeps ? "disconnected" : "settled";
643
643
  this._hashFn = opts.versioningHash ?? defaultHash;
644
- this._versioning = opts.versioning != null ? createVersioning(opts.versioning, this._cached, {
644
+ this._versioning = opts.versioning != null ? createVersioning(opts.versioning, this._cached === NO_VALUE ? void 0 : this._cached, {
645
645
  id: opts.versioningId,
646
646
  hash: this._hashFn
647
647
  }) : void 0;
@@ -725,10 +725,14 @@ var NodeImpl = class {
725
725
  _applyVersioning(level, opts) {
726
726
  if (this._versioning != null) return;
727
727
  this._hashFn = opts?.hash ?? this._hashFn;
728
- this._versioning = createVersioning(level, this._cached, {
729
- id: opts?.id,
730
- hash: this._hashFn
731
- });
728
+ this._versioning = createVersioning(
729
+ level,
730
+ this._cached === NO_VALUE ? void 0 : this._cached,
731
+ {
732
+ id: opts?.id,
733
+ hash: this._hashFn
734
+ }
735
+ );
732
736
  }
733
737
  hasGuard() {
734
738
  return this._guard != null;
@@ -738,7 +742,7 @@ var NodeImpl = class {
738
742
  return this._guard(normalizeActor(actor), "observe");
739
743
  }
740
744
  get() {
741
- return this._cached;
745
+ return this._cached === NO_VALUE ? void 0 : this._cached;
742
746
  }
743
747
  down(messages, options) {
744
748
  if (messages.length === 0) return;
@@ -795,6 +799,7 @@ var NodeImpl = class {
795
799
  }
796
800
  if (this._terminal && this._opts.resubscribable) {
797
801
  this._terminal = false;
802
+ this._cached = NO_VALUE;
798
803
  this._status = this._hasDeps ? "disconnected" : "settled";
799
804
  this._opts.onResubscribe?.();
800
805
  }
@@ -894,8 +899,7 @@ var NodeImpl = class {
894
899
  const cleanupFn = this._cleanup;
895
900
  this._cleanup = void 0;
896
901
  cleanupFn?.();
897
- this._cached = void 0;
898
- this._hasEmittedData = false;
902
+ this._cached = NO_VALUE;
899
903
  this._lastDepValues = void 0;
900
904
  }
901
905
  this._status = statusAfterMessage(this._status, m);
@@ -904,8 +908,7 @@ var NodeImpl = class {
904
908
  }
905
909
  if (t === TEARDOWN) {
906
910
  if (this._opts.resetOnTeardown) {
907
- this._cached = void 0;
908
- this._hasEmittedData = false;
911
+ this._cached = NO_VALUE;
909
912
  }
910
913
  const teardownCleanup = this._cleanup;
911
914
  this._cleanup = void 0;
@@ -938,14 +941,13 @@ var NodeImpl = class {
938
941
  const wasDirty = this._status === "dirty";
939
942
  let unchanged;
940
943
  try {
941
- unchanged = this._hasEmittedData && this._equals(this._cached, value);
944
+ unchanged = this._cached !== NO_VALUE && this._equals(this._cached, value);
942
945
  } catch (eqErr) {
943
946
  const eqMsg = eqErr instanceof Error ? eqErr.message : String(eqErr);
944
947
  const wrapped = new Error(`Node "${this.name}": equals threw: ${eqMsg}`, { cause: eqErr });
945
948
  this._downInternal([[ERROR, wrapped]]);
946
949
  return;
947
950
  }
948
- this._hasEmittedData = true;
949
951
  if (unchanged) {
950
952
  this._downInternal(wasDirty ? [[RESOLVED]] : [[DIRTY], [RESOLVED]]);
951
953
  return;
@@ -5141,7 +5143,7 @@ var DynamicNodeImpl = class {
5141
5143
  _actions;
5142
5144
  _boundEmitToSinks;
5143
5145
  // Mutable state
5144
- _cached;
5146
+ _cached = NO_VALUE;
5145
5147
  _status = "disconnected";
5146
5148
  _terminal = false;
5147
5149
  _connected = false;
@@ -5235,7 +5237,7 @@ var DynamicNodeImpl = class {
5235
5237
  return this._guard(normalizeActor(actor), "observe");
5236
5238
  }
5237
5239
  get() {
5238
- return this._cached;
5240
+ return this._cached === NO_VALUE ? void 0 : this._cached;
5239
5241
  }
5240
5242
  down(messages, options) {
5241
5243
  if (messages.length === 0) return;
@@ -5293,6 +5295,7 @@ var DynamicNodeImpl = class {
5293
5295
  }
5294
5296
  if (this._terminal && this._resubscribable) {
5295
5297
  this._terminal = false;
5298
+ this._cached = NO_VALUE;
5296
5299
  this._status = "disconnected";
5297
5300
  this._onResubscribe?.();
5298
5301
  }
@@ -5370,10 +5373,13 @@ var DynamicNodeImpl = class {
5370
5373
  const t = m[0];
5371
5374
  if (t === DATA) this._cached = m[1];
5372
5375
  if (t === INVALIDATE) {
5373
- this._cached = void 0;
5376
+ this._cached = NO_VALUE;
5377
+ this._status = "dirty";
5374
5378
  }
5375
- if (t === DATA || t === RESOLVED) {
5379
+ if (t === DATA) {
5376
5380
  this._status = "settled";
5381
+ } else if (t === RESOLVED) {
5382
+ this._status = "resolved";
5377
5383
  } else if (t === DIRTY) {
5378
5384
  this._status = "dirty";
5379
5385
  } else if (t === COMPLETE) {
@@ -5384,7 +5390,7 @@ var DynamicNodeImpl = class {
5384
5390
  this._terminal = true;
5385
5391
  }
5386
5392
  if (t === TEARDOWN) {
5387
- if (this._resetOnTeardown) this._cached = void 0;
5393
+ if (this._resetOnTeardown) this._cached = NO_VALUE;
5388
5394
  try {
5389
5395
  this._propagateToMeta(t);
5390
5396
  } finally {
@@ -5407,7 +5413,15 @@ var DynamicNodeImpl = class {
5407
5413
  }
5408
5414
  _emitAutoValue(value) {
5409
5415
  const wasDirty = this._status === "dirty";
5410
- const unchanged = this._equals(this._cached, value);
5416
+ let unchanged;
5417
+ try {
5418
+ unchanged = this._cached !== NO_VALUE && this._equals(this._cached, value);
5419
+ } catch (eqErr) {
5420
+ const eqMsg = eqErr instanceof Error ? eqErr.message : String(eqErr);
5421
+ const wrapped = new Error(`Node "${this.name}": equals threw: ${eqMsg}`, { cause: eqErr });
5422
+ this._downInternal([[ERROR, wrapped]]);
5423
+ return;
5424
+ }
5411
5425
  if (unchanged) {
5412
5426
  this._downInternal(wasDirty ? [[RESOLVED]] : [[DIRTY], [RESOLVED]]);
5413
5427
  return;