@manyducks.co/dolla 2.0.0-alpha.59 → 2.0.0-alpha.60
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/dist/core/context.d.ts +2 -18
- package/dist/core/index.d.ts +3 -4
- package/dist/core/logger.d.ts +5 -2
- package/dist/core/markup.d.ts +47 -21
- package/dist/core/mount.d.ts +2 -2
- package/dist/core/nodes/dom.d.ts +4 -4
- package/dist/core/nodes/dynamic.d.ts +4 -4
- package/dist/core/nodes/html.d.ts +4 -5
- package/dist/core/nodes/portal.d.ts +3 -3
- package/dist/core/nodes/repeat.d.ts +3 -3
- package/dist/core/nodes/view.d.ts +8 -3
- package/dist/core/symbols.d.ts +2 -2
- package/dist/core/views/default-crash-view.d.ts +1 -12
- package/dist/http.js +1 -1
- package/dist/i18n.js +2 -2
- package/dist/index.js +38 -37
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.js +1 -1
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx-runtime.js +1 -1
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/{logger-Ck_9LCem.js → logger-MPwl-Xqu.js} +70 -62
- package/dist/logger-MPwl-Xqu.js.map +1 -0
- package/dist/{markup-BBa4WBj1.js → markup-BGlfQYQk.js} +302 -325
- package/dist/markup-BGlfQYQk.js.map +1 -0
- package/dist/router/router.d.ts +12 -5
- package/dist/router-BpuJQ6OA.js +516 -0
- package/dist/router-BpuJQ6OA.js.map +1 -0
- package/dist/router.js +1 -1
- package/dist/{typeChecking-BJ-ymQ2F.js → typeChecking-CbltMOUt.js} +2 -1
- package/dist/{typeChecking-BJ-ymQ2F.js.map → typeChecking-CbltMOUt.js.map} +1 -1
- package/dist/types.d.ts +11 -2
- package/dist/utils.d.ts +2 -0
- package/package.json +1 -1
- package/dist/core/app.d.ts +0 -17
- package/dist/logger-Ck_9LCem.js.map +0 -1
- package/dist/markup-BBa4WBj1.js.map +0 -1
- package/dist/router-CaR7Xd4T.js +0 -490
- package/dist/router-CaR7Xd4T.js.map +0 -1
package/dist/core/context.d.ts
CHANGED
|
@@ -73,25 +73,9 @@ export declare class Context implements Logger {
|
|
|
73
73
|
*/
|
|
74
74
|
static linked(parent: Context, name: MaybeSignal<string>, options?: LinkedContextOptions): Context;
|
|
75
75
|
/**
|
|
76
|
-
* Emit
|
|
76
|
+
* Emit a lifecycle event to `context`.
|
|
77
77
|
*/
|
|
78
|
-
static
|
|
79
|
-
/**
|
|
80
|
-
* Emit "did mount" lifecycle event to `context`.
|
|
81
|
-
*/
|
|
82
|
-
static didMount(context: Context): void;
|
|
83
|
-
/**
|
|
84
|
-
* Emit "will unmount" lifecycle event to `context`.
|
|
85
|
-
*/
|
|
86
|
-
static willUnmount(context: Context): void;
|
|
87
|
-
/**
|
|
88
|
-
* Emit "did unmount" lifecycle event to `context`.
|
|
89
|
-
*/
|
|
90
|
-
static didUnmount(context: Context): void;
|
|
91
|
-
/**
|
|
92
|
-
* Emit "dispose" lifecycle event to `context`.
|
|
93
|
-
*/
|
|
94
|
-
static dispose(context: Context): void;
|
|
78
|
+
static emit(context: Context, event: LifecycleEvent): void;
|
|
95
79
|
/**
|
|
96
80
|
* Traverses _parent contexts until arriving at one that doesn't have a parent itself.
|
|
97
81
|
* Returns null if this context is the parent.
|
package/dist/core/index.d.ts
CHANGED
|
@@ -4,14 +4,13 @@ export { createContext } from "./context.js";
|
|
|
4
4
|
export type { Context } from "./context.js";
|
|
5
5
|
export { m, portal, render, repeat, unless, when } from "./markup.js";
|
|
6
6
|
export type { MarkupNode } from "./markup.js";
|
|
7
|
-
export { type Mixin } from "./nodes/html.js";
|
|
8
7
|
export { ref, type Ref } from "./ref.js";
|
|
9
8
|
export { mount, type UnmountFn } from "./mount.js";
|
|
10
9
|
export { deepEqual, shallowEqual, strictEqual } from "../utils.js";
|
|
11
10
|
export { getEnv, setEnv } from "./env.js";
|
|
12
|
-
export { createLogger, setLogFilter, setLogLevels } from "./logger.js";
|
|
13
|
-
export type { Logger,
|
|
14
|
-
export type { View, Store, InputType, Renderable, Env, CSSProperties } from "../types.js";
|
|
11
|
+
export { createLogger, setLogFilter, setLogLevels, onLoggerCrash } from "./logger.js";
|
|
12
|
+
export type { Logger, LoggerCrashProps, LoggerOptions, LogLevels } from "./logger.js";
|
|
13
|
+
export type { View, Store, Mixin, InputType, Renderable, Env, CSSProperties } from "../types.js";
|
|
15
14
|
export type { CrashViewProps } from "./views/default-crash-view.js";
|
|
16
15
|
import type { IntrinsicElements as Elements } from "../types.js";
|
|
17
16
|
declare global {
|
package/dist/core/logger.d.ts
CHANGED
|
@@ -27,13 +27,16 @@ export interface LoggerOptions {
|
|
|
27
27
|
*/
|
|
28
28
|
console?: any;
|
|
29
29
|
}
|
|
30
|
-
export interface
|
|
30
|
+
export interface LoggerCrashProps {
|
|
31
31
|
error: Error;
|
|
32
32
|
loggerName: string;
|
|
33
33
|
tag?: string;
|
|
34
34
|
tagName?: string;
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Listen for logged crashes.
|
|
38
|
+
*/
|
|
39
|
+
export declare function onLoggerCrash(listener: (context: LoggerCrashProps) => void): () => void;
|
|
37
40
|
export declare function createLogger(name: MaybeSignal<string>, options?: LoggerOptions): Logger;
|
|
38
41
|
export declare function setLogFilter(filter: string | RegExp): void;
|
|
39
42
|
export declare function setLogLevels(options: Partial<LogLevels>): void;
|
package/dist/core/markup.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Renderable, View } from "../types.js";
|
|
1
|
+
import type { IntrinsicElements, Renderable, View } from "../types.js";
|
|
2
2
|
import { Context } from "./context.js";
|
|
3
3
|
import { KeyFn, RenderFn } from "./nodes/repeat.js";
|
|
4
4
|
import { type MaybeSignal, type Signal } from "./signals.js";
|
|
@@ -27,17 +27,23 @@ export interface MarkupNode {
|
|
|
27
27
|
*/
|
|
28
28
|
readonly root?: Node;
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* Returns true when this MarkupNode is mounted.
|
|
31
31
|
*/
|
|
32
32
|
isMounted(): boolean;
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* Mount this MarkupNode to a `parent` element.
|
|
35
|
+
* If passed, this MarkupNode will be mounted as the next sibling of `after`.
|
|
35
36
|
*/
|
|
36
37
|
mount(parent: Element, after?: Node): void;
|
|
37
38
|
/**
|
|
39
|
+
* Unmount this MarkupNode from its parent element.
|
|
40
|
+
*
|
|
41
|
+
* The `skipDOM` option can be passed as an optimization when unmounting a parent node.
|
|
42
|
+
* A value of `true` indicates that no DOM operations need to happen because the parent is already being unmounted.
|
|
38
43
|
*
|
|
44
|
+
* @param skipDOM - No DOM updates will be performed when true. Lifecycle methods will be called regardless.
|
|
39
45
|
*/
|
|
40
|
-
unmount(
|
|
46
|
+
unmount(skipDOM?: boolean): void;
|
|
41
47
|
/**
|
|
42
48
|
* Moves a node without unmounting and remounting (if the browser supports Element.moveBefore).
|
|
43
49
|
*/
|
|
@@ -45,35 +51,55 @@ export interface MarkupNode {
|
|
|
45
51
|
}
|
|
46
52
|
export declare function isMarkupNode(value: any): value is MarkupNode;
|
|
47
53
|
export declare enum MarkupType {
|
|
48
|
-
Text = "$text",
|
|
49
|
-
Repeat = "$repeat",
|
|
50
|
-
Dynamic = "$dynamic",
|
|
51
54
|
DOM = "$dom",
|
|
52
|
-
|
|
55
|
+
Dynamic = "$dynamic",
|
|
56
|
+
Portal = "$portal",
|
|
57
|
+
Repeat = "$repeat"
|
|
53
58
|
}
|
|
54
|
-
export interface
|
|
55
|
-
[MarkupType.
|
|
56
|
-
value:
|
|
57
|
-
};
|
|
58
|
-
[MarkupType.Repeat]: {
|
|
59
|
-
items: Signal<any[]>;
|
|
60
|
-
key: KeyFn<any>;
|
|
61
|
-
render: RenderFn<any>;
|
|
59
|
+
export interface MarkupNodeProps {
|
|
60
|
+
[MarkupType.DOM]: {
|
|
61
|
+
value: Node;
|
|
62
62
|
};
|
|
63
63
|
[MarkupType.Dynamic]: {
|
|
64
64
|
source: Signal<any>;
|
|
65
65
|
};
|
|
66
|
-
[MarkupType.DOM]: {
|
|
67
|
-
value: Node;
|
|
68
|
-
};
|
|
69
66
|
[MarkupType.Portal]: {
|
|
70
67
|
content: Renderable;
|
|
71
68
|
parent: Element;
|
|
72
69
|
};
|
|
73
|
-
[
|
|
70
|
+
[MarkupType.Repeat]: {
|
|
71
|
+
items: Signal<any[]>;
|
|
72
|
+
key: KeyFn<any>;
|
|
73
|
+
render: RenderFn<any>;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export interface MarkupCustomElementProps {
|
|
77
|
+
/**
|
|
78
|
+
* Custom element tagName pattern (must include a hyphen).
|
|
79
|
+
*/
|
|
80
|
+
[tag: `${string}-${string}`]: Record<string, any>;
|
|
74
81
|
}
|
|
75
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Creates a Markup element that defines an HTML element.
|
|
84
|
+
*/
|
|
85
|
+
export declare function m<T extends keyof IntrinsicElements>(tag: T, attrs: IntrinsicElements[T] & {
|
|
86
|
+
children?: Renderable;
|
|
87
|
+
}): Markup;
|
|
88
|
+
/**
|
|
89
|
+
* Creates a Markup element that defines an HTML custom element.
|
|
90
|
+
*/
|
|
91
|
+
export declare function m<T extends keyof MarkupCustomElementProps>(type: T, props: MarkupCustomElementProps[T]): Markup;
|
|
92
|
+
/**
|
|
93
|
+
* Creates a Markup element that defines a MarkupNode.
|
|
94
|
+
*/
|
|
95
|
+
export declare function m<T extends keyof MarkupNodeProps>(type: T, props: MarkupNodeProps[T]): Markup;
|
|
96
|
+
/**
|
|
97
|
+
* Creates a Markup element that defines a view.
|
|
98
|
+
*/
|
|
76
99
|
export declare function m<P extends {}>(type: View<P>, props?: P): Markup;
|
|
100
|
+
/**
|
|
101
|
+
* Creates a Markup element that defines a view.
|
|
102
|
+
*/
|
|
77
103
|
export declare function m<P>(type: View<P>, props: P): Markup;
|
|
78
104
|
/**
|
|
79
105
|
* If `condition` is truthy, displays `thenContent`, otherwise `elseContent`.
|
package/dist/core/mount.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Router } from "../router/router";
|
|
2
2
|
import type { View } from "../types";
|
|
3
3
|
import { Context } from "./context";
|
|
4
|
-
import { type
|
|
4
|
+
import { type LoggerCrashProps } from "./logger";
|
|
5
5
|
export type UnmountFn = () => Promise<void>;
|
|
6
6
|
export interface MountOptions {
|
|
7
|
-
crashView?: View<
|
|
7
|
+
crashView?: View<LoggerCrashProps>;
|
|
8
8
|
/**
|
|
9
9
|
* An existing Context to use as the root, otherwise a new one will be created.
|
|
10
10
|
* Use this to provide top-level stores and state to the whole app.
|
package/dist/core/nodes/dom.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { MarkupNode } from "../markup";
|
|
2
|
-
import {
|
|
2
|
+
import { TYPE } from "../symbols";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Lightweight MarkupNode wrapper for a plain DOM node.
|
|
5
5
|
*/
|
|
6
6
|
export declare class DOMNode implements MarkupNode {
|
|
7
|
-
[
|
|
7
|
+
[TYPE]: symbol;
|
|
8
8
|
root: Node;
|
|
9
9
|
constructor(node: Node);
|
|
10
10
|
isMounted(): boolean;
|
|
11
11
|
mount(parent: Element, after?: Node): void;
|
|
12
|
-
unmount(
|
|
12
|
+
unmount(skipDOM?: boolean): void;
|
|
13
13
|
move(parent: Element, after?: Node): void;
|
|
14
14
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Context } from "../context.js";
|
|
2
2
|
import { type MarkupNode } from "../markup.js";
|
|
3
|
-
import { Signal } from "../signals.js";
|
|
4
|
-
import {
|
|
3
|
+
import { type Signal } from "../signals.js";
|
|
4
|
+
import { TYPE } from "../symbols.js";
|
|
5
5
|
/**
|
|
6
6
|
* Displays dynamic children without a parent element.
|
|
7
7
|
* Renders a Reactive value via a render function.
|
|
@@ -9,7 +9,7 @@ import { IS_MARKUP_NODE } from "../symbols.js";
|
|
|
9
9
|
* This is probably the most used element type aside from HTML.
|
|
10
10
|
*/
|
|
11
11
|
export declare class Dynamic implements MarkupNode {
|
|
12
|
-
[
|
|
12
|
+
[TYPE]: symbol;
|
|
13
13
|
root: Text;
|
|
14
14
|
private children;
|
|
15
15
|
private context;
|
|
@@ -18,7 +18,7 @@ export declare class Dynamic implements MarkupNode {
|
|
|
18
18
|
constructor(context: Context, $slot: Signal<any>);
|
|
19
19
|
isMounted(): boolean;
|
|
20
20
|
mount(parent: Node, after?: Node): void;
|
|
21
|
-
unmount(
|
|
21
|
+
unmount(skipDOM?: boolean): void;
|
|
22
22
|
move(parent: Element, after?: Node): void;
|
|
23
23
|
private cleanup;
|
|
24
24
|
private update;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Context } from "../context.js";
|
|
2
2
|
import { type MarkupNode } from "../markup.js";
|
|
3
|
-
import {
|
|
4
|
-
export type Mixin<E extends Element = Element> = (element: E, context: Context) => void;
|
|
3
|
+
import { TYPE } from "../symbols.js";
|
|
5
4
|
export declare class HTML implements MarkupNode {
|
|
6
|
-
[
|
|
7
|
-
root
|
|
5
|
+
[TYPE]: symbol;
|
|
6
|
+
root: HTMLElement | SVGElement;
|
|
8
7
|
private parentContext;
|
|
9
8
|
private context;
|
|
10
9
|
tag: string;
|
|
@@ -16,7 +15,7 @@ export declare class HTML implements MarkupNode {
|
|
|
16
15
|
constructor(context: Context, tag: string, props: Record<string, any>);
|
|
17
16
|
isMounted(): boolean;
|
|
18
17
|
mount(parent: Node, after?: Node): void;
|
|
19
|
-
unmount(
|
|
18
|
+
unmount(skipDOM?: boolean): void;
|
|
20
19
|
move(parent: Element, after?: Node): void;
|
|
21
20
|
private attachProp;
|
|
22
21
|
private applyProps;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Renderable } from "../../types.js";
|
|
2
2
|
import { Context } from "../context.js";
|
|
3
3
|
import { type MarkupNode } from "../markup.js";
|
|
4
|
-
import {
|
|
4
|
+
import { TYPE } from "../symbols.js";
|
|
5
5
|
/**
|
|
6
6
|
* Renders content into a specified parent node.
|
|
7
7
|
*/
|
|
8
8
|
export declare class Portal implements MarkupNode {
|
|
9
|
-
[
|
|
9
|
+
[TYPE]: symbol;
|
|
10
10
|
private context;
|
|
11
11
|
private content;
|
|
12
12
|
private parent;
|
|
@@ -14,6 +14,6 @@ export declare class Portal implements MarkupNode {
|
|
|
14
14
|
constructor(context: Context, content: Renderable, parent: Element);
|
|
15
15
|
isMounted(): boolean;
|
|
16
16
|
mount(_parent: Element, _after?: Node): void;
|
|
17
|
-
unmount(
|
|
17
|
+
unmount(skipDOM?: boolean): void;
|
|
18
18
|
move(_parent: Element, _after?: Node): void;
|
|
19
19
|
}
|
|
@@ -2,12 +2,12 @@ import type { Renderable } from "../../types.js";
|
|
|
2
2
|
import type { Context } from "../context.js";
|
|
3
3
|
import type { MarkupNode } from "../markup.js";
|
|
4
4
|
import { type Signal } from "../signals.js";
|
|
5
|
-
import {
|
|
5
|
+
import { TYPE } from "../symbols.js";
|
|
6
6
|
export type Key = string | number | symbol;
|
|
7
7
|
export type KeyFn<T> = (item: T, index: number) => Key;
|
|
8
8
|
export type RenderFn<T> = (item: Signal<T>, index: Signal<number>, ctx: Context) => Renderable;
|
|
9
9
|
export declare class Repeat<T> implements MarkupNode {
|
|
10
|
-
[
|
|
10
|
+
[TYPE]: symbol;
|
|
11
11
|
root: Text;
|
|
12
12
|
private context;
|
|
13
13
|
private items;
|
|
@@ -18,7 +18,7 @@ export declare class Repeat<T> implements MarkupNode {
|
|
|
18
18
|
constructor(context: Context, items: Signal<T[]>, key: KeyFn<T>, render: RenderFn<T>);
|
|
19
19
|
isMounted(): boolean;
|
|
20
20
|
mount(parent: Element, after?: Node): void;
|
|
21
|
-
unmount(
|
|
21
|
+
unmount(skipDOM?: boolean): void;
|
|
22
22
|
move(parent: Element, after?: Node): void;
|
|
23
23
|
private _cleanup;
|
|
24
24
|
private _update;
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import type { View } from "../../types.js";
|
|
2
2
|
import { Context } from "../context.js";
|
|
3
3
|
import { type MarkupNode } from "../markup.js";
|
|
4
|
-
import {
|
|
4
|
+
import { TYPE } from "../symbols.js";
|
|
5
5
|
export declare const VIEW: unique symbol;
|
|
6
6
|
export declare class ViewInstance<P> implements MarkupNode {
|
|
7
|
-
[
|
|
7
|
+
[TYPE]: symbol;
|
|
8
8
|
uniqueId: string;
|
|
9
9
|
context: Context;
|
|
10
10
|
props: P;
|
|
11
11
|
view: View<P>;
|
|
12
12
|
node?: MarkupNode;
|
|
13
13
|
get root(): Node;
|
|
14
|
+
/**
|
|
15
|
+
* @param context - Parent contenxt to link to.
|
|
16
|
+
* @param view - View function to mount.
|
|
17
|
+
* @param props - Props to pass to view function.
|
|
18
|
+
*/
|
|
14
19
|
constructor(context: Context, view: View<P>, props: P);
|
|
15
20
|
isMounted(): boolean;
|
|
16
21
|
mount(parent: Element, after?: Node): void;
|
|
17
|
-
unmount(
|
|
22
|
+
unmount(skipDOM?: boolean): void;
|
|
18
23
|
move(parent: Element, after?: Node): void;
|
|
19
24
|
}
|
package/dist/core/symbols.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const
|
|
1
|
+
export declare const TYPE: unique symbol;
|
|
2
|
+
export declare const MARKUP_NODE: unique symbol;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Markup } from "../markup.js";
|
|
2
1
|
/**
|
|
3
2
|
* Props passed to the crash view when a crash occurs.
|
|
4
3
|
*/
|
|
@@ -20,14 +19,4 @@ export type CrashViewProps = {
|
|
|
20
19
|
*/
|
|
21
20
|
tagName?: string;
|
|
22
21
|
};
|
|
23
|
-
export declare function DefaultCrashView(props: CrashViewProps): Markup<
|
|
24
|
-
style: {
|
|
25
|
-
backgroundColor: string;
|
|
26
|
-
color: string;
|
|
27
|
-
padding: string;
|
|
28
|
-
position: string;
|
|
29
|
-
inset: number;
|
|
30
|
-
fontSize: string;
|
|
31
|
-
};
|
|
32
|
-
children: Markup<any>[];
|
|
33
|
-
}>;
|
|
22
|
+
export declare function DefaultCrashView(props: CrashViewProps): import("../markup.js").Markup<any>;
|
package/dist/http.js
CHANGED
|
@@ -6,7 +6,7 @@ var g = (r, e, t) => e in r ? b(r, e, { enumerable: !0, configurable: !0, writab
|
|
|
6
6
|
var a = (r, e, t) => g(r, typeof e != "symbol" ? e + "" : e, t), m = (r, e, t) => e.has(r) || f("Cannot " + t);
|
|
7
7
|
var d = (r, e, t) => (m(r, e, "read from private field"), t ? t.call(r) : e.get(r)), c = (r, e, t) => e.has(r) ? f("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t);
|
|
8
8
|
var o = (r, e, t) => (m(r, e, "access private method"), t);
|
|
9
|
-
import { i as w } from "./typeChecking-
|
|
9
|
+
import { i as w } from "./typeChecking-CbltMOUt.js";
|
|
10
10
|
var l, p, i, h;
|
|
11
11
|
class O {
|
|
12
12
|
constructor() {
|
package/dist/i18n.js
CHANGED
|
@@ -5,8 +5,8 @@ var D = (o) => {
|
|
|
5
5
|
var J = (o, t, e) => t in o ? B(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
6
6
|
var O = (o, t, e) => J(o, typeof t != "symbol" ? t + "" : t, e), _ = (o, t, e) => t.has(o) || D("Cannot " + e);
|
|
7
7
|
var i = (o, t, e) => (_(o, t, "read from private field"), e ? e.call(o) : t.get(o)), m = (o, t, e) => t.has(o) ? D("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(o) : t.set(o, e), N = (o, t, e, n) => (_(o, t, "write to private field"), n ? n.call(o, e) : t.set(o, e), e), g = (o, t, e) => (_(o, t, "access private method"), e);
|
|
8
|
-
import { $, h as K, d as Q, g as x } from "./logger-
|
|
9
|
-
import { b as C, i as j, c as U, t as P } from "./typeChecking-
|
|
8
|
+
import { $, h as K, d as Q, g as x } from "./logger-MPwl-Xqu.js";
|
|
9
|
+
import { b as C, i as j, c as U, t as P } from "./typeChecking-CbltMOUt.js";
|
|
10
10
|
var I, F, p, S, G;
|
|
11
11
|
class W {
|
|
12
12
|
constructor(t) {
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { o as
|
|
2
|
-
import { $ as
|
|
3
|
-
import {
|
|
4
|
-
import { c as
|
|
5
|
-
import { R as
|
|
6
|
-
import { a as x } from "./typeChecking-
|
|
1
|
+
import { o as h } from "./logger-MPwl-Xqu.js";
|
|
2
|
+
import { $ as k, b as D, h as I, d as V, e as F, g as _, c as q, f as v, i as B, j as $, s as P, a as S, u as W } from "./logger-MPwl-Xqu.js";
|
|
3
|
+
import { m as t, w as y, C as n, L as m, V as f } from "./markup-BGlfQYQk.js";
|
|
4
|
+
import { c as A, p as Y, r as j, a as G, u as H } from "./markup-BGlfQYQk.js";
|
|
5
|
+
import { R as w, M as p, U as b } from "./router-BpuJQ6OA.js";
|
|
6
|
+
import { a as x } from "./typeChecking-CbltMOUt.js";
|
|
7
7
|
const u = Symbol("Ref.EMPTY");
|
|
8
|
-
function
|
|
8
|
+
function C(e = u) {
|
|
9
9
|
return function() {
|
|
10
10
|
if (arguments.length === 0) {
|
|
11
11
|
if (e === u)
|
|
@@ -18,7 +18,7 @@ function N(e = u) {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
function E(e) {
|
|
21
|
-
return
|
|
21
|
+
return t("div", {
|
|
22
22
|
style: {
|
|
23
23
|
backgroundColor: "#880000",
|
|
24
24
|
color: "#fff",
|
|
@@ -36,7 +36,7 @@ function E(e) {
|
|
|
36
36
|
style: { fontFamily: "monospace" },
|
|
37
37
|
children: e.loggerName
|
|
38
38
|
}),
|
|
39
|
-
|
|
39
|
+
y(
|
|
40
40
|
e.tag,
|
|
41
41
|
t("span", {
|
|
42
42
|
style: { fontFamily: "monospace", opacity: 0.5 },
|
|
@@ -75,41 +75,42 @@ function E(e) {
|
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
let s = !1;
|
|
78
|
-
async function
|
|
78
|
+
async function R(e, o, r) {
|
|
79
79
|
if (x(Element, o, "Expected an element or a selector string. Got type: %t, value: %v"), s)
|
|
80
80
|
throw new Error("A Dolla app is already mounted.");
|
|
81
|
-
let l, i,
|
|
81
|
+
let l, i, d = (r == null ? void 0 : r.crashView) ?? E;
|
|
82
82
|
const a = (r == null ? void 0 : r.context) ?? new n("App");
|
|
83
|
-
|
|
84
|
-
s &&
|
|
85
|
-
}), n.
|
|
86
|
-
async function
|
|
87
|
-
s && (n.
|
|
83
|
+
h((g) => {
|
|
84
|
+
s && c(), new f(a, d, g).mount(o);
|
|
85
|
+
}), n.emit(a, m.WILL_MOUNT), e instanceof w ? (i = e, l = await i[p](o, a)) : l = new f(a, e, {}), l.mount(o), s = !0, n.emit(a, m.DID_MOUNT);
|
|
86
|
+
async function c() {
|
|
87
|
+
s && (n.emit(a, m.WILL_UNMOUNT), l.unmount(!1), i && await i[b](), s = !1, n.emit(a, m.DID_UNMOUNT));
|
|
88
88
|
}
|
|
89
|
-
return
|
|
89
|
+
return c;
|
|
90
90
|
}
|
|
91
91
|
export {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
92
|
+
k as $,
|
|
93
|
+
D as batch,
|
|
94
|
+
A as createContext,
|
|
95
|
+
I as createLogger,
|
|
96
|
+
V as deepEqual,
|
|
97
|
+
F as effect,
|
|
98
|
+
_ as get,
|
|
99
|
+
q as getEnv,
|
|
100
100
|
t as m,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
101
|
+
R as mount,
|
|
102
|
+
h as onLoggerCrash,
|
|
103
|
+
Y as portal,
|
|
104
|
+
C as ref,
|
|
105
|
+
j as render,
|
|
106
|
+
G as repeat,
|
|
107
|
+
v as setEnv,
|
|
108
|
+
B as setLogFilter,
|
|
109
|
+
$ as setLogLevels,
|
|
110
|
+
P as shallowEqual,
|
|
111
|
+
S as strictEqual,
|
|
111
112
|
H as unless,
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
W as untracked,
|
|
114
|
+
y as when
|
|
114
115
|
};
|
|
115
116
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/core/ref.ts","../src/core/views/default-crash-view.ts","../src/core/mount.ts"],"sourcesContent":["const EMPTY_REF = Symbol(\"Ref.EMPTY\");\n\n/**\n * A hybrid getter/setter function that stores the last value it was called with.\n * Guarantees a value is held at runtime by throwing an error if no value is set.\n */\nexport interface Ref<T> {\n /**\n * Returns the currently stored value of the ref, or throws an error if no value has been set.\n */\n (): T;\n\n /**\n * Stores a new value to the ref and returns that value.\n */\n (value: T): T;\n}\n\n/**\n * Creates a Ref.\n */\nexport function ref<T>(value?: T): Ref<T>;\n\nexport function ref(value = EMPTY_REF) {\n return function () {\n if (arguments.length === 0) {\n if (value === EMPTY_REF) {\n throw new Error(`Ref getter was called, but ref has no value! Be sure to set your refs before accessing them.`);\n }\n } else if (arguments.length === 1) {\n value = arguments[0];\n } else {\n throw new Error(`Ref called with too many arguments. Expected 0 or 1 arguments.`);\n }\n\n return value;\n };\n}\n","import { when, m
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/core/ref.ts","../src/core/views/default-crash-view.ts","../src/core/mount.ts"],"sourcesContent":["const EMPTY_REF = Symbol(\"Ref.EMPTY\");\n\n/**\n * A hybrid getter/setter function that stores the last value it was called with.\n * Guarantees a value is held at runtime by throwing an error if no value is set.\n */\nexport interface Ref<T> {\n /**\n * Returns the currently stored value of the ref, or throws an error if no value has been set.\n */\n (): T;\n\n /**\n * Stores a new value to the ref and returns that value.\n */\n (value: T): T;\n}\n\n/**\n * Creates a Ref.\n */\nexport function ref<T>(value?: T): Ref<T>;\n\nexport function ref(value = EMPTY_REF) {\n return function () {\n if (arguments.length === 0) {\n if (value === EMPTY_REF) {\n throw new Error(`Ref getter was called, but ref has no value! Be sure to set your refs before accessing them.`);\n }\n } else if (arguments.length === 1) {\n value = arguments[0];\n } else {\n throw new Error(`Ref called with too many arguments. Expected 0 or 1 arguments.`);\n }\n\n return value;\n };\n}\n","import { when, m } from \"../markup.js\";\n\n/**\n * Props passed to the crash view when a crash occurs.\n */\nexport type CrashViewProps = {\n /**\n * JavaScript Error object.\n */\n error: Error;\n\n /**\n * A string to identify the logger that reported this error.\n */\n loggerName: string;\n\n /**\n * Unique identifier to pinpoint the specific view that reported the crash.\n */\n tag?: string;\n\n /**\n * Label for the tag.\n */\n tagName?: string;\n};\n\nexport function DefaultCrashView(props: CrashViewProps) {\n return m(\"div\", {\n style: {\n backgroundColor: \"#880000\",\n color: \"#fff\",\n padding: \"2rem\",\n position: \"fixed\",\n inset: 0,\n fontSize: \"20px\",\n },\n children: [\n m(\"h1\", { style: { marginBottom: \"0.5rem\" }, children: \"The app has crashed\" }),\n m(\"p\", {\n style: { marginBottom: \"0.25rem\" },\n children: [\n m(\"span\", {\n style: { fontFamily: \"monospace\" },\n children: props.loggerName,\n }),\n when(\n props.tag,\n m(\"span\", {\n style: { fontFamily: \"monospace\", opacity: 0.5 },\n children: ` [${props.tagName ? `${props.tagName}: ` : \"\"}${props.tag}]`,\n }),\n ),\n \" says:\",\n ],\n }),\n m(\"blockquote\", {\n style: {\n backgroundColor: \"#991111\",\n padding: \"0.25em\",\n borderRadius: \"6px\",\n fontFamily: \"monospace\",\n marginBottom: \"1rem\",\n },\n children: [\n m(\"span\", {\n style: {\n display: \"inline-block\",\n backgroundColor: \"red\",\n padding: \"0.1em 0.4em\",\n marginRight: \"0.5em\",\n borderRadius: \"4px\",\n fontSize: \"0.9em\",\n fontWeight: \"bold\",\n },\n children: props.error.name,\n }),\n props.error.message,\n ],\n }),\n m(\"p\", { children: \"Please see the browser console for details.\" }),\n ],\n });\n}\n","import { MOUNT, Router, UNMOUNT } from \"../router/router\";\nimport { assertInstanceOf } from \"../typeChecking\";\nimport type { View } from \"../types\";\nimport { Context, LifecycleEvent } from \"./context\";\nimport { type LoggerCrashProps, onLoggerCrash } from \"./logger\";\nimport { type MarkupNode } from \"./markup\";\nimport { ViewInstance } from \"./nodes/view\";\nimport { DefaultCrashView } from \"./views/default-crash-view\";\n\nlet isMounted = false;\n\nexport type UnmountFn = () => Promise<void>;\nexport interface MountOptions {\n crashView?: View<LoggerCrashProps>;\n\n /**\n * An existing Context to use as the root, otherwise a new one will be created.\n * Use this to provide top-level stores and state to the whole app.\n */\n context?: Context;\n}\n\nexport async function mount(view: View<{}>, domNode: Element, options?: MountOptions): Promise<UnmountFn>;\nexport async function mount(router: Router, domNode: Element, options?: MountOptions): Promise<UnmountFn>;\n\nexport async function mount(view: any, rootElement: Element, options?: MountOptions): Promise<UnmountFn> {\n assertInstanceOf(Element, rootElement, \"Expected an element or a selector string. Got type: %t, value: %v\");\n\n if (isMounted) {\n throw new Error(`A Dolla app is already mounted.`);\n }\n\n let rootView: MarkupNode;\n let router: Router | undefined;\n let crashView = options?.crashView ?? DefaultCrashView;\n\n const rootContext = options?.context ?? new Context(\"App\");\n\n onLoggerCrash((props) => {\n if (isMounted) {\n unmount();\n }\n\n // Mount the crash page\n new ViewInstance(rootContext, crashView, props).mount(rootElement);\n });\n\n Context.emit(rootContext, LifecycleEvent.WILL_MOUNT);\n\n if (view instanceof Router) {\n // Store router reference so we can unmount it with the app.\n router = view;\n rootView = await router[MOUNT](rootElement, rootContext);\n } else {\n rootView = new ViewInstance(rootContext, view, {});\n }\n rootView.mount(rootElement);\n isMounted = true;\n\n Context.emit(rootContext, LifecycleEvent.DID_MOUNT);\n\n async function unmount() {\n if (!isMounted) return;\n\n Context.emit(rootContext, LifecycleEvent.WILL_UNMOUNT);\n\n rootView.unmount(false);\n if (router) {\n await router[UNMOUNT]();\n }\n isMounted = false;\n\n Context.emit(rootContext, LifecycleEvent.DID_UNMOUNT);\n }\n\n return unmount;\n}\n"],"names":["EMPTY_REF","ref","value","DefaultCrashView","props","m","when","isMounted","mount","view","rootElement","options","assertInstanceOf","rootView","router","crashView","rootContext","Context","onLoggerCrash","unmount","ViewInstance","LifecycleEvent","Router","MOUNT","UNMOUNT"],"mappings":"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"}
|
package/dist/jsx-dev-runtime.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-dev-runtime.js","sources":["../src/jsx-dev-runtime.js"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.js","sources":["../src/jsx-dev-runtime.js"],"sourcesContent":["import { createLogger } from \"./core\";\nimport { Markup } from \"./core/markup\";\nexport { Fragment } from \"./core/views/fragment\";\n\nexport function jsxDEV(element, props, key, isStaticChildren, source, self) {\n // TODO: Take additional dev arguments and use them for better debugging.\n // console.info({ element, props, key, isStaticChildren, source, self });\n return new Markup(element, key != null ? { ...props, key } : props);\n}\n"],"names":["jsxDEV","element","props","key","isStaticChildren","source","self","Markup"],"mappings":";;AAIO,SAASA,EAAOC,GAASC,GAAOC,GAAKC,GAAkBC,GAAQC,GAAM;AAG1E,SAAO,IAAIC,EAAON,GAASE,KAAO,OAAO,EAAE,GAAGD,GAAO,KAAAC,EAAK,IAAGD,CAAK;AACpE;"}
|
package/dist/jsx-runtime.js
CHANGED
package/dist/jsx-runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-runtime.js","sources":["../src/jsx-runtime.js"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"jsx-runtime.js","sources":["../src/jsx-runtime.js"],"sourcesContent":["import { Markup } from \"./core/markup\";\nexport { Fragment } from \"./core/views/fragment\";\n\n/**\n * JSX function for elements with dynamic children.\n */\nexport function jsx(element, props, key) {\n return new Markup(element, key != null ? { ...props, key } : props);\n}\n\n/**\n * JSX function for elements with static children.\n */\nexport function jsxs(element, props, key) {\n return new Markup(element, key != null ? { ...props, key } : props);\n}\n"],"names":["jsx","element","props","key","Markup","jsxs"],"mappings":";;AAMO,SAASA,EAAIC,GAASC,GAAOC,GAAK;AACvC,SAAO,IAAIC,EAAOH,GAASE,KAAO,OAAO,EAAE,GAAGD,GAAO,KAAAC,EAAK,IAAGD,CAAK;AACpE;AAKO,SAASG,EAAKJ,GAASC,GAAOC,GAAK;AACxC,SAAO,IAAIC,EAAOH,GAASE,KAAO,OAAO,EAAE,GAAGD,GAAO,KAAAC,EAAK,IAAGD,CAAK;AACpE;"}
|