effectable 0.1.0
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/LICENSE +21 -0
- package/README.md +157 -0
- package/build/LICENSE +21 -0
- package/build/bootstrap/bootstrap.d.ts +32 -0
- package/build/bootstrap/bootstrap.d.ts.map +1 -0
- package/build/bootstrap/bootstrap.js +179 -0
- package/build/bootstrap/bootstrap.js.map +1 -0
- package/build/bootstrap/index.d.ts +9 -0
- package/build/bootstrap/index.d.ts.map +1 -0
- package/build/bootstrap/index.js +14 -0
- package/build/bootstrap/index.js.map +1 -0
- package/build/bootstrap/types.d.ts +105 -0
- package/build/bootstrap/types.d.ts.map +1 -0
- package/build/bootstrap/types.js +26 -0
- package/build/bootstrap/types.js.map +1 -0
- package/build/component/Component.d.ts +126 -0
- package/build/component/Component.d.ts.map +1 -0
- package/build/component/Component.js +123 -0
- package/build/component/Component.js.map +1 -0
- package/build/component/GraphRuntime.d.ts +457 -0
- package/build/component/GraphRuntime.d.ts.map +1 -0
- package/build/component/GraphRuntime.js +1168 -0
- package/build/component/GraphRuntime.js.map +1 -0
- package/build/component/constants.d.ts +1 -0
- package/build/component/constants.d.ts.map +1 -0
- package/build/component/constants.js +2 -0
- package/build/component/constants.js.map +1 -0
- package/build/component/context.d.ts +199 -0
- package/build/component/context.d.ts.map +1 -0
- package/build/component/context.js +262 -0
- package/build/component/context.js.map +1 -0
- package/build/component/graphRuntime.constants.d.ts +13 -0
- package/build/component/graphRuntime.constants.d.ts.map +1 -0
- package/build/component/graphRuntime.constants.js +15 -0
- package/build/component/graphRuntime.constants.js.map +1 -0
- package/build/component/h.d.ts +48 -0
- package/build/component/h.d.ts.map +1 -0
- package/build/component/h.js +72 -0
- package/build/component/h.js.map +1 -0
- package/build/component/index.d.ts +19 -0
- package/build/component/index.d.ts.map +1 -0
- package/build/component/index.js +39 -0
- package/build/component/index.js.map +1 -0
- package/build/component/lifecycle.d.ts +179 -0
- package/build/component/lifecycle.d.ts.map +1 -0
- package/build/component/lifecycle.js +367 -0
- package/build/component/lifecycle.js.map +1 -0
- package/build/component/refs.d.ts +105 -0
- package/build/component/refs.d.ts.map +1 -0
- package/build/component/refs.js +128 -0
- package/build/component/refs.js.map +1 -0
- package/build/component/types.d.ts +169 -0
- package/build/component/types.d.ts.map +1 -0
- package/build/component/types.js +40 -0
- package/build/component/types.js.map +1 -0
- package/build/connect/connect.d.ts +31 -0
- package/build/connect/connect.d.ts.map +1 -0
- package/build/connect/connect.js +500 -0
- package/build/connect/connect.js.map +1 -0
- package/build/connect/index.d.ts +8 -0
- package/build/connect/index.d.ts.map +1 -0
- package/build/connect/index.js +11 -0
- package/build/connect/index.js.map +1 -0
- package/build/connect/types.d.ts +90 -0
- package/build/connect/types.d.ts.map +1 -0
- package/build/connect/types.js +8 -0
- package/build/connect/types.js.map +1 -0
- package/build/index.d.ts +26 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +60 -0
- package/build/index.js.map +1 -0
- package/build/runtime/BusDecorators.d.ts +113 -0
- package/build/runtime/BusDecorators.d.ts.map +1 -0
- package/build/runtime/BusDecorators.js +302 -0
- package/build/runtime/BusDecorators.js.map +1 -0
- package/build/runtime/CommandBus.d.ts +43 -0
- package/build/runtime/CommandBus.d.ts.map +1 -0
- package/build/runtime/CommandBus.js +65 -0
- package/build/runtime/CommandBus.js.map +1 -0
- package/build/runtime/EventBus.d.ts +50 -0
- package/build/runtime/EventBus.d.ts.map +1 -0
- package/build/runtime/EventBus.js +90 -0
- package/build/runtime/EventBus.js.map +1 -0
- package/build/runtime/HandleRegistry.d.ts +143 -0
- package/build/runtime/HandleRegistry.d.ts.map +1 -0
- package/build/runtime/HandleRegistry.js +244 -0
- package/build/runtime/HandleRegistry.js.map +1 -0
- package/build/runtime/QueryBus.d.ts +43 -0
- package/build/runtime/QueryBus.d.ts.map +1 -0
- package/build/runtime/QueryBus.js +65 -0
- package/build/runtime/QueryBus.js.map +1 -0
- package/build/runtime/index.d.ts +13 -0
- package/build/runtime/index.d.ts.map +1 -0
- package/build/runtime/index.js +32 -0
- package/build/runtime/index.js.map +1 -0
- package/build/runtime/types.d.ts +79 -0
- package/build/runtime/types.d.ts.map +1 -0
- package/build/runtime/types.js +8 -0
- package/build/runtime/types.js.map +1 -0
- package/build/store/createStore.d.ts +36 -0
- package/build/store/createStore.d.ts.map +1 -0
- package/build/store/createStore.js +131 -0
- package/build/store/createStore.js.map +1 -0
- package/build/store/index.d.ts +14 -0
- package/build/store/index.d.ts.map +1 -0
- package/build/store/index.js +39 -0
- package/build/store/index.js.map +1 -0
- package/build/store/middleware.d.ts +38 -0
- package/build/store/middleware.d.ts.map +1 -0
- package/build/store/middleware.js +99 -0
- package/build/store/middleware.js.map +1 -0
- package/build/store/selector.d.ts +62 -0
- package/build/store/selector.d.ts.map +1 -0
- package/build/store/selector.js +226 -0
- package/build/store/selector.js.map +1 -0
- package/build/store/semanticStateTree.d.ts +91 -0
- package/build/store/semanticStateTree.d.ts.map +1 -0
- package/build/store/semanticStateTree.js +263 -0
- package/build/store/semanticStateTree.js.map +1 -0
- package/build/store/types.d.ts +259 -0
- package/build/store/types.d.ts.map +1 -0
- package/build/store/types.js +28 -0
- package/build/store/types.js.map +1 -0
- package/package.json +109 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lifecycle and Disposable types for Effectable/component.
|
|
3
|
+
* Lifecycle contract and Explicit Resource Management (TS 5.2+, Symbol.dispose).
|
|
4
|
+
* Also includes VirtualServiceNode, Fiber, and NodeLifecycleStatus types for declarative component trees.
|
|
5
|
+
*
|
|
6
|
+
* @module Effectable/component/types
|
|
7
|
+
*/
|
|
8
|
+
import type { Component } from './Component';
|
|
9
|
+
/**
|
|
10
|
+
* Lifecycle interface for a GraphRuntime / connect-HOC component instance.
|
|
11
|
+
* Methods are called in order: onMount -> onUpdate* -> onUnmount.
|
|
12
|
+
*/
|
|
13
|
+
export interface Lifecycle {
|
|
14
|
+
/** Mount: start subscriptions, timers, and background work. */
|
|
15
|
+
onMount?(): void | Promise<void>;
|
|
16
|
+
/** On every state/props update (prev/next). */
|
|
17
|
+
onUpdate?(prev: unknown, next: unknown): void | Promise<void>;
|
|
18
|
+
/** Unmount: drop subscriptions and stop side effects. */
|
|
19
|
+
onUnmount?(): void | Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Internal runtime hook for components that need custom application of incoming `props`
|
|
23
|
+
* during reconcile instead of a direct `instance.props = nextProps`.
|
|
24
|
+
*
|
|
25
|
+
* Used by `connect`-HOC to update props and rebuild merged props
|
|
26
|
+
* (`props + dispatch props + state props`) without losing previously computed values.
|
|
27
|
+
*/
|
|
28
|
+
export declare const RUNTIME_PROPS_RECEIVER: unique symbol;
|
|
29
|
+
/**
|
|
30
|
+
* Hidden scheduler hook: GraphRuntime writes this symbol onto a mounted instance after
|
|
31
|
+
* successful startup. `Component.setState()` invokes it after `onUpdate` so GraphRuntime
|
|
32
|
+
* can schedule an automatic subtree reconcile without an explicit external call.
|
|
33
|
+
*
|
|
34
|
+
* Cleared by GraphRuntime before `runShutdown` on unmount.
|
|
35
|
+
* Absence of the symbol on the instance (standalone or before mount / after unmount) means “no runtime”.
|
|
36
|
+
*/
|
|
37
|
+
export declare const SCHEDULE_UPDATE_HOOK: unique symbol;
|
|
38
|
+
/**
|
|
39
|
+
* Internal contract for a component that intercepts `props` updates from GraphRuntime.
|
|
40
|
+
*
|
|
41
|
+
* Not part of the public API for user components; intended for infrastructure HOCs.
|
|
42
|
+
*/
|
|
43
|
+
export interface RuntimePropsReceiver<P = unknown> {
|
|
44
|
+
[RUNTIME_PROPS_RECEIVER]?(props: P): void;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Explicit Resource Management (ECMAScript) contract.
|
|
48
|
+
* Implementation allows using the instance in `using` for a guaranteed dispose call on block exit.
|
|
49
|
+
*/
|
|
50
|
+
export interface Disposable {
|
|
51
|
+
[Symbol.dispose](): void;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Typed ref object for accessing a component instance from a parent.
|
|
55
|
+
* Filled by GraphRuntime when the node mounts.
|
|
56
|
+
*/
|
|
57
|
+
export interface RefObject<T> {
|
|
58
|
+
/** Current component instance (null before mount or after unmount). */
|
|
59
|
+
current: T | null;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Typed component constructor.
|
|
63
|
+
*/
|
|
64
|
+
export type ComponentConstructor<P = unknown> = new (props: P) => Component<unknown, P>;
|
|
65
|
+
/**
|
|
66
|
+
* Virtual service-tree node — a declarative component description for GraphRuntime.
|
|
67
|
+
* Created by h() and never contains side effects.
|
|
68
|
+
*
|
|
69
|
+
* To store heterogeneous nodes in arrays (compose() result, children)
|
|
70
|
+
* use AnyVirtualServiceNode (without a generic).
|
|
71
|
+
*/
|
|
72
|
+
export interface VirtualServiceNode<P = unknown> {
|
|
73
|
+
/**
|
|
74
|
+
* Component class that GraphRuntime will instantiate.
|
|
75
|
+
* Stored as an unknown constructor for covariant compatibility when held
|
|
76
|
+
* in arrays and runtime structures. GraphRuntime uses vnode.props to create the instance.
|
|
77
|
+
*/
|
|
78
|
+
type: ComponentConstructor<unknown>;
|
|
79
|
+
/** Props passed to the component constructor. */
|
|
80
|
+
props: P;
|
|
81
|
+
/**
|
|
82
|
+
* Stable identity key for diffing.
|
|
83
|
+
* Required in dynamic lists — without a key the reconciler cannot correctly reuse nodes.
|
|
84
|
+
*/
|
|
85
|
+
key?: string;
|
|
86
|
+
/** Ref for accessing the instance from the parent component. */
|
|
87
|
+
ref?: RefObject<unknown>;
|
|
88
|
+
/** Child nodes in declaration order. */
|
|
89
|
+
children: VirtualServiceNode[];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Node lifecycle status within GraphRuntime.
|
|
93
|
+
* Transitions are strictly unidirectional (except the ready -> update pass -> ready loop).
|
|
94
|
+
*
|
|
95
|
+
* registered -> resolved -> created -> mounted -> ready
|
|
96
|
+
* ready -(props/state/context change)-> update pass -> ready
|
|
97
|
+
* ready -> unmounting -> unmounted -> destroyed
|
|
98
|
+
* any stage -> failed (no return)
|
|
99
|
+
*/
|
|
100
|
+
export type NodeLifecycleStatus = 'registered' | 'resolved' | 'created' | 'mounted' | 'ready' | 'unmounting' | 'unmounted' | 'destroyed' | 'failed';
|
|
101
|
+
/**
|
|
102
|
+
* Named fiber effect tags for the reconciler commit phase.
|
|
103
|
+
* null (no tag) is not part of the object — see {@link FiberEffectTag}.
|
|
104
|
+
*/
|
|
105
|
+
export declare const FIBER_EFFECT_TAG: {
|
|
106
|
+
/** New node (PLACE). */
|
|
107
|
+
readonly PLACE: "PLACE";
|
|
108
|
+
/** Props update (UPDATE). */
|
|
109
|
+
readonly UPDATE: "UPDATE";
|
|
110
|
+
/** Node removal (DELETE). */
|
|
111
|
+
readonly DELETE: "DELETE";
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Fiber effect tag: a value from {@link FIBER_EFFECT_TAG} or `null`.
|
|
115
|
+
*
|
|
116
|
+
* NOTE: `null` means no uncommitted effect on the fiber. Currently set only after
|
|
117
|
+
* a successful PLACE/materialize: when `runStartup` completes ok (sync materialize path,
|
|
118
|
+
* `continueMaterializeAsync`, `finalizeMaterializeAsync`), GraphRuntime resets
|
|
119
|
+
* `effectTag` from {@link FIBER_EFFECT_TAG.PLACE} to `null` before `injectUpdateHook`.
|
|
120
|
+
*
|
|
121
|
+
* Do not confuse with “node was never updated”: after {@link FIBER_EFFECT_TAG.UPDATE}
|
|
122
|
+
* (`applyFiberUpdate`) the tag remains `UPDATE` and is not reset back to `null`.
|
|
123
|
+
* For DELETE there is no separate assignment on the fiber in the current GraphRuntime —
|
|
124
|
+
* removal goes through `destroyFiber` without writing `effectTag = DELETE`.
|
|
125
|
+
*/
|
|
126
|
+
export type FiberEffectTag = (typeof FIBER_EFFECT_TAG)[keyof typeof FIBER_EFFECT_TAG] | null;
|
|
127
|
+
/**
|
|
128
|
+
* Readonly snapshot of a fiber node for test/debug introspection ({@link GraphRuntime.inspectRootFiber}).
|
|
129
|
+
* Does not contain mutable references to RuntimeFiber / instance / engine.
|
|
130
|
+
*/
|
|
131
|
+
export type FiberInspectNode = {
|
|
132
|
+
/** Current effectTag after the last materialize/reconcile phase. */
|
|
133
|
+
effectTag: FiberEffectTag;
|
|
134
|
+
/** true if the fiber has a materialized instance. */
|
|
135
|
+
hasInstance: boolean;
|
|
136
|
+
/** Virtual node key (null if unset). */
|
|
137
|
+
key: string | null;
|
|
138
|
+
/** Number of direct child fibers. */
|
|
139
|
+
childCount: number;
|
|
140
|
+
/** Recursive readonly child snapshots (compose order). */
|
|
141
|
+
children: readonly FiberInspectNode[];
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Fiber — the reconciler work unit.
|
|
145
|
+
* Each virtual tree node has a corresponding fiber in the current tree.
|
|
146
|
+
* During reconcile a work-in-progress (WIP) tree is built via the alternate field.
|
|
147
|
+
*/
|
|
148
|
+
export interface Fiber<P = unknown> {
|
|
149
|
+
/** Virtual node this fiber was created from. */
|
|
150
|
+
vnode: VirtualServiceNode<P>;
|
|
151
|
+
/** Real component instance (null before the created phase). */
|
|
152
|
+
instance: Component<unknown, P> | null;
|
|
153
|
+
/** Current node lifecycle status. */
|
|
154
|
+
lifecycleStatus: NodeLifecycleStatus;
|
|
155
|
+
/** Child fibers in declaration order. */
|
|
156
|
+
children: Fiber[];
|
|
157
|
+
/** Parent fiber (null for the root). */
|
|
158
|
+
parentFiber: Fiber | null;
|
|
159
|
+
/**
|
|
160
|
+
* Alternate fiber — WIP pair of the current node during reconcile.
|
|
161
|
+
* current.alternate == wip, wip.alternate == current.
|
|
162
|
+
*/
|
|
163
|
+
alternate: Fiber | null;
|
|
164
|
+
/** Pending props for a node update (null — no pending update). */
|
|
165
|
+
pendingProps: P | null;
|
|
166
|
+
/** Effect tag for the commit phase. */
|
|
167
|
+
effectTag: FiberEffectTag;
|
|
168
|
+
}
|
|
169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AAC;IACrC,yCAAyC;IACzC,QAAQ,EAAE,KAAK,EAAE,CAAC;IAClB,wCAAwC;IACxC,WAAW,EAAE,KAAK,GAAG,IAAI,CAAC;IAC1B;;;OAGG;IACH,SAAS,EAAE,KAAK,GAAG,IAAI,CAAC;IACxB,kEAAkE;IAClE,YAAY,EAAE,CAAC,GAAG,IAAI,CAAC;IACvB,uCAAuC;IACvC,SAAS,EAAE,cAAc,CAAC;CAC3B"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Lifecycle and Disposable types for Effectable/component.
|
|
4
|
+
* Lifecycle contract and Explicit Resource Management (TS 5.2+, Symbol.dispose).
|
|
5
|
+
* Also includes VirtualServiceNode, Fiber, and NodeLifecycleStatus types for declarative component trees.
|
|
6
|
+
*
|
|
7
|
+
* @module Effectable/component/types
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.FIBER_EFFECT_TAG = exports.SCHEDULE_UPDATE_HOOK = exports.RUNTIME_PROPS_RECEIVER = void 0;
|
|
11
|
+
/**
|
|
12
|
+
* Internal runtime hook for components that need custom application of incoming `props`
|
|
13
|
+
* during reconcile instead of a direct `instance.props = nextProps`.
|
|
14
|
+
*
|
|
15
|
+
* Used by `connect`-HOC to update props and rebuild merged props
|
|
16
|
+
* (`props + dispatch props + state props`) without losing previously computed values.
|
|
17
|
+
*/
|
|
18
|
+
exports.RUNTIME_PROPS_RECEIVER = Symbol('effectable:runtime_props_receiver');
|
|
19
|
+
/**
|
|
20
|
+
* Hidden scheduler hook: GraphRuntime writes this symbol onto a mounted instance after
|
|
21
|
+
* successful startup. `Component.setState()` invokes it after `onUpdate` so GraphRuntime
|
|
22
|
+
* can schedule an automatic subtree reconcile without an explicit external call.
|
|
23
|
+
*
|
|
24
|
+
* Cleared by GraphRuntime before `runShutdown` on unmount.
|
|
25
|
+
* Absence of the symbol on the instance (standalone or before mount / after unmount) means “no runtime”.
|
|
26
|
+
*/
|
|
27
|
+
exports.SCHEDULE_UPDATE_HOOK = Symbol('effectable:schedule_update_hook');
|
|
28
|
+
/**
|
|
29
|
+
* Named fiber effect tags for the reconciler commit phase.
|
|
30
|
+
* null (no tag) is not part of the object — see {@link FiberEffectTag}.
|
|
31
|
+
*/
|
|
32
|
+
exports.FIBER_EFFECT_TAG = {
|
|
33
|
+
/** New node (PLACE). */
|
|
34
|
+
PLACE: 'PLACE',
|
|
35
|
+
/** Props update (UPDATE). */
|
|
36
|
+
UPDATE: 'UPDATE',
|
|
37
|
+
/** Node removal (DELETE). */
|
|
38
|
+
DELETE: 'DELETE',
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/component/types.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAiBH;;;;;;GAMG;AACU,QAAA,sBAAsB,GAAG,MAAM,CAAC,mCAAmC,CAAC,CAAC;AAElF;;;;;;;GAOG;AACU,QAAA,oBAAoB,GAAG,MAAM,CAAC,iCAAiC,CAAC,CAAC;AAoF9E;;;GAGG;AACU,QAAA,gBAAgB,GAAG;IAC9B,wBAAwB;IACxB,KAAK,EAAE,OAAO;IACd,6BAA6B;IAC7B,MAAM,EAAE,QAAQ;IAChB,6BAA6B;IAC7B,MAAM,EAAE,QAAQ;CACR,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HOC connect: connects a component class to the store via mapStateToProps and/or mapDispatchToProps,
|
|
3
|
+
* implemented as a class-based wrapper over the original class.
|
|
4
|
+
*
|
|
5
|
+
* Call: `connect(store, mapState?, mapDispatch?)(Ctor)`.
|
|
6
|
+
* Third argument: full function `(dispatch, props) => …`, short `(dispatch) => …`,
|
|
7
|
+
* or an object of action creators `{ key: (...args) => action }` (see `resolveMapDispatchProps`).
|
|
8
|
+
*
|
|
9
|
+
* @module Effectable/connect/connect
|
|
10
|
+
*/
|
|
11
|
+
import type { Action } from '../store/types';
|
|
12
|
+
import type { Store } from '../store/types';
|
|
13
|
+
import type { MapStateToProps, MapDispatchToProps, ConnectOptions, ConnectableHocTarget } from './types';
|
|
14
|
+
/**
|
|
15
|
+
* Connects a component class to the store (class-based HOC): merge into `props` from state and/or dispatch.
|
|
16
|
+
* Supports two forms:
|
|
17
|
+
* - `connect(store, mapState?, mapDispatch?)` for a root connected component;
|
|
18
|
+
* - `connect(mapState?, mapDispatch?)` for a child connected component that receives the store from context.
|
|
19
|
+
*
|
|
20
|
+
* @template S store state type
|
|
21
|
+
* @template P props type of the connected component
|
|
22
|
+
* @template R result type of `mapStateToProps`
|
|
23
|
+
* @template A action type
|
|
24
|
+
* @param {Store<S, A> | MapStateToProps<S, P, R> | null | undefined} [storeOrMapStateToProps] - explicit store or `mapStateToProps`
|
|
25
|
+
* @param {MapStateToProps<S, P, R> | MapDispatchToProps<S, P, A> | null | undefined} [mapStateToPropsOrMapDispatchToProps] - `mapStateToProps` or `mapDispatchToProps`
|
|
26
|
+
* @param {MapDispatchToProps<S, P, A> | ConnectOptions | null | undefined} [mapDispatchToPropsOrOptions] - `mapDispatchToProps` or {@link ConnectOptions}
|
|
27
|
+
* @param {ConnectOptions} [maybeOptions] - {@link ConnectOptions} (e.g. `ownPropsModeMerge`) for the form with an explicit store
|
|
28
|
+
* @returns {<C extends ConnectableHocTarget>(Constructor: C) => C} HOC: `(Ctor) => subclass of C` with the same constructor name
|
|
29
|
+
*/
|
|
30
|
+
export declare function connect<S, P = unknown, R = unknown, A extends Action = Action>(storeOrMapStateToProps?: Store<S, A> | MapStateToProps<S, P, R> | null, mapStateToPropsOrMapDispatchToProps?: MapStateToProps<S, P, R> | MapDispatchToProps<S, P, A> | null, mapDispatchToPropsOrOptions?: MapDispatchToProps<S, P, A> | ConnectOptions | null, maybeOptions?: ConnectOptions): <C extends ConnectableHocTarget>(Constructor: C) => C;
|
|
31
|
+
//# sourceMappingURL=connect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../src/connect/connect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAU5C,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAIlB,cAAc,EACd,oBAAoB,EAErB,MAAM,SAAS,CAAC;AAqjBjB;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EAC5E,sBAAsB,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,EACtE,mCAAmC,CAAC,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,EACnG,2BAA2B,CAAC,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,cAAc,GAAG,IAAI,EACjF,YAAY,CAAC,EAAE,cAAc,GAC5B,CAAC,CAAC,SAAS,oBAAoB,EAAE,WAAW,EAAE,CAAC,KAAK,CAAC,CA2BvD"}
|