@solidjs/signals 2.0.0-rc.10 → 2.0.0-rc.13

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.
@@ -14,7 +14,7 @@ export interface DevHooks {
14
14
  * `warn`/`error` as failures unless they opt in to `info`.
15
15
  */
16
16
  export type DiagnosticSeverity = "info" | "warn" | "error";
17
- export type DiagnosticCode = "STRICT_READ_UNTRACKED" | "PENDING_ASYNC_UNTRACKED_READ" | "PENDING_ASYNC_FORBIDDEN_SCOPE" | "REACTIVE_WRITE_IN_OWNED_SCOPE" | "ASYNC_STORE_SETTER" | "ACTION_CALLED_IN_OWNED_SCOPE" | "RUN_WITH_DISPOSED_OWNER" | "NO_OWNER_CLEANUP" | "CLEANUP_IN_FORBIDDEN_SCOPE" | "SETTLED_CLEANUP_UNOWNED" | "SETTLE_WALK_UNINITIALIZED_SOURCE" | "FLUSH_IN_EFFECT_CALLBACK" | "PRIMITIVE_IN_FORBIDDEN_SCOPE" | "NO_OWNER_EFFECT" | "NO_OWNER_BOUNDARY" | "ASYNC_OUTSIDE_LOADING_BOUNDARY" | "LOADING_ON_OUTSIDE_HOLD" | "INVALID_REFRESH_TARGET" | "INVALID_AFFECTS_TARGET" | "MISSING_EFFECT_FN" | "SYNC_NODE_RECEIVED_ASYNC" | "UNTRACKED_READ_AFTER_AWAIT" | "REACTIVITY_HALTED" | "INVARIANT_VIOLATION" | "HUGE_FAN_OUT" | "HUGE_FAN_IN" | "GRAPH_GROWTH" | "HOT_SCOPE_RERUNS" | "HOT_SCOPE_TIME" | "WIDE_SCOPE_DEPS" | "UNSTABLE_MEMO_OUTPUT" | "WASTED_RECOMPUTE" | "ASYNC_WATERFALL" | "HOT_SCOPE_FANOUT" | "SILENT_HOLD" | "LONG_HOLD" | "UNTRACKED_ASYNC_HANDLER" | "ABANDONED_FLIGHTS" | "FALLBACK_FLASH" | "STACKED_HOLDS" | "OPTIMISTIC_REVERTED" | "EFFECT_WRITES_OWN_SOURCE" | "EFFECT_RELAY_TEAR" | "IMMUTABLE_UPDATE_IN_STORE" | "UNSTABLE_LIST_IDENTITY" | "SSR_RENDER_ERROR_CONTAINED" | "SSR_SUBTREE_ABANDONED" | "SSR_STREAM_ABANDONED" | "SSR_CLIENT_CONTENT_MASKED" | "LATE_HEADER_WRITE" | "SERVER_ERROR_SANITIZED" | "SSR_BOUNDARY_WATERFALL" | "SSR_UNDECLARED_LIVE_SOURCE" | "SERVER_WRITE" | "REVEAL_IN_RENDER_TO_STRING" | "LAZY_ASSET_UNMAPPED" | "PRELOAD_DESCRIPTOR_INVALID" | "HEAD_TAG_INVALID" | "UNRECOGNIZED_INSERT_VALUE" | "UNSCOPED_HOLE_ALLOCATED_IDS" | "BEHAVIOR_CLAIM_DROPPED" | "FRAME_MARKER_CORRUPTED" | "DYNAMIC_ASYNC_COMPONENT";
17
+ export type DiagnosticCode = "STRICT_READ_UNTRACKED" | "PENDING_ASYNC_UNTRACKED_READ" | "PENDING_ASYNC_FORBIDDEN_SCOPE" | "REACTIVE_WRITE_IN_OWNED_SCOPE" | "ASYNC_STORE_SETTER" | "ACTION_CALLED_IN_OWNED_SCOPE" | "RUN_WITH_DISPOSED_OWNER" | "NO_OWNER_CLEANUP" | "CLEANUP_IN_FORBIDDEN_SCOPE" | "SETTLED_CLEANUP_UNOWNED" | "SETTLE_WALK_UNINITIALIZED_SOURCE" | "FLUSH_IN_EFFECT_CALLBACK" | "PRIMITIVE_IN_FORBIDDEN_SCOPE" | "NO_OWNER_EFFECT" | "NO_OWNER_BOUNDARY" | "ASYNC_OUTSIDE_LOADING_BOUNDARY" | "LOADING_ON_OUTSIDE_HOLD" | "INVALID_REFRESH_TARGET" | "INVALID_AFFECTS_TARGET" | "MISSING_EFFECT_FN" | "SYNC_NODE_RECEIVED_ASYNC" | "UNTRACKED_READ_AFTER_AWAIT" | "REACTIVITY_HALTED" | "INVARIANT_VIOLATION" | "HUGE_FAN_OUT" | "HUGE_FAN_IN" | "GRAPH_GROWTH" | "HOT_SCOPE_RERUNS" | "HOT_SCOPE_TIME" | "WIDE_SCOPE_DEPS" | "UNSTABLE_MEMO_OUTPUT" | "WASTED_RECOMPUTE" | "ASYNC_WATERFALL" | "HOT_SCOPE_FANOUT" | "SILENT_HOLD" | "LONG_HOLD" | "UNTRACKED_ASYNC_HANDLER" | "ABANDONED_FLIGHTS" | "FALLBACK_FLASH" | "STACKED_HOLDS" | "OPTIMISTIC_REVERTED" | "EFFECT_WRITES_OWN_SOURCE" | "EFFECT_RELAY_TEAR" | "IMMUTABLE_UPDATE_IN_STORE" | "UNSTABLE_LIST_IDENTITY" | "SSR_RENDER_ERROR_CONTAINED" | "SSR_SUBTREE_ABANDONED" | "SSR_STREAM_ABANDONED" | "SSR_CLIENT_CONTENT_MASKED" | "LATE_HEADER_WRITE" | "SERVER_ERROR_SANITIZED" | "SSR_BOUNDARY_WATERFALL" | "SSR_UNDECLARED_LIVE_SOURCE" | "SERVER_WRITE" | "REVEAL_IN_RENDER_TO_STRING" | "LAZY_ASSET_UNMAPPED" | "PRELOAD_DESCRIPTOR_INVALID" | "HEAD_TAG_INVALID" | "UNRECOGNIZED_INSERT_VALUE" | "UNSCOPED_HOLE_ALLOCATED_IDS" | "ATTRIBUTE_SLOT_POSITION" | "FRAME_MARKER_CORRUPTED" | "DYNAMIC_ASYNC_COMPONENT";
18
18
  export type DiagnosticKind = "strict-read" | "async" | "write" | "lifecycle" | "owner" | "error" | "perf" | "graph"
19
19
  /** Perceived responsiveness: the runtime behaved correctly but the user saw no feedback. */
20
20
  | "responsiveness"
@@ -210,6 +210,24 @@ export type RecordLive<K extends RecordType> = RecordTypes[K] extends {
210
210
  live: infer L;
211
211
  } ? L : never;
212
212
  export type RecordListener<K extends RecordType> = (event: RecordEvent<K>, live: RecordLive<K>) => void;
213
+ /**
214
+ * What a `Records.subscribe` asks of the emitter beyond the record itself.
215
+ */
216
+ export interface RecordSubscribeOptions {
217
+ /**
218
+ * Ask for the record's BODIES: the live handles that cost the emitter
219
+ * something per record to take, and are taken only while a listener of
220
+ * the type has asked — so a consumer that reads ids, statuses and
221
+ * timings (an APM adapter, the performance tracks) never pays for what a
222
+ * body viewer (devtools' network panel) reads. Accepted for any type, the
223
+ * channel being generic; meaningful today for `"call"`, whose
224
+ * `live.request` (a reconstruction of the dispatched request) and
225
+ * `live.response` (an unread clone, a transient double-buffer of the
226
+ * payload) are taken only under it — without it, the transport's own
227
+ * objects. An emitter asks with `observed(type, "bodies")`.
228
+ */
229
+ bodies?: boolean;
230
+ }
213
231
  /**
214
232
  * The records channel — `OBSERVE.records`, on either platform: one place a
215
233
  * consumer (an APM adapter's `init()`, devtools, the diagnostics harness)
@@ -235,14 +253,28 @@ export interface Records {
235
253
  * Deliver `type` records as they complete; returns the unsubscribe. The
236
254
  * subscription is the channel's, not any emitter's: it outlives the
237
255
  * attribution engine's `enable()`/`disable()` cycles and is dropped only
238
- * by its own unsubscribe.
256
+ * by its own unsubscribe. `options` asks the emitter for more than the
257
+ * record — see `RecordSubscribeOptions`. One entry per listener function:
258
+ * its options are read at its first subscription to the type, a repeat
259
+ * subscription of the same function changes nothing, and either disposer
260
+ * removes it. What an emitter takes is decided once per record from the
261
+ * union of the type's subscribers, so a listener without `bodies` that
262
+ * shares a call with one that asked receives the same `live` — the clone.
239
263
  */
240
- subscribe<K extends RecordType>(type: K, listener: RecordListener<K>): () => void;
264
+ subscribe<K extends RecordType>(type: K, listener: RecordListener<K>, options?: RecordSubscribeOptions): () => void;
241
265
  /**
242
266
  * Whether anything is subscribed to `type` — an emitter's pre-check, so
243
267
  * a record nobody will hear costs nothing to not build (no clock read).
244
268
  */
245
269
  observed(type: RecordType): boolean;
270
+ /**
271
+ * Whether a listener of `type` asked for its bodies
272
+ * (`subscribe(type, listener, { bodies: true })`) — the emitter's
273
+ * pre-check for the live handles that cost something per record to take.
274
+ * `false` while every listener of the type is a plain one, and once the
275
+ * last body-wanting one unsubscribed.
276
+ */
277
+ observed(type: RecordType, facet: "bodies"): boolean;
246
278
  /**
247
279
  * Delivers a completed record to `type`'s listeners, synchronously: how a
248
280
  * runtime publishes. Snapshot semantics without a snapshot — the listener
@@ -299,11 +331,32 @@ export interface Observe {
299
331
  * and stores created under it are excluded subjects wherever their writes
300
332
  * come from (a click handler, an adapter callback), so writes need no
301
333
  * `runWithOwner` — and must not use one: a write under an owner is a write
302
- * in an owned scope (REACTIVE_WRITE_IN_OWNED_SCOPE). Irrevocable for the
303
- * owner's lifetime.
334
+ * in an owned scope (REACTIVE_WRITE_IN_OWNED_SCOPE). One mark per owner:
335
+ * a later `exclude` or `include` on the same owner replaces it, and
336
+ * `include` re-admits a subtree beneath it.
304
337
  */
305
338
  exclude(owner: Owner): void;
306
- /** Whether `subject` sits under an excluded owner (itself included). */
339
+ /**
340
+ * Marks `owner`'s subtree as the app's again, beneath an excluded owner.
341
+ * The verdict for a subject is the NEAREST marked ancestor's (the subject
342
+ * itself included): an `include` under an `exclude` re-admits that
343
+ * subtree, an `exclude` under an `include` excludes it again, and the
344
+ * markers nest to any depth. For an observer that WRAPS the app it
345
+ * watches — a toolbar rendering `<DevToolbar><App/></DevToolbar>` — so
346
+ * the toolbar's own root is excluded and the app's root, created under
347
+ * it, is included back. Mark the root as it is created, as with
348
+ * `exclude`: the attribution engine caches each node's verdict the first
349
+ * time it asks and keeps it for the node's life, so a mark set after a
350
+ * node was judged does not reach it. Alone — with no excluded ancestor —
351
+ * an included owner is what it already was. One mark per owner: a later
352
+ * `exclude` or `include` on the same owner replaces it.
353
+ */
354
+ include(owner: Owner): void;
355
+ /**
356
+ * Whether `subject` sits under an excluded owner (itself included) — the
357
+ * nearest marked ancestor on its owner chain answers, with the one mark
358
+ * (the latest `exclude`/`include`) that owner carries.
359
+ */
307
360
  isExcluded(subject: DiagnosticSubject | null | undefined): boolean;
308
361
  /**
309
362
  * Root-first names of the owners enclosing `subject` (inclusive when the
@@ -12,5 +12,5 @@ export { flush, Queue, GlobalQueue, enforceLoadingBoundary, resetErrorHalt, type
12
12
  export type { InteractionRef, NavigationRef } from "./attribution-hooks.js";
13
13
  export { ROOT_ERROR_HOOK } from "./scheduler.js";
14
14
  export { configureClientErrors, type ClientErrorContext, type ClientErrorHook, type ClientErrorsConfig } from "./error-hooks.js";
15
- export { DEV, OBSERVE, setConsoleFooter, type AttributionSlot, type Dev, type Observe, type ServerObserve, type Records, type RecordTypes, type HostRecordTypes, type RecordType, type RecordEvent, type RecordLive, type RecordListener, type DevHooks, type DiagnosticCapture, type DiagnosticCode, type DiagnosticEvent, type DiagnosticKind, type DiagnosticListener, type Diagnostics, type DiagnosticSeverity, type DiagnosticSubject } from "./dev.js";
15
+ export { DEV, OBSERVE, setConsoleFooter, type AttributionSlot, type Dev, type Observe, type ServerObserve, type Records, type RecordTypes, type HostRecordTypes, type RecordType, type RecordEvent, type RecordLive, type RecordListener, type RecordSubscribeOptions, type DevHooks, type DiagnosticCapture, type DiagnosticCode, type DiagnosticEvent, type DiagnosticKind, type DiagnosticListener, type Diagnostics, type DiagnosticSeverity, type DiagnosticSubject } from "./dev.js";
16
16
  export * from "./constants.js";
@@ -260,7 +260,11 @@ export declare class GlobalQueue extends Queue {
260
260
  * commit whatever its relation to the committed value — a landing equal to
261
261
  * committed still differs from the override — then _supersedeOverride
262
262
  * decides. Installed with the optimistic engine; only reachable on a node
263
- * that has an override. */
263
+ * that has an override — or, from `mapArray` once a lane pass has run over
264
+ * the map, on a per-slot signal (never CONFIG_OPTIMISTIC): the slot arm
265
+ * publishes a lane pass's write as the slot's derived override, lands a
266
+ * plain pass's write over one, and is the plain `setSignal` otherwise (F1,
267
+ * see optimistic.ts landOnOverride). */
264
268
  static _landOnOverride: (<T>(el: Signal<T> | Computed<T>, v: T | ((prev: T) => T)) => T) | null;
265
269
  static _trackOptimisticStore: ((store: any) => void) | null;
266
270
  flush(): void;
@@ -14,7 +14,7 @@ import { type Dev, type Observe } from "./core/index.js";
14
14
  export declare const OBSERVE: Observe | undefined;
15
15
  /** Dev tier (devtools hooks, graph traversal, console reporting): dev builds only. */
16
16
  export declare const DEV: Dev | undefined;
17
- export type { Owner, Context, ContextRecord, IQueue, ExternalSourceFactory, ExternalSource, ExternalSourceConfig, Refreshable, AttributionSlot, ClientErrorContext, ClientErrorHook, ClientErrorsConfig, InteractionRef, NavigationRef, Dev, Observe, ServerObserve, Records, RecordTypes, HostRecordTypes, RecordType, RecordEvent, RecordLive, RecordListener, DevHooks, DiagnosticCapture, DiagnosticCode, DiagnosticEvent, DiagnosticKind, DiagnosticListener, Diagnostics, DiagnosticSeverity, DiagnosticSubject } from "./core/index.js";
17
+ export type { Owner, Context, ContextRecord, IQueue, ExternalSourceFactory, ExternalSource, ExternalSourceConfig, Refreshable, AttributionSlot, ClientErrorContext, ClientErrorHook, ClientErrorsConfig, InteractionRef, NavigationRef, Dev, Observe, ServerObserve, Records, RecordTypes, HostRecordTypes, RecordType, RecordEvent, RecordLive, RecordListener, RecordSubscribeOptions, DevHooks, DiagnosticCapture, DiagnosticCode, DiagnosticEvent, DiagnosticKind, DiagnosticListener, Diagnostics, DiagnosticSeverity, DiagnosticSubject } from "./core/index.js";
18
18
  export { createSignal, createMemo, createEffect, createRenderEffect, createTrackedEffect, createReaction, createOptimistic, refresh, resolve, until, onSettled, onCleanup } from "./signals.js";
19
19
  export type { Truthy, UntilOptions, Accessor, SourceAccessor, Setter, Signal, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, SignalOptions, MemoOptions, NoInfer } from "./signals.js";
20
20
  export { affects } from "./affects.js";
@@ -551,13 +551,30 @@ export declare function resolve<T>(fn: () => T): Promise<T>;
551
551
  export declare function refresh<T>(target: Refreshable<T>): Promise<T extends (...args: any) => infer V ? V : T>;
552
552
  /** Falsy values a truthy predicate result is narrowed against. */
553
553
  export type Truthy<T> = Exclude<T, false | 0 | 0n | "" | null | undefined>;
554
+ /**
555
+ * The global `AbortSignal` when the consumer's libs declare one (DOM,
556
+ * WebWorker, `@types/node`), else the surface `until` uses — so these
557
+ * declarations check under neither lib without widening the global type.
558
+ */
559
+ type GlobalAbortSignal = typeof globalThis extends {
560
+ AbortSignal: {
561
+ prototype: infer S;
562
+ };
563
+ } ? S : {
564
+ readonly aborted: boolean;
565
+ readonly reason: any;
566
+ addEventListener(type: "abort", listener: () => void, options?: {
567
+ once?: boolean;
568
+ }): void;
569
+ removeEventListener(type: "abort", listener: () => void): void;
570
+ };
554
571
  export interface UntilOptions {
555
572
  /** Reject with `TimeoutError` if the predicate has not turned truthy within
556
573
  * this many milliseconds. Strongly recommended when the confirming truth
557
574
  * arrives over a transport that can drop (sockets, subscriptions). */
558
575
  timeout?: number;
559
576
  /** Reject with `signal.reason` on abort. */
560
- signal?: AbortSignal;
577
+ signal?: GlobalAbortSignal;
561
578
  }
562
579
  /**
563
580
  * Awaits a reactive predicate and resolves the first time it settles *truthy*,
@@ -16,8 +16,10 @@ export declare function bumpDeep(t: StoreNextTarget): void;
16
16
  * the real container (committed + overlay writes − deletes) that fold will
17
17
  * SWAP in as the committed backing, exactly as if the draft had started on
18
18
  * the clone path. Consumers that need a complete container (reconcile's
19
- * diff walks, drafts escaping into other storage) call this. */
20
- export declare function materializePB(target: StoreNextTarget): void;
19
+ * diff walks, drafts escaping into other storage) call this, and so does the
20
+ * commit itself when the fold changed the key set (overlayRebuilds). Returns
21
+ * the pending backing (the clone, or the pb as-is when not an overlay). */
22
+ export declare function materializePB(target: StoreNextTarget): Record<PropertyKey, any>;
21
23
  /** Resolve the held committed view (#3074): answers the masked old backing
22
24
  * while the hold is live, and lazily clears a hold whose transition has
23
25
  * committed (transitions merge — resolve through currentTransition, same as
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidjs/signals",
3
- "version": "2.0.0-rc.10",
3
+ "version": "2.0.0-rc.13",
4
4
  "description": "Solid's reactive primitives: signals, memos, effects, stores, and async-aware computations.",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",