@wardic/core 1.0.0-rc.4 → 1.0.0-rc.6

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 (45) hide show
  1. package/dist/Clock.d.ts.map +1 -1
  2. package/dist/Clock.js +20 -12
  3. package/dist/Clock.js.map +1 -1
  4. package/dist/FrameLoop.d.ts +12 -1
  5. package/dist/FrameLoop.d.ts.map +1 -1
  6. package/dist/FrameLoop.js +23 -1
  7. package/dist/FrameLoop.js.map +1 -1
  8. package/dist/LiveValue.d.ts +4 -3
  9. package/dist/LiveValue.d.ts.map +1 -1
  10. package/dist/LiveValue.js +7 -5
  11. package/dist/LiveValue.js.map +1 -1
  12. package/dist/Probe.d.ts +5 -47
  13. package/dist/Probe.d.ts.map +1 -1
  14. package/dist/Probe.js +5 -5
  15. package/dist/Probe.js.map +1 -1
  16. package/dist/ScrollSource.d.ts +62 -0
  17. package/dist/ScrollSource.d.ts.map +1 -0
  18. package/dist/ScrollSource.js +21 -0
  19. package/dist/ScrollSource.js.map +1 -0
  20. package/dist/SharedSource.d.ts +35 -15
  21. package/dist/SharedSource.d.ts.map +1 -1
  22. package/dist/SharedSource.js +84 -108
  23. package/dist/SharedSource.js.map +1 -1
  24. package/dist/index.d.ts +2 -1
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +2 -1
  27. package/dist/index.js.map +1 -1
  28. package/dist/internal/frameLoop.d.ts +17 -0
  29. package/dist/internal/frameLoop.d.ts.map +1 -1
  30. package/dist/internal/frameLoop.js +33 -20
  31. package/dist/internal/frameLoop.js.map +1 -1
  32. package/dist/internal/hearing.d.ts +13 -0
  33. package/dist/internal/hearing.d.ts.map +1 -0
  34. package/dist/internal/hearing.js +71 -0
  35. package/dist/internal/hearing.js.map +1 -0
  36. package/package.json +1 -1
  37. package/src/Clock.ts +29 -17
  38. package/src/FrameLoop.ts +24 -1
  39. package/src/LiveValue.ts +9 -7
  40. package/src/Probe.ts +8 -54
  41. package/src/ScrollSource.ts +68 -0
  42. package/src/SharedSource.ts +113 -146
  43. package/src/index.ts +2 -1
  44. package/src/internal/frameLoop.ts +41 -18
  45. package/src/internal/hearing.ts +76 -0
@@ -29,11 +29,11 @@
29
29
  *
30
30
  * Observability: a span per run, named after its Primitive (`machine.span`), and one per burst
31
31
  * (`wardic.frameloop`). A run's `<name>: start` debug log, annotated with its span's attributes,
32
- * built only when a Debug log would be kept (#542). Per tick, no span or log: a gauge of running
33
- * animations and a histogram of ms per tick, each one `updateUnsafe` (ADR-0027, decision 6), and the
34
- * runs that settled or failed in it, counted as they end and added at its end by the loop's own
35
- * `afterTick` hook, its first (#542). The histogram ends before the hooks, so it measures the steps
36
- * alone, not the gate's flush (ADR-0033).
32
+ * built only when a Debug log would be kept (#542). Per tick, no span or log. With the metrics an app
33
+ * gives (`FrameLoop.layerMetrics`, #518): a gauge of running animations and a histogram of ms per tick,
34
+ * each one `updateUnsafe` (ADR-0027, decision 6), and the runs that settled or failed in it, counted as
35
+ * they end and added at its end by the loop's own `afterTick` hook, its first (#542). The histogram ends
36
+ * before the hooks, so it measures the steps alone, not the gate's flush (ADR-0033).
37
37
  *
38
38
  * A run's span is opened without a stack frame (ADR-0040, decision 3): `useSpan` with the span as
39
39
  * the `ParentSpan`, not `withSpan`, whose frame Effect stamps on an interrupted run's cause and
@@ -57,7 +57,6 @@ import * as Exit from "effect/Exit";
57
57
  import * as FiberHandle from "effect/FiberHandle";
58
58
  import { constUndefined, identity } from "effect/Function";
59
59
  import * as LogLevel from "effect/LogLevel";
60
- import * as Metric from "effect/Metric";
61
60
  import * as Option from "effect/Option";
62
61
  import * as Predicate from "effect/Predicate";
63
62
  import * as References from "effect/References";
@@ -66,12 +65,13 @@ import * as Tracer from "effect/Tracer";
66
65
  import * as Clock from "../Clock.js";
67
66
  import * as Supersede from "../Supersede.js";
68
67
  import { isTraced, traced } from "./tracing.js";
69
- const animations = Metric.gauge("wardic_frameloop_animations", { description: "Primitives running on the Frame loop" });
70
- const settledRuns = Metric.counter("wardic_frameloop_settled", { description: "Runs on the Frame loop that settled" });
71
- const failedRuns = Metric.counter("wardic_frameloop_failed", { description: "Runs on the Frame loop that failed" });
72
- const tickMs = Metric.histogram("wardic_frameloop_tick_ms", {
73
- description: "Milliseconds the Frame loop spends on one tick",
74
- boundaries: Metric.linearBoundaries({ start: 0, width: 0.5, count: 32 }),
68
+ /**
69
+ * Where a run's fiber finds the metrics. The loop takes them from the first run that has them: an app
70
+ * gives them beside its Environment, which the loop's own build doesn't see, as `CheckFrames` is read.
71
+ */
72
+ // #518, ADR-0067 *Amendment (#518)*, decision 2.
73
+ export const MetricsGiven = Context.Reference("@wardic/core/FrameLoop/Metrics", {
74
+ defaultValue: constUndefined,
75
75
  });
76
76
  /**
77
77
  * A check for development, off by default: on, every run started where it's on checks each Frame before
@@ -174,6 +174,8 @@ export const make = Effect.fnUntraced(function* () {
174
174
  // once per tick. An interruption is neither, nor a superseded run, which the loop doesn't end.
175
175
  let settledCount = 0;
176
176
  let failedCount = 0;
177
+ // The metrics, once a run brings them (#518).
178
+ let metrics;
177
179
  /** End `entry`'s run: removed, counted, and its fiber resumed with `exit` (inline, within the tick). */
178
180
  const end = (entry, exit) => {
179
181
  entry.removed = true;
@@ -185,10 +187,12 @@ export const make = Effect.fnUntraced(function* () {
185
187
  };
186
188
  /** The runs ended since the last count, into the counters: once per tick, and as a burst ends. */
187
189
  const countEnds = () => {
188
- if (settledCount > 0)
189
- settledRuns.updateUnsafe(settledCount, buildContext);
190
- if (failedCount > 0)
191
- failedRuns.updateUnsafe(failedCount, buildContext);
190
+ if (Predicate.isNotUndefined(metrics)) {
191
+ if (settledCount > 0)
192
+ metrics.settled.updateUnsafe(settledCount, buildContext);
193
+ if (failedCount > 0)
194
+ metrics.failed.updateUnsafe(failedCount, buildContext);
195
+ }
192
196
  settledCount = 0;
193
197
  failedCount = 0;
194
198
  return undefined;
@@ -234,7 +238,10 @@ export const make = Effect.fnUntraced(function* () {
234
238
  // The first lane's loops stay inline in `tick`: moved into a function shared with the last lane,
235
239
  // Node's `chase/loop` ran 55% slower (`bench:core`, ADR-0027 *Amendment (#137)*).
236
240
  const tick = (dt) => {
237
- const t0 = performance.now();
241
+ // The tick's start, read only for the metrics' histogram (#518).
242
+ let t0 = 0;
243
+ if (Predicate.isNotUndefined(metrics))
244
+ t0 = performance.now();
238
245
  // Both counts before any step: a run added during the tick, to either lane, waits for the next.
239
246
  const count = entries.length;
240
247
  const lastCount = lastEntries.length;
@@ -267,8 +274,10 @@ export const make = Effect.fnUntraced(function* () {
267
274
  entries.length = kept;
268
275
  if (lastEntries.length > 0)
269
276
  kept += compactLast();
270
- animations.updateUnsafe(kept, buildContext);
271
- tickMs.updateUnsafe(performance.now() - t0, buildContext);
277
+ if (Predicate.isNotUndefined(metrics)) {
278
+ metrics.animations.updateUnsafe(kept, buildContext);
279
+ metrics.tickMs.updateUnsafe(performance.now() - t0, buildContext);
280
+ }
272
281
  // The end of the tick: everything for this Refresh frame is written (ADR-0033). After
273
282
  // `tickMs`, which stays the cost of the steps alone.
274
283
  const ended = hooks;
@@ -299,7 +308,8 @@ export const make = Effect.fnUntraced(function* () {
299
308
  if (!entry.removed)
300
309
  end(entry, ending);
301
310
  });
302
- animations.updateUnsafe(0, buildContext);
311
+ if (Predicate.isNotUndefined(metrics))
312
+ metrics.animations.updateUnsafe(0, buildContext);
303
313
  countEnds();
304
314
  };
305
315
  const ticking = clock.ticks.pipe(Stream.map(tick), Stream.takeUntil(identity), Stream.runDrain, Effect.onExit((exit) => Effect.sync(() => endAll(exit))), (self) => traced(self, "wardic.frameloop", { root: true }), Effect.provideContext(buildContext));
@@ -323,6 +333,9 @@ export const make = Effect.fnUntraced(function* () {
323
333
  const runIn = (lane) => ((machine, sink, options) => Effect.withFiber((fiber) => {
324
334
  // Its start log only when a Debug log would be kept (#542): Effect's own rule, read once.
325
335
  const logged = !LogLevel.isGreaterThan(fiber.getRef(References.MinimumLogLevel), "Debug");
336
+ // The metrics from the first run whose fiber has them (#518); none is read once they're in.
337
+ if (Predicate.isUndefined(metrics))
338
+ metrics = fiber.getRef(MetricsGiven);
326
339
  if (!isTraced(fiber))
327
340
  return added(lane, machine, sink, options, undefined, logged);
328
341
  return Effect.useSpan(machine.span.name, { attributes: machine.span.attributes }, (span) => Effect.provideService(added(lane, machine, sink, options, span, logged), Tracer.ParentSpan, span));
@@ -1 +1 @@
1
- {"version":3,"file":"frameLoop.js","sourceRoot":"","sources":["../../src/internal/frameLoop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAA;AACtC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AACnC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AACnC,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAA;AAE/C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,aAAa,CAAA;AAEpC,OAAO,KAAK,SAAS,MAAM,i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,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;QACtC,MAAM,KAAK,GAAU;YACnB,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI;YACvB,IAAI,EAAE,OAAO,CAAC,KAAK,EAAE;YACrB,IAAI,EAAE,WAAmD;YACzD,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,OAAO,EAAE,QAAQ,CAAC,UAAU,EAA+C;YAC3E,OAAO,EAAE,KAAK;SACf,CAAA;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAChB,IAAI,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC;YAAE,aAAa,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;QAC9E,OAAO,MAAM,CAAC,EAAE,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;IACrC,CAAC,CAAA;IAED,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,EAAE,SAAS,EAAkB,CAAA;AACxF,CAAC,EACD,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,uBAAuB,CAAC,CAChD,CAAA"}
@@ -0,0 +1,13 @@
1
+ import * as Exit from "effect/Exit";
2
+ import * as Stream from "effect/Stream";
3
+ export interface Hearing<A> {
4
+ /** Hands the Stream `a`. */
5
+ readonly hear: (a: A) => void;
6
+ /** Ends the Stream after what it was handed: failed with `exit`'s failure, else ended. An interruption ends it. */
7
+ readonly end: (exit: Exit.Exit<void>) => void;
8
+ /** What it was handed, in order, until its end. */
9
+ readonly stream: Stream.Stream<A>;
10
+ }
11
+ /** A fresh hearing, handed nothing yet. */
12
+ export declare const make: <A>() => Hearing<A>;
13
+ //# sourceMappingURL=hearing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hearing.d.ts","sourceRoot":"","sources":["../../src/internal/hearing.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AAGnC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,MAAM,WAAW,OAAO,CAAC,CAAC;IACxB,4BAA4B;IAC5B,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,CAAA;IAC7B,mHAAmH;IACnH,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAA;IAC7C,mDAAmD;IACnD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;CAClC;AASD,2CAA2C;AAC3C,eAAO,MAAM,IAAI,GAAI,CAAC,OAAK,OAAO,CAAC,CAAC,CAyCnC,CAAA"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * A subscriber's hearing: its own Stream, fed by plain calls. `hear` hands it a value and `end` ends it,
3
+ * or fails it with its source's failure. A consumer waiting on the Stream is resumed inside the call, as a
4
+ * `PubSub`'s subscriber was, never through the Effect scheduler (ADR-0017, decision 3), and a busy one
5
+ * takes everything handed since, together, at its next pull.
6
+ */
7
+ // #518, ADR-0067 *Amendment (#518)*, decision 3: under `Clock.ticks` and `SharedSource`, where a `PubSub` per
8
+ // source put its code in every app. Not a `Queue`: its offer schedules a release of its takers on the
9
+ // scheduler, a task a frame, even when they're released at once.
10
+ import * as Arr from "effect/Array";
11
+ import * as Cause from "effect/Cause";
12
+ import * as Effect from "effect/Effect";
13
+ import * as Exit from "effect/Exit";
14
+ import * as Option from "effect/Option";
15
+ import * as Predicate from "effect/Predicate";
16
+ import * as Stream from "effect/Stream";
17
+ /** A pull's end: the source's failure, else the Stream's end. An interruption ends it. */
18
+ const endOf = (exit) => {
19
+ if (Exit.isSuccess(exit))
20
+ return Cause.done();
21
+ if (Cause.hasInterruptsOnly(exit.cause))
22
+ return Cause.done();
23
+ return Effect.failCause(exit.cause);
24
+ };
25
+ /** A fresh hearing, handed nothing yet. */
26
+ export const make = () => {
27
+ let heard = [];
28
+ let ended = Option.none();
29
+ // The waiting pull's settle, while one waits. Per tick on the Clock's: a statement check, no Option.
30
+ let waiting;
31
+ const wake = () => {
32
+ if (Predicate.isUndefined(waiting))
33
+ return;
34
+ const resume = waiting;
35
+ waiting = undefined;
36
+ resume();
37
+ };
38
+ const take = Effect.callback((resume) => {
39
+ // What it was handed since, or its end: whether there was either to resume with.
40
+ const settle = () => {
41
+ if (Arr.isReadonlyArrayNonEmpty(heard)) {
42
+ const taken = heard;
43
+ heard = [];
44
+ resume(Effect.succeed(taken));
45
+ return true;
46
+ }
47
+ if (Option.isNone(ended))
48
+ return false;
49
+ resume(endOf(ended.value));
50
+ return true;
51
+ };
52
+ if (settle())
53
+ return;
54
+ waiting = settle;
55
+ return Effect.sync(() => {
56
+ waiting = undefined;
57
+ });
58
+ });
59
+ return {
60
+ hear: (a) => {
61
+ heard.push(a);
62
+ wake();
63
+ },
64
+ end: (exit) => {
65
+ ended = Option.some(exit);
66
+ wake();
67
+ },
68
+ stream: Stream.fromPull(Effect.succeed(take)),
69
+ };
70
+ };
71
+ //# sourceMappingURL=hearing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hearing.js","sourceRoot":"","sources":["../../src/internal/hearing.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,8GAA8G;AAC9G,sGAAsG;AACtG,iEAAiE;AACjE,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AACnC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAWvC,0FAA0F;AAC1F,MAAM,KAAK,GAAG,CAAC,IAA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,CAAA;QACD,IAAI,MAAM,EAAE;YAAE,OAAM;QACpB,OAAO,GAAG,MAAM,CAAA;QAChB,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;YACtB,OAAO,GAAG,SAAS,CAAA;QACrB,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IACF,OAAO;QACL,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE;YACV,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACb,IAAI,EAAE,CAAA;QACR,CAAC;QACD,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE;YACZ,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACzB,IAAI,EAAE,CAAA;QACR,CAAC;QACD,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KAC9C,CAAA;AACH,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wardic/core",
3
- "version": "1.0.0-rc.4",
3
+ "version": "1.0.0-rc.6",
4
4
  "description": "Wardic's animation engine on Effect: springs, tweens, keyframes, variants, the projection geometry, and the services an environment provides.",
5
5
  "keywords": [
6
6
  "animation",
package/src/Clock.ts CHANGED
@@ -16,7 +16,7 @@
16
16
  // per-Environment re-implementation.
17
17
  //
18
18
  // The loop is the single update path: every Refresh frame computes `dt` from successive timestamps and
19
- // calls `tick`, the only publisher to the internal tick `PubSub`. There is deliberately no `MAX_DT` clamp
19
+ // calls `tick`, the only one that hands a tick to the subscribers. There is deliberately no `MAX_DT` clamp
20
20
  // here: clamping is a consumer-boundary concern (each leaf's step clamps at `Machine.MAX_DT`, #78), so the
21
21
  // Clock reports raw deltas.
22
22
  //
@@ -41,6 +41,7 @@
41
41
  // `InterpolatorRegistry.layer` is the precedent for a shared constructor living in core. Observability:
42
42
  // each subscription to `ticks` runs inside a `wardic.clock` span and emits a debug log on subscribe; the
43
43
  // per-frame `tick` path stays quiet, the hot path.
44
+ import * as Arr from "effect/Array"
44
45
  import * as Bool from "effect/Boolean"
45
46
  import * as Context from "effect/Context"
46
47
  import * as Effect from "effect/Effect"
@@ -48,11 +49,11 @@ import * as Layer from "effect/Layer"
48
49
  import * as MutableRef from "effect/MutableRef"
49
50
  import * as Option from "effect/Option"
50
51
  import * as Predicate from "effect/Predicate"
51
- import * as PubSub from "effect/PubSub"
52
52
  import * as Scope from "effect/Scope"
53
53
  import * as Stream from "effect/Stream"
54
54
  import * as Microtask from "./Microtask.ts"
55
55
  import * as RefreshFrameSource from "./RefreshFrameSource.ts"
56
+ import * as Hearing from "./internal/hearing.ts"
56
57
  import { tracedStream } from "./internal/tracing.ts"
57
58
 
58
59
  /**
@@ -132,8 +133,10 @@ export const fromRefreshFrames: <Handle>(
132
133
  const { requestFrame, cancelFrame } = source
133
134
  const now = Option.getOrElse(Option.fromNullishOr(source.now), () => () => performance.now())
134
135
 
135
- // Carries dt (seconds) to subscribers of `ticks`.
136
- const tickPubSub = yield* PubSub.unbounded<number>()
136
+ // Who hears each dt (seconds): each subscriber's hearing, which resumes a waiting subscriber inside the
137
+ // Refresh frame's callback. Replaced, never changed in place, as `InputFeed.byTarget`'s list is (#518: a
138
+ // `PubSub` did this, and every app shipped its code).
139
+ let hearers: ReadonlyArray<(dt: number) => void> = []
137
140
 
138
141
  // The previous Refresh frame's time (ms), for dt computation; None => no
139
142
  // Refresh frame since the loop started (ADR-0017, decision 2). It is the frame's
@@ -173,17 +176,17 @@ export const fromRefreshFrames: <Handle>(
173
176
  * gets the rest of the interval, and a dt never goes below 0. There is no upper
174
177
  * clamp here: that is the consumer boundary's (`MAX_DT`).
175
178
  *
176
- * Publishes dt to the tick PubSub. Hot path — intentionally unlogged; one `now()`
177
- * read per Refresh frame.
179
+ * Hands dt to every subscriber. Hot path — intentionally unlogged; one `now()` read per
180
+ * Refresh frame.
178
181
  */
179
182
  const tick = (t: number): Effect.Effect<void> =>
180
- Effect.suspend(() => {
183
+ Effect.sync(() => {
181
184
  const at = now()
182
185
  const [current, delta] = timing(t, at)
183
186
  MutableRef.set(lastTime, Option.some(current))
184
187
  MutableRef.set(lastStamp, Option.some(t))
185
188
  MutableRef.set(lastNow, at)
186
- return PubSub.publish(tickPubSub, delta).pipe(Effect.asVoid)
189
+ Arr.forEach(hearers, (hear) => hear(delta))
187
190
  })
188
191
 
189
192
  // One Refresh frame as an interruptible Effect: requests a frame, resumes with
@@ -266,20 +269,29 @@ export const fromRefreshFrames: <Handle>(
266
269
  MutableRef.decrement(subscribers)
267
270
  })
268
271
 
269
- // Subscribing joins the tick PubSub, then joins the loop. Join the PubSub
270
- // FIRST, so no tick published once the loop runs can miss this subscriber.
272
+ // Subscribing joins the hearers, then joins the loop. Join the hearers FIRST,
273
+ // so no tick once the loop runs can miss this subscriber.
271
274
  // A Stream, not a Channel: measured 2026-11-02, Stream's own layers were ~5% of a pull of 1,000
272
275
  // subscribers' ticks (bench:core's `ticksOnly`), and at most one pull a frame a provider on an
273
276
  // app's path, under 0.3% of a frame. Channel goes only where a profile shows it (#618, M5).
274
277
  const ticks = tracedStream(
275
278
  Stream.unwrap(
276
- Effect.gen(function* () {
277
- yield* Effect.logDebug("wardic.clock: subscribe")
278
- const subscription = yield* PubSub.subscribe(tickPubSub)
279
- yield* Effect.acquireRelease(join, () => leave)
280
- return Stream.fromSubscription(subscription)
281
- }),
282
- ),
279
+ Effect.gen(function* () {
280
+ yield* Effect.logDebug("wardic.clock: subscribe")
281
+ const { hear, stream } = Hearing.make<number>()
282
+ yield* Effect.acquireRelease(
283
+ Effect.sync(() => {
284
+ hearers = Arr.append(hearers, hear)
285
+ }),
286
+ () =>
287
+ Effect.sync(() => {
288
+ hearers = Arr.filter(hearers, (heard) => heard !== hear)
289
+ }),
290
+ )
291
+ yield* Effect.acquireRelease(join, () => leave)
292
+ return stream
293
+ }),
294
+ ),
283
295
  "wardic.clock",
284
296
  )
285
297
 
package/src/FrameLoop.ts CHANGED
@@ -2,7 +2,8 @@
2
2
  * The Frame loop: the one loop per Environment that steps every running animation once a tick, in one
3
3
  * pass, so many animations cost one loop and not a fiber each. A binding runs its animations on it with
4
4
  * `Machine.run`, each Frame handed to its sink. `CheckFrames` turns on a check for development, which
5
- * fails a run whose step gives a NaN or an Infinity, with `NonFiniteFrame`.
5
+ * fails a run whose step gives a NaN or an Infinity, with `NonFiniteFrame`, and `layerMetrics` the loop's
6
+ * metrics, for the devtools or an exporter.
6
7
  *
7
8
  * @example
8
9
  * import * as FrameLoop from "@wardic/core/FrameLoop"
@@ -17,6 +18,7 @@
17
18
  // authors.
18
19
  import * as Context from "effect/Context"
19
20
  import * as Layer from "effect/Layer"
21
+ import * as Metric from "effect/Metric"
20
22
  import * as internal from "./internal/frameLoop.ts"
21
23
 
22
24
  export { CheckFrames, NonFiniteFrame } from "./internal/frameLoop.ts"
@@ -41,3 +43,24 @@ export class FrameLoop extends Context.Service<FrameLoop, internal.Shape>()("@wa
41
43
  // `DomLive`, `testLayer`. Built from the internal `make` (#618, C1): a service class with a `make` of its
42
44
  // own showed it to callers, who build the loop only through this Layer (ADR-0028, decision 11).
43
45
  export const layer = Layer.effect(FrameLoop)(internal.make())
46
+
47
+ /**
48
+ * The Frame loop's metrics, for an app that reads them: `wardic_frameloop_animations`, the animations
49
+ * running now; `wardic_frameloop_settled` and `wardic_frameloop_failed`, counts of the runs that ended;
50
+ * and `wardic_frameloop_tick_ms`, each tick's work, as a histogram. Merge it beside the Environment, as
51
+ * you give the devtools or an exporter. Without it, the loop records no metric.
52
+ *
53
+ * @example
54
+ * const env = Layer.mergeAll(DomLive, devtools, FrameLoop.layerMetrics)
55
+ */
56
+ // #518, ADR-0067 *Amendment (#518)*, decision 2: opt-in, so an app that reads none ships none. Marked pure,
57
+ // so an app that never imports it drops `Metric`.
58
+ export const layerMetrics: Layer.Layer<never> = /*#__PURE__*/ Layer.sync(internal.MetricsGiven, () => ({
59
+ animations: Metric.gauge("wardic_frameloop_animations", { description: "Primitives running on the Frame loop" }),
60
+ settled: Metric.counter("wardic_frameloop_settled", { description: "Runs on the Frame loop that settled" }),
61
+ failed: Metric.counter("wardic_frameloop_failed", { description: "Runs on the Frame loop that failed" }),
62
+ tickMs: Metric.histogram("wardic_frameloop_tick_ms", {
63
+ description: "Milliseconds the Frame loop spends on one tick",
64
+ boundaries: Metric.linearBoundaries({ start: 0, width: 0.5, count: 32 }),
65
+ }),
66
+ }))
package/src/LiveValue.ts CHANGED
@@ -27,7 +27,8 @@ import * as Match from "effect/Match"
27
27
  import { constant, constFalse, constTrue, constUndefined, constVoid, identity } from "effect/Function"
28
28
  import * as Option from "effect/Option"
29
29
  import * as Predicate from "effect/Predicate"
30
- import { Atom, AtomRegistry } from "effect/reactivity"
30
+ import * as Atom from "effect/reactivity/Atom"
31
+ import * as AtomRegistry from "effect/reactivity/AtomRegistry"
31
32
  import * as Rec from "effect/Record"
32
33
  import type * as Scope from "effect/Scope"
33
34
  import * as UndefinedOr from "effect/UndefinedOr"
@@ -36,7 +37,7 @@ import * as Easing from "./Easing.ts"
36
37
  import * as InterpolatorRegistry from "./InterpolatorRegistry.ts"
37
38
  import type * as Frame from "./Frame.ts"
38
39
  import * as Machine from "./Machine.ts"
39
- import * as Probe from "./Probe.ts"
40
+ import * as ScrollSource from "./ScrollSource.ts"
40
41
  import * as Supersede from "./Supersede.ts"
41
42
  import { dual } from "./internal/dual.ts"
42
43
 
@@ -534,11 +535,12 @@ export interface ScrollValues {
534
535
  * @example
535
536
  * const { scrollYProgress } = yield* LiveValue.scroll({ container })
536
537
  */
537
- // #234, ADR-0043 *Amendment (#233, #234)*: derived from the Environment's `Probe.scroll`.
538
- export const scroll: (options?: Probe.ScrollOptions) => Effect.Effect<ScrollValues, never, Probe.Probe | Scope.Scope> = Effect.fnUntraced(
539
- function* (options: Probe.ScrollOptions = {}) {
540
- const probe = yield* Probe.Probe
541
- const info = yield* probe.scroll(options)
538
+ // #234, ADR-0043 *Amendment (#233, #234)*: derived from the Environment's `ScrollSource` (the Probe's
539
+ // `scroll` until #518).
540
+ export const scroll: (options?: ScrollSource.Options) => Effect.Effect<ScrollValues, never, ScrollSource.ScrollSource | Scope.Scope> =
541
+ Effect.fnUntraced(function* (options: ScrollSource.Options = {}) {
542
+ const source = yield* ScrollSource.ScrollSource
543
+ const info = yield* source.scroll(options)
542
544
  return {
543
545
  scrollX: Atom.make((get) => get(info).x.current),
544
546
  scrollY: Atom.make((get) => get(info).y.current),
package/src/Probe.ts CHANGED
@@ -1,24 +1,23 @@
1
1
  /**
2
2
  * The Probe: what an Environment can tell the engine about what it draws. It measures a target's box;
3
- * holds the viewport's size, whether the user prefers reduced motion, whether the Environment is shown,
4
- * and a container's scroll, live, as Atoms; and observes a target's resizes and whether it's in view.
5
- * Layout animations, in-view gestures, scroll-linked values and reduced motion all read it.
3
+ * holds the viewport's size, whether the user prefers reduced motion and whether the Environment is
4
+ * shown, live, as Atoms; and observes a target's resizes and whether it's in view. Layout animations,
5
+ * in-view gestures and reduced motion all read it. A container's scroll is `ScrollSource`'s.
6
6
  *
7
7
  * @example
8
8
  * import * as Probe from "@wardic/core/Probe"
9
9
  *
10
10
  * const probe = yield* Probe.Probe
11
11
  * const bounds = yield* probe.measure(card)
12
- * const scroll = yield* probe.scroll({ container: list })
13
12
  */
14
13
  // ADR-0028, decision 11. #610 (ADR-0036 *Amendment (#610)*): `visible`, not the web's `pageVisible`;
15
14
  // `margin` is `unknown`, the Environment's syntax; `prefersReducedMotion` keeps its name, plain words in
16
- // any Environment, where `reducedMotion` is the provider's setting.
15
+ // any Environment, where `reducedMotion` is the provider's setting. #518: `scroll` moved to `ScrollSource`,
16
+ // which the `scroll` Feature builds, so an app that reads no scroll ships none of its code.
17
17
  import * as Context from "effect/Context"
18
18
  import type * as Effect from "effect/Effect"
19
- import type * as Scope from "effect/Scope"
20
19
  import type * as Stream from "effect/Stream"
21
- import type { Atom } from "effect/reactivity"
20
+ import type * as Atom from "effect/reactivity/Atom"
22
21
  import type * as InputFeed from "./InputFeed.ts"
23
22
 
24
23
  /** A target's box as an Environment measures it, in its coordinates: its corner, its size and its four edges. */
@@ -49,44 +48,6 @@ export interface Viewport {
49
48
  readonly height: number
50
49
  }
51
50
 
52
- /** One axis of a container's scroll. */
53
- // #234, ADR-0043 *Amendment (#233, #234)*.
54
- export interface ScrollAxis {
55
- /** How far the container is scrolled on the axis, in the Environment's units. */
56
- readonly current: number
57
- /** How far it can scroll on the axis: 0 for a container that doesn't overflow. */
58
- readonly length: number
59
- /**
60
- * Progress, 0 to 1: through the container's scroll range, or, on the options' `axis` with a
61
- * `target` or an `offset`, through the offsets the target passes.
62
- */
63
- readonly progress: number
64
- }
65
-
66
- /** A container's scroll on both axes: what the Probe's `scroll` holds. */
67
- export interface Scroll {
68
- /** Across. */
69
- readonly x: ScrollAxis
70
- /** Down. */
71
- readonly y: ScrollAxis
72
- }
73
-
74
- /** What the Probe's `scroll` reads, as Motion's `scroll` options. */
75
- export interface ScrollOptions {
76
- /** The scroll container: the Environment's own when left out. */
77
- readonly container?: unknown
78
- /** An element whose progress through the container `progress` reads, on `axis`. */
79
- readonly target?: unknown
80
- /**
81
- * Where on `axis` the target's progress runs, from 0 to 1, in the Environment's own terms, which it
82
- * reads and resolves, as `@wardic/dom`'s `ScrollOffset` does. Core passes it through, as it does
83
- * `container` and `target`.
84
- */
85
- readonly offset?: unknown
86
- /** The axis `target` and `offset` apply to. Default `"y"`. */
87
- readonly axis?: "x" | "y"
88
- }
89
-
90
51
  /** What an intersection is observed against, as Motion's `viewport`. Default: the viewport, no margin, any of the target. */
91
52
  // #273, ADR-0047.
92
53
  export interface IntersectionOptions {
@@ -94,9 +55,9 @@ export interface IntersectionOptions {
94
55
  readonly root?: unknown
95
56
  /**
96
57
  * How far the container's edges are grown, or shrunk, before it counts, in the Environment's own
97
- * syntax: core passes it on, as it does `ScrollOptions.offset`.
58
+ * syntax: core passes it on, as it does `ScrollSource.Options.offset`.
98
59
  */
99
- // #610: `unknown`, as `offset` is; `@wardic/dom` takes the web's string (`rootMargin`).
60
+ // #610: `unknown`, as `ScrollSource.Options.offset` is; `@wardic/dom` takes the web's string (`rootMargin`).
100
61
  readonly margin?: unknown
101
62
  /** How much of the target must be in it to count: from 0, any of it, to 1, all of it. */
102
63
  readonly amount?: number | undefined
@@ -125,13 +86,6 @@ export class Probe extends Context.Service<Probe, {
125
86
  */
126
87
  // #443; `pageVisible` until #610.
127
88
  readonly visible: Atom.Atom<boolean>
128
- /**
129
- * A container's scroll, live: an Atom the Environment sets as the container scrolls or resizes, as it
130
- * happens, so a value derived from it is written in the frame that shows the scroll. One listener a
131
- * container, however many read it, held while the Scope is.
132
- */
133
- // #234, ADR-0043 *Amendment (#233, #234)*.
134
- readonly scroll: (options?: ScrollOptions) => Effect.Effect<Atom.Atom<Scroll>, never, Scope.Scope>
135
89
  /** A target's box each time it resizes. */
136
90
  readonly observeResize: (target: unknown) => Stream.Stream<Bounds>
137
91
  /**
@@ -0,0 +1,68 @@
1
+ /**
2
+ * An Environment's scroll: a container's scroll, live, as an Atom the Environment sets as the container
3
+ * scrolls or resizes, as it happens, so a value derived from it is written in the frame that shows the
4
+ * scroll. Scroll-linked values read it (`LiveValue.scroll`).
5
+ *
6
+ * @example
7
+ * import * as ScrollSource from "@wardic/core/ScrollSource"
8
+ *
9
+ * const source = yield* ScrollSource.ScrollSource
10
+ * const scroll = yield* source.scroll({ container: list })
11
+ */
12
+ // #518, ADR-0067 *Amendment (#518)*, decision 5: the Probe's `scroll` until then (#234, ADR-0043
13
+ // *Amendment (#233, #234)*). A service of its own, so an app that reads no scroll ships none of an
14
+ // Environment's scroll code: the Solid binding's `scroll` Feature builds it, the Environment's when it
15
+ // gives one (`@wardic/test`'s), else the DOM's (`DomScrollSource`). Tier 2 (ADR-0008), for Environment
16
+ // authors.
17
+ import * as Context from "effect/Context"
18
+ import type * as Effect from "effect/Effect"
19
+ import type * as Scope from "effect/Scope"
20
+ import type * as Atom from "effect/reactivity/Atom"
21
+
22
+ /** One axis of a container's scroll. */
23
+ // #234, ADR-0043 *Amendment (#233, #234)*.
24
+ export interface Axis {
25
+ /** How far the container is scrolled on the axis, in the Environment's units. */
26
+ readonly current: number
27
+ /** How far it can scroll on the axis: 0 for a container that doesn't overflow. */
28
+ readonly length: number
29
+ /**
30
+ * Progress, 0 to 1: through the container's scroll range, or, on the options' `axis` with a
31
+ * `target` or an `offset`, through the offsets the target passes.
32
+ */
33
+ readonly progress: number
34
+ }
35
+
36
+ /** A container's scroll on both axes: what `scroll` holds. */
37
+ export interface Scroll {
38
+ /** Across. */
39
+ readonly x: Axis
40
+ /** Down. */
41
+ readonly y: Axis
42
+ }
43
+
44
+ /** What `scroll` reads, as Motion's `scroll` options. */
45
+ export interface Options {
46
+ /** The scroll container: the Environment's own when left out. */
47
+ readonly container?: unknown
48
+ /** An element whose progress through the container `progress` reads, on `axis`. */
49
+ readonly target?: unknown
50
+ /**
51
+ * Where on `axis` the target's progress runs, from 0 to 1, in the Environment's own terms, which it
52
+ * reads and resolves, as `@wardic/dom`'s `ScrollOffset` does. Core passes it through, as it does
53
+ * `container` and `target`.
54
+ */
55
+ readonly offset?: unknown
56
+ /** The axis `target` and `offset` apply to. Default `"y"`. */
57
+ readonly axis?: "x" | "y"
58
+ }
59
+
60
+ /** An Environment's scroll. */
61
+ export class ScrollSource extends Context.Service<ScrollSource, {
62
+ /**
63
+ * A container's scroll, live: an Atom the Environment sets as the container scrolls or resizes, as it
64
+ * happens, so a value derived from it is written in the frame that shows the scroll. One listener a
65
+ * container, however many read it, held while the Scope is.
66
+ */
67
+ readonly scroll: (options?: Options) => Effect.Effect<Atom.Atom<Scroll>, never, Scope.Scope>
68
+ }>()("@wardic/core/ScrollSource") {}