@manyducks.co/dolla 2.0.0-alpha.54 → 2.0.0-alpha.56
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 +81 -42
- package/dist/core/env.d.ts +2 -8
- package/dist/core/index.d.ts +7 -9
- package/dist/core/logger.d.ts +3 -3
- package/dist/core/markup.d.ts +44 -43
- package/dist/core/mount.d.ts +11 -6
- package/dist/core/nodes/dom.d.ts +6 -6
- package/dist/core/nodes/dynamic.d.ts +15 -17
- package/dist/core/nodes/html.d.ts +11 -23
- package/dist/core/nodes/portal.d.ts +9 -13
- package/dist/core/nodes/repeat.d.ts +13 -18
- package/dist/core/nodes/view.d.ts +14 -95
- package/dist/core/ref.d.ts +2 -6
- package/dist/core/symbols.d.ts +1 -3
- package/dist/core/views/default-crash-view.d.ts +1 -1
- package/dist/core/views/fragment.d.ts +1 -2
- package/dist/fragment-BahD_BJA.js +7 -0
- package/dist/fragment-BahD_BJA.js.map +1 -0
- package/dist/http.js +1 -1
- package/dist/i18n.js +14 -14
- package/dist/i18n.js.map +1 -1
- package/dist/index.js +50 -64
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.d.ts +1 -1
- package/dist/jsx-dev-runtime.js +8 -8
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx-runtime.d.ts +2 -2
- package/dist/jsx-runtime.js +9 -9
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/{logger-CBfhf3fA.js → logger-sSxIw5od.js} +143 -142
- package/dist/logger-sSxIw5od.js.map +1 -0
- package/dist/markup-DS7yYBga.js +844 -0
- package/dist/markup-DS7yYBga.js.map +1 -0
- package/dist/router/index.d.ts +1 -1
- package/dist/router/router.d.ts +10 -7
- package/dist/router-D43DV_bv.js +489 -0
- package/dist/router-D43DV_bv.js.map +1 -0
- package/dist/router.js +1 -1
- package/dist/router.js.map +1 -1
- package/dist/{typeChecking-EAVNeFyB.js → typeChecking-BJ-ymQ2F.js} +7 -12
- package/dist/{typeChecking-EAVNeFyB.js.map → typeChecking-BJ-ymQ2F.js.map} +1 -1
- package/dist/types.d.ts +13 -14
- package/docs/mixins.md +1 -1
- package/docs/ref.md +93 -0
- package/notes/scratch.md +24 -0
- package/package.json +2 -2
- package/dist/core/mixin.d.ts +0 -62
- package/dist/core/nodes/fragment.d.ts +0 -19
- package/dist/core/nodes/outlet.d.ts +0 -20
- package/dist/core/store.d.ts +0 -57
- package/dist/core/views/passthrough.d.ts +0 -5
- package/dist/fragment-CmWsN-4Y.js +0 -8
- package/dist/fragment-CmWsN-4Y.js.map +0 -1
- package/dist/logger-CBfhf3fA.js.map +0 -1
- package/dist/router-BoJac1lD.js +0 -482
- package/dist/router-BoJac1lD.js.map +0 -1
- package/dist/view-BKpHFpWG.js +0 -1044
- package/dist/view-BKpHFpWG.js.map +0 -1
package/README.md
CHANGED
|
@@ -73,22 +73,11 @@ function Counter(props, ctx) {
|
|
|
73
73
|
$(() => $count() > 10),
|
|
74
74
|
<span>That's a lot of clicks!</span>,
|
|
75
75
|
)}
|
|
76
|
-
|
|
77
|
-
{/* ALT: Or slot a getter function into the DOM and have it conditionally render an element */}
|
|
78
|
-
{() => {
|
|
79
|
-
// DEV NOTE
|
|
80
|
-
// If we get Dynamic to track its rendered elements and diff them by keys
|
|
81
|
-
// then we may be able to do away with repeat and when and just do things like:
|
|
82
|
-
// <ul>{() => items().map(item => <li>{item}</li>)}</ul>
|
|
83
|
-
if ($count() > 10) {
|
|
84
|
-
return <span>That's a lot of clicks!</span>;
|
|
85
|
-
}
|
|
86
|
-
}}
|
|
87
76
|
</div>
|
|
88
77
|
);
|
|
89
78
|
}
|
|
90
79
|
|
|
91
|
-
mount(document.body
|
|
80
|
+
mount(Counter, document.body);
|
|
92
81
|
```
|
|
93
82
|
|
|
94
83
|
> TODO: Show small examples for routing and stores.
|
package/dist/core/context.d.ts
CHANGED
|
@@ -1,69 +1,108 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type
|
|
3
|
-
import type
|
|
4
|
-
|
|
1
|
+
import type { Store } from "../types";
|
|
2
|
+
import { type Logger, type LoggerOptions } from "./logger";
|
|
3
|
+
import { type EffectFn, type MaybeSignal, type UnsubscribeFn } from "./signals";
|
|
4
|
+
type StoreMap = Map<Store<any, any>, any>;
|
|
5
|
+
export declare enum LifecycleEvent {
|
|
6
|
+
WILL_MOUNT = 0,
|
|
7
|
+
DID_MOUNT = 1,
|
|
8
|
+
WILL_UNMOUNT = 2,
|
|
9
|
+
DID_UNMOUNT = 3
|
|
10
|
+
}
|
|
11
|
+
type LifecycleListener = () => void;
|
|
12
|
+
declare enum LifecycleState {
|
|
13
|
+
Unmounted = 0,
|
|
14
|
+
WillMount = 1,
|
|
15
|
+
WillMountByDependent = 2,
|
|
16
|
+
DidMount = 3,
|
|
17
|
+
DidMountByDependent = 4,
|
|
18
|
+
WillUnmount = 5,
|
|
19
|
+
WillUnmountByDependent = 6,
|
|
20
|
+
DidUnmount = 7
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Manages lifecycle events for a Context.
|
|
24
|
+
*/
|
|
25
|
+
declare class ContextLifecycle {
|
|
26
|
+
#private;
|
|
27
|
+
state: LifecycleState;
|
|
28
|
+
dependents: number;
|
|
29
|
+
on<E extends LifecycleEvent>(event: E, listener: LifecycleListener): void;
|
|
30
|
+
off<E extends LifecycleEvent>(event: E, listener: LifecycleListener): void;
|
|
31
|
+
notify<E extends LifecycleEvent>(event: E): void;
|
|
32
|
+
emit<E extends LifecycleEvent>(event: E, dependent?: boolean): void;
|
|
33
|
+
dispose(): void;
|
|
34
|
+
}
|
|
35
|
+
export interface ContextOptions {
|
|
36
|
+
logger?: LoggerOptions;
|
|
37
|
+
}
|
|
38
|
+
export interface LinkedContextOptions extends ContextOptions {
|
|
39
|
+
bindLifecycleToParent?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface Context extends Logger {
|
|
42
|
+
}
|
|
43
|
+
export declare class Context implements Logger {
|
|
44
|
+
#private;
|
|
45
|
+
_name: string;
|
|
46
|
+
_lifecycle: ContextLifecycle;
|
|
47
|
+
_parent?: Context;
|
|
48
|
+
_stores?: StoreMap;
|
|
49
|
+
_state?: Map<any, any>;
|
|
50
|
+
get isMounted(): boolean;
|
|
5
51
|
/**
|
|
6
|
-
*
|
|
52
|
+
* Returns a new Context with this one as its parent.
|
|
7
53
|
*/
|
|
54
|
+
static linked(parent: Context, name: MaybeSignal<string>, options?: LinkedContextOptions): Context;
|
|
55
|
+
static emit(event: LifecycleEvent, context: Context): void;
|
|
56
|
+
constructor(name: MaybeSignal<string>, options?: ContextOptions);
|
|
8
57
|
/**
|
|
9
|
-
*
|
|
58
|
+
* Returns the current name of this context.
|
|
10
59
|
*/
|
|
11
|
-
|
|
60
|
+
getName(): string;
|
|
12
61
|
/**
|
|
13
|
-
*
|
|
62
|
+
* Sets a new name for this context.
|
|
14
63
|
*/
|
|
15
|
-
|
|
64
|
+
setName(name: MaybeSignal<string>): void;
|
|
65
|
+
addStore<T>(store: Store<any, T>, options?: any): this;
|
|
66
|
+
getStore<T>(store: Store<any, T>): T;
|
|
16
67
|
/**
|
|
17
|
-
*
|
|
68
|
+
* Schedule a callback function to run just before this context is mounted.
|
|
18
69
|
*/
|
|
19
|
-
|
|
70
|
+
beforeMount(listener: LifecycleListener): () => void;
|
|
20
71
|
/**
|
|
21
|
-
*
|
|
72
|
+
* Schedule a callback function to run after this context is mounted.
|
|
22
73
|
*/
|
|
23
|
-
|
|
74
|
+
onMount(listener: LifecycleListener): () => void;
|
|
24
75
|
/**
|
|
25
|
-
*
|
|
76
|
+
* Schedule a callback function to run just before this context is unmounted.
|
|
26
77
|
*/
|
|
78
|
+
beforeUnmount(listener: LifecycleListener): () => void;
|
|
27
79
|
/**
|
|
28
|
-
*
|
|
80
|
+
* Schedule a callback function to run after this context is unmounted.
|
|
29
81
|
*/
|
|
82
|
+
onUnmount(listener: LifecycleListener): () => void;
|
|
83
|
+
effect(callback: EffectFn): UnsubscribeFn;
|
|
30
84
|
/**
|
|
31
|
-
*
|
|
85
|
+
* Gets the value stored at `key`, or returns the `defaultValue` if none is set.
|
|
32
86
|
*/
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
export interface ComponentContext {
|
|
87
|
+
getState<T>(key: any, defaultValue: T): T;
|
|
36
88
|
/**
|
|
37
|
-
*
|
|
89
|
+
* Gets the value stored at `key`, or throws an error if none is set.
|
|
38
90
|
*/
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* A context capable of providing stores.
|
|
43
|
-
*/
|
|
44
|
-
export interface StoreProviderContext {
|
|
91
|
+
getState<T>(key: any): T;
|
|
45
92
|
/**
|
|
46
|
-
*
|
|
93
|
+
* Returns a Map containing all state values available to this context.
|
|
47
94
|
*/
|
|
48
|
-
|
|
95
|
+
getState(): Map<any, any>;
|
|
49
96
|
/**
|
|
50
|
-
*
|
|
97
|
+
* Stores `value` at `key` in this context's state.
|
|
51
98
|
*/
|
|
52
|
-
|
|
99
|
+
setState<T>(key: any, value: T): void;
|
|
53
100
|
/**
|
|
54
|
-
*
|
|
101
|
+
* For each tuple in `entries`, stores `value` at `key` in this context's state.
|
|
55
102
|
*/
|
|
56
|
-
|
|
103
|
+
setState(entries: [key: any, value: any][]): void;
|
|
57
104
|
}
|
|
58
|
-
export
|
|
59
|
-
|
|
60
|
-
* Gets the closest instance of a store. Throws an error if the store isn't provided higher in the tree.
|
|
61
|
-
*/
|
|
62
|
-
get<Value>(store: StoreFunction<any, Value>): Value;
|
|
105
|
+
export declare function createContext(name: MaybeSignal<string>, options?: ContextOptions): Context;
|
|
106
|
+
export declare class StoreError extends Error {
|
|
63
107
|
}
|
|
64
|
-
type StoreMap = Map<any, any>;
|
|
65
|
-
export declare const globalStores: StoreMap;
|
|
66
|
-
export declare const rootElementContext: {
|
|
67
|
-
stores: StoreMap;
|
|
68
|
-
};
|
|
69
108
|
export {};
|
package/dist/core/env.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Gets the current environment value.
|
|
4
|
-
*/
|
|
5
|
-
export declare function getEnv(): Env;
|
|
6
|
-
/**
|
|
7
|
-
* Sets the environment value. Affects which log messages will print and how much debugging info is included in the DOM.
|
|
8
|
-
*/
|
|
1
|
+
import type { Env } from "../types";
|
|
2
|
+
export declare function getEnv(): string;
|
|
9
3
|
export declare function setEnv(value: Env): void;
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
export { $, effect, get, peek } from "./signals.js";
|
|
2
2
|
export type { MaybeSignal, Signal, Source } from "./signals.js";
|
|
3
|
+
export { createContext } from "./context.js";
|
|
4
|
+
export type { Context } from "./context.js";
|
|
5
|
+
export { m, portal, render, repeat, unless, when } from "./markup.js";
|
|
6
|
+
export type { MarkupNode } from "./markup.js";
|
|
7
|
+
export { type Mixin } from "./nodes/html.js";
|
|
3
8
|
export { ref, type Ref } from "./ref.js";
|
|
4
|
-
export {
|
|
9
|
+
export { mount, type UnmountFn } from "./mount.js";
|
|
5
10
|
export { deepEqual, shallowEqual, strictEqual } from "../utils.js";
|
|
6
|
-
export { Stores, type StoreContext, type StoreFunction } from "./store.js";
|
|
7
|
-
export { type Mixin, type MixinContext } from "./mixin.js";
|
|
8
|
-
export { markup, portal, repeat, unless, when, constructMarkup } from "./markup.js";
|
|
9
|
-
export type { Markup, MarkupElement } from "./markup.js";
|
|
10
11
|
export { getEnv, setEnv } from "./env.js";
|
|
11
|
-
export type { Env } from "./env.js";
|
|
12
12
|
export { createLogger, setLogFilter, setLogLevels } from "./logger.js";
|
|
13
13
|
export type { Logger, LoggerErrorContext, LoggerOptions, LogLevels } from "./logger.js";
|
|
14
|
-
export {
|
|
15
|
-
export type { ViewContext, ViewElement, ViewFunction } from "./nodes/view.js";
|
|
14
|
+
export type { View, Store, InputType, Renderable, Env } from "../types.js";
|
|
16
15
|
export type { CrashViewProps } from "./views/default-crash-view.js";
|
|
17
|
-
export type { InputType, Renderable } from "../types.js";
|
|
18
16
|
import type { IntrinsicElements as Elements } from "../types.js";
|
|
19
17
|
declare global {
|
|
20
18
|
namespace JSX {
|
package/dist/core/logger.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type MaybeSignal } from "./signals";
|
|
1
|
+
import type { Env } from "../types.js";
|
|
2
|
+
import { type MaybeSignal } from "./signals.js";
|
|
3
3
|
export interface LogLevels {
|
|
4
4
|
info: boolean | Env;
|
|
5
5
|
log: boolean | Env;
|
|
@@ -11,7 +11,7 @@ export interface Logger {
|
|
|
11
11
|
log(...args: any[]): void;
|
|
12
12
|
warn(...args: any[]): void;
|
|
13
13
|
error(...args: any[]): void;
|
|
14
|
-
crash(error: Error):
|
|
14
|
+
crash(error: Error): Error;
|
|
15
15
|
}
|
|
16
16
|
export interface LoggerOptions {
|
|
17
17
|
/**
|
package/dist/core/markup.d.ts
CHANGED
|
@@ -1,64 +1,68 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { Renderable, View } from "../types.js";
|
|
2
|
+
import { Context } from "./context.js";
|
|
3
|
+
import { KeyFn, RenderFn } from "./nodes/repeat.js";
|
|
4
4
|
import { type MaybeSignal, type Signal } from "./signals.js";
|
|
5
5
|
/**
|
|
6
6
|
* Markup is a set of element metadata that hasn't been constructed into a MarkupElement yet.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export declare class Markup<P extends Record<any, any> = Record<any, any>> {
|
|
9
9
|
/**
|
|
10
10
|
* In the case of a view, type will be the View function itself. It can also hold an identifier for special nodes like "$cond", "$repeat", etc.
|
|
11
11
|
* DOM nodes can be created by name, such as HTML elements like "div", "ul" or "span", SVG elements like ""
|
|
12
12
|
*/
|
|
13
|
-
type: string |
|
|
13
|
+
type: string | View<P>;
|
|
14
14
|
/**
|
|
15
|
-
* Data that will be passed to a new
|
|
15
|
+
* Data that will be passed to a new MarkupNode instance when it is constructed.
|
|
16
16
|
*/
|
|
17
|
-
props
|
|
17
|
+
props: P | undefined;
|
|
18
18
|
/**
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
|
-
children
|
|
21
|
+
children: Renderable[];
|
|
22
|
+
constructor(type: string | View<P>, props?: P, ...children: Renderable[]);
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
|
-
* A
|
|
25
|
+
* A mountable node that has been constructed from Markup metadata.
|
|
25
26
|
*/
|
|
26
|
-
export interface
|
|
27
|
-
|
|
27
|
+
export interface MarkupNode {
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
readonly root?: Node;
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
28
35
|
readonly isMounted: boolean;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
mount(parent: Node, after?: Node): void;
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
*/
|
|
43
|
+
unmount(parentIsUnmounting?: boolean): void;
|
|
29
44
|
}
|
|
30
|
-
export declare function
|
|
31
|
-
export declare function isMarkupElement(value: any): value is MarkupElement;
|
|
32
|
-
export declare function toMarkup(renderables: Renderable | Renderable[]): Markup[];
|
|
33
|
-
export declare function constructMarkup(markup: Markup | Markup[]): MarkupElement;
|
|
45
|
+
export declare function isMarkupNode(value: any): value is MarkupNode;
|
|
34
46
|
export declare enum MarkupType {
|
|
35
47
|
Text = "$text",
|
|
36
48
|
Repeat = "$repeat",
|
|
37
49
|
Dynamic = "$dynamic",
|
|
38
|
-
|
|
39
|
-
Fragment = "$fragment",
|
|
40
|
-
Node = "$node",
|
|
50
|
+
DOM = "$dom",
|
|
41
51
|
Portal = "$portal"
|
|
42
52
|
}
|
|
43
|
-
export interface
|
|
53
|
+
export interface MarkupProps {
|
|
44
54
|
[MarkupType.Text]: {
|
|
45
55
|
value: any;
|
|
46
56
|
};
|
|
47
57
|
[MarkupType.Repeat]: {
|
|
48
58
|
items: Signal<any[]>;
|
|
49
|
-
|
|
50
|
-
|
|
59
|
+
key: KeyFn<any>;
|
|
60
|
+
render: RenderFn<any>;
|
|
51
61
|
};
|
|
52
62
|
[MarkupType.Dynamic]: {
|
|
53
|
-
source: Signal<
|
|
63
|
+
source: Signal<any>;
|
|
54
64
|
};
|
|
55
|
-
[MarkupType.
|
|
56
|
-
view: Signal<View<{}> | undefined>;
|
|
57
|
-
};
|
|
58
|
-
[MarkupType.Fragment]: {
|
|
59
|
-
children: MaybeSignal<MarkupElement[]>;
|
|
60
|
-
};
|
|
61
|
-
[MarkupType.Node]: {
|
|
65
|
+
[MarkupType.DOM]: {
|
|
62
66
|
value: Node;
|
|
63
67
|
};
|
|
64
68
|
[MarkupType.Portal]: {
|
|
@@ -67,31 +71,28 @@ export interface MarkupAttributes {
|
|
|
67
71
|
};
|
|
68
72
|
[tag: string]: Record<string, any>;
|
|
69
73
|
}
|
|
70
|
-
export declare function
|
|
71
|
-
export declare function
|
|
74
|
+
export declare function m<T extends keyof MarkupProps>(type: T, props: MarkupProps[T], ...children: Renderable[]): Markup;
|
|
75
|
+
export declare function m<P extends {}>(type: View<P>, props?: P, ...children: Renderable[]): Markup;
|
|
76
|
+
export declare function m<P>(type: View<P>, props: P, ...children: any[]): Markup;
|
|
72
77
|
/**
|
|
73
|
-
*
|
|
78
|
+
* If `condition` is truthy, displays `thenContent`, otherwise `elseContent`.
|
|
74
79
|
*/
|
|
75
80
|
export declare function when(condition: MaybeSignal<any>, thenContent?: Renderable, elseContent?: Renderable): Markup;
|
|
76
81
|
/**
|
|
77
|
-
* Inverted `when`.
|
|
82
|
+
* Inverted `when`. If `condition` is falsy, displays `thenContent`, otherwise `elseContent`.
|
|
78
83
|
*/
|
|
79
84
|
export declare function unless(condition: MaybeSignal<any>, thenContent?: Renderable, elseContent?: Renderable): Markup;
|
|
80
85
|
/**
|
|
81
|
-
* Calls `
|
|
82
|
-
* The result of `
|
|
86
|
+
* Calls `render` for each item in `items`. Dynamically adds and removes views as items change.
|
|
87
|
+
* The result of `key` is used to compare items and decide if item was added, removed or updated.
|
|
83
88
|
*/
|
|
84
|
-
export declare function repeat<T>(items: MaybeSignal<T[]>,
|
|
89
|
+
export declare function repeat<T>(items: MaybeSignal<T[]>, key: KeyFn<T>, render: RenderFn<T>): Markup;
|
|
85
90
|
/**
|
|
86
91
|
* Renders `content` into a `parent` node anywhere in the page, rather than its usual position in the view.
|
|
87
92
|
*/
|
|
88
93
|
export declare function portal(parent: Node, content: Renderable): Markup;
|
|
94
|
+
export declare function render(content: Renderable, context?: Context): MarkupNode;
|
|
89
95
|
/**
|
|
90
|
-
*
|
|
91
|
-
*/
|
|
92
|
-
export declare function toMarkupElements(elementContext: ElementContext, markup: Markup | Markup[]): MarkupElement[];
|
|
93
|
-
/**
|
|
94
|
-
* Combines one or more MarkupElements into a single MarkupElement.
|
|
96
|
+
* Convert basically anything into a set of MarkupElements.
|
|
95
97
|
*/
|
|
96
|
-
export declare function
|
|
97
|
-
export declare function isRenderable(value: unknown): value is Renderable;
|
|
98
|
+
export declare function toMarkupNodes(context: Context, ...content: any[]): MarkupNode[];
|
package/dist/core/mount.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
import { Router } from "../router/router";
|
|
2
|
+
import type { View } from "../types";
|
|
3
|
+
import { Context } from "./context";
|
|
1
4
|
import { type LoggerErrorContext } from "./logger";
|
|
2
|
-
import { type ViewFunction } from "./nodes/view";
|
|
3
5
|
export type UnmountFn = () => Promise<void>;
|
|
4
6
|
export interface MountOptions {
|
|
5
|
-
crashView?:
|
|
7
|
+
crashView?: View<LoggerErrorContext>;
|
|
8
|
+
/**
|
|
9
|
+
* An existing Context to use as the root, otherwise a new one will be created.
|
|
10
|
+
* Use this to provide top-level stores and state to the whole app.
|
|
11
|
+
*/
|
|
12
|
+
context?: Context;
|
|
6
13
|
}
|
|
7
|
-
export declare function mount(
|
|
8
|
-
export declare function mount(
|
|
9
|
-
export declare function mount(parent: string, view: any, options?: MountOptions): Promise<UnmountFn>;
|
|
10
|
-
export declare function mount(parent: string, router: any, options?: MountOptions): Promise<UnmountFn>;
|
|
14
|
+
export declare function mount(view: View<{}>, domNode: Element, options?: MountOptions): Promise<UnmountFn>;
|
|
15
|
+
export declare function mount(router: Router, domNode: Element, options?: MountOptions): Promise<UnmountFn>;
|
package/dist/core/nodes/dom.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
1
|
+
import type { MarkupNode } from "../markup";
|
|
2
|
+
import { IS_MARKUP_NODE } from "../symbols";
|
|
3
3
|
/**
|
|
4
|
-
* Wraps any plain DOM node in a
|
|
4
|
+
* Wraps any plain DOM node in a MarkupNode interface.
|
|
5
5
|
*/
|
|
6
|
-
export declare class DOMNode implements
|
|
7
|
-
[
|
|
8
|
-
|
|
6
|
+
export declare class DOMNode implements MarkupNode {
|
|
7
|
+
[IS_MARKUP_NODE]: boolean;
|
|
8
|
+
root: Node;
|
|
9
9
|
get isMounted(): boolean;
|
|
10
10
|
constructor(node: Node);
|
|
11
11
|
mount(parent: Node, after?: Node): void;
|
|
@@ -1,30 +1,28 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type
|
|
3
|
-
import { type MarkupElement } from "../markup.js";
|
|
1
|
+
import type { Context } from "../context.js";
|
|
2
|
+
import { type MarkupNode } from "../markup.js";
|
|
4
3
|
import { Signal } from "../signals.js";
|
|
5
|
-
import {
|
|
6
|
-
interface DynamicOptions {
|
|
7
|
-
source: Signal<Renderable>;
|
|
8
|
-
elementContext: ElementContext;
|
|
9
|
-
}
|
|
4
|
+
import { IS_MARKUP_NODE } from "../symbols.js";
|
|
10
5
|
/**
|
|
11
6
|
* Displays dynamic children without a parent element.
|
|
12
7
|
* Renders a Reactive value via a render function.
|
|
13
8
|
*
|
|
14
9
|
* This is probably the most used element type aside from HTML.
|
|
15
10
|
*/
|
|
16
|
-
export declare class Dynamic implements
|
|
17
|
-
[
|
|
18
|
-
|
|
11
|
+
export declare class Dynamic implements MarkupNode {
|
|
12
|
+
[IS_MARKUP_NODE]: boolean;
|
|
13
|
+
root: Text;
|
|
19
14
|
private children;
|
|
20
|
-
private
|
|
21
|
-
private
|
|
15
|
+
private context;
|
|
16
|
+
private $slot;
|
|
22
17
|
private unsubscribe?;
|
|
23
18
|
get isMounted(): boolean;
|
|
24
|
-
constructor(
|
|
19
|
+
constructor(context: Context, $slot: Signal<any>);
|
|
25
20
|
mount(parent: Node, after?: Node): void;
|
|
26
21
|
unmount(parentIsUnmounting?: boolean): void;
|
|
27
|
-
cleanup
|
|
28
|
-
update
|
|
22
|
+
private cleanup;
|
|
23
|
+
private update;
|
|
24
|
+
/**
|
|
25
|
+
* Move marker node to end of children.
|
|
26
|
+
*/
|
|
27
|
+
private moveMarker;
|
|
29
28
|
}
|
|
30
|
-
export {};
|
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type
|
|
3
|
-
import {
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
export declare class HTML implements MarkupElement {
|
|
11
|
-
[IS_MARKUP_ELEMENT]: boolean;
|
|
12
|
-
domNode: SVGElement | HTMLElement;
|
|
13
|
-
elementContext: ElementContext;
|
|
1
|
+
import { Context } from "../context.js";
|
|
2
|
+
import { type MarkupNode } from "../markup.js";
|
|
3
|
+
import { IS_MARKUP_NODE } from "../symbols.js";
|
|
4
|
+
export type Mixin<E extends Element = Element> = (element: E, context: Context) => void;
|
|
5
|
+
export declare class HTML implements MarkupNode {
|
|
6
|
+
[IS_MARKUP_NODE]: boolean;
|
|
7
|
+
root: HTMLElement | SVGElement;
|
|
8
|
+
private context;
|
|
14
9
|
private props;
|
|
15
|
-
private
|
|
16
|
-
private
|
|
10
|
+
private children?;
|
|
11
|
+
private childNodes;
|
|
17
12
|
private unsubscribers;
|
|
18
|
-
private mixin?;
|
|
19
|
-
private logger;
|
|
20
13
|
private ref?;
|
|
21
14
|
private canClickAway;
|
|
22
15
|
get isMounted(): boolean;
|
|
23
|
-
constructor(
|
|
16
|
+
constructor(context: Context, tag: string, props: Record<string, any>, children?: any[]);
|
|
24
17
|
mount(parent: Node, after?: Node): void;
|
|
25
18
|
unmount(parentIsUnmounting?: boolean): void;
|
|
26
19
|
private attachProp;
|
|
@@ -28,8 +21,3 @@ export declare class HTML implements MarkupElement {
|
|
|
28
21
|
private applyStyles;
|
|
29
22
|
private applyClasses;
|
|
30
23
|
}
|
|
31
|
-
/**
|
|
32
|
-
* Converts a camelCase string to kebab-case.
|
|
33
|
-
*/
|
|
34
|
-
export declare function camelToKebab(value: string): string;
|
|
35
|
-
export {};
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import type { Renderable } from "../../types.js";
|
|
2
|
-
import
|
|
3
|
-
import { type
|
|
4
|
-
import {
|
|
5
|
-
interface PortalConfig {
|
|
6
|
-
content: Renderable;
|
|
7
|
-
parent: Node;
|
|
8
|
-
elementContext: ElementContext;
|
|
9
|
-
}
|
|
2
|
+
import { Context } from "../context.js";
|
|
3
|
+
import { type MarkupNode } from "../markup.js";
|
|
4
|
+
import { IS_MARKUP_NODE } from "../symbols.js";
|
|
10
5
|
/**
|
|
11
6
|
* Renders content into a specified parent node.
|
|
12
7
|
*/
|
|
13
|
-
export declare class Portal implements
|
|
14
|
-
[
|
|
15
|
-
private
|
|
8
|
+
export declare class Portal implements MarkupNode {
|
|
9
|
+
[IS_MARKUP_NODE]: boolean;
|
|
10
|
+
private context;
|
|
11
|
+
private content;
|
|
12
|
+
private parent;
|
|
16
13
|
private element?;
|
|
17
14
|
get isMounted(): boolean;
|
|
18
|
-
constructor(
|
|
15
|
+
constructor(context: Context, content: Renderable, parent: Node);
|
|
19
16
|
mount(_parent: Node, _after?: Node): void;
|
|
20
17
|
unmount(parentIsUnmounting?: boolean): void;
|
|
21
18
|
}
|
|
22
|
-
export {};
|
|
@@ -1,28 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Renderable } from "../../types.js";
|
|
2
|
+
import type { Context } from "../context.js";
|
|
3
|
+
import type { MarkupNode } from "../markup.js";
|
|
3
4
|
import { type Signal } from "../signals.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
export declare class Repeat<T> implements MarkupElement {
|
|
13
|
-
[IS_MARKUP_ELEMENT]: boolean;
|
|
14
|
-
domNode: Text;
|
|
5
|
+
import { IS_MARKUP_NODE } from "../symbols.js";
|
|
6
|
+
export type KeyFn<T> = (item: T, index: number) => string | number | symbol;
|
|
7
|
+
export type RenderFn<T> = (item: Signal<T>, index: Signal<number>, ctx: Context) => Renderable;
|
|
8
|
+
export declare class Repeat<T> implements MarkupNode {
|
|
9
|
+
[IS_MARKUP_NODE]: boolean;
|
|
10
|
+
root: Text;
|
|
11
|
+
private context;
|
|
15
12
|
private items;
|
|
13
|
+
private key;
|
|
14
|
+
private render;
|
|
16
15
|
private unsubscribe;
|
|
17
16
|
private connectedItems;
|
|
18
|
-
private elementContext;
|
|
19
|
-
private renderFn;
|
|
20
|
-
private keyFn;
|
|
21
17
|
get isMounted(): boolean;
|
|
22
|
-
constructor(
|
|
18
|
+
constructor(context: Context, items: Signal<T[]>, key: KeyFn<T>, render: RenderFn<T>);
|
|
23
19
|
mount(parent: Node, after?: Node): void;
|
|
24
20
|
unmount(parentIsUnmounting?: boolean): void;
|
|
25
21
|
private _cleanup;
|
|
26
22
|
private _update;
|
|
27
23
|
}
|
|
28
|
-
export {};
|