@graphrefly/graphrefly 0.7.0 → 0.9.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.
- package/dist/{chunk-L4J2K2RT.js → chunk-A2AJJOSJ.js} +3 -3
- package/dist/{chunk-ISGMZ2T3.js → chunk-E7OH6ZAZ.js} +3 -3
- package/dist/{chunk-47YJEZUJ.js → chunk-LR2CLSEF.js} +2 -2
- package/dist/{chunk-3EVXOI5C.js → chunk-QTZSBQGJ.js} +35 -21
- package/dist/chunk-QTZSBQGJ.js.map +1 -0
- package/dist/{chunk-ONLYF6GA.js → chunk-TZLX4KIT.js} +3 -3
- package/dist/{chunk-FGLZ5QID.js → chunk-UCW3VWMN.js} +4 -4
- package/dist/{chunk-BLCXEMAD.js → chunk-WYI7YW54.js} +16 -8
- package/dist/chunk-WYI7YW54.js.map +1 -0
- package/dist/{chunk-OSR3G3DP.js → chunk-XCZPGOVP.js} +3 -3
- package/dist/{chunk-PEBORXRA.js → chunk-YWTP2XRJ.js} +2 -2
- package/dist/compat/nestjs/index.cjs +47 -25
- package/dist/compat/nestjs/index.cjs.map +1 -1
- package/dist/compat/nestjs/index.d.cts +3 -3
- package/dist/compat/nestjs/index.d.ts +3 -3
- package/dist/compat/nestjs/index.js +7 -7
- package/dist/core/index.cjs +34 -20
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +3 -3
- package/dist/extra/index.cjs +34 -20
- package/dist/extra/index.cjs.map +1 -1
- package/dist/extra/index.d.cts +3 -3
- package/dist/extra/index.d.ts +3 -3
- package/dist/extra/index.js +3 -3
- package/dist/graph/index.cjs +47 -25
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.d.cts +2 -2
- package/dist/graph/index.d.ts +2 -2
- package/dist/graph/index.js +4 -4
- package/dist/{graph-B3BoJjcb.d.cts → graph-DqTICAY2.d.cts} +11 -5
- package/dist/{graph-CmiUuhaN.d.ts → graph-X9uwnD_z.d.ts} +11 -5
- package/dist/{index-D0cx-Yht.d.cts → index-3U0WxdD-.d.cts} +1 -1
- package/dist/{index-D1hgSTzr.d.cts → index-BP1t_38S.d.cts} +2 -2
- package/dist/{index-CsUq2rrK.d.ts → index-BPCeYDS4.d.ts} +1 -1
- package/dist/{index-BrgtEG-C.d.ts → index-BVG5pjin.d.ts} +3 -1
- package/dist/{index-D8NIq6om.d.cts → index-BYEgosAX.d.cts} +3 -1
- package/dist/{index-BsuKSs4L.d.cts → index-BYa2YMat.d.cts} +2 -2
- package/dist/{index-DFFNKYig.d.ts → index-DLO8wnYU.d.ts} +2 -2
- package/dist/{index-Bf2X1YSI.d.ts → index-DMv1Etbi.d.ts} +1 -1
- package/dist/{index-Bl7hJcc3.d.cts → index-DbwgQ4Cw.d.cts} +1 -1
- package/dist/{index-Pm68AYPh.d.ts → index-a5gHmH5b.d.ts} +2 -2
- package/dist/index.cjs +322 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +200 -25
- package/dist/index.d.ts +200 -25
- package/dist/index.js +291 -18
- package/dist/index.js.map +1 -1
- package/dist/patterns/reactive-layout/index.cjs +47 -25
- package/dist/patterns/reactive-layout/index.cjs.map +1 -1
- package/dist/patterns/reactive-layout/index.d.cts +2 -2
- package/dist/patterns/reactive-layout/index.d.ts +2 -2
- package/dist/patterns/reactive-layout/index.js +4 -4
- package/dist/{reactive-log-CAXzJ7hw.d.cts → reactive-log-BfX6bOSZ.d.cts} +1 -1
- package/dist/{reactive-log-DwNhOe0g.d.ts → reactive-log-RhgIog2Z.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-3EVXOI5C.js.map +0 -1
- package/dist/chunk-BLCXEMAD.js.map +0 -1
- /package/dist/{chunk-L4J2K2RT.js.map → chunk-A2AJJOSJ.js.map} +0 -0
- /package/dist/{chunk-ISGMZ2T3.js.map → chunk-E7OH6ZAZ.js.map} +0 -0
- /package/dist/{chunk-47YJEZUJ.js.map → chunk-LR2CLSEF.js.map} +0 -0
- /package/dist/{chunk-ONLYF6GA.js.map → chunk-TZLX4KIT.js.map} +0 -0
- /package/dist/{chunk-FGLZ5QID.js.map → chunk-UCW3VWMN.js.map} +0 -0
- /package/dist/{chunk-OSR3G3DP.js.map → chunk-XCZPGOVP.js.map} +0 -0
- /package/dist/{chunk-PEBORXRA.js.map → chunk-YWTP2XRJ.js.map} +0 -0
|
@@ -547,6 +547,7 @@ function advanceVersion(info, newValue, hashFn) {
|
|
|
547
547
|
}
|
|
548
548
|
|
|
549
549
|
// src/core/node.ts
|
|
550
|
+
var NO_VALUE = /* @__PURE__ */ Symbol.for("graphrefly/NO_VALUE");
|
|
550
551
|
function createIntBitSet() {
|
|
551
552
|
let bits = 0;
|
|
552
553
|
return {
|
|
@@ -647,7 +648,6 @@ var NodeImpl = class {
|
|
|
647
648
|
_producerStarted = false;
|
|
648
649
|
_connecting = false;
|
|
649
650
|
_manualEmitUsed = false;
|
|
650
|
-
_hasEmittedData = false;
|
|
651
651
|
_sinkCount = 0;
|
|
652
652
|
_singleDepSinkCount = 0;
|
|
653
653
|
// --- Object/collection state ---
|
|
@@ -677,10 +677,10 @@ var NodeImpl = class {
|
|
|
677
677
|
this._hasDeps = deps.length > 0;
|
|
678
678
|
this._autoComplete = opts.completeWhenDepsComplete ?? true;
|
|
679
679
|
this._isSingleDep = deps.length === 1 && fn != null;
|
|
680
|
-
this._cached = opts.initial;
|
|
680
|
+
this._cached = "initial" in opts ? opts.initial : NO_VALUE;
|
|
681
681
|
this._status = this._hasDeps ? "disconnected" : "settled";
|
|
682
682
|
this._hashFn = opts.versioningHash ?? defaultHash;
|
|
683
|
-
this._versioning = opts.versioning != null ? createVersioning(opts.versioning, this._cached, {
|
|
683
|
+
this._versioning = opts.versioning != null ? createVersioning(opts.versioning, this._cached === NO_VALUE ? void 0 : this._cached, {
|
|
684
684
|
id: opts.versioningId,
|
|
685
685
|
hash: this._hashFn
|
|
686
686
|
}) : void 0;
|
|
@@ -764,10 +764,14 @@ var NodeImpl = class {
|
|
|
764
764
|
_applyVersioning(level, opts) {
|
|
765
765
|
if (this._versioning != null) return;
|
|
766
766
|
this._hashFn = opts?.hash ?? this._hashFn;
|
|
767
|
-
this._versioning = createVersioning(
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
767
|
+
this._versioning = createVersioning(
|
|
768
|
+
level,
|
|
769
|
+
this._cached === NO_VALUE ? void 0 : this._cached,
|
|
770
|
+
{
|
|
771
|
+
id: opts?.id,
|
|
772
|
+
hash: this._hashFn
|
|
773
|
+
}
|
|
774
|
+
);
|
|
771
775
|
}
|
|
772
776
|
hasGuard() {
|
|
773
777
|
return this._guard != null;
|
|
@@ -777,7 +781,7 @@ var NodeImpl = class {
|
|
|
777
781
|
return this._guard(normalizeActor(actor), "observe");
|
|
778
782
|
}
|
|
779
783
|
get() {
|
|
780
|
-
return this._cached;
|
|
784
|
+
return this._cached === NO_VALUE ? void 0 : this._cached;
|
|
781
785
|
}
|
|
782
786
|
down(messages, options) {
|
|
783
787
|
if (messages.length === 0) return;
|
|
@@ -834,6 +838,7 @@ var NodeImpl = class {
|
|
|
834
838
|
}
|
|
835
839
|
if (this._terminal && this._opts.resubscribable) {
|
|
836
840
|
this._terminal = false;
|
|
841
|
+
this._cached = NO_VALUE;
|
|
837
842
|
this._status = this._hasDeps ? "disconnected" : "settled";
|
|
838
843
|
this._opts.onResubscribe?.();
|
|
839
844
|
}
|
|
@@ -933,8 +938,7 @@ var NodeImpl = class {
|
|
|
933
938
|
const cleanupFn = this._cleanup;
|
|
934
939
|
this._cleanup = void 0;
|
|
935
940
|
cleanupFn?.();
|
|
936
|
-
this._cached =
|
|
937
|
-
this._hasEmittedData = false;
|
|
941
|
+
this._cached = NO_VALUE;
|
|
938
942
|
this._lastDepValues = void 0;
|
|
939
943
|
}
|
|
940
944
|
this._status = statusAfterMessage(this._status, m);
|
|
@@ -943,8 +947,7 @@ var NodeImpl = class {
|
|
|
943
947
|
}
|
|
944
948
|
if (t === TEARDOWN) {
|
|
945
949
|
if (this._opts.resetOnTeardown) {
|
|
946
|
-
this._cached =
|
|
947
|
-
this._hasEmittedData = false;
|
|
950
|
+
this._cached = NO_VALUE;
|
|
948
951
|
}
|
|
949
952
|
const teardownCleanup = this._cleanup;
|
|
950
953
|
this._cleanup = void 0;
|
|
@@ -977,14 +980,13 @@ var NodeImpl = class {
|
|
|
977
980
|
const wasDirty = this._status === "dirty";
|
|
978
981
|
let unchanged;
|
|
979
982
|
try {
|
|
980
|
-
unchanged = this.
|
|
983
|
+
unchanged = this._cached !== NO_VALUE && this._equals(this._cached, value);
|
|
981
984
|
} catch (eqErr) {
|
|
982
985
|
const eqMsg = eqErr instanceof Error ? eqErr.message : String(eqErr);
|
|
983
986
|
const wrapped = new Error(`Node "${this.name}": equals threw: ${eqMsg}`, { cause: eqErr });
|
|
984
987
|
this._downInternal([[ERROR, wrapped]]);
|
|
985
988
|
return;
|
|
986
989
|
}
|
|
987
|
-
this._hasEmittedData = true;
|
|
988
990
|
if (unchanged) {
|
|
989
991
|
this._downInternal(wasDirty ? [[RESOLVED]] : [[DIRTY], [RESOLVED]]);
|
|
990
992
|
return;
|
|
@@ -1213,7 +1215,7 @@ var DynamicNodeImpl = class {
|
|
|
1213
1215
|
_actions;
|
|
1214
1216
|
_boundEmitToSinks;
|
|
1215
1217
|
// Mutable state
|
|
1216
|
-
_cached;
|
|
1218
|
+
_cached = NO_VALUE;
|
|
1217
1219
|
_status = "disconnected";
|
|
1218
1220
|
_terminal = false;
|
|
1219
1221
|
_connected = false;
|
|
@@ -1307,7 +1309,7 @@ var DynamicNodeImpl = class {
|
|
|
1307
1309
|
return this._guard(normalizeActor(actor), "observe");
|
|
1308
1310
|
}
|
|
1309
1311
|
get() {
|
|
1310
|
-
return this._cached;
|
|
1312
|
+
return this._cached === NO_VALUE ? void 0 : this._cached;
|
|
1311
1313
|
}
|
|
1312
1314
|
down(messages, options) {
|
|
1313
1315
|
if (messages.length === 0) return;
|
|
@@ -1365,6 +1367,7 @@ var DynamicNodeImpl = class {
|
|
|
1365
1367
|
}
|
|
1366
1368
|
if (this._terminal && this._resubscribable) {
|
|
1367
1369
|
this._terminal = false;
|
|
1370
|
+
this._cached = NO_VALUE;
|
|
1368
1371
|
this._status = "disconnected";
|
|
1369
1372
|
this._onResubscribe?.();
|
|
1370
1373
|
}
|
|
@@ -1442,10 +1445,13 @@ var DynamicNodeImpl = class {
|
|
|
1442
1445
|
const t = m[0];
|
|
1443
1446
|
if (t === DATA) this._cached = m[1];
|
|
1444
1447
|
if (t === INVALIDATE) {
|
|
1445
|
-
this._cached =
|
|
1448
|
+
this._cached = NO_VALUE;
|
|
1449
|
+
this._status = "dirty";
|
|
1446
1450
|
}
|
|
1447
|
-
if (t === DATA
|
|
1451
|
+
if (t === DATA) {
|
|
1448
1452
|
this._status = "settled";
|
|
1453
|
+
} else if (t === RESOLVED) {
|
|
1454
|
+
this._status = "resolved";
|
|
1449
1455
|
} else if (t === DIRTY) {
|
|
1450
1456
|
this._status = "dirty";
|
|
1451
1457
|
} else if (t === COMPLETE) {
|
|
@@ -1456,7 +1462,7 @@ var DynamicNodeImpl = class {
|
|
|
1456
1462
|
this._terminal = true;
|
|
1457
1463
|
}
|
|
1458
1464
|
if (t === TEARDOWN) {
|
|
1459
|
-
if (this._resetOnTeardown) this._cached =
|
|
1465
|
+
if (this._resetOnTeardown) this._cached = NO_VALUE;
|
|
1460
1466
|
try {
|
|
1461
1467
|
this._propagateToMeta(t);
|
|
1462
1468
|
} finally {
|
|
@@ -1479,7 +1485,15 @@ var DynamicNodeImpl = class {
|
|
|
1479
1485
|
}
|
|
1480
1486
|
_emitAutoValue(value) {
|
|
1481
1487
|
const wasDirty = this._status === "dirty";
|
|
1482
|
-
|
|
1488
|
+
let unchanged;
|
|
1489
|
+
try {
|
|
1490
|
+
unchanged = this._cached !== NO_VALUE && this._equals(this._cached, value);
|
|
1491
|
+
} catch (eqErr) {
|
|
1492
|
+
const eqMsg = eqErr instanceof Error ? eqErr.message : String(eqErr);
|
|
1493
|
+
const wrapped = new Error(`Node "${this.name}": equals threw: ${eqMsg}`, { cause: eqErr });
|
|
1494
|
+
this._downInternal([[ERROR, wrapped]]);
|
|
1495
|
+
return;
|
|
1496
|
+
}
|
|
1483
1497
|
if (unchanged) {
|
|
1484
1498
|
this._downInternal(wasDirty ? [[RESOLVED]] : [[DIRTY], [RESOLVED]]);
|
|
1485
1499
|
return;
|
|
@@ -3299,20 +3313,28 @@ var Graph = class _Graph {
|
|
|
3299
3313
|
return g;
|
|
3300
3314
|
}
|
|
3301
3315
|
/**
|
|
3302
|
-
* Plain snapshot with **recursively sorted object keys** for deterministic serialization (§3.8).
|
|
3316
|
+
* Plain snapshot object with **recursively sorted object keys** for deterministic serialization (§3.8).
|
|
3303
3317
|
*
|
|
3304
3318
|
* @remarks
|
|
3305
|
-
* ECMAScript `JSON.stringify(graph)` invokes this method; it must return a plain object, not an
|
|
3306
|
-
* already-stringified JSON string (otherwise the graph would be double-encoded).
|
|
3307
3319
|
* For a single UTF-8 string with a trailing newline (convenient for git), use {@link Graph.toJSONString}.
|
|
3308
3320
|
*
|
|
3309
3321
|
* @returns Same object as {@link Graph.snapshot}.
|
|
3310
3322
|
*/
|
|
3311
|
-
|
|
3323
|
+
toObject() {
|
|
3312
3324
|
return this.snapshot();
|
|
3313
3325
|
}
|
|
3314
3326
|
/**
|
|
3315
|
-
*
|
|
3327
|
+
* ECMAScript `JSON.stringify` hook — delegates to {@link Graph.toObject}.
|
|
3328
|
+
*
|
|
3329
|
+
* @remarks
|
|
3330
|
+
* Must return a plain object (not a string) so `JSON.stringify(graph)` works correctly
|
|
3331
|
+
* without double-encoding.
|
|
3332
|
+
*/
|
|
3333
|
+
toJSON() {
|
|
3334
|
+
return this.toObject();
|
|
3335
|
+
}
|
|
3336
|
+
/**
|
|
3337
|
+
* Deterministic JSON **text**: `JSON.stringify` of {@link Graph.toObject} plus a trailing newline (§3.8).
|
|
3316
3338
|
*
|
|
3317
3339
|
* @returns Stable string suitable for diffs.
|
|
3318
3340
|
*/
|