@manyducks.co/dolla 2.0.0-alpha.30 → 2.0.0-alpha.31

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.
@@ -1,6 +1,6 @@
1
1
  import { HTTP } from "../modules/http.js";
2
2
  import { I18n } from "../modules/i18n.js";
3
- import { Router } from "../modules/router.js";
3
+ import { type Router } from "../modules/router.js";
4
4
  import { type CrashViewProps } from "../views/default-crash-view.js";
5
5
  import { Batch } from "./batch.js";
6
6
  import { ContextEvent, type StorableContext } from "./context.js";
@@ -48,7 +48,6 @@ export declare class Dolla implements StorableContext {
48
48
  private readonly stats;
49
49
  readonly http: HTTP;
50
50
  readonly i18n: I18n;
51
- readonly router: Router;
52
51
  constructor();
53
52
  watch: <I extends import("./state.js").MaybeState<any>[]>(states: [...I], fn: (...currentValues: import("./state.js").StateValues<I>) => void) => import("./state.js").StopFunction;
54
53
  createState: typeof createState;
@@ -81,7 +80,7 @@ export declare class Dolla implements StorableContext {
81
80
  /**
82
81
  * Returns the HTMLElement Dolla is mounted to. This will return undefined until Dolla.mount() is called.
83
82
  */
84
- getRootElement(): HTMLElement | undefined;
83
+ getRootElement(): Element | undefined;
85
84
  /**
86
85
  * Returns the top level view Dolla is rendering inside the root element. This will return undefined until Dolla.mount() is called.
87
86
  */
@@ -121,8 +120,10 @@ export declare class Dolla implements StorableContext {
121
120
  * Gets the nearest instance of a store. Throws an error if the store isn't provided higher in the tree.
122
121
  */
123
122
  useStore<Value>(factory: StoreFactory<any, Value>): Value;
124
- mount(selector: string, view?: ViewFunction<any>): Promise<void>;
125
- mount(element: HTMLElement, view?: ViewFunction<any>): Promise<void>;
123
+ mount(selector: string, router: Router): Promise<void>;
124
+ mount(selector: string, view: ViewFunction<any>): Promise<void>;
125
+ mount(element: Element, router: Router): Promise<void>;
126
+ mount(element: Element, view: ViewFunction<any>): Promise<void>;
126
127
  unmount(): Promise<void>;
127
128
  /**
128
129
  * Registers a `callback` to run after `Dolla.mount` is called, before the app is mounted. If `callback` returns a Promise,
@@ -4,3 +4,4 @@ export declare const IS_MARKUP: unique symbol;
4
4
  export declare const IS_MARKUP_ELEMENT: unique symbol;
5
5
  export declare const IS_STORE: unique symbol;
6
6
  export declare const IS_STORE_FACTORY: unique symbol;
7
+ export declare const IS_ROUTER: unique symbol;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  export { createState, derive, isState, toState, toValue } from "./core/state.js";
2
2
  export type { MaybeState, Setter, State, StopFunction } from "./core/state.js";
3
3
  export { createRef, isRef, type Ref } from "./core/ref.js";
4
- export { createStore, type Store, type StoreFunction, type StoreFactory } from "./core/store.js";
4
+ export { createStore, type Store, type StoreFactory, type StoreFunction } from "./core/store.js";
5
+ export { createRouter, type Router, type RouterOptions } from "./modules/router.js";
5
6
  export { deepEqual, shallowEqual, strictEqual } from "./utils.js";
6
7
  export { cond, createMarkup, html, portal, repeat } from "./core/markup.js";
7
8
  export type { Markup, MarkupElement } from "./core/markup.js";