@directive-run/core 0.7.0 → 0.8.1

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/index.d.cts CHANGED
@@ -1275,8 +1275,12 @@ interface CreateDerivationsOptions<S extends Schema, D extends DerivationsDef<S>
1275
1275
  * Notifications are deferred during invalidation so listeners always see
1276
1276
  * consistent state across multiple simultaneous fact changes.
1277
1277
  *
1278
- * @param options - Derivation definitions, facts proxy, store, and optional lifecycle callbacks
1279
- * @returns A `DerivationsManager` with get/invalidate/subscribe/getProxy methods
1278
+ * @param options - Derivation definitions, facts proxy, store, and optional
1279
+ * lifecycle callbacks.
1280
+ * @returns A {@link DerivationsManager} for accessing, invalidating, and
1281
+ * subscribing to derived values.
1282
+ *
1283
+ * @internal
1280
1284
  */
1281
1285
  declare function createDerivationsManager<S extends Schema, D extends DerivationsDef<S>>(options: CreateDerivationsOptions<S, D>): DerivationsManager<S, D>;
1282
1286
 
@@ -2226,16 +2230,34 @@ declare function createEngine<S extends Schema>(config: SystemConfig<any>): Syst
2226
2230
 
2227
2231
  /**
2228
2232
  * Get the current tracking context.
2229
- * Returns null context if no tracking is active.
2233
+ *
2234
+ * @returns The active {@link TrackingContext}, or a null context (no-op) if
2235
+ * no tracking is active.
2236
+ *
2237
+ * @internal
2230
2238
  */
2231
2239
  declare function getCurrentTracker(): TrackingContext;
2232
2240
  /**
2233
- * Check if we're currently tracking dependencies.
2241
+ * Check if dependency tracking is currently active.
2242
+ *
2243
+ * @returns `true` if inside a {@link withTracking} call, `false` otherwise.
2244
+ *
2245
+ * @internal
2234
2246
  */
2235
2247
  declare function isTracking(): boolean;
2236
2248
  /**
2237
2249
  * Run a function with dependency tracking.
2238
- * Returns the computed value and the set of dependencies accessed.
2250
+ *
2251
+ * @remarks
2252
+ * Pushes a fresh tracking context onto the stack, executes `fn`, then pops
2253
+ * the context. Any fact reads inside `fn` are recorded as dependencies.
2254
+ * Nesting is supported — inner calls get their own independent context.
2255
+ *
2256
+ * @param fn - The function to execute under tracking.
2257
+ * @returns An object with the computed `value` and a `deps` Set of accessed
2258
+ * fact keys.
2259
+ *
2260
+ * @internal
2239
2261
  */
2240
2262
  declare function withTracking<T>(fn: () => T): {
2241
2263
  value: T;
@@ -2243,12 +2265,28 @@ declare function withTracking<T>(fn: () => T): {
2243
2265
  };
2244
2266
  /**
2245
2267
  * Run a function without tracking.
2246
- * Useful for reading facts without creating dependencies.
2268
+ *
2269
+ * @remarks
2270
+ * Temporarily clears the tracking stack so that fact reads inside `fn` do
2271
+ * not register as dependencies. The stack is restored after `fn` returns
2272
+ * (even on error). Useful for side-effect reads that should not trigger
2273
+ * derivation invalidation.
2274
+ *
2275
+ * @param fn - The function to execute without tracking.
2276
+ * @returns The return value of `fn`.
2277
+ *
2278
+ * @internal
2247
2279
  */
2248
2280
  declare function withoutTracking<T>(fn: () => T): T;
2249
2281
  /**
2250
2282
  * Track a specific key in the current context.
2251
- * No-op if not currently tracking.
2283
+ *
2284
+ * @remarks
2285
+ * No-op if no tracking context is active.
2286
+ *
2287
+ * @param key - The fact key to record as a dependency.
2288
+ *
2289
+ * @internal
2252
2290
  */
2253
2291
  declare function trackAccess(key: string): void;
2254
2292
 
package/dist/index.d.ts CHANGED
@@ -1275,8 +1275,12 @@ interface CreateDerivationsOptions<S extends Schema, D extends DerivationsDef<S>
1275
1275
  * Notifications are deferred during invalidation so listeners always see
1276
1276
  * consistent state across multiple simultaneous fact changes.
1277
1277
  *
1278
- * @param options - Derivation definitions, facts proxy, store, and optional lifecycle callbacks
1279
- * @returns A `DerivationsManager` with get/invalidate/subscribe/getProxy methods
1278
+ * @param options - Derivation definitions, facts proxy, store, and optional
1279
+ * lifecycle callbacks.
1280
+ * @returns A {@link DerivationsManager} for accessing, invalidating, and
1281
+ * subscribing to derived values.
1282
+ *
1283
+ * @internal
1280
1284
  */
1281
1285
  declare function createDerivationsManager<S extends Schema, D extends DerivationsDef<S>>(options: CreateDerivationsOptions<S, D>): DerivationsManager<S, D>;
1282
1286
 
@@ -2226,16 +2230,34 @@ declare function createEngine<S extends Schema>(config: SystemConfig<any>): Syst
2226
2230
 
2227
2231
  /**
2228
2232
  * Get the current tracking context.
2229
- * Returns null context if no tracking is active.
2233
+ *
2234
+ * @returns The active {@link TrackingContext}, or a null context (no-op) if
2235
+ * no tracking is active.
2236
+ *
2237
+ * @internal
2230
2238
  */
2231
2239
  declare function getCurrentTracker(): TrackingContext;
2232
2240
  /**
2233
- * Check if we're currently tracking dependencies.
2241
+ * Check if dependency tracking is currently active.
2242
+ *
2243
+ * @returns `true` if inside a {@link withTracking} call, `false` otherwise.
2244
+ *
2245
+ * @internal
2234
2246
  */
2235
2247
  declare function isTracking(): boolean;
2236
2248
  /**
2237
2249
  * Run a function with dependency tracking.
2238
- * Returns the computed value and the set of dependencies accessed.
2250
+ *
2251
+ * @remarks
2252
+ * Pushes a fresh tracking context onto the stack, executes `fn`, then pops
2253
+ * the context. Any fact reads inside `fn` are recorded as dependencies.
2254
+ * Nesting is supported — inner calls get their own independent context.
2255
+ *
2256
+ * @param fn - The function to execute under tracking.
2257
+ * @returns An object with the computed `value` and a `deps` Set of accessed
2258
+ * fact keys.
2259
+ *
2260
+ * @internal
2239
2261
  */
2240
2262
  declare function withTracking<T>(fn: () => T): {
2241
2263
  value: T;
@@ -2243,12 +2265,28 @@ declare function withTracking<T>(fn: () => T): {
2243
2265
  };
2244
2266
  /**
2245
2267
  * Run a function without tracking.
2246
- * Useful for reading facts without creating dependencies.
2268
+ *
2269
+ * @remarks
2270
+ * Temporarily clears the tracking stack so that fact reads inside `fn` do
2271
+ * not register as dependencies. The stack is restored after `fn` returns
2272
+ * (even on error). Useful for side-effect reads that should not trigger
2273
+ * derivation invalidation.
2274
+ *
2275
+ * @param fn - The function to execute without tracking.
2276
+ * @returns The return value of `fn`.
2277
+ *
2278
+ * @internal
2247
2279
  */
2248
2280
  declare function withoutTracking<T>(fn: () => T): T;
2249
2281
  /**
2250
2282
  * Track a specific key in the current context.
2251
- * No-op if not currently tracking.
2283
+ *
2284
+ * @remarks
2285
+ * No-op if no tracking context is active.
2286
+ *
2287
+ * @param key - The fact key to record as a dependency.
2288
+ *
2289
+ * @internal
2252
2290
  */
2253
2291
  declare function trackAccess(key: string): void;
2254
2292