@manyducks.co/dolla 2.0.0-alpha.3 → 2.0.0-alpha.30
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 +31 -951
- package/dist/core/batch.d.ts +17 -0
- package/dist/core/context.d.ts +94 -0
- package/dist/{modules → core}/dolla.d.ts +68 -19
- package/dist/core/markup.d.ts +91 -0
- package/dist/core/nodes/dom.d.ts +13 -0
- package/dist/core/nodes/html.d.ts +39 -0
- package/dist/core/nodes/observer.d.ts +30 -0
- package/dist/core/nodes/outlet.d.ts +19 -0
- package/dist/core/nodes/portal.d.ts +22 -0
- package/dist/core/nodes/repeat.d.ts +36 -0
- package/dist/core/nodes/view.d.ts +92 -0
- package/dist/core/ref.d.ts +29 -0
- package/dist/core/state.d.ts +126 -0
- package/dist/core/stats.d.ts +31 -0
- package/dist/core/store.d.ts +62 -0
- package/dist/core/symbols.d.ts +6 -0
- package/dist/index.d.ts +17 -11
- package/dist/index.js +991 -1010
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.d.ts +2 -2
- package/dist/jsx-dev-runtime.js +2 -2
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx-runtime.d.ts +3 -3
- package/dist/jsx-runtime.js +2 -2
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/modules/http.d.ts +5 -5
- package/dist/modules/i18n.d.ts +129 -0
- package/dist/modules/router.d.ts +27 -48
- package/dist/passthrough-d2lcM0cd.js +1563 -0
- package/dist/passthrough-d2lcM0cd.js.map +1 -0
- package/dist/typeChecking.d.ts +2 -2
- package/dist/types.d.ts +12 -13
- package/dist/utils.d.ts +14 -2
- package/dist/views/default-crash-view.d.ts +1 -1
- package/dist/views/passthrough.d.ts +2 -2
- package/docs/http.md +29 -0
- package/docs/i18n.md +38 -0
- package/docs/index.md +10 -0
- package/docs/router.md +77 -0
- package/docs/setup.md +31 -0
- package/docs/state.md +141 -0
- package/docs/stores.md +62 -0
- package/docs/views.md +308 -0
- package/index.d.ts +2 -2
- package/notes/TODO.md +6 -0
- package/notes/context-vars.md +21 -0
- package/notes/readme-scratch.md +222 -0
- package/notes/route-middleware.md +42 -0
- package/notes/scratch.md +195 -7
- package/notes/stores.md +73 -0
- package/package.json +12 -14
- package/tests/{signals.test.js → state.test.js} +6 -6
- package/vite.config.js +0 -10
- package/dist/markup.d.ts +0 -100
- package/dist/modules/language.d.ts +0 -41
- package/dist/modules/render.d.ts +0 -17
- package/dist/nodes/cond.d.ts +0 -26
- package/dist/nodes/html.d.ts +0 -26
- package/dist/nodes/observer.d.ts +0 -29
- package/dist/nodes/outlet.d.ts +0 -22
- package/dist/nodes/portal.d.ts +0 -19
- package/dist/nodes/repeat.d.ts +0 -34
- package/dist/nodes/text.d.ts +0 -19
- package/dist/passthrough-DrtCifRF.js +0 -1228
- package/dist/passthrough-DrtCifRF.js.map +0 -1
- package/dist/signals.d.ts +0 -101
- package/dist/view.d.ts +0 -50
- /package/dist/{routing.d.ts → modules/router.utils.d.ts} +0 -0
- /package/dist/{routing.test.d.ts → modules/router.utils.test.d.ts} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export function jsxDEV(element: any, props: any, key: any, isStaticChildren: any, source: any, self: any): import("./markup
|
|
2
|
-
export { Passthrough as Fragment } from "./views/passthrough
|
|
1
|
+
export function jsxDEV(element: any, props: any, key: any, isStaticChildren: any, source: any, self: any): import("./core/markup").Markup;
|
|
2
|
+
export { Passthrough as Fragment } from "./views/passthrough";
|
package/dist/jsx-dev-runtime.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { P as m } from "./passthrough-
|
|
1
|
+
import { z as s } from "./passthrough-d2lcM0cd.js";
|
|
2
|
+
import { P as m } from "./passthrough-d2lcM0cd.js";
|
|
3
3
|
function d(n, r, t, e, a, l) {
|
|
4
4
|
const i = { ...o(["children", "key"], r) }, c = Array.isArray(r.children) ? r.children : [r.children];
|
|
5
5
|
return s(n, i, ...c);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-dev-runtime.js","sources":["../src/jsx-dev-runtime.js"],"sourcesContent":["import { createMarkup } from \"./markup
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.js","sources":["../src/jsx-dev-runtime.js"],"sourcesContent":["import { createMarkup } from \"./core/markup\";\nexport { Passthrough as Fragment } from \"./views/passthrough\";\n\nexport function jsxDEV(element, props, key, isStaticChildren, source, self) {\n const attributes = { ...omit([\"children\", \"key\"], props) };\n const children = Array.isArray(props.children) ? props.children : [props.children];\n\n return createMarkup(element, attributes, ...children);\n}\n\nfunction omit(keys, object) {\n const result = {};\n for (const key in object) {\n if (!keys.includes(key)) {\n result[key] = object[key];\n }\n }\n return result;\n}\n"],"names":["jsxDEV","element","props","key","isStaticChildren","source","self","attributes","omit","children","createMarkup","keys","object","result"],"mappings":";;AAGO,SAASA,EAAOC,GAASC,GAAOC,GAAKC,GAAkBC,GAAQC,GAAM;AAC1E,QAAMC,IAAa,EAAE,GAAGC,EAAK,CAAC,YAAY,KAAK,GAAGN,CAAK,EAAG,GACpDO,IAAW,MAAM,QAAQP,EAAM,QAAQ,IAAIA,EAAM,WAAW,CAACA,EAAM,QAAQ;AAEjF,SAAOQ,EAAaT,GAASM,GAAY,GAAGE,CAAQ;AACtD;AAEA,SAASD,EAAKG,GAAMC,GAAQ;AAC1B,QAAMC,IAAS,CAAE;AACjB,aAAWV,KAAOS;AAChB,IAAKD,EAAK,SAASR,CAAG,MACpBU,EAAOV,CAAG,IAAIS,EAAOT,CAAG;AAG5B,SAAOU;AACT;"}
|
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* JSX function for elements with dynamic children.
|
|
3
3
|
*/
|
|
4
|
-
export function jsx(element: any, props: any, key: any): import("./markup
|
|
4
|
+
export function jsx(element: any, props: any, key: any): import("./core/markup").Markup;
|
|
5
5
|
/**
|
|
6
6
|
* JSX function for elements with static children.
|
|
7
7
|
*/
|
|
8
|
-
export function jsxs(element: any, props: any, key: any): import("./markup
|
|
9
|
-
export { Passthrough as Fragment } from "./views/passthrough
|
|
8
|
+
export function jsxs(element: any, props: any, key: any): import("./core/markup").Markup;
|
|
9
|
+
export { Passthrough as Fragment } from "./views/passthrough";
|
package/dist/jsx-runtime.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { P as l } from "./passthrough-
|
|
1
|
+
import { z as t } from "./passthrough-d2lcM0cd.js";
|
|
2
|
+
import { P as l } from "./passthrough-d2lcM0cd.js";
|
|
3
3
|
function d(n, e, r) {
|
|
4
4
|
return t(n, e ? { ...u(["children", "key"], e) } : void 0, e.children);
|
|
5
5
|
}
|
package/dist/jsx-runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-runtime.js","sources":["../src/jsx-runtime.js"],"sourcesContent":["import { createMarkup } from \"./markup
|
|
1
|
+
{"version":3,"file":"jsx-runtime.js","sources":["../src/jsx-runtime.js"],"sourcesContent":["import { createMarkup } from \"./core/markup\";\nexport { Passthrough as Fragment } from \"./views/passthrough\";\n\n/**\n * JSX function for elements with dynamic children.\n */\nexport function jsx(element, props, key) {\n return createMarkup(element, props ? { ...omit([\"children\", \"key\"], props) } : undefined, ...[props.children]);\n}\n\n/**\n * JSX function for elements with static children.\n */\nexport function jsxs(element, props, key) {\n return createMarkup(element, props ? { ...omit([\"children\", \"key\"], props) } : undefined, props.children);\n}\n\nfunction omit(keys, object) {\n const result = {};\n for (const key in object) {\n if (!keys.includes(key)) {\n result[key] = object[key];\n }\n }\n return result;\n}\n"],"names":["jsx","element","props","key","createMarkup","omit","jsxs","keys","object","result"],"mappings":";;AAMO,SAASA,EAAIC,GAASC,GAAOC,GAAK;AACvC,SAAOC,EAAaH,GAASC,IAAQ,EAAE,GAAGG,EAAK,CAAC,YAAY,KAAK,GAAGH,CAAK,EAAC,IAAK,QAAeA,EAAM,QAAS;AAC/G;AAKO,SAASI,EAAKL,GAASC,GAAOC,GAAK;AACxC,SAAOC,EAAaH,GAASC,IAAQ,EAAE,GAAGG,EAAK,CAAC,YAAY,KAAK,GAAGH,CAAK,EAAC,IAAK,QAAWA,EAAM,QAAQ;AAC1G;AAEA,SAASG,EAAKE,GAAMC,GAAQ;AAC1B,QAAMC,IAAS,CAAE;AACjB,aAAWN,KAAOK;AAChB,IAAKD,EAAK,SAASJ,CAAG,MACpBM,EAAON,CAAG,IAAIK,EAAOL,CAAG;AAG5B,SAAOM;AACT;"}
|
package/dist/modules/http.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { Dolla } from "../core/dolla.js";
|
|
1
2
|
/**
|
|
2
3
|
* A simple HTTP client with middleware support. Middleware applies to all requests made through this store,
|
|
3
4
|
* so it's the perfect way to handle things like auth headers and permission checks for API calls.
|
|
4
5
|
*/
|
|
5
6
|
export declare class HTTP {
|
|
6
7
|
#private;
|
|
8
|
+
constructor(dolla: Dolla);
|
|
7
9
|
/**
|
|
8
10
|
* Adds a new middleware that will apply to subsequent requests.
|
|
9
11
|
* Returns a function to remove this middleware.
|
|
@@ -37,18 +39,16 @@ export interface RequestOptions<ReqBody> {
|
|
|
37
39
|
}
|
|
38
40
|
export interface HTTPRequest<Body> {
|
|
39
41
|
method: string;
|
|
40
|
-
|
|
41
|
-
readonly sameOrigin: boolean;
|
|
42
|
+
url: URL;
|
|
42
43
|
headers: Headers;
|
|
43
|
-
query: URLSearchParams;
|
|
44
44
|
body: Body;
|
|
45
45
|
}
|
|
46
46
|
export interface HTTPResponse<Body> {
|
|
47
47
|
method: string;
|
|
48
|
-
|
|
48
|
+
url: URL;
|
|
49
|
+
headers: Headers;
|
|
49
50
|
status: number;
|
|
50
51
|
statusText: string;
|
|
51
|
-
headers: Record<string, string>;
|
|
52
52
|
body: Body;
|
|
53
53
|
}
|
|
54
54
|
export declare class HTTPResponseError extends Error {
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { Dolla } from "../core/dolla.js";
|
|
2
|
+
import { type MaybeState, type State } from "../core/state.js";
|
|
3
|
+
/**
|
|
4
|
+
* A JSON object of translated strings. Values can be string templates or nested objects.
|
|
5
|
+
*/
|
|
6
|
+
interface LocalizedStrings extends Record<string, string | LocalizedStrings> {
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A formatter to be applied to a variable.
|
|
10
|
+
*/
|
|
11
|
+
type Format = {
|
|
12
|
+
name: string;
|
|
13
|
+
options: Record<string, any>;
|
|
14
|
+
};
|
|
15
|
+
export interface TranslationConfig {
|
|
16
|
+
/**
|
|
17
|
+
* Name of the locale this translation is for (BCP 47 locale names recommended).
|
|
18
|
+
*/
|
|
19
|
+
locale: string;
|
|
20
|
+
/**
|
|
21
|
+
* Path to a JSON file with translated strings for this language.
|
|
22
|
+
*/
|
|
23
|
+
path?: string;
|
|
24
|
+
/**
|
|
25
|
+
* A callback function that returns a Promise that resolves to the translation object for this language.
|
|
26
|
+
*/
|
|
27
|
+
fetch?: () => Promise<LocalizedStrings>;
|
|
28
|
+
}
|
|
29
|
+
export type I18nSetupOptions = {
|
|
30
|
+
/**
|
|
31
|
+
* Default locale to load on startup
|
|
32
|
+
*/
|
|
33
|
+
locale?: string | null;
|
|
34
|
+
translations: TranslationConfig[];
|
|
35
|
+
};
|
|
36
|
+
export type TOptions = {
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
40
|
+
count?: MaybeState<number>;
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
context?: MaybeState<string>;
|
|
45
|
+
/**
|
|
46
|
+
* Override formats specified in the template with the ones in the array for each named variable.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* t("example_key", {
|
|
50
|
+
* count: 5,
|
|
51
|
+
* formatOverrides: {
|
|
52
|
+
* count: [ { name: "datetime", options: { style: "currency", currency: "JPY" } } ]
|
|
53
|
+
* }
|
|
54
|
+
* });
|
|
55
|
+
*/
|
|
56
|
+
formatOverrides?: MaybeState<Record<string, Record<string, Format[]>>>;
|
|
57
|
+
[value: string]: MaybeState<any>;
|
|
58
|
+
};
|
|
59
|
+
export type Formatter = (locale: string, value: unknown, options: Record<string, any>) => string;
|
|
60
|
+
/**
|
|
61
|
+
* Dolla's I(nternationalizatio)n module. Manages language translations and locale-based formatting.
|
|
62
|
+
*/
|
|
63
|
+
export declare class I18n {
|
|
64
|
+
#private;
|
|
65
|
+
$locale: State<string | undefined>;
|
|
66
|
+
constructor(dolla: Dolla);
|
|
67
|
+
get locales(): string[];
|
|
68
|
+
setup(options: I18nSetupOptions): void;
|
|
69
|
+
setLocale(name: string): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Returns a State containing the value at `key`.
|
|
72
|
+
|
|
73
|
+
* @param selector - Key to the translated value.
|
|
74
|
+
* @param options - A map of `{{placeholder}}` names and the values to replace them with.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* const $value = t("your.key.here", { count: 5 });
|
|
78
|
+
*/
|
|
79
|
+
t(selector: string, options?: TOptions): State<string>;
|
|
80
|
+
/**
|
|
81
|
+
* Add a custom format callback.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* Dolla.i18n.addFormat("uppercase", (locale, value, options) => {
|
|
85
|
+
* return value.toUpperCase();
|
|
86
|
+
* });
|
|
87
|
+
*
|
|
88
|
+
* {
|
|
89
|
+
* "greeting": "Hello, {{name|uppercase}}!"
|
|
90
|
+
* }
|
|
91
|
+
*
|
|
92
|
+
* t("greeting", {name: "world"}); // State<"Hello, WORLD!">
|
|
93
|
+
*/
|
|
94
|
+
addFormat(name: string, callback: (locale: string, value: unknown, options: Record<string, any>) => string): void;
|
|
95
|
+
/**
|
|
96
|
+
* Creates an `Intl.Collator` configured for the current locale.
|
|
97
|
+
* NOTE: The Collator remains bound to the locale it was created with, even when the app's locale changes.
|
|
98
|
+
*
|
|
99
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator/Collator#options
|
|
100
|
+
*/
|
|
101
|
+
collator(options?: Intl.CollatorOptions): Intl.Collator;
|
|
102
|
+
/**
|
|
103
|
+
* Returns a State containing the number formatted for the current locale. Uses `Intl.NumberFormat` under the hood.
|
|
104
|
+
*
|
|
105
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
|
|
106
|
+
*/
|
|
107
|
+
number(count: MaybeState<number | bigint>, options?: Intl.NumberFormatOptions): State<string>;
|
|
108
|
+
/**
|
|
109
|
+
* Returns a State containing the date formatted for the current locale. Uses `Intl.DateTimeFormat` under the hood.
|
|
110
|
+
*
|
|
111
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#options
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* const date = new Date();
|
|
115
|
+
* const $formatted = Dolla.i18n.dateTime(date, { dateFormat: "short" });
|
|
116
|
+
*/
|
|
117
|
+
dateTime(date?: MaybeState<string | number | Date | undefined>, options?: Intl.DateTimeFormatOptions): State<string>;
|
|
118
|
+
/**
|
|
119
|
+
* Returns a State containing the date formatted for the current locale. Uses `Intl.DateTimeFormat` under the hood.
|
|
120
|
+
*
|
|
121
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#options
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* const list = new Date();
|
|
125
|
+
* const $formatted = Dolla.i18n.list(list, { });
|
|
126
|
+
*/
|
|
127
|
+
list(list: MaybeState<Iterable<string>>, options?: Intl.ListFormatOptions): State<string>;
|
|
128
|
+
}
|
|
129
|
+
export {};
|
package/dist/modules/router.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import type {
|
|
1
|
+
import type { Dolla } from "../core/dolla.js";
|
|
2
|
+
import type { ViewFunction } from "../core/nodes/view.js";
|
|
3
|
+
import type { Stringable } from "../types.js";
|
|
4
4
|
export interface RouteMatchContext {
|
|
5
5
|
/**
|
|
6
6
|
* Redirects the user to a different route instead of matching the current one.
|
|
@@ -29,14 +29,15 @@ export interface Route {
|
|
|
29
29
|
*/
|
|
30
30
|
beforeMatch?: (ctx: RouteMatchContext) => void | Promise<void>;
|
|
31
31
|
}
|
|
32
|
+
export interface RouteMeta {
|
|
33
|
+
redirect?: string | ((ctx: RouteRedirectContext) => string) | ((ctx: RouteRedirectContext) => Promise<string>);
|
|
34
|
+
pattern?: string;
|
|
35
|
+
layers?: RouteLayer[];
|
|
36
|
+
beforeMatch?: (ctx: RouteMatchContext) => void | Promise<void>;
|
|
37
|
+
}
|
|
32
38
|
export interface RouteConfig {
|
|
33
39
|
pattern: string;
|
|
34
|
-
meta:
|
|
35
|
-
redirect?: string | ((ctx: RouteRedirectContext) => string) | ((ctx: RouteRedirectContext) => Promise<string>);
|
|
36
|
-
pattern?: string;
|
|
37
|
-
layers?: RouteLayer[];
|
|
38
|
-
beforeMatch?: (ctx: RouteMatchContext) => void | Promise<void>;
|
|
39
|
-
};
|
|
40
|
+
meta: RouteMeta;
|
|
40
41
|
}
|
|
41
42
|
export interface RouteLayer {
|
|
42
43
|
id: number;
|
|
@@ -63,11 +64,6 @@ export interface RouteRedirectContext {
|
|
|
63
64
|
*/
|
|
64
65
|
query: Record<string, string | number | boolean | undefined>;
|
|
65
66
|
}
|
|
66
|
-
interface ParsedParams {
|
|
67
|
-
[key: string]: string | number | boolean | (string | number | boolean | null)[] | null;
|
|
68
|
-
}
|
|
69
|
-
interface ParsedQuery extends ParsedParams {
|
|
70
|
-
}
|
|
71
67
|
export interface NavigateOptions {
|
|
72
68
|
/**
|
|
73
69
|
* Replace the current item in the history stack instead of adding a new one.
|
|
@@ -79,57 +75,33 @@ export interface NavigateOptions {
|
|
|
79
75
|
*/
|
|
80
76
|
preserveQuery?: boolean;
|
|
81
77
|
}
|
|
82
|
-
export
|
|
83
|
-
/**
|
|
84
|
-
* Constructs routes like "https://www.example.com/#/sub/route" which work without any server-side setup.
|
|
85
|
-
* A good choice if your app has no backend.
|
|
86
|
-
*/
|
|
87
|
-
hash = "hash",
|
|
88
|
-
/**
|
|
89
|
-
* Constructs routes like "https://www.example.com/sub/route" which look nicer (subjective?) than hash routes and are what most users will expect URLs to look like, but require additional backend setup.
|
|
90
|
-
* Path routing requires you to configure your backend to redirect to the app's index.html when subpaths are requested.
|
|
91
|
-
*/
|
|
92
|
-
path = "path"
|
|
93
|
-
}
|
|
94
|
-
export interface RouterSetupOptions {
|
|
78
|
+
export interface RouterOptions {
|
|
95
79
|
routes: Route[];
|
|
96
80
|
/**
|
|
97
|
-
*
|
|
81
|
+
* When true, the router will construct routes like "https://www.example.com/#/sub/route" which work without any backend intervention.
|
|
98
82
|
*/
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
export interface RouterElements {
|
|
102
|
-
readonly rootElement?: HTMLElement;
|
|
103
|
-
readonly rootView?: ViewNode;
|
|
83
|
+
hash?: boolean;
|
|
104
84
|
}
|
|
105
85
|
export declare class Router {
|
|
106
86
|
#private;
|
|
107
87
|
/**
|
|
108
88
|
* The currently matched route pattern, if any.
|
|
109
89
|
*/
|
|
110
|
-
$pattern: import("../
|
|
90
|
+
$pattern: import("../core/state.js").State<string | undefined>;
|
|
111
91
|
/**
|
|
112
92
|
* The current URL path.
|
|
113
93
|
*/
|
|
114
|
-
$path: import("../
|
|
94
|
+
$path: import("../core/state.js").State<string>;
|
|
115
95
|
/**
|
|
116
96
|
* The current named path params.
|
|
117
97
|
*/
|
|
118
|
-
$params: import("../
|
|
98
|
+
$params: import("../core/state.js").State<Record<string, string | number>>;
|
|
119
99
|
/**
|
|
120
100
|
* The current query params. Changes to this object will be reflected in the URL.
|
|
121
101
|
*/
|
|
122
|
-
$query: import("../
|
|
123
|
-
constructor(dolla: Dolla
|
|
124
|
-
setup(options:
|
|
125
|
-
/**
|
|
126
|
-
* Navigates to another route.
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
129
|
-
* navigate("/login"); // navigate to `/login`
|
|
130
|
-
* navigate(["/users", 215], { replace: true }); // replace current history entry with `/users/215`
|
|
131
|
-
*/
|
|
132
|
-
go(path: Stringable | Stringable[], options?: NavigateOptions): void;
|
|
102
|
+
$query: import("../core/state.js").State<Record<string, string | number | boolean>>;
|
|
103
|
+
constructor(dolla: Dolla);
|
|
104
|
+
setup(options: RouterOptions): Promise<void>;
|
|
133
105
|
/**
|
|
134
106
|
* Navigate backward. Pass a number of steps to hit the back button that many times.
|
|
135
107
|
*/
|
|
@@ -138,6 +110,14 @@ export declare class Router {
|
|
|
138
110
|
* Navigate forward. Pass a number of steps to hit the forward button that many times.
|
|
139
111
|
*/
|
|
140
112
|
forward(steps?: number): void;
|
|
113
|
+
/**
|
|
114
|
+
* Navigates to another route.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* Dolla.router.go("/login"); // navigate to `/login`
|
|
118
|
+
* Dolla.router.go["/users", 215], { replace: true }); // replace current history entry with `/users/215`
|
|
119
|
+
*/
|
|
120
|
+
go(path: Stringable | Stringable[], options?: NavigateOptions): void;
|
|
141
121
|
}
|
|
142
122
|
/**
|
|
143
123
|
* Intercepts links within the root node.
|
|
@@ -149,4 +129,3 @@ export declare class Router {
|
|
|
149
129
|
* @param _window - (optional) Override for global window object
|
|
150
130
|
*/
|
|
151
131
|
export declare function catchLinks(root: HTMLElement, callback: (anchor: HTMLAnchorElement) => void, _window?: Window & typeof globalThis): () => void;
|
|
152
|
-
export {};
|