@solidjs/signals 0.0.9 → 0.0.10

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.
@@ -28,6 +28,7 @@
28
28
  */
29
29
  import { type Flags } from "./flags.js";
30
30
  import { Owner } from "./owner.js";
31
+ import { type IQueue } from "./scheduler.js";
31
32
  export interface SignalOptions<T> {
32
33
  name?: string;
33
34
  equals?: ((prev: T, next: T) => boolean) | false;
@@ -51,8 +52,6 @@ interface ObserverType {
51
52
  * Returns the current observer.
52
53
  */
53
54
  export declare function getObserver(): ObserverType | null;
54
- export declare function getClock(): number;
55
- export declare function incrementClock(): void;
56
55
  export declare const UNCHANGED: unique symbol;
57
56
  export type UNCHANGED = typeof UNCHANGED;
58
57
  export declare class Computation<T = any> extends Owner implements SourceType, ObserverType {
@@ -155,4 +154,5 @@ export declare function catchError(fn: () => void): unknown | undefined;
155
154
  */
156
155
  export declare function compute<T>(owner: Owner | null, fn: (val: T) => T, observer: Computation<T>): T;
157
156
  export declare function compute<T>(owner: Owner | null, fn: (val: undefined) => T, observer: null): T;
157
+ export declare function createBoundary<T>(fn: () => T, queue: IQueue): T;
158
158
  export {};
@@ -1,6 +1,5 @@
1
1
  import { EFFECT_RENDER, EFFECT_USER } from "./constants.js";
2
2
  import { Computation, type SignalOptions } from "./core.js";
3
- import { type IQueue } from "./scheduler.js";
4
3
  /**
5
4
  * Effects are the leaf nodes of our reactive graph. When their sources change, they are
6
5
  * automatically added to the queue of effects to re-execute, which will cause them to fetch their
@@ -13,7 +12,6 @@ export declare class Effect<T = any> extends Computation<T> {
13
12
  _modified: boolean;
14
13
  _prevValue: T | undefined;
15
14
  _type: typeof EFFECT_RENDER | typeof EFFECT_USER;
16
- _queue: IQueue;
17
15
  constructor(initialValue: T, compute: (val?: T) => T, effect: (val: T, prev: T | undefined) => void | (() => void), error?: (err: unknown) => void | (() => void), options?: SignalOptions<T> & {
18
16
  render?: boolean;
19
17
  defer?: boolean;
@@ -25,12 +23,12 @@ export declare class Effect<T = any> extends Computation<T> {
25
23
  _runEffect(): void;
26
24
  }
27
25
  export declare class EagerComputation<T = any> extends Computation<T> {
28
- _queue: IQueue;
29
- constructor(initialValue: T, compute: () => T, options?: SignalOptions<T>);
26
+ constructor(initialValue: T, compute: () => T, options?: SignalOptions<T> & {
27
+ defer?: boolean;
28
+ });
30
29
  _notify(state: number, skipQueue?: boolean): void;
31
30
  }
32
31
  export declare class ProjectionComputation extends Computation {
33
- _queue: IQueue;
34
32
  constructor(compute: () => void);
35
33
  _notify(state: number, skipQueue?: boolean): void;
36
34
  }
@@ -1,3 +1,4 @@
1
+ import type { Owner } from "./owner.js";
1
2
  export declare class NotReadyError extends Error {
2
3
  }
3
4
  export declare class NoOwnerError extends Error {
@@ -10,5 +11,5 @@ export declare class EffectError extends Error {
10
11
  constructor(effect: Function, cause: unknown);
11
12
  }
12
13
  export interface ErrorHandler {
13
- (error: unknown): void;
14
+ (error: unknown, node: Owner): void;
14
15
  }
@@ -1,8 +1,8 @@
1
1
  export { ContextNotFoundError, NoOwnerError, NotReadyError, type ErrorHandler } from "./error.js";
2
2
  export { Owner, createContext, getContext, setContext, hasContext, getOwner, onCleanup, type Context, type ContextRecord, type Disposable } from "./owner.js";
3
- export { Computation, getObserver, isEqual, untrack, getClock, hasUpdated, isStale, latest, catchError, UNCHANGED, compute, type SignalOptions } from "./core.js";
3
+ export { Computation, createBoundary, getObserver, isEqual, untrack, hasUpdated, isStale, latest, catchError, UNCHANGED, compute, type SignalOptions } from "./core.js";
4
4
  export { Effect, EagerComputation } from "./effect.js";
5
- export { flushSync, createBoundary, type IQueue, Queue } from "./scheduler.js";
5
+ export { flushSync, getClock, incrementClock, type IQueue, Queue } from "./scheduler.js";
6
6
  export { createSuspense } from "./suspense.js";
7
7
  export { SUPPORTS_PROXY } from "./constants.js";
8
8
  export * from "./flags.js";
@@ -28,7 +28,7 @@
28
28
  * Note that the owner tree is largely orthogonal to the reactivity tree, and is much closer to the component tree.
29
29
  */
30
30
  import { type ErrorHandler } from "./error.js";
31
- import type { IQueue } from "./scheduler.js";
31
+ import { type IQueue } from "./scheduler.js";
32
32
  export type ContextRecord = Record<string | symbol, unknown>;
33
33
  export interface Disposable {
34
34
  (): void;
@@ -46,7 +46,7 @@ export declare class Owner {
46
46
  _disposal: Disposable | Disposable[] | null;
47
47
  _context: ContextRecord;
48
48
  _handlers: ErrorHandler[] | null;
49
- _queue: IQueue | null;
49
+ _queue: IQueue;
50
50
  constructor(signal?: boolean);
51
51
  append(child: Owner): void;
52
52
  dispose(this: Owner, self?: boolean): void;
@@ -1,5 +1,7 @@
1
- import { Computation } from "./core.js";
1
+ import type { Computation } from "./core.js";
2
2
  import type { Effect } from "./effect.js";
3
+ export declare function getClock(): number;
4
+ export declare function incrementClock(): void;
3
5
  export interface IQueue {
4
6
  enqueue<T extends Computation | Effect>(type: number, node: T): void;
5
7
  run(type: number): boolean | void;
@@ -23,4 +25,3 @@ export declare const globalQueue: Queue;
23
25
  * the queue synchronously to get the latest updates by calling `flushSync()`.
24
26
  */
25
27
  export declare function flushSync(): void;
26
- export declare function createBoundary<T>(fn: () => T, queue: IQueue): T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidjs/signals",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",