@graphrefly/graphrefly 0.11.0 → 0.13.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/dist/{chunk-FMVFRP7L.js → chunk-5RN7NBNG.js} +5 -5
  2. package/dist/{chunk-UG2QZMRN.js → chunk-6B2ZCCNN.js} +40 -39
  3. package/dist/chunk-6B2ZCCNN.js.map +1 -0
  4. package/dist/{chunk-2VHNCFGG.js → chunk-H4UFM6WD.js} +46 -17
  5. package/dist/chunk-H4UFM6WD.js.map +1 -0
  6. package/dist/{chunk-PZCDQD2U.js → chunk-HA6QMDKQ.js} +4 -4
  7. package/dist/{chunk-5WXTWOD7.js → chunk-KNGOJEYP.js} +2 -2
  8. package/dist/{chunk-OHUECHWY.js → chunk-PFMXKG4Y.js} +2 -2
  9. package/dist/{chunk-U5HFZGAQ.js → chunk-QOGWU5K7.js} +3 -3
  10. package/dist/{chunk-3WACHRHV.js → chunk-UPC5OEB5.js} +17 -17
  11. package/dist/chunk-UPC5OEB5.js.map +1 -0
  12. package/dist/{chunk-2OTXEZQO.js → chunk-UQI4GAHD.js} +3 -3
  13. package/dist/compat/nestjs/index.cjs +37 -37
  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 +39 -39
  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 +79 -51
  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 +5 -5
  28. package/dist/graph/index.cjs +37 -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-Bbgvinsi.d.ts → index-CKyYg4IP.d.ts} +17 -13
  38. package/dist/{index-CCvzN5GB.d.cts → index-DANO9Gg7.d.cts} +2 -2
  39. package/dist/{index-DpZozxaJ.d.cts → index-DBhLjWSV.d.cts} +17 -13
  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 +283 -71
  46. package/dist/index.cjs.map +1 -1
  47. package/dist/index.d.cts +85 -15
  48. package/dist/index.d.ts +85 -15
  49. package/dist/index.js +200 -16
  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 +50 -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 +1 -1
  61. package/dist/chunk-2VHNCFGG.js.map +0 -1
  62. package/dist/chunk-3WACHRHV.js.map +0 -1
  63. package/dist/chunk-UG2QZMRN.js.map +0 -1
  64. /package/dist/{chunk-FMVFRP7L.js.map → chunk-5RN7NBNG.js.map} +0 -0
  65. /package/dist/{chunk-PZCDQD2U.js.map → chunk-HA6QMDKQ.js.map} +0 -0
  66. /package/dist/{chunk-5WXTWOD7.js.map → chunk-KNGOJEYP.js.map} +0 -0
  67. /package/dist/{chunk-OHUECHWY.js.map → chunk-PFMXKG4Y.js.map} +0 -0
  68. /package/dist/{chunk-U5HFZGAQ.js.map → chunk-QOGWU5K7.js.map} +0 -0
  69. /package/dist/{chunk-2OTXEZQO.js.map → chunk-UQI4GAHD.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- export { A as Actor, C as CLEANUP_RESULT, d as COMPLETE, e as CleanupResult, D as DATA, f as DEFAULT_ACTOR, g as DIRTY, h as DescribeDetail, i as DescribeField, j as DescribeNodeOutput, E as ERROR, G as GuardAction, k as GuardDenied, l as GuardDeniedDetails, H as HashFn, I as INVALIDATE, M as Message, m as Messages, N as Node, b as NodeActions, n as NodeDescribeKind, c as NodeFn, o as NodeGuard, a as NodeOptions, p as NodeSink, q as NodeStatus, r as NodeTransportOptions, s as NodeVersionInfo, O as OnMessageHandler, P as PAUSE, t as PolicyAllow, u as PolicyDeny, v as PolicyRuleData, R as RESOLVED, w as RESUME, S as SubscribeHints, T as TEARDOWN, V as V0, x as V1, y as VersioningLevel, z as VersioningOptions, B as accessHintForGuard, F as advanceVersion, J as cleanupResult, K as createVersioning, L as defaultHash, Q as describeNode, U as isKnownMessageType, W as isPhase2Message, X as isTerminalMessage, Y as isV1, Z as knownMessageTypes, _ as messageTier, $ as metaSnapshot, a0 as node, a1 as normalizeActor, a2 as policy, a3 as policyFromRules, a4 as propagatesToMeta, a5 as resolveDescribeFields } from '../meta-BcuDhtwu.cjs';
2
- export { B as BridgeOptions, D as DEFAULT_DOWN, a as DynGet, b as DynamicNodeFn, c as DynamicNodeImpl, d as DynamicNodeOptions, P as PipeOperator, R as ResettableTimer, e as batch, f as bridge, g as derived, h as dynamicNode, j as effect, k as emitWithBatch, l as isBatching, m as monotonicNs, p as partitionForBatch, n as pipe, o as producer, s as state, w as wallClockNs } from '../index-QfbXNW1N.cjs';
1
+ export { A as Actor, C as CLEANUP_RESULT, d as COMPLETE, e as CleanupResult, D as DATA, f as DEFAULT_ACTOR, g as DIRTY, h as DescribeDetail, i as DescribeField, j as DescribeNodeOutput, E as ERROR, G as GuardAction, k as GuardDenied, l as GuardDeniedDetails, H as HashFn, I as INVALIDATE, M as Message, m as Messages, N as Node, b as NodeActions, n as NodeDescribeKind, c as NodeFn, o as NodeGuard, a as NodeOptions, p as NodeSink, q as NodeStatus, r as NodeTransportOptions, s as NodeVersionInfo, O as OnMessageHandler, P as PAUSE, t as PolicyAllow, u as PolicyDeny, v as PolicyRuleData, R as RESOLVED, w as RESUME, S as SubscribeHints, T as TEARDOWN, V as V0, x as V1, y as VersioningLevel, z as VersioningOptions, B as accessHintForGuard, F as advanceVersion, J as cleanupResult, K as createVersioning, L as defaultHash, Q as describeNode, U as isKnownMessageType, W as isPhase2Message, X as isTerminalMessage, Y as isV1, Z as knownMessageTypes, _ as messageTier, $ as metaSnapshot, a0 as node, a1 as normalizeActor, a2 as policy, a3 as policyFromRules, a4 as propagatesToMeta, a5 as resolveDescribeFields } from '../meta-CrZUQAJ6.cjs';
2
+ export { B as BridgeOptions, D as DEFAULT_DOWN, a as DownStrategy, b as DynGet, c as DynamicNodeFn, d as DynamicNodeImpl, e as DynamicNodeOptions, P as PipeOperator, R as ResettableTimer, f as batch, g as bridge, h as derived, j as downWithBatch, k as dynamicNode, l as effect, m as isBatching, n as monotonicNs, p as partitionForBatch, o as pipe, q as producer, s as state, w as wallClockNs } from '../index-DKIyo4Bq.cjs';
@@ -1,2 +1,2 @@
1
- export { A as Actor, C as CLEANUP_RESULT, d as COMPLETE, e as CleanupResult, D as DATA, f as DEFAULT_ACTOR, g as DIRTY, h as DescribeDetail, i as DescribeField, j as DescribeNodeOutput, E as ERROR, G as GuardAction, k as GuardDenied, l as GuardDeniedDetails, H as HashFn, I as INVALIDATE, M as Message, m as Messages, N as Node, b as NodeActions, n as NodeDescribeKind, c as NodeFn, o as NodeGuard, a as NodeOptions, p as NodeSink, q as NodeStatus, r as NodeTransportOptions, s as NodeVersionInfo, O as OnMessageHandler, P as PAUSE, t as PolicyAllow, u as PolicyDeny, v as PolicyRuleData, R as RESOLVED, w as RESUME, S as SubscribeHints, T as TEARDOWN, V as V0, x as V1, y as VersioningLevel, z as VersioningOptions, B as accessHintForGuard, F as advanceVersion, J as cleanupResult, K as createVersioning, L as defaultHash, Q as describeNode, U as isKnownMessageType, W as isPhase2Message, X as isTerminalMessage, Y as isV1, Z as knownMessageTypes, _ as messageTier, $ as metaSnapshot, a0 as node, a1 as normalizeActor, a2 as policy, a3 as policyFromRules, a4 as propagatesToMeta, a5 as resolveDescribeFields } from '../meta-BcuDhtwu.js';
2
- export { B as BridgeOptions, D as DEFAULT_DOWN, a as DynGet, b as DynamicNodeFn, c as DynamicNodeImpl, d as DynamicNodeOptions, P as PipeOperator, R as ResettableTimer, e as batch, f as bridge, g as derived, h as dynamicNode, j as effect, k as emitWithBatch, l as isBatching, m as monotonicNs, p as partitionForBatch, n as pipe, o as producer, s as state, w as wallClockNs } from '../index-Dzdm20sx.js';
1
+ export { A as Actor, C as CLEANUP_RESULT, d as COMPLETE, e as CleanupResult, D as DATA, f as DEFAULT_ACTOR, g as DIRTY, h as DescribeDetail, i as DescribeField, j as DescribeNodeOutput, E as ERROR, G as GuardAction, k as GuardDenied, l as GuardDeniedDetails, H as HashFn, I as INVALIDATE, M as Message, m as Messages, N as Node, b as NodeActions, n as NodeDescribeKind, c as NodeFn, o as NodeGuard, a as NodeOptions, p as NodeSink, q as NodeStatus, r as NodeTransportOptions, s as NodeVersionInfo, O as OnMessageHandler, P as PAUSE, t as PolicyAllow, u as PolicyDeny, v as PolicyRuleData, R as RESOLVED, w as RESUME, S as SubscribeHints, T as TEARDOWN, V as V0, x as V1, y as VersioningLevel, z as VersioningOptions, B as accessHintForGuard, F as advanceVersion, J as cleanupResult, K as createVersioning, L as defaultHash, Q as describeNode, U as isKnownMessageType, W as isPhase2Message, X as isTerminalMessage, Y as isV1, Z as knownMessageTypes, _ as messageTier, $ as metaSnapshot, a0 as node, a1 as normalizeActor, a2 as policy, a3 as policyFromRules, a4 as propagatesToMeta, a5 as resolveDescribeFields } from '../meta-CrZUQAJ6.js';
2
+ export { B as BridgeOptions, D as DEFAULT_DOWN, a as DownStrategy, b as DynGet, c as DynamicNodeFn, d as DynamicNodeImpl, e as DynamicNodeOptions, P as PipeOperator, R as ResettableTimer, f as batch, g as bridge, h as derived, j as downWithBatch, k as dynamicNode, l as effect, m as isBatching, n as monotonicNs, p as partitionForBatch, o as pipe, q as producer, s as state, w as wallClockNs } from '../index-BNB0KjKe.js';
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DEFAULT_DOWN,
3
3
  bridge
4
- } from "../chunk-FMVFRP7L.js";
4
+ } from "../chunk-5RN7NBNG.js";
5
5
  import {
6
6
  ResettableTimer
7
7
  } from "../chunk-WZ2Z2CRV.js";
@@ -9,7 +9,7 @@ import {
9
9
  describeNode,
10
10
  metaSnapshot,
11
11
  resolveDescribeFields
12
- } from "../chunk-OHUECHWY.js";
12
+ } from "../chunk-PFMXKG4Y.js";
13
13
  import {
14
14
  CLEANUP_RESULT,
15
15
  COMPLETE,
@@ -31,9 +31,9 @@ import {
31
31
  createVersioning,
32
32
  defaultHash,
33
33
  derived,
34
+ downWithBatch,
34
35
  dynamicNode,
35
36
  effect,
36
- emitWithBatch,
37
37
  isBatching,
38
38
  isKnownMessageType,
39
39
  isPhase2Message,
@@ -52,7 +52,7 @@ import {
52
52
  propagatesToMeta,
53
53
  state,
54
54
  wallClockNs
55
- } from "../chunk-UG2QZMRN.js";
55
+ } from "../chunk-6B2ZCCNN.js";
56
56
  export {
57
57
  CLEANUP_RESULT,
58
58
  COMPLETE,
@@ -78,9 +78,9 @@ export {
78
78
  defaultHash,
79
79
  derived,
80
80
  describeNode,
81
+ downWithBatch,
81
82
  dynamicNode,
82
83
  effect,
83
- emitWithBatch,
84
84
  isBatching,
85
85
  isKnownMessageType,
86
86
  isPhase2Message,
@@ -98,7 +98,6 @@ __export(extra_exports, {
98
98
  fromTimer: () => fromTimer,
99
99
  fromWebSocket: () => fromWebSocket,
100
100
  fromWebhook: () => fromWebhook,
101
- gate: () => gate,
102
101
  globToRegExp: () => globToRegExp,
103
102
  interval: () => interval,
104
103
  last: () => last,
@@ -177,6 +176,7 @@ __export(extra_exports, {
177
176
  toWebSocket: () => toWebSocket,
178
177
  tokenBucket: () => tokenBucket,
179
178
  tokenTracker: () => tokenTracker,
179
+ valve: () => valve,
180
180
  verifiable: () => verifiable,
181
181
  window: () => window,
182
182
  windowCount: () => windowCount,
@@ -339,12 +339,12 @@ function partitionForBatch(messages) {
339
339
  }
340
340
  return { immediate, deferred, terminal };
341
341
  }
342
- function emitWithBatch(emit, messages, phase = 2, options) {
342
+ function downWithBatch(sink, messages, phase = 2, options) {
343
343
  if (messages.length === 0) {
344
344
  return;
345
345
  }
346
346
  if (options?.strategy === "sequential") {
347
- _emitSequential(emit, messages, phase);
347
+ _downSequential(sink, messages, phase);
348
348
  return;
349
349
  }
350
350
  const queue = phase === 3 ? pendingPhase3 : pendingPhase2;
@@ -352,61 +352,61 @@ function emitWithBatch(emit, messages, phase = 2, options) {
352
352
  const t = messages[0][0];
353
353
  if (t === DATA || t === RESOLVED) {
354
354
  if (isBatching()) {
355
- queue.push(() => emit(messages));
355
+ queue.push(() => sink(messages));
356
356
  } else {
357
- emit(messages);
357
+ sink(messages);
358
358
  }
359
359
  } else if (isTerminalMessage(t)) {
360
360
  if (isBatching()) {
361
- queue.push(() => emit(messages));
361
+ queue.push(() => sink(messages));
362
362
  } else {
363
- emit(messages);
363
+ sink(messages);
364
364
  }
365
365
  } else {
366
- emit(messages);
366
+ sink(messages);
367
367
  }
368
368
  return;
369
369
  }
370
370
  const { immediate, deferred, terminal } = partitionForBatch(messages);
371
371
  if (immediate.length > 0) {
372
- emit(immediate);
372
+ sink(immediate);
373
373
  }
374
374
  if (isBatching()) {
375
375
  if (deferred.length > 0) {
376
- queue.push(() => emit(deferred));
376
+ queue.push(() => sink(deferred));
377
377
  }
378
378
  if (terminal.length > 0) {
379
- queue.push(() => emit(terminal));
379
+ queue.push(() => sink(terminal));
380
380
  }
381
381
  } else {
382
382
  if (deferred.length > 0) {
383
- emit(deferred);
383
+ sink(deferred);
384
384
  }
385
385
  if (terminal.length > 0) {
386
- emit(terminal);
386
+ sink(terminal);
387
387
  }
388
388
  }
389
389
  }
390
- function _emitSequential(emit, messages, phase = 2) {
390
+ function _downSequential(sink, messages, phase = 2) {
391
391
  const dataQueue = phase === 3 ? pendingPhase3 : pendingPhase2;
392
392
  for (const msg of messages) {
393
393
  const tier = messageTier(msg[0]);
394
394
  if (tier === 2) {
395
395
  if (isBatching()) {
396
396
  const m = msg;
397
- dataQueue.push(() => emit([m]));
397
+ dataQueue.push(() => sink([m]));
398
398
  } else {
399
- emit([msg]);
399
+ sink([msg]);
400
400
  }
401
401
  } else if (tier >= 3) {
402
402
  if (isBatching()) {
403
403
  const m = msg;
404
- pendingPhase3.push(() => emit([m]));
404
+ pendingPhase3.push(() => sink([m]));
405
405
  } else {
406
- emit([msg]);
406
+ sink([msg]);
407
407
  }
408
408
  } else {
409
- emit([msg]);
409
+ sink([msg]);
410
410
  }
411
411
  }
412
412
  }
@@ -624,7 +624,7 @@ var NodeImpl = class {
624
624
  _singleDepSinks = /* @__PURE__ */ new WeakSet();
625
625
  _upstreamUnsubs = [];
626
626
  _actions;
627
- _boundEmitToSinks;
627
+ _boundDownToSinks;
628
628
  _inspectorHook;
629
629
  _versioning;
630
630
  _hashFn;
@@ -671,7 +671,7 @@ var NodeImpl = class {
671
671
  },
672
672
  emit(value) {
673
673
  self._manualEmitUsed = true;
674
- self._emitAutoValue(value);
674
+ self._downAutoValue(value);
675
675
  },
676
676
  up(messages) {
677
677
  self._upInternal(messages);
@@ -679,7 +679,7 @@ var NodeImpl = class {
679
679
  };
680
680
  this.down = this.down.bind(this);
681
681
  this.up = this.up.bind(this);
682
- this._boundEmitToSinks = this._emitToSinks.bind(this);
682
+ this._boundDownToSinks = this._downToSinks.bind(this);
683
683
  }
684
684
  get name() {
685
685
  return this._registryName ?? this._optsName;
@@ -785,12 +785,12 @@ var NodeImpl = class {
785
785
  if (sinkMessages[i][0] !== DIRTY) filtered.push(sinkMessages[i]);
786
786
  }
787
787
  if (filtered.length > 0) {
788
- emitWithBatch(this._boundEmitToSinks, filtered);
788
+ downWithBatch(this._boundDownToSinks, filtered);
789
789
  }
790
790
  return;
791
791
  }
792
792
  }
793
- emitWithBatch(this._boundEmitToSinks, sinkMessages);
793
+ downWithBatch(this._boundDownToSinks, sinkMessages);
794
794
  }
795
795
  subscribe(sink, hints) {
796
796
  if (hints?.actor != null && this._guard != null) {
@@ -877,7 +877,7 @@ var NodeImpl = class {
877
877
  this._disconnectUpstream();
878
878
  }
879
879
  // --- Private methods (prototype, _ prefix) ---
880
- _emitToSinks(messages) {
880
+ _downToSinks(messages) {
881
881
  if (this._sinks == null) return;
882
882
  if (typeof this._sinks === "function") {
883
883
  this._sinks(messages);
@@ -939,7 +939,7 @@ var NodeImpl = class {
939
939
  _canSkipDirty() {
940
940
  return this._sinkCount === 1 && this._singleDepSinkCount === 1;
941
941
  }
942
- _emitAutoValue(value) {
942
+ _downAutoValue(value) {
943
943
  const wasDirty = this._status === "dirty";
944
944
  let unchanged;
945
945
  try {
@@ -992,7 +992,7 @@ var NodeImpl = class {
992
992
  this._cleanup = out.cleanup;
993
993
  if (this._manualEmitUsed) return;
994
994
  if ("value" in out) {
995
- this._emitAutoValue(out.value);
995
+ this._downAutoValue(out.value);
996
996
  }
997
997
  return;
998
998
  }
@@ -1002,7 +1002,7 @@ var NodeImpl = class {
1002
1002
  }
1003
1003
  if (this._manualEmitUsed) return;
1004
1004
  if (out === void 0) return;
1005
- this._emitAutoValue(out);
1005
+ this._downAutoValue(out);
1006
1006
  } catch (err) {
1007
1007
  const errMsg = err instanceof Error ? err.message : String(err);
1008
1008
  const wrapped = new Error(`Node "${this.name}": fn threw: ${errMsg}`, { cause: err });
@@ -5151,7 +5151,7 @@ var DynamicNodeImpl = class {
5151
5151
  _singleDepSinks = /* @__PURE__ */ new WeakSet();
5152
5152
  // Actions object (for onMessage handler)
5153
5153
  _actions;
5154
- _boundEmitToSinks;
5154
+ _boundDownToSinks;
5155
5155
  // Mutable state
5156
5156
  _cached = NO_VALUE;
5157
5157
  _status = "disconnected";
@@ -5198,7 +5198,7 @@ var DynamicNodeImpl = class {
5198
5198
  self._downInternal(messages);
5199
5199
  },
5200
5200
  emit(value) {
5201
- self._emitAutoValue(value);
5201
+ self._downAutoValue(value);
5202
5202
  },
5203
5203
  up(messages) {
5204
5204
  for (const dep of self._deps) {
@@ -5206,7 +5206,7 @@ var DynamicNodeImpl = class {
5206
5206
  }
5207
5207
  }
5208
5208
  };
5209
- this._boundEmitToSinks = this._emitToSinks.bind(this);
5209
+ this._boundDownToSinks = this._downToSinks.bind(this);
5210
5210
  }
5211
5211
  get name() {
5212
5212
  return this._registryName ?? this._optsName;
@@ -5286,12 +5286,12 @@ var DynamicNodeImpl = class {
5286
5286
  if (sinkMessages[i][0] !== DIRTY) filtered.push(sinkMessages[i]);
5287
5287
  }
5288
5288
  if (filtered.length > 0) {
5289
- emitWithBatch(this._boundEmitToSinks, filtered);
5289
+ downWithBatch(this._boundDownToSinks, filtered);
5290
5290
  }
5291
5291
  return;
5292
5292
  }
5293
5293
  }
5294
- emitWithBatch(this._boundEmitToSinks, sinkMessages);
5294
+ downWithBatch(this._boundDownToSinks, sinkMessages);
5295
5295
  }
5296
5296
  _canSkipDirty() {
5297
5297
  return this._sinkCount === 1 && this._singleDepSinkCount === 1;
@@ -5367,7 +5367,7 @@ var DynamicNodeImpl = class {
5367
5367
  this._disconnect();
5368
5368
  }
5369
5369
  // --- Private methods ---
5370
- _emitToSinks(messages) {
5370
+ _downToSinks(messages) {
5371
5371
  if (this._sinks == null) return;
5372
5372
  if (typeof this._sinks === "function") {
5373
5373
  this._sinks(messages);
@@ -5421,7 +5421,7 @@ var DynamicNodeImpl = class {
5421
5421
  }
5422
5422
  }
5423
5423
  }
5424
- _emitAutoValue(value) {
5424
+ _downAutoValue(value) {
5425
5425
  const wasDirty = this._status === "dirty";
5426
5426
  let unchanged;
5427
5427
  try {
@@ -5481,7 +5481,7 @@ var DynamicNodeImpl = class {
5481
5481
  const result = this._fn(get);
5482
5482
  this._rewire(trackedDeps);
5483
5483
  if (result === void 0) return;
5484
- this._emitAutoValue(result);
5484
+ this._downAutoValue(result);
5485
5485
  } catch (err) {
5486
5486
  this._downInternal([[ERROR, err]]);
5487
5487
  }
@@ -5545,14 +5545,14 @@ var DynamicNodeImpl = class {
5545
5545
  this._dirtyBits.add(index);
5546
5546
  this._settledBits.delete(index);
5547
5547
  if (this._dirtyBits.size === 1) {
5548
- emitWithBatch(this._boundEmitToSinks, [[DIRTY]]);
5548
+ downWithBatch(this._boundDownToSinks, [[DIRTY]]);
5549
5549
  }
5550
5550
  continue;
5551
5551
  }
5552
5552
  if (t === DATA || t === RESOLVED) {
5553
5553
  if (!this._dirtyBits.has(index)) {
5554
5554
  this._dirtyBits.add(index);
5555
- emitWithBatch(this._boundEmitToSinks, [[DIRTY]]);
5555
+ downWithBatch(this._boundDownToSinks, [[DIRTY]]);
5556
5556
  }
5557
5557
  this._settledBits.add(index);
5558
5558
  if (this._allDirtySettled()) {
@@ -6668,30 +6668,58 @@ function throttle(source, ms, opts) {
6668
6668
  );
6669
6669
  }
6670
6670
  function sample(source, notifier, opts) {
6671
+ let lastSourceValue = NO_VALUE;
6672
+ let terminated = false;
6673
+ let sourceCompleted = false;
6671
6674
  return node([source, notifier], () => void 0, {
6672
6675
  ...operatorOpts3(opts),
6673
6676
  completeWhenDepsComplete: false,
6677
+ onResubscribe: opts?.resubscribable === true ? () => {
6678
+ lastSourceValue = NO_VALUE;
6679
+ terminated = false;
6680
+ sourceCompleted = false;
6681
+ } : void 0,
6674
6682
  onMessage(msg, i, a) {
6683
+ if (terminated) return true;
6675
6684
  const t = msg[0];
6676
- if (t === ERROR) {
6685
+ const tier = messageTier(t);
6686
+ if (tier >= 3) {
6687
+ if (t === ERROR) {
6688
+ terminated = true;
6689
+ a.down([msg]);
6690
+ return true;
6691
+ }
6692
+ if (t === COMPLETE) {
6693
+ if (i === 0) {
6694
+ sourceCompleted = true;
6695
+ lastSourceValue = NO_VALUE;
6696
+ return true;
6697
+ }
6698
+ terminated = true;
6699
+ a.down([msg]);
6700
+ return true;
6701
+ }
6677
6702
  a.down([msg]);
6678
6703
  return true;
6679
6704
  }
6680
- if (t === COMPLETE) {
6705
+ if (i === 0) {
6706
+ if (t === DATA) {
6707
+ lastSourceValue = msg[1];
6708
+ return true;
6709
+ }
6710
+ if (t === DIRTY || t === RESOLVED) return true;
6681
6711
  a.down([msg]);
6682
6712
  return true;
6683
6713
  }
6684
- if (i === 1 && t === DATA) {
6685
- a.emit(source.get());
6686
- return true;
6687
- }
6688
- if (i === 1 && t === RESOLVED) {
6689
- return true;
6690
- }
6691
- if (i === 0) {
6714
+ if (t === DATA) {
6715
+ if (lastSourceValue !== NO_VALUE && !sourceCompleted) {
6716
+ a.emit(lastSourceValue);
6717
+ }
6692
6718
  return true;
6693
6719
  }
6694
- return false;
6720
+ if (t === RESOLVED) return true;
6721
+ a.down([msg]);
6722
+ return true;
6695
6723
  }
6696
6724
  });
6697
6725
  }
@@ -7158,7 +7186,7 @@ function rescue(source, recover, opts) {
7158
7186
  }
7159
7187
  });
7160
7188
  }
7161
- function gate(source, control, opts) {
7189
+ function valve(source, control, opts) {
7162
7190
  return node(
7163
7191
  [source, control],
7164
7192
  (_deps, a) => {
@@ -8368,7 +8396,6 @@ function workerSelf(target, opts) {
8368
8396
  fromTimer,
8369
8397
  fromWebSocket,
8370
8398
  fromWebhook,
8371
- gate,
8372
8399
  globToRegExp,
8373
8400
  interval,
8374
8401
  last,
@@ -8447,6 +8474,7 @@ function workerSelf(target, opts) {
8447
8474
  toWebSocket,
8448
8475
  tokenBucket,
8449
8476
  tokenTracker,
8477
+ valve,
8450
8478
  verifiable,
8451
8479
  window,
8452
8480
  windowCount,