@manyducks.co/dolla 2.0.0-alpha.35 → 2.0.0-alpha.37
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/README.md +1 -12
- package/dist/core/context.d.ts +1 -52
- package/dist/core/dolla.d.ts +4 -4
- package/dist/core/nodes/dynamic.d.ts +5 -5
- package/dist/core/nodes/html.d.ts +11 -15
- package/dist/core/nodes/list.d.ts +9 -15
- package/dist/core/nodes/outlet.d.ts +6 -6
- package/dist/core/nodes/portal.d.ts +2 -2
- package/dist/core/nodes/view.d.ts +17 -34
- package/dist/core/ref.d.ts +0 -17
- package/dist/core/signals.d.ts +0 -3
- package/dist/core/store.d.ts +10 -16
- package/dist/core/symbols.d.ts +0 -1
- package/dist/http/index.d.ts +0 -1
- package/dist/index.js +1237 -898
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.js +20 -14
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx-runtime.js +27 -16
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/markup-Px0heVon.js +1465 -0
- package/dist/markup-Px0heVon.js.map +1 -0
- package/dist/typeChecking.d.ts +0 -96
- package/dist/typeChecking.test.d.ts +1 -0
- package/dist/types.d.ts +0 -1
- package/dist/utils.d.ts +4 -1
- package/docs/views.md +0 -86
- package/notes/context-routes.md +56 -0
- package/notes/elimination.md +33 -0
- package/package.json +3 -4
- package/vite.config.js +5 -3
- package/dist/core/_batch.d.ts +0 -21
- package/dist/markup-BWJWLvDF.js +0 -1634
- package/dist/markup-BWJWLvDF.js.map +0 -1
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ Dolla's goals include:
|
|
|
25
25
|
|
|
26
26
|
> TODO: Write about why Dolla was started and what it's all about.
|
|
27
27
|
|
|
28
|
-
- Borne of frustration using React and similar libs (useEffect, referential equality, a pain to integrate other libs into its lifecycle, need to hunt for libraries to move beyond Hello World).
|
|
28
|
+
- Borne of frustration using React and similar libs (useEffect, referential equality, a pain to integrate other libs into its lifecycle, need to hunt for libraries to move much beyond Hello World).
|
|
29
29
|
- Merges ideas from my favorite libraries and frameworks (Solid/Knockout, Choo, Svelte, i18next, etc) into one curated set designed to work well together.
|
|
30
30
|
- Opinionated (with the _correct_ opinions).
|
|
31
31
|
- Many mainstream libraries seem too big for what they do. The entirety of Dolla is less than half the size of [`react-router`](https://bundlephobia.com/package/react-router@7.1.5).
|
|
@@ -49,17 +49,6 @@ function Counter() {
|
|
|
49
49
|
</div>
|
|
50
50
|
</div>
|
|
51
51
|
`;
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<div>
|
|
55
|
-
<p>Clicks: {$count}</p>
|
|
56
|
-
<div>
|
|
57
|
-
<button onClick={decrement}>-1</button>
|
|
58
|
-
<button onClick={reset}>Reset</button>
|
|
59
|
-
<button onClick={increment}>+1</button>
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
);
|
|
63
52
|
});
|
|
64
53
|
|
|
65
54
|
Dolla.mount(document.body, Counter);
|
package/dist/core/context.d.ts
CHANGED
|
@@ -1,28 +1,10 @@
|
|
|
1
|
-
import type { Emitter } from "@manyducks.co/emitter";
|
|
2
1
|
import type { Dolla } from "./dolla";
|
|
3
2
|
import type { Store, StoreFunction } from "./store";
|
|
4
|
-
export interface GenericEvents {
|
|
5
|
-
[type: string]: [...args: any[]];
|
|
6
|
-
}
|
|
7
|
-
export interface GenericContextData {
|
|
8
|
-
[key: string | symbol]: any;
|
|
9
|
-
}
|
|
10
|
-
export interface ContextEmitterEvents {
|
|
11
|
-
[type: string | symbol]: [ContextEvent, ...args: any[]];
|
|
12
|
-
}
|
|
13
3
|
export interface ElementContext {
|
|
14
4
|
/**
|
|
15
5
|
* The root Dolla instance this element belongs to.
|
|
16
6
|
*/
|
|
17
7
|
root: Dolla;
|
|
18
|
-
/**
|
|
19
|
-
* Storage for context variables.
|
|
20
|
-
*/
|
|
21
|
-
data: Record<string | symbol, unknown>;
|
|
22
|
-
/**
|
|
23
|
-
* Event emitter for this context.
|
|
24
|
-
*/
|
|
25
|
-
emitter: Emitter<ContextEmitterEvents>;
|
|
26
8
|
/**
|
|
27
9
|
* Stores attached to this context.
|
|
28
10
|
*/
|
|
@@ -40,33 +22,11 @@ export interface ElementContext {
|
|
|
40
22
|
*/
|
|
41
23
|
viewName?: string;
|
|
42
24
|
}
|
|
43
|
-
|
|
44
|
-
* Mapping of listener function passed to `.on` -> wrapped versions that discard eventName.
|
|
45
|
-
* Wrapping listeners is necessary because the context API's `.on` method does not pass the event name to "*" listeners while the emitter does.
|
|
46
|
-
* ContextEvent objects already have the event name stored as `event.type`.
|
|
47
|
-
*/
|
|
48
|
-
export type WildcardListenerMap = Map<(event: ContextEvent, ...args: any[]) => void, (eventName: string | symbol, event: ContextEvent, ...args: any[]) => void>;
|
|
49
|
-
export interface ComponentContext<Events extends GenericEvents = GenericEvents> {
|
|
25
|
+
export interface ComponentContext {
|
|
50
26
|
/**
|
|
51
27
|
* A name for debugging purposes. Prepended to log messages.
|
|
52
28
|
*/
|
|
53
29
|
name: string;
|
|
54
|
-
/**
|
|
55
|
-
* Adds a listener to be called when an event with a matching `type` is emitted.
|
|
56
|
-
*/
|
|
57
|
-
on<T extends keyof Events>(type: T, listener: (event: ContextEvent, ...args: Events[T]) => void): void;
|
|
58
|
-
/**
|
|
59
|
-
* Removes a listener from the list to be called when an event with a matching `type` is emitted.
|
|
60
|
-
*/
|
|
61
|
-
off(type: string, listener: (event: ContextEvent, ...args: any[]) => void): void;
|
|
62
|
-
/**
|
|
63
|
-
* Adds a listener to be called when an event with a matching `type` is emitted. The listener is immediately removed after being called once.
|
|
64
|
-
*/
|
|
65
|
-
once<T extends keyof Events>(type: T, listener: (event: ContextEvent, ...args: Events[T]) => void): void;
|
|
66
|
-
/**
|
|
67
|
-
* Emits a new event to all listeners.
|
|
68
|
-
*/
|
|
69
|
-
emit<T extends keyof Events>(type: T, ...args: Events[T]): boolean;
|
|
70
30
|
}
|
|
71
31
|
/**
|
|
72
32
|
* A context capable of providing stores.
|
|
@@ -91,14 +51,3 @@ export interface StoreConsumerContext {
|
|
|
91
51
|
*/
|
|
92
52
|
get<Value>(store: StoreFunction<any, Value>): Value;
|
|
93
53
|
}
|
|
94
|
-
/**
|
|
95
|
-
* An event emitted from and received by a Dolla context. These are separate from DOM events.
|
|
96
|
-
*/
|
|
97
|
-
export declare class ContextEvent {
|
|
98
|
-
#private;
|
|
99
|
-
constructor(type: string);
|
|
100
|
-
get type(): string;
|
|
101
|
-
get isStopped(): boolean;
|
|
102
|
-
stop(): void;
|
|
103
|
-
get [Symbol.toStringTag](): string;
|
|
104
|
-
}
|
package/dist/core/dolla.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { HTTP } from "../http/index.js";
|
|
2
|
-
import { I18n } from "../translate/index.js";
|
|
3
2
|
import { type Router } from "../router/index.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { I18n } from "../translate/index.js";
|
|
4
|
+
import type { StoreConsumerContext, StoreProviderContext } from "./context.js";
|
|
6
5
|
import { type Markup, type MarkupElement } from "./markup.js";
|
|
7
6
|
import { type ViewElement, type ViewFunction } from "./nodes/view.js";
|
|
8
7
|
import { StoreFunction } from "./store.js";
|
|
8
|
+
import { type CrashViewProps } from "./views/default-crash-view.js";
|
|
9
9
|
export type Environment = "development" | "production";
|
|
10
10
|
/**
|
|
11
11
|
* Log type toggles. Each message category can be turned on or off or enabled only in a specific environment.
|
|
@@ -125,4 +125,4 @@ export declare class Dolla implements StoreProviderContext, StoreConsumerContext
|
|
|
125
125
|
*/
|
|
126
126
|
constructMarkup(markup: Markup | Markup[]): MarkupElement;
|
|
127
127
|
}
|
|
128
|
-
export declare function getDefaultConsole():
|
|
128
|
+
export declare function getDefaultConsole(): Console | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Renderable } from "../../types.js";
|
|
2
2
|
import type { ElementContext } from "../context.js";
|
|
3
3
|
import { type MarkupElement } from "../markup.js";
|
|
4
|
-
import { type Reactive
|
|
4
|
+
import { type Reactive } from "../signals.js";
|
|
5
5
|
import { IS_MARKUP_ELEMENT } from "../symbols.js";
|
|
6
6
|
interface DynamicOptions {
|
|
7
7
|
source: Reactive<Renderable>;
|
|
@@ -14,10 +14,10 @@ interface DynamicOptions {
|
|
|
14
14
|
export declare class Dynamic implements MarkupElement {
|
|
15
15
|
[IS_MARKUP_ELEMENT]: boolean;
|
|
16
16
|
node: Text;
|
|
17
|
-
children
|
|
18
|
-
elementContext
|
|
19
|
-
source
|
|
20
|
-
unsubscribe
|
|
17
|
+
private children;
|
|
18
|
+
private elementContext;
|
|
19
|
+
private source;
|
|
20
|
+
private unsubscribe?;
|
|
21
21
|
get isMounted(): boolean;
|
|
22
22
|
constructor(options: DynamicOptions);
|
|
23
23
|
mount(parent: Node, after?: Node): void;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { type ElementContext } from "../context.js";
|
|
2
2
|
import { type Markup, type MarkupElement } from "../markup.js";
|
|
3
|
-
import { type Ref } from "../ref.js";
|
|
4
|
-
import { type MaybeReactive, type UnsubscribeFunction } from "../signals.js";
|
|
5
3
|
import { IS_MARKUP_ELEMENT } from "../symbols.js";
|
|
6
4
|
type HTMLOptions = {
|
|
7
5
|
elementContext: ElementContext;
|
|
@@ -12,23 +10,21 @@ type HTMLOptions = {
|
|
|
12
10
|
export declare class HTML implements MarkupElement {
|
|
13
11
|
[IS_MARKUP_ELEMENT]: boolean;
|
|
14
12
|
node: HTMLElement | SVGElement;
|
|
15
|
-
props
|
|
16
|
-
childMarkup
|
|
17
|
-
children
|
|
18
|
-
unsubscribers
|
|
19
|
-
elementContext
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
canClickAway: boolean;
|
|
13
|
+
private props;
|
|
14
|
+
private childMarkup;
|
|
15
|
+
private children;
|
|
16
|
+
private unsubscribers;
|
|
17
|
+
private elementContext;
|
|
18
|
+
private ref?;
|
|
19
|
+
private canClickAway;
|
|
23
20
|
get isMounted(): boolean;
|
|
24
21
|
constructor({ tag, props, children, elementContext }: HTMLOptions);
|
|
25
22
|
mount(parent: Node, after?: Node): void;
|
|
26
23
|
unmount(parentIsUnmounting?: boolean): void;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
applyClasses(element: HTMLElement | SVGElement, classes: unknown, unsubscribers: UnsubscribeFunction[]): () => void;
|
|
24
|
+
private attachProp;
|
|
25
|
+
private applyProps;
|
|
26
|
+
private applyStyles;
|
|
27
|
+
private applyClasses;
|
|
32
28
|
}
|
|
33
29
|
/**
|
|
34
30
|
* Converts a camelCase string to kebab-case.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ElementContext } from "../context.js";
|
|
2
2
|
import { type MarkupElement } from "../markup.js";
|
|
3
|
-
import { type
|
|
3
|
+
import { type Reactive } from "../signals.js";
|
|
4
4
|
import { IS_MARKUP_ELEMENT } from "../symbols.js";
|
|
5
5
|
import { type ViewContext, type ViewResult } from "./view.js";
|
|
6
6
|
interface ListOptions<T> {
|
|
@@ -9,26 +9,20 @@ interface ListOptions<T> {
|
|
|
9
9
|
keyFn: (item: T, index: number) => string | number | symbol;
|
|
10
10
|
renderFn: (item: Reactive<T>, index: Reactive<number>, ctx: ViewContext) => ViewResult;
|
|
11
11
|
}
|
|
12
|
-
type ConnectedItem<T> = {
|
|
13
|
-
key: any;
|
|
14
|
-
item: Atom<T>;
|
|
15
|
-
index: Atom<number>;
|
|
16
|
-
element: MarkupElement;
|
|
17
|
-
};
|
|
18
12
|
export declare class List<T> implements MarkupElement {
|
|
19
13
|
[IS_MARKUP_ELEMENT]: boolean;
|
|
20
14
|
node: Text;
|
|
21
|
-
items
|
|
22
|
-
unsubscribe
|
|
23
|
-
connectedItems
|
|
24
|
-
elementContext
|
|
25
|
-
renderFn
|
|
26
|
-
keyFn
|
|
15
|
+
private items;
|
|
16
|
+
private unsubscribe;
|
|
17
|
+
private connectedItems;
|
|
18
|
+
private elementContext;
|
|
19
|
+
private renderFn;
|
|
20
|
+
private keyFn;
|
|
27
21
|
get isMounted(): boolean;
|
|
28
22
|
constructor({ elementContext, items, renderFn, keyFn }: ListOptions<T>);
|
|
29
23
|
mount(parent: Node, after?: Node): void;
|
|
30
24
|
unmount(parentIsUnmounting?: boolean): void;
|
|
31
|
-
_cleanup
|
|
32
|
-
_update
|
|
25
|
+
private _cleanup;
|
|
26
|
+
private _update;
|
|
33
27
|
}
|
|
34
28
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type MarkupElement } from "../markup.js";
|
|
2
|
-
import { type MaybeReactive
|
|
2
|
+
import { type MaybeReactive } from "../signals.js";
|
|
3
3
|
import { IS_MARKUP_ELEMENT } from "../symbols.js";
|
|
4
4
|
/**
|
|
5
5
|
* Manages several MarkupElements as one.
|
|
@@ -8,12 +8,12 @@ export declare class Outlet implements MarkupElement {
|
|
|
8
8
|
[IS_MARKUP_ELEMENT]: boolean;
|
|
9
9
|
node: Text;
|
|
10
10
|
isMounted: boolean;
|
|
11
|
-
source
|
|
12
|
-
elements
|
|
13
|
-
unsubscribe
|
|
11
|
+
private source;
|
|
12
|
+
private elements;
|
|
13
|
+
private unsubscribe?;
|
|
14
14
|
constructor(source: MaybeReactive<MarkupElement[]>);
|
|
15
15
|
mount(parent: Node, after?: Node | undefined): void;
|
|
16
16
|
unmount(parentIsUnmounting?: boolean): void;
|
|
17
|
-
cleanup
|
|
18
|
-
update
|
|
17
|
+
private cleanup;
|
|
18
|
+
private update;
|
|
19
19
|
}
|
|
@@ -12,8 +12,8 @@ interface PortalConfig {
|
|
|
12
12
|
*/
|
|
13
13
|
export declare class Portal implements MarkupElement {
|
|
14
14
|
[IS_MARKUP_ELEMENT]: boolean;
|
|
15
|
-
config
|
|
16
|
-
element
|
|
15
|
+
private config;
|
|
16
|
+
private element?;
|
|
17
17
|
get isMounted(): boolean;
|
|
18
18
|
constructor(config: PortalConfig);
|
|
19
19
|
mount(_parent: Node, _after?: Node): void;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type ComponentContext, type ElementContext, type GenericEvents, type StoreConsumerContext, type StoreProviderContext, type WildcardListenerMap } from "../context.js";
|
|
1
|
+
import type { ComponentContext, ElementContext, StoreConsumerContext, StoreProviderContext } from "../context.js";
|
|
3
2
|
import type { Logger } from "../dolla.js";
|
|
4
|
-
import {
|
|
3
|
+
import { type Markup, type MarkupElement } from "../markup.js";
|
|
5
4
|
import { type EffectCallback, type Reactive, type UnsubscribeFunction } from "../signals.js";
|
|
6
5
|
import { IS_MARKUP_ELEMENT } from "../symbols.js";
|
|
7
6
|
/**
|
|
@@ -18,7 +17,7 @@ export interface ViewElement extends MarkupElement {
|
|
|
18
17
|
*/
|
|
19
18
|
setChildView(view: ViewFunction<{}>): ViewElement;
|
|
20
19
|
}
|
|
21
|
-
export interface ViewContext
|
|
20
|
+
export interface ViewContext extends Omit<Logger, "setName">, ComponentContext, StoreProviderContext, StoreConsumerContext {
|
|
22
21
|
/**
|
|
23
22
|
* An ID unique to this view.
|
|
24
23
|
*/
|
|
@@ -48,43 +47,28 @@ export interface ViewContext<Events extends GenericEvents = GenericEvents> exten
|
|
|
48
47
|
* Callback will be run each time a tracked state gets a new value.
|
|
49
48
|
*/
|
|
50
49
|
effect(callback: EffectCallback): UnsubscribeFunction;
|
|
51
|
-
/**
|
|
52
|
-
* Renders a list of reactive items.
|
|
53
|
-
*/
|
|
54
|
-
list: typeof list;
|
|
55
|
-
/**
|
|
56
|
-
* Creates a reactive conditional; the second argument is displayed when the condition is true and the third is displayed when the condition is false.
|
|
57
|
-
*/
|
|
58
|
-
if: typeof cond;
|
|
59
50
|
/**
|
|
60
51
|
* Returns a Markup element that displays this view's children.
|
|
61
52
|
*/
|
|
62
53
|
outlet(): Markup;
|
|
63
|
-
/**
|
|
64
|
-
* Displays an element as a child of another DOM node, rather than the position it would normally be mounted at.
|
|
65
|
-
*/
|
|
66
|
-
portal: typeof portal;
|
|
67
54
|
}
|
|
68
|
-
type ViewEvents = {
|
|
69
|
-
beforeMount: [];
|
|
70
|
-
mounted: [];
|
|
71
|
-
beforeUnmount: [];
|
|
72
|
-
unmounted: [];
|
|
73
|
-
};
|
|
74
55
|
export declare class View<P> implements ViewElement {
|
|
75
56
|
[IS_MARKUP_ELEMENT]: boolean;
|
|
76
57
|
uniqueId: string;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
58
|
+
elementContext: ElementContext;
|
|
59
|
+
logger: Logger;
|
|
60
|
+
props: P;
|
|
61
|
+
fn: ViewFunction<P>;
|
|
62
|
+
element?: MarkupElement;
|
|
63
|
+
childMarkup: Markup[];
|
|
64
|
+
children: import("../signals.js").Atom<MarkupElement[]>;
|
|
65
|
+
lifecycleListeners: {
|
|
66
|
+
beforeMount: (() => any)[];
|
|
67
|
+
mount: (() => any)[];
|
|
68
|
+
beforeUnmount: (() => any)[];
|
|
69
|
+
unmount: (() => any)[];
|
|
70
|
+
};
|
|
71
|
+
constructor(elementContext: ElementContext, fn: ViewFunction<P>, props: P, children?: Markup[]);
|
|
88
72
|
get node(): Node;
|
|
89
73
|
isMounted: boolean;
|
|
90
74
|
mount(parent: Node, after?: Node): void;
|
|
@@ -92,4 +76,3 @@ export declare class View<P> implements ViewElement {
|
|
|
92
76
|
setChildView(fn: ViewFunction<{}>): View<{}>;
|
|
93
77
|
private _initialize;
|
|
94
78
|
}
|
|
95
|
-
export {};
|
package/dist/core/ref.d.ts
CHANGED
|
@@ -12,22 +12,6 @@ export interface Ref<T> {
|
|
|
12
12
|
*/
|
|
13
13
|
<T>(value: T | undefined): void;
|
|
14
14
|
}
|
|
15
|
-
/**
|
|
16
|
-
* A Ref is a function that returns the last argument it was called with.
|
|
17
|
-
* Calling it with no arguments will simply return the latest value.
|
|
18
|
-
* Calling it with an argument will store that value and immediately return it.
|
|
19
|
-
*
|
|
20
|
-
* @param value - An (optional) initial value to store.
|
|
21
|
-
*
|
|
22
|
-
* @deprecated
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* const ref = createRef(5);
|
|
26
|
-
* ref(); // 5
|
|
27
|
-
* ref(500);
|
|
28
|
-
* ref(); // 500
|
|
29
|
-
*/
|
|
30
|
-
export declare function createRef<T>(value?: T): Ref<T>;
|
|
31
15
|
/**
|
|
32
16
|
* A Ref is a function that returns the last argument it was called with.
|
|
33
17
|
* Calling it with no arguments will simply return the latest value.
|
|
@@ -42,4 +26,3 @@ export declare function createRef<T>(value?: T): Ref<T>;
|
|
|
42
26
|
* number(); // 500
|
|
43
27
|
*/
|
|
44
28
|
export declare function ref<T>(value?: T): Ref<T>;
|
|
45
|
-
export declare function isRef<T extends Node>(value: any): value is Ref<T>;
|
package/dist/core/signals.d.ts
CHANGED
|
@@ -36,9 +36,6 @@ export interface ReactiveOptions<T> {
|
|
|
36
36
|
}
|
|
37
37
|
export declare class Atom<T> implements Reactive<T> {
|
|
38
38
|
#private;
|
|
39
|
-
/**
|
|
40
|
-
* A label for debugging purposes.
|
|
41
|
-
*/
|
|
42
39
|
name?: string;
|
|
43
40
|
constructor(signal: Signal<T>, options?: ReactiveOptions<T>);
|
|
44
41
|
get value(): T;
|
package/dist/core/store.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { GenericEvents, StoreConsumerContext, type ComponentContext, type ElementContext, type WildcardListenerMap } from "./context.js";
|
|
1
|
+
import type { StoreConsumerContext, ComponentContext, ElementContext } from "./context.js";
|
|
3
2
|
import type { Logger } from "./dolla.js";
|
|
4
3
|
import { EffectCallback, UnsubscribeFunction } from "./signals.js";
|
|
5
4
|
export type StoreFunction<Options, Value> = (this: StoreContext, options: Options, context: StoreContext) => Value;
|
|
6
5
|
export type StoreFactory<Options, Value> = Options extends undefined ? () => Store<Options, Value> : (options: Options) => Store<Options, Value>;
|
|
7
|
-
export interface StoreContext
|
|
6
|
+
export interface StoreContext extends Omit<Logger, "setName">, ComponentContext, StoreConsumerContext {
|
|
8
7
|
/**
|
|
9
8
|
* True while this store is attached to a context that is currently mounted in the view tree.
|
|
10
9
|
*/
|
|
@@ -23,10 +22,6 @@ export interface StoreContext<Events extends GenericEvents = GenericEvents> exte
|
|
|
23
22
|
*/
|
|
24
23
|
effect(callback: EffectCallback): UnsubscribeFunction;
|
|
25
24
|
}
|
|
26
|
-
type StoreEvents = {
|
|
27
|
-
mounted: [];
|
|
28
|
-
unmounted: [];
|
|
29
|
-
};
|
|
30
25
|
export declare class Store<Options, Value> {
|
|
31
26
|
readonly fn: StoreFunction<Options, Value>;
|
|
32
27
|
private _options;
|
|
@@ -35,14 +30,14 @@ export declare class Store<Options, Value> {
|
|
|
35
30
|
*/
|
|
36
31
|
value: Value;
|
|
37
32
|
isMounted: boolean;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
elementContext: ElementContext;
|
|
34
|
+
lifecycleListeners: {
|
|
35
|
+
mount: (() => any)[];
|
|
36
|
+
unmount: (() => any)[];
|
|
37
|
+
};
|
|
38
|
+
logger: Logger;
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
46
41
|
constructor(fn: StoreFunction<Options, Value>, options: Options);
|
|
47
42
|
/**
|
|
48
43
|
* Attaches this Store to the elementContext.
|
|
@@ -55,4 +50,3 @@ export declare class Store<Options, Value> {
|
|
|
55
50
|
export declare function isStore<Options, Value>(value: any): value is Store<Options, Value>;
|
|
56
51
|
export declare class StoreError extends Error {
|
|
57
52
|
}
|
|
58
|
-
export {};
|
package/dist/core/symbols.d.ts
CHANGED