Deployed the page to Github Pages.
This commit is contained in:
parent
1d79754e93
commit
2c89899458
62797 changed files with 6551425 additions and 15279 deletions
498
node_modules/@angular/core/primitives/event-dispatch/index.d.ts
generated
vendored
Executable file
498
node_modules/@angular/core/primitives/event-dispatch/index.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,498 @@
|
|||
/**
|
||||
* @license Angular v18.2.10
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Records information about the action that should handle a given `Event`.
|
||||
*/
|
||||
declare interface ActionInfo {
|
||||
name: string;
|
||||
element: Element;
|
||||
}
|
||||
|
||||
declare type ActionInfoInternal = [name: string, element: Element];
|
||||
|
||||
|
||||
export declare const Attribute: {
|
||||
/**
|
||||
* The jsaction attribute defines a mapping of a DOM event to a
|
||||
* generic event (aka jsaction), to which the actual event handlers
|
||||
* that implement the behavior of the application are bound. The
|
||||
* value is a semicolon separated list of colon separated pairs of
|
||||
* an optional DOM event name and a jsaction name. If the optional
|
||||
* DOM event name is omitted, 'click' is assumed. The jsaction names
|
||||
* are dot separated pairs of a namespace and a simple jsaction
|
||||
* name.
|
||||
*
|
||||
* See grammar in README.md for expected syntax in the attribute value.
|
||||
*/
|
||||
JSACTION: "jsaction";
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates an `EarlyJsactionData`, adds events to it, and populates it on a nested object on
|
||||
* the window.
|
||||
*/
|
||||
export declare function bootstrapAppScopedEarlyEventContract(container: HTMLElement, appId: string, bubbleEventTypes: string[], captureEventTypes: string[], dataContainer?: EarlyJsactionDataContainer): void;
|
||||
|
||||
/** Clear the early event contract. */
|
||||
export declare function clearAppScopedEarlyEventContract(appId: string, dataContainer?: EarlyJsactionDataContainer): void;
|
||||
|
||||
/** Clones an `EventInfo` */
|
||||
declare function cloneEventInfo(eventInfo: EventInfo): EventInfo;
|
||||
|
||||
/**
|
||||
* Utility function for creating an `EventInfo`.
|
||||
*
|
||||
* This should be used in compilation units that are less sensitive to code
|
||||
* size.
|
||||
*/
|
||||
declare function createEventInfo({ eventType, event, targetElement, container, timestamp, action, isReplay, a11yClickKey, }: {
|
||||
eventType: string;
|
||||
event: Event;
|
||||
targetElement: Element;
|
||||
container: Element;
|
||||
timestamp: number;
|
||||
action?: ActionInfo;
|
||||
isReplay?: boolean;
|
||||
a11yClickKey?: boolean;
|
||||
}): EventInfo;
|
||||
|
||||
/**
|
||||
* Utility function for creating an `EventInfo`.
|
||||
*
|
||||
* This can be used from code-size sensitive compilation units, as taking
|
||||
* parameters vs. an `Object` literal reduces code size.
|
||||
*/
|
||||
declare function createEventInfoFromParameters(eventType: string, event: Event, targetElement: Element, container: Element, timestamp: number, action?: ActionInfoInternal, isReplay?: boolean, a11yClickKey?: boolean): EventInfo;
|
||||
|
||||
/** A function that is called to handle events captured by the EventContract. */
|
||||
declare type Dispatcher = (eventInfo: eventInfoLib.EventInfo, globalDispatch?: boolean) => void;
|
||||
|
||||
/**
|
||||
* Defines the early jsaction data types.
|
||||
*/
|
||||
declare interface EarlyJsactionData {
|
||||
/** List used to keep track of the early JSAction event types. */
|
||||
et: string[];
|
||||
/** List used to keep track of the early JSAction capture event types. */
|
||||
etc: string[];
|
||||
/** Early JSAction handler for all events. */
|
||||
h: (event: Event) => void;
|
||||
/** Dispatcher handler. Initializes to populating `q`. */
|
||||
d: (eventInfo: EventInfo) => void;
|
||||
/** List used to push `EventInfo` objects if the dispatcher is not registered. */
|
||||
q: EventInfo[];
|
||||
/** Container for listening to events. */
|
||||
c: HTMLElement;
|
||||
}
|
||||
|
||||
export declare interface EarlyJsactionDataContainer {
|
||||
_ejsa?: EarlyJsactionData;
|
||||
_ejsas?: {
|
||||
[appId: string]: EarlyJsactionData | undefined;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* EventContract intercepts events in the bubbling phase at the
|
||||
* boundary of a container element, and maps them to generic actions
|
||||
* which are specified using the custom jsaction attribute in
|
||||
* HTML. Behavior of the application is then specified in terms of
|
||||
* handler for such actions, cf. jsaction.Dispatcher in dispatcher.js.
|
||||
*
|
||||
* This has several benefits: (1) No DOM event handlers need to be
|
||||
* registered on the specific elements in the UI. (2) The set of
|
||||
* events that the application has to handle can be specified in terms
|
||||
* of the semantics of the application, rather than in terms of DOM
|
||||
* events. (3) Invocation of handlers can be delayed and handlers can
|
||||
* be delay loaded in a generic way.
|
||||
*/
|
||||
export declare class EventContract implements UnrenamedEventContract {
|
||||
static MOUSE_SPECIAL_SUPPORT: boolean;
|
||||
private containerManager;
|
||||
/**
|
||||
* The DOM events which this contract covers. Used to prevent double
|
||||
* registration of event types. The value of the map is the
|
||||
* internally created DOM event handler function that handles the
|
||||
* DOM events. See addEvent().
|
||||
*
|
||||
*/
|
||||
private eventHandlers;
|
||||
private browserEventTypeToExtraEventTypes;
|
||||
/**
|
||||
* The dispatcher function. Events are passed to this function for
|
||||
* handling once it was set using the registerDispatcher() method. This is
|
||||
* done because the function is passed from another jsbinary, so passing the
|
||||
* instance and invoking the method here would require to leave the method
|
||||
* unobfuscated.
|
||||
*/
|
||||
private dispatcher;
|
||||
/**
|
||||
* The list of suspended `EventInfo` that will be dispatched
|
||||
* as soon as the `Dispatcher` is registered.
|
||||
*/
|
||||
private queuedEventInfos;
|
||||
constructor(containerManager: EventContractContainerManager);
|
||||
private handleEvent;
|
||||
/**
|
||||
* Handle an `EventInfo`.
|
||||
*/
|
||||
private handleEventInfo;
|
||||
/**
|
||||
* Enables jsaction handlers to be called for the event type given by
|
||||
* name.
|
||||
*
|
||||
* If the event is already registered, this does nothing.
|
||||
*
|
||||
* @param prefixedEventType If supplied, this event is used in
|
||||
* the actual browser event registration instead of the name that is
|
||||
* exposed to jsaction. Use this if you e.g. want users to be able
|
||||
* to subscribe to jsaction="transitionEnd:foo" while the underlying
|
||||
* event is webkitTransitionEnd in one browser and mozTransitionEnd
|
||||
* in another.
|
||||
*/
|
||||
addEvent(eventType: string, prefixedEventType?: string): void;
|
||||
/**
|
||||
* Gets the queued early events and replay them using the appropriate handler
|
||||
* in the provided event contract. Once all the events are replayed, it cleans
|
||||
* up the early contract.
|
||||
*/
|
||||
replayEarlyEvents(earlyJsactionData?: EarlyJsactionData | undefined): void;
|
||||
/**
|
||||
* Replays all the early `EventInfo` objects, dispatching them through the normal
|
||||
* `EventContract` flow.
|
||||
*/
|
||||
replayEarlyEventInfos(earlyEventInfos: eventInfoLib.EventInfo[]): void;
|
||||
/**
|
||||
* Returns all JSAction event types that have been registered for a given
|
||||
* browser event type.
|
||||
*/
|
||||
private getEventTypesForBrowserEventType;
|
||||
/**
|
||||
* Returns the event handler function for a given event type.
|
||||
*/
|
||||
handler(eventType: string): EventHandler | undefined;
|
||||
/**
|
||||
* Cleans up the event contract. This resets all of the `EventContract`'s
|
||||
* internal state. Users are responsible for not using this `EventContract`
|
||||
* after it has been cleaned up.
|
||||
*/
|
||||
cleanUp(): void;
|
||||
/**
|
||||
* Register a dispatcher function. Event info of each event mapped to
|
||||
* a jsaction is passed for handling to this callback. The queued
|
||||
* events are passed as well to the dispatcher for later replaying
|
||||
* once the dispatcher is registered. Clears the event queue to null.
|
||||
*
|
||||
* @param dispatcher The dispatcher function.
|
||||
* @param restriction
|
||||
*/
|
||||
registerDispatcher(dispatcher: Dispatcher, restriction: Restriction): void;
|
||||
/**
|
||||
* Unrenamed alias for registerDispatcher. Necessary for any codebases that
|
||||
* split the `EventContract` and `Dispatcher` code into different compilation
|
||||
* units.
|
||||
*/
|
||||
ecrd(dispatcher: Dispatcher, restriction: Restriction): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A class representing a container node and all the event handlers
|
||||
* installed on it. Used so that handlers can be cleaned up if the
|
||||
* container is removed from the contract.
|
||||
*/
|
||||
export declare class EventContractContainer implements EventContractContainerManager {
|
||||
readonly element: Element;
|
||||
/**
|
||||
* Array of event handlers and their corresponding event types that are
|
||||
* installed on this container.
|
||||
*
|
||||
*/
|
||||
private handlerInfos;
|
||||
/**
|
||||
* @param element The container Element.
|
||||
*/
|
||||
constructor(element: Element);
|
||||
/**
|
||||
* Installs the provided installer on the element owned by this container,
|
||||
* and maintains a reference to resulting handler in order to remove it
|
||||
* later if desired.
|
||||
*/
|
||||
addEventListener(eventType: string, getHandler: (element: Element) => (event: Event) => void): void;
|
||||
/**
|
||||
* Removes all the handlers installed on this container.
|
||||
*/
|
||||
cleanUp(): void;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* An `EventContractContainerManager` provides the common interface for managing
|
||||
* containers.
|
||||
*/
|
||||
declare interface EventContractContainerManager {
|
||||
addEventListener(eventType: string, getHandler: (element: Element) => (event: Event) => void): void;
|
||||
cleanUp(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A dispatcher that uses browser-based `Event` semantics, for example bubbling, `stopPropagation`,
|
||||
* `currentTarget`, etc.
|
||||
*/
|
||||
export declare class EventDispatcher {
|
||||
private readonly dispatchDelegate;
|
||||
private readonly clickModSupport;
|
||||
private readonly actionResolver;
|
||||
private readonly dispatcher;
|
||||
constructor(dispatchDelegate: (event: Event, actionName: string) => void, clickModSupport?: boolean);
|
||||
/**
|
||||
* The entrypoint for the `EventContract` dispatch.
|
||||
*/
|
||||
dispatch(eventInfo: EventInfo): void;
|
||||
/** Internal method that does basic disaptching. */
|
||||
private dispatchToDelegate;
|
||||
}
|
||||
|
||||
/**
|
||||
* A function that handles an event dispatched from the browser.
|
||||
*
|
||||
* eventType: May differ from `event.type` if JSAction uses a
|
||||
* short-hand name or is patching over an non-bubbling event with a bubbling
|
||||
* variant.
|
||||
* event: The native browser event.
|
||||
* container: The container for this dispatch.
|
||||
*/
|
||||
declare type EventHandler = (eventType: string, event: Event, container: Element) => void;
|
||||
|
||||
/**
|
||||
* Records information for later handling of events. This type is
|
||||
* shared, and instances of it are passed, between the eventcontract
|
||||
* and the dispatcher jsbinary. Therefore, the fields of this type are
|
||||
* referenced by string literals rather than property literals
|
||||
* throughout the code.
|
||||
*
|
||||
* 'targetElement' is the element the action occurred on, 'actionElement'
|
||||
* is the element that has the jsaction handler.
|
||||
*
|
||||
* A null 'actionElement' identifies an EventInfo instance that didn't match a
|
||||
* jsaction attribute. This allows us to execute global event handlers with the
|
||||
* appropriate event type (including a11y clicks and custom events).
|
||||
* The declare portion of this interface creates a set of externs that make sure
|
||||
* renaming doesn't happen for EventInfo. This is important since EventInfo
|
||||
* is shared across multiple binaries.
|
||||
*/
|
||||
declare interface EventInfo {
|
||||
eventType: string;
|
||||
event: Event;
|
||||
targetElement: Element;
|
||||
/** The element that is the container for this Event. */
|
||||
eic: Element;
|
||||
timeStamp: number;
|
||||
/**
|
||||
* The action parsed from the JSAction element.
|
||||
*/
|
||||
eia?: ActionInfoInternal;
|
||||
/**
|
||||
* Whether this `Event` is a replay event, meaning no dispatcher was
|
||||
* installed when this `Event` was originally dispatched.
|
||||
*/
|
||||
eirp?: boolean;
|
||||
/**
|
||||
* Whether this `Event` represents a `keydown` event that should be processed
|
||||
* as a `click`. Only used when a11y click events is on.
|
||||
*/
|
||||
eiack?: boolean;
|
||||
/** Whether action resolution has already run on this `EventInfo`. */
|
||||
eir?: boolean;
|
||||
}
|
||||
|
||||
declare namespace eventInfoLib {
|
||||
export {
|
||||
getEventType,
|
||||
setEventType,
|
||||
getEvent,
|
||||
setEvent,
|
||||
getTargetElement,
|
||||
setTargetElement,
|
||||
getContainer,
|
||||
setContainer,
|
||||
getTimestamp,
|
||||
setTimestamp,
|
||||
getAction,
|
||||
setAction,
|
||||
unsetAction,
|
||||
getActionName,
|
||||
getActionElement,
|
||||
getIsReplay,
|
||||
setIsReplay,
|
||||
getA11yClickKey,
|
||||
setA11yClickKey,
|
||||
getResolved,
|
||||
setResolved,
|
||||
cloneEventInfo,
|
||||
createEventInfoFromParameters,
|
||||
createEventInfo,
|
||||
ActionInfo,
|
||||
EventInfo,
|
||||
EventInfoWrapper
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility class around an `EventInfo`.
|
||||
*
|
||||
* This should be used in compilation units that are less sensitive to code
|
||||
* size.
|
||||
*/
|
||||
export declare class EventInfoWrapper {
|
||||
readonly eventInfo: EventInfo;
|
||||
constructor(eventInfo: EventInfo);
|
||||
getEventType(): string;
|
||||
setEventType(eventType: string): void;
|
||||
getEvent(): Event;
|
||||
setEvent(event: Event): void;
|
||||
getTargetElement(): Element;
|
||||
setTargetElement(targetElement: Element): void;
|
||||
getContainer(): Element;
|
||||
setContainer(container: Element): void;
|
||||
getTimestamp(): number;
|
||||
setTimestamp(timestamp: number): void;
|
||||
getAction(): {
|
||||
name: string;
|
||||
element: Element;
|
||||
} | undefined;
|
||||
setAction(action: ActionInfo | undefined): void;
|
||||
getIsReplay(): boolean | undefined;
|
||||
setIsReplay(replay: boolean): void;
|
||||
getResolved(): boolean | undefined;
|
||||
setResolved(resolved: boolean): void;
|
||||
clone(): EventInfoWrapper;
|
||||
}
|
||||
|
||||
/** Extra event phases beyond what the browser provides. */
|
||||
export declare const EventPhase: {
|
||||
REPLAY: number;
|
||||
};
|
||||
|
||||
/** Added for readability when accessing stable property names. */
|
||||
declare function getA11yClickKey(eventInfo: EventInfo): boolean | undefined;
|
||||
|
||||
/** Added for readability when accessing stable property names. */
|
||||
declare function getAction(eventInfo: EventInfo): ActionInfoInternal | undefined;
|
||||
|
||||
/**
|
||||
* Reads the jsaction parser cache for the given DOM element. If no cache is yet present,
|
||||
* creates an empty one.
|
||||
*/
|
||||
export declare function getActionCache(element: Element): {
|
||||
[key: string]: string | undefined;
|
||||
};
|
||||
|
||||
/** Added for readability when accessing stable property names. */
|
||||
declare function getActionElement(actionInfo: ActionInfoInternal): Element;
|
||||
|
||||
/** Added for readability when accessing stable property names. */
|
||||
declare function getActionName(actionInfo: ActionInfoInternal): string;
|
||||
|
||||
/** Get the queued `EventInfo` objects that were dispatched before a dispatcher was registered. */
|
||||
export declare function getAppScopedQueuedEventInfos(appId: string, dataContainer?: EarlyJsactionDataContainer): EventInfo[];
|
||||
|
||||
/** Added for readability when accessing stable property names. */
|
||||
declare function getContainer(eventInfo: EventInfo): Element;
|
||||
|
||||
/** Added for readability when accessing stable property names. */
|
||||
declare function getEvent(eventInfo: EventInfo): Event;
|
||||
|
||||
/** Added for readability when accessing stable property names. */
|
||||
declare function getEventType(eventInfo: EventInfo): string;
|
||||
|
||||
/** Added for readability when accessing stable property names. */
|
||||
declare function getIsReplay(eventInfo: EventInfo): boolean | undefined;
|
||||
|
||||
/** Added for readability when accessing stable property names. */
|
||||
declare function getResolved(eventInfo: EventInfo): boolean | undefined;
|
||||
|
||||
/** Added for readability when accessing stable property names. */
|
||||
declare function getTargetElement(eventInfo: EventInfo): Element;
|
||||
|
||||
/** Added for readability when accessing stable property names. */
|
||||
declare function getTimestamp(eventInfo: EventInfo): number;
|
||||
|
||||
/**
|
||||
* Whether or not an event type should be registered in the capture phase.
|
||||
* @param eventType
|
||||
* @returns bool
|
||||
*/
|
||||
export declare const isCaptureEventType: (eventType: string) => boolean;
|
||||
|
||||
/**
|
||||
* Whether or not an event type is registered in the early contract.
|
||||
*/
|
||||
export declare const isEarlyEventType: (eventType: string) => boolean;
|
||||
|
||||
/**
|
||||
* Registers a dispatcher function on the `EarlyJsactionData` present on the nested object on the
|
||||
* window.
|
||||
*/
|
||||
export declare function registerAppScopedDispatcher(restriction: Restriction, appId: string, dispatcher: (eventInfo: EventInfo) => void, dataContainer?: EarlyJsactionDataContainer): void;
|
||||
|
||||
/**
|
||||
* Registers deferred functionality for an EventContract and a Jsaction
|
||||
* Dispatcher.
|
||||
*/
|
||||
export declare function registerDispatcher(eventContract: UnrenamedEventContract, dispatcher: EventDispatcher): void;
|
||||
|
||||
/** Removes all event listener handlers. */
|
||||
export declare function removeAllAppScopedEventListeners(appId: string, dataContainer?: EarlyJsactionDataContainer): void;
|
||||
|
||||
|
||||
/**
|
||||
* @fileoverview An enum to control who can call certain jsaction APIs.
|
||||
*/
|
||||
declare enum Restriction {
|
||||
I_AM_THE_JSACTION_FRAMEWORK = 0
|
||||
}
|
||||
|
||||
/** Added for readability when accessing stable property names. */
|
||||
declare function setA11yClickKey(eventInfo: EventInfo, a11yClickKey: boolean): void;
|
||||
|
||||
/** Added for readability when accessing stable property names. */
|
||||
declare function setAction(eventInfo: EventInfo, actionName: string, actionElement: Element): void;
|
||||
|
||||
/** Added for readability when accessing stable property names. */
|
||||
declare function setContainer(eventInfo: EventInfo, container: Element): void;
|
||||
|
||||
/** Added for readability when accessing stable property names. */
|
||||
declare function setEvent(eventInfo: EventInfo, event: Event): void;
|
||||
|
||||
/** Added for readability when accessing stable property names. */
|
||||
declare function setEventType(eventInfo: EventInfo, eventType: string): void;
|
||||
|
||||
/** Added for readability when accessing stable property names. */
|
||||
declare function setIsReplay(eventInfo: EventInfo, replay: boolean): void;
|
||||
|
||||
/** Added for readability when accessing stable property names. */
|
||||
declare function setResolved(eventInfo: EventInfo, resolved: boolean): void;
|
||||
|
||||
/** Added for readability when accessing stable property names. */
|
||||
declare function setTargetElement(eventInfo: EventInfo, targetElement: Element): void;
|
||||
|
||||
/** Added for readability when accessing stable property names. */
|
||||
declare function setTimestamp(eventInfo: EventInfo, timestamp: number): void;
|
||||
|
||||
/**
|
||||
* The API of an EventContract that is safe to call from any compilation unit.
|
||||
*/
|
||||
declare interface UnrenamedEventContract {
|
||||
ecrd(dispatcher: Dispatcher, restriction: Restriction): void;
|
||||
}
|
||||
|
||||
/** Added for readability when accessing stable property names. */
|
||||
declare function unsetAction(eventInfo: EventInfo): void;
|
||||
|
||||
export { }
|
||||
304
node_modules/@angular/core/primitives/signals/index.d.ts
generated
vendored
Executable file
304
node_modules/@angular/core/primitives/signals/index.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,304 @@
|
|||
/**
|
||||
* @license Angular v18.2.10
|
||||
* (c) 2010-2024 Google LLC. https://angular.io/
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
|
||||
declare type ComputedGetter<T> = (() => T) & {
|
||||
[SIGNAL]: ComputedNode<T>;
|
||||
};
|
||||
|
||||
/**
|
||||
* A computation, which derives a value from a declarative reactive expression.
|
||||
*
|
||||
* `Computed`s are both producers and consumers of reactivity.
|
||||
*/
|
||||
export declare interface ComputedNode<T> extends ReactiveNode {
|
||||
/**
|
||||
* Current value of the computation, or one of the sentinel values above (`UNSET`, `COMPUTING`,
|
||||
* `ERROR`).
|
||||
*/
|
||||
value: T;
|
||||
/**
|
||||
* If `value` is `ERRORED`, the error caught from the last computation attempt which will
|
||||
* be re-thrown.
|
||||
*/
|
||||
error: unknown;
|
||||
/**
|
||||
* The computation function which will produce a new value.
|
||||
*/
|
||||
computation: () => T;
|
||||
equal: ValueEqualityFn<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finalize this consumer's state after a reactive computation has run.
|
||||
*
|
||||
* Must be called by subclasses which represent reactive computations, after those computations
|
||||
* have finished.
|
||||
*/
|
||||
export declare function consumerAfterComputation(node: ReactiveNode | null, prevConsumer: ReactiveNode | null): void;
|
||||
|
||||
/**
|
||||
* Prepare this consumer to run a computation in its reactive context.
|
||||
*
|
||||
* Must be called by subclasses which represent reactive computations, before those computations
|
||||
* begin.
|
||||
*/
|
||||
export declare function consumerBeforeComputation(node: ReactiveNode | null): ReactiveNode | null;
|
||||
|
||||
/**
|
||||
* Disconnect this consumer from the graph.
|
||||
*/
|
||||
export declare function consumerDestroy(node: ReactiveNode): void;
|
||||
|
||||
export declare function consumerMarkDirty(node: ReactiveNode): void;
|
||||
|
||||
/**
|
||||
* Determine whether this consumer has any dependencies which have changed since the last time
|
||||
* they were read.
|
||||
*/
|
||||
export declare function consumerPollProducersForChange(node: ReactiveNode): boolean;
|
||||
|
||||
/**
|
||||
* Create a computed signal which derives a reactive value from an expression.
|
||||
*/
|
||||
export declare function createComputed<T>(computation: () => T): ComputedGetter<T>;
|
||||
|
||||
/**
|
||||
* Create a `Signal` that can be set or updated directly.
|
||||
*/
|
||||
export declare function createSignal<T>(initialValue: T): SignalGetter<T>;
|
||||
|
||||
export declare function createWatch(fn: (onCleanup: WatchCleanupRegisterFn) => void, schedule: (watch: Watch) => void, allowSignalWrites: boolean): Watch;
|
||||
|
||||
/**
|
||||
* The default equality function used for `signal` and `computed`, which uses referential equality.
|
||||
*/
|
||||
export declare function defaultEquals<T>(a: T, b: T): boolean;
|
||||
|
||||
export declare function getActiveConsumer(): ReactiveNode | null;
|
||||
|
||||
export declare function isInNotificationPhase(): boolean;
|
||||
|
||||
export declare function isReactive(value: unknown): value is Reactive;
|
||||
|
||||
/**
|
||||
* Called by implementations when a producer's signal is read.
|
||||
*/
|
||||
export declare function producerAccessed(node: ReactiveNode): void;
|
||||
|
||||
/**
|
||||
* Increment the global epoch counter.
|
||||
*
|
||||
* Called by source producers (that is, not computeds) whenever their values change.
|
||||
*/
|
||||
export declare function producerIncrementEpoch(): void;
|
||||
|
||||
/**
|
||||
* Propagate a dirty notification to live consumers of this producer.
|
||||
*/
|
||||
export declare function producerNotifyConsumers(node: ReactiveNode): void;
|
||||
|
||||
/**
|
||||
* Whether this `ReactiveNode` in its producer capacity is currently allowed to initiate updates,
|
||||
* based on the current consumer context.
|
||||
*/
|
||||
export declare function producerUpdatesAllowed(): boolean;
|
||||
|
||||
/**
|
||||
* Ensure this producer's `version` is up-to-date.
|
||||
*/
|
||||
export declare function producerUpdateValueVersion(node: ReactiveNode): void;
|
||||
|
||||
export declare interface Reactive {
|
||||
[SIGNAL]: ReactiveNode;
|
||||
}
|
||||
|
||||
export declare const REACTIVE_NODE: ReactiveNode;
|
||||
|
||||
/**
|
||||
* A producer and/or consumer which participates in the reactive graph.
|
||||
*
|
||||
* Producer `ReactiveNode`s which are accessed when a consumer `ReactiveNode` is the
|
||||
* `activeConsumer` are tracked as dependencies of that consumer.
|
||||
*
|
||||
* Certain consumers are also tracked as "live" consumers and create edges in the other direction,
|
||||
* from producer to consumer. These edges are used to propagate change notifications when a
|
||||
* producer's value is updated.
|
||||
*
|
||||
* A `ReactiveNode` may be both a producer and consumer.
|
||||
*/
|
||||
export declare interface ReactiveNode {
|
||||
/**
|
||||
* Version of the value that this node produces.
|
||||
*
|
||||
* This is incremented whenever a new value is produced by this node which is not equal to the
|
||||
* previous value (by whatever definition of equality is in use).
|
||||
*/
|
||||
version: Version;
|
||||
/**
|
||||
* Epoch at which this node is verified to be clean.
|
||||
*
|
||||
* This allows skipping of some polling operations in the case where no signals have been set
|
||||
* since this node was last read.
|
||||
*/
|
||||
lastCleanEpoch: Version;
|
||||
/**
|
||||
* Whether this node (in its consumer capacity) is dirty.
|
||||
*
|
||||
* Only live consumers become dirty, when receiving a change notification from a dependency
|
||||
* producer.
|
||||
*/
|
||||
dirty: boolean;
|
||||
/**
|
||||
* Producers which are dependencies of this consumer.
|
||||
*
|
||||
* Uses the same indices as the `producerLastReadVersion` and `producerIndexOfThis` arrays.
|
||||
*/
|
||||
producerNode: ReactiveNode[] | undefined;
|
||||
/**
|
||||
* `Version` of the value last read by a given producer.
|
||||
*
|
||||
* Uses the same indices as the `producerNode` and `producerIndexOfThis` arrays.
|
||||
*/
|
||||
producerLastReadVersion: Version[] | undefined;
|
||||
/**
|
||||
* Index of `this` (consumer) in each producer's `liveConsumers` array.
|
||||
*
|
||||
* This value is only meaningful if this node is live (`liveConsumers.length > 0`). Otherwise
|
||||
* these indices are stale.
|
||||
*
|
||||
* Uses the same indices as the `producerNode` and `producerLastReadVersion` arrays.
|
||||
*/
|
||||
producerIndexOfThis: number[] | undefined;
|
||||
/**
|
||||
* Index into the producer arrays that the next dependency of this node as a consumer will use.
|
||||
*
|
||||
* This index is zeroed before this node as a consumer begins executing. When a producer is read,
|
||||
* it gets inserted into the producers arrays at this index. There may be an existing dependency
|
||||
* in this location which may or may not match the incoming producer, depending on whether the
|
||||
* same producers were read in the same order as the last computation.
|
||||
*/
|
||||
nextProducerIndex: number;
|
||||
/**
|
||||
* Array of consumers of this producer that are "live" (they require push notifications).
|
||||
*
|
||||
* `liveConsumerNode.length` is effectively our reference count for this node.
|
||||
*/
|
||||
liveConsumerNode: ReactiveNode[] | undefined;
|
||||
/**
|
||||
* Index of `this` (producer) in each consumer's `producerNode` array.
|
||||
*
|
||||
* Uses the same indices as the `liveConsumerNode` array.
|
||||
*/
|
||||
liveConsumerIndexOfThis: number[] | undefined;
|
||||
/**
|
||||
* Whether writes to signals are allowed when this consumer is the `activeConsumer`.
|
||||
*
|
||||
* This is used to enforce guardrails such as preventing writes to writable signals in the
|
||||
* computation function of computed signals, which is supposed to be pure.
|
||||
*/
|
||||
consumerAllowSignalWrites: boolean;
|
||||
readonly consumerIsAlwaysLive: boolean;
|
||||
/**
|
||||
* Tracks whether producers need to recompute their value independently of the reactive graph (for
|
||||
* example, if no initial value has been computed).
|
||||
*/
|
||||
producerMustRecompute(node: unknown): boolean;
|
||||
producerRecomputeValue(node: unknown): void;
|
||||
consumerMarkedDirty(node: unknown): void;
|
||||
/**
|
||||
* Called when a signal is read within this consumer.
|
||||
*/
|
||||
consumerOnSignalRead(node: unknown): void;
|
||||
}
|
||||
|
||||
export declare function runPostSignalSetFn(): void;
|
||||
|
||||
export declare function setActiveConsumer(consumer: ReactiveNode | null): ReactiveNode | null;
|
||||
|
||||
|
||||
export declare function setAlternateWeakRefImpl(impl: unknown): void;
|
||||
|
||||
export declare function setPostSignalSetFn(fn: (() => void) | null): (() => void) | null;
|
||||
|
||||
export declare function setThrowInvalidWriteToSignalError(fn: () => never): void;
|
||||
|
||||
/**
|
||||
* Symbol used to tell `Signal`s apart from other functions.
|
||||
*
|
||||
* This can be used to auto-unwrap signals in various cases, or to auto-wrap non-signal values.
|
||||
*/
|
||||
export declare const SIGNAL: unique symbol;
|
||||
|
||||
export declare const SIGNAL_NODE: SignalNode<unknown>;
|
||||
|
||||
declare type SignalBaseGetter<T> = (() => T) & {
|
||||
readonly [SIGNAL]: unknown;
|
||||
};
|
||||
|
||||
export declare interface SignalGetter<T> extends SignalBaseGetter<T> {
|
||||
readonly [SIGNAL]: SignalNode<T>;
|
||||
}
|
||||
|
||||
export declare interface SignalNode<T> extends ReactiveNode {
|
||||
value: T;
|
||||
equal: ValueEqualityFn<T>;
|
||||
}
|
||||
|
||||
export declare function signalSetFn<T>(node: SignalNode<T>, newValue: T): void;
|
||||
|
||||
export declare function signalUpdateFn<T>(node: SignalNode<T>, updater: (value: T) => T): void;
|
||||
|
||||
|
||||
/**
|
||||
* A comparison function which can determine if two values are equal.
|
||||
*/
|
||||
export declare type ValueEqualityFn<T> = (a: T, b: T) => boolean;
|
||||
|
||||
|
||||
declare type Version = number & {
|
||||
__brand: 'Version';
|
||||
};
|
||||
|
||||
export declare interface Watch {
|
||||
notify(): void;
|
||||
/**
|
||||
* Execute the reactive expression in the context of this `Watch` consumer.
|
||||
*
|
||||
* Should be called by the user scheduling algorithm when the provided
|
||||
* `schedule` hook is called by `Watch`.
|
||||
*/
|
||||
run(): void;
|
||||
cleanup(): void;
|
||||
/**
|
||||
* Destroy the watcher:
|
||||
* - disconnect it from the reactive graph;
|
||||
* - mark it as destroyed so subsequent run and notify operations are noop.
|
||||
*/
|
||||
destroy(): void;
|
||||
[SIGNAL]: WatchNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* A cleanup function that can be optionally registered from the watch logic. If registered, the
|
||||
* cleanup logic runs before the next watch execution.
|
||||
*/
|
||||
export declare type WatchCleanupFn = () => void;
|
||||
|
||||
/**
|
||||
* A callback passed to the watch function that makes it possible to register cleanup logic.
|
||||
*/
|
||||
export declare type WatchCleanupRegisterFn = (cleanupFn: WatchCleanupFn) => void;
|
||||
|
||||
declare interface WatchNode extends ReactiveNode {
|
||||
hasRun: boolean;
|
||||
fn: ((onCleanup: WatchCleanupRegisterFn) => void) | null;
|
||||
schedule: ((watch: Watch) => void) | null;
|
||||
cleanupFn: WatchCleanupFn;
|
||||
ref: Watch;
|
||||
}
|
||||
|
||||
export { }
|
||||
Loading…
Add table
Add a link
Reference in a new issue