@manyducks.co/dolla 2.0.0-alpha.35 → 2.0.0-alpha.36

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 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).
@@ -35,7 +35,7 @@ Dolla's goals include:
35
35
  A basic view. Note that the view function is called exactly once when the view is first mounted. All changes to DOM nodes thereafter happen as a result of `$state` values changing.
36
36
 
37
37
  ```js
38
- import Dolla, { atom, html } from "@manyducks.co/dolla";
38
+ import Dolla, { atom, effect, get, html } from "@manyducks.co/dolla";
39
39
 
40
40
  function Counter() {
41
41
  const count = atom(0);
@@ -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);
@@ -0,0 +1,130 @@
1
+ import { type Dependency, type Subscriber } from "alien-signals";
2
+ /**
3
+ * A function to compare the current and next values. Returning `true` means the value has changed.
4
+ */
5
+ export type EqualityFunction<T> = (current: T, next: T) => boolean;
6
+ export interface ReactiveOptions<T> {
7
+ /**
8
+ * A label for debugging purposes.
9
+ */
10
+ name?: string;
11
+ /**
12
+ * A function to compare the current and next values. Returning `true` means the value has changed.
13
+ */
14
+ equals?: EqualityFunction<T>;
15
+ }
16
+ export interface Effect extends Subscriber, Dependency {
17
+ name?: string;
18
+ fn(): void;
19
+ }
20
+ export interface Computed<T = any> extends Signal<T | undefined>, Subscriber {
21
+ name?: string;
22
+ getter: (cachedValue?: T) => T;
23
+ equals: EqualityFunction<T>;
24
+ }
25
+ export interface Signal<T = any> extends Dependency {
26
+ name?: string;
27
+ currentValue: T;
28
+ }
29
+ /**
30
+ * A readable reactive state object.
31
+ */
32
+ export interface Reactive<T> {
33
+ readonly name?: string;
34
+ /**
35
+ * The current value. Read-only.
36
+ */
37
+ readonly value: T;
38
+ }
39
+ export interface Atom<T> extends Reactive<T> {
40
+ /**
41
+ * The current value.
42
+ */
43
+ value: T;
44
+ }
45
+ export type MaybeReactive<T> = Reactive<T> | T;
46
+ export type UnsubscribeFunction = () => void;
47
+ /**
48
+ * Determines if a value is reactive.
49
+ */
50
+ export declare function isReactive<T>(value: any): value is Reactive<T>;
51
+ /**
52
+ * Creates a simple reactive container that stores a value.
53
+ * Atom values can be read and updated with the `value` property
54
+ *
55
+ * @example
56
+ * const count = atom(1);
57
+ * count.value++;
58
+ * count.value; // 2
59
+ */
60
+ export declare function atom<T>(): Atom<T | undefined>;
61
+ /**
62
+ * Creates a simple reactive container that stores a value.
63
+ * Atom values can be read and updated with the `value` property.
64
+ *
65
+ * @example
66
+ * const count = atom(1);
67
+ * count.value++;
68
+ * count.value; // 2
69
+ */
70
+ export declare function atom<T>(value: T, options?: ReactiveOptions<T>): Atom<T>;
71
+ /**
72
+ * Creates a simple reactive container that stores a value.
73
+ * Atom values can be read and updated with the `value` property.
74
+ *
75
+ * @example
76
+ * const count = atom(1);
77
+ * count.value++;
78
+ * count.value; // 2
79
+ */
80
+ export declare function atom<T>(value?: T, options?: ReactiveOptions<T>): Atom<T | undefined>;
81
+ type ComposeCallback<T> = (previousValue?: T) => MaybeReactive<T>;
82
+ /**
83
+ * Creates a reactive container that derives its value from other reactive values that it tracks.
84
+ *
85
+ * @example
86
+ * const count = atom(1);
87
+ * const doubled = compose(() => get(count) * 2);
88
+ */
89
+ export declare function compose<T>(fn: ComposeCallback<T>, options?: ReactiveOptions<T>): Reactive<T>;
90
+ /**
91
+ * Takes a new value to set, or a callback that receives the current value and returns a new value to set.
92
+ */
93
+ type Setter<T> = (next: T | ((current: T) => T)) => void;
94
+ export declare function set<T>(atom: Atom<T>): Setter<T>;
95
+ export declare function set<T>(atom: Atom<T>, next: T | ((current: T) => T)): void;
96
+ /**
97
+ * Returns the current value from a reactive _and track it_ if called in a `compose` or `effect` scope.
98
+ * If a non-reactive value is passed it will just be returned untracked.
99
+ *
100
+ * @example
101
+ * const count = atom(1);
102
+ * const value = get(count); // 1
103
+ *
104
+ * const value = get(5); // 5
105
+ */
106
+ export declare function get<T>(value: MaybeReactive<T>): T;
107
+ /**
108
+ * Returns the current value from a reactive (without tracking).
109
+ * If a non-reactive value is passed it will be returned.
110
+ *
111
+ * @example
112
+ * ctx.effect(() => {
113
+ * const doubled = get(count) * 2; // `count` will be tracked
114
+ *
115
+ * const doubled = peek(count) * 2; // `count` will NOT be tracked
116
+ * });
117
+ */
118
+ export declare function peek<T>(value: MaybeReactive<T>): T;
119
+ export type EffectCallback = () => void;
120
+ /**
121
+ * Creates a tracked scope that re-runs whenever the values of any tracked reactives changes.
122
+ * Reactives are tracked by accessing their `value` within the body of the function.
123
+ *
124
+ * NOTE: You must call the unsubscribe function to stop watching for changes.
125
+ * If you are using an effect inside a View or Store, use `ctx.effect` instead, which cleans up automatically when the component unmounts.
126
+ */
127
+ export declare function effect(fn: EffectCallback, options?: {
128
+ name?: string;
129
+ }): UnsubscribeFunction;
130
+ export {};
@@ -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
- }
@@ -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 { type CrashViewProps } from "./views/default-crash-view.js";
5
- import { type StoreProviderContext, type StoreConsumerContext } from "./context.js";
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.
@@ -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, type UnsubscribeFunction } from "../signals.js";
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: MarkupElement[];
18
- elementContext: ElementContext;
19
- source: Reactive<Renderable>;
20
- unsubscribe?: UnsubscribeFunction;
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: Record<string, any>;
16
- childMarkup: Markup[];
17
- children: MarkupElement[];
18
- unsubscribers: UnsubscribeFunction[];
19
- elementContext: ElementContext;
20
- uniqueId: string;
21
- ref?: Ref<any>;
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
- getUpdateKey(type: string, value: string | number): string;
28
- attachProp<T>(value: MaybeReactive<T>, callback: (value: T) => void): void;
29
- applyProps(element: HTMLElement | SVGElement, props: Record<string, unknown>): void;
30
- applyStyles(element: HTMLElement | SVGElement, styles: unknown, unsubscribers: UnsubscribeFunction[]): () => void;
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 Atom, type Reactive, type UnsubscribeFunction } from "../signals.js";
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: Reactive<T[]>;
22
- unsubscribe: UnsubscribeFunction | null;
23
- connectedItems: ConnectedItem<T>[];
24
- elementContext: ElementContext;
25
- renderFn: (this: ViewContext, value: Reactive<T>, index: Reactive<number>, context: ViewContext) => ViewResult;
26
- keyFn: (value: T, index: number) => string | number | symbol;
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(parentIsUnmounting: boolean): void;
32
- _update(value: T[]): void;
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, type UnsubscribeFunction } from "../signals.js";
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: MaybeReactive<MarkupElement[]>;
12
- elements: MarkupElement[];
13
- unsubscribe?: UnsubscribeFunction;
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(parentIsUnmounting: boolean): void;
18
- update(newElements: MarkupElement[]): void;
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: PortalConfig;
16
- element?: MarkupElement;
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 { Emitter } from "@manyducks.co/emitter";
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 { cond, list, portal, type Markup, type MarkupElement } from "../markup.js";
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<Events extends GenericEvents = GenericEvents> extends Omit<Logger, "setName">, ComponentContext<Events>, StoreProviderContext, StoreConsumerContext {
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
- _elementContext: ElementContext;
78
- _logger: Logger;
79
- _view: ViewFunction<P>;
80
- _props: P;
81
- _element?: MarkupElement;
82
- _childMarkup: Markup[];
83
- _children: import("../signals.js").Atom<MarkupElement[]>;
84
- _unsubscribes: UnsubscribeFunction[];
85
- _emitter: Emitter<ViewEvents>;
86
- _wildcardListeners: WildcardListenerMap;
87
- constructor(elementContext: ElementContext, view: ViewFunction<P>, props: P, children?: Markup[]);
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 {};
@@ -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>;
@@ -1,10 +1,9 @@
1
- import { Emitter } from "@manyducks.co/emitter";
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<Events extends GenericEvents = GenericEvents> extends Omit<Logger, "setName">, ComponentContext<Events>, StoreConsumerContext {
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
- _elementContext: ElementContext;
39
- _emitter: Emitter<StoreEvents>;
40
- _wildcardListeners: WildcardListenerMap;
41
- _logger: Logger;
42
- _unsubscribes: UnsubscribeFunction[];
43
- _name: string;
44
- _id: string;
45
- get name(): string;
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 {};
@@ -1,4 +1,3 @@
1
- export declare const IS_REF: unique symbol;
2
1
  export declare const IS_MARKUP: unique symbol;
3
2
  export declare const IS_MARKUP_ELEMENT: unique symbol;
4
3
  export declare const IS_STORE: unique symbol;