@manyducks.co/dolla 2.0.0-alpha.4 → 2.0.0-alpha.41
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 -964
- package/dist/core/context.d.ts +53 -0
- package/dist/{modules → core}/dolla.d.ts +43 -26
- package/dist/core/markup.d.ts +90 -0
- package/dist/core/nodes/dom.d.ts +13 -0
- package/dist/core/nodes/dynamic.d.ts +28 -0
- package/dist/core/nodes/html.d.ts +33 -0
- package/dist/core/nodes/list.d.ts +28 -0
- package/dist/core/nodes/outlet.d.ts +19 -0
- package/dist/core/nodes/portal.d.ts +22 -0
- package/dist/core/nodes/view.d.ts +78 -0
- package/dist/core/ref.d.ts +28 -0
- package/dist/core/signals.d.ts +127 -0
- package/dist/core/store.d.ts +52 -0
- package/dist/core/symbols.d.ts +4 -0
- package/dist/{views → core/views}/passthrough.d.ts +1 -1
- package/dist/{modules/http.d.ts → http/index.d.ts} +3 -5
- package/dist/index.d.ts +14 -11
- package/dist/index.js +986 -1216
- 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/markup-DkQI155j.js +1447 -0
- package/dist/markup-DkQI155j.js.map +1 -0
- package/dist/{modules/router.d.ts → router/index.d.ts} +37 -48
- package/dist/router/router.utils.test.d.ts +1 -0
- package/dist/translate/index.d.ts +133 -0
- package/dist/typeChecking.d.ts +2 -98
- package/dist/typeChecking.test.d.ts +1 -0
- package/dist/types.d.ts +12 -14
- package/dist/utils.d.ts +18 -3
- package/docs/http.md +29 -0
- package/docs/i18n.md +38 -0
- package/docs/index.md +10 -0
- package/docs/router.md +80 -0
- package/docs/setup.md +31 -0
- package/docs/signals.md +149 -0
- package/docs/state.md +141 -0
- package/docs/stores.md +62 -0
- package/docs/views.md +208 -0
- package/index.d.ts +2 -2
- package/notes/TODO.md +6 -0
- package/notes/atomic.md +209 -0
- package/notes/context-routes.md +56 -0
- package/notes/elimination.md +33 -0
- package/notes/readme-scratch.md +260 -0
- package/notes/route-middleware.md +42 -0
- package/notes/scratch.md +330 -7
- package/notes/stores.md +53 -0
- package/package.json +14 -10
- package/vite.config.js +5 -10
- package/build.js +0 -34
- 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 -31
- 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-BSLd3foL.js +0 -1245
- package/dist/passthrough-BSLd3foL.js.map +0 -1
- package/dist/signals.d.ts +0 -101
- package/dist/view.d.ts +0 -50
- package/tests/signals.test.js +0 -135
- /package/dist/{routing.test.d.ts → core/signals.test.d.ts} +0 -0
- /package/dist/{views → core/views}/default-crash-view.d.ts +0 -0
- /package/dist/{routing.d.ts → router/router.utils.d.ts} +0 -0
package/notes/stores.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Stores
|
|
2
|
+
|
|
3
|
+
Ideas for updating the API.
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
function CounterStore(initialCount = 0, ctx) {
|
|
7
|
+
const [$value, setValue] = createState(initialCount);
|
|
8
|
+
|
|
9
|
+
ctx.on("counter:increment", (e) => {
|
|
10
|
+
e.stop(); // Stop this event from bubbling up to counters at higher levels (if any).
|
|
11
|
+
setValue((current) => current + 1);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
ctx.on("counter:decrement", (e) => {
|
|
15
|
+
e.stop();
|
|
16
|
+
setValue((current) => current - 1);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// Events can be emitted from this context in a store.
|
|
20
|
+
ctx.emit("otherEvent");
|
|
21
|
+
|
|
22
|
+
ctx.onMount(() => {
|
|
23
|
+
// Setup
|
|
24
|
+
// This is called based on the context the store is attached to.
|
|
25
|
+
// If Dolla, it's called when the app is mounted. If ViewContext, it's called when the view is mounted.
|
|
26
|
+
});
|
|
27
|
+
ctx.onUnmount(() => {
|
|
28
|
+
// Cleanup
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Context variables will be accessible on the same context (e.g. the view this is attached to and below)
|
|
32
|
+
ctx.get("context variable");
|
|
33
|
+
ctx.set("context variable", "context variable value");
|
|
34
|
+
|
|
35
|
+
// Stores don't have to return anything, but if they do it becomes accessible with `ctx.use(Store)`.
|
|
36
|
+
return $value;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Attach it to the app.
|
|
40
|
+
Dolla.provide(CounterStore, 0);
|
|
41
|
+
|
|
42
|
+
function ExampleView(props, ctx) {
|
|
43
|
+
// ctx.use lets you access the return value
|
|
44
|
+
// but the events will still be received and handled regardless
|
|
45
|
+
const $count = ctx.use(Counter);
|
|
46
|
+
|
|
47
|
+
return html`
|
|
48
|
+
<button onclick=${() => this.emit("counter:decrement")}>-1</button>
|
|
49
|
+
<span>${$count}</span>
|
|
50
|
+
<button onclick=${() => this.emit("counter:increment")}>+1</button>
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
```
|
package/package.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manyducks.co/dolla",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.41",
|
|
4
4
|
"description": "Front-end components, routing and state management.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"sideEffects": false,
|
|
9
|
-
"repository":
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/manyducksco/dolla.git"
|
|
12
|
+
},
|
|
10
13
|
"scripts": {
|
|
11
|
-
"test": "
|
|
14
|
+
"test": "vitest",
|
|
12
15
|
"build:esbuild": "tsc && node build.js",
|
|
13
16
|
"build": "vite build && tsc",
|
|
14
17
|
"start": "tsc --watch",
|
|
@@ -36,16 +39,17 @@
|
|
|
36
39
|
"types": "./jsx-dev-runtime.d.ts"
|
|
37
40
|
}
|
|
38
41
|
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"alien-signals": "^1.0.3",
|
|
44
|
+
"htm": "^3.1.1"
|
|
45
|
+
},
|
|
39
46
|
"devDependencies": {
|
|
40
|
-
"@types/node": "^22.
|
|
47
|
+
"@types/node": "^22.12.0",
|
|
41
48
|
"csstype": "^3.1.3",
|
|
42
|
-
"esbuild": "^0.24.2",
|
|
43
|
-
"history": "^5.3.0",
|
|
44
|
-
"htm": "^3.1.1",
|
|
45
|
-
"nanoid": "^5.0.9",
|
|
46
49
|
"prettier": "^3.4.2",
|
|
47
|
-
"simple-color-hash": "^1.0.2",
|
|
48
50
|
"typescript": "^5.7.3",
|
|
49
|
-
"vite": "^6.0.
|
|
51
|
+
"vite": "^6.0.11",
|
|
52
|
+
"vite-plugin-externalize-deps": "^0.9.0",
|
|
53
|
+
"vitest": "^3.0.5"
|
|
50
54
|
}
|
|
51
55
|
}
|
package/vite.config.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { resolve } from "node:path";
|
|
2
2
|
import { defineConfig } from "vite";
|
|
3
|
+
// import { externalizeDeps } from "vite-plugin-externalize-deps";
|
|
3
4
|
|
|
4
5
|
export default defineConfig({
|
|
5
6
|
build: {
|
|
6
|
-
// minify: "terser",
|
|
7
|
-
// minify: false,
|
|
8
7
|
sourcemap: true,
|
|
8
|
+
minify: true,
|
|
9
|
+
// target: "esnext",
|
|
9
10
|
|
|
10
11
|
lib: {
|
|
11
12
|
entry: {
|
|
@@ -16,13 +17,7 @@ export default defineConfig({
|
|
|
16
17
|
name: "Dolla",
|
|
17
18
|
formats: ["es"],
|
|
18
19
|
},
|
|
19
|
-
// rollupOptions: {
|
|
20
|
-
// external: ["vue"],
|
|
21
|
-
// output: {
|
|
22
|
-
// globals: {
|
|
23
|
-
// vue: "Vue",
|
|
24
|
-
// },
|
|
25
|
-
// },
|
|
26
|
-
// },
|
|
27
20
|
},
|
|
21
|
+
|
|
22
|
+
// plugins: [externalizeDeps()],
|
|
28
23
|
});
|
package/build.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import esbuild from "esbuild";
|
|
3
|
-
|
|
4
|
-
esbuild
|
|
5
|
-
.build({
|
|
6
|
-
entryPoints: ["src/index.ts"],
|
|
7
|
-
bundle: true,
|
|
8
|
-
metafile: true,
|
|
9
|
-
sourcemap: true,
|
|
10
|
-
// minify: process.env.NODE_ENV === "production",
|
|
11
|
-
outdir: "dist",
|
|
12
|
-
format: "esm",
|
|
13
|
-
})
|
|
14
|
-
.then((result) => {
|
|
15
|
-
fs.writeFileSync("esbuild-meta.json", JSON.stringify(result.metafile));
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
esbuild.build({
|
|
19
|
-
entryPoints: ["src/jsx-runtime.js"],
|
|
20
|
-
bundle: false,
|
|
21
|
-
minify: false,
|
|
22
|
-
sourcemap: true,
|
|
23
|
-
outdir: "dist",
|
|
24
|
-
format: "esm",
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
esbuild.build({
|
|
28
|
-
entryPoints: ["src/jsx-dev-runtime.js"],
|
|
29
|
-
bundle: false,
|
|
30
|
-
minify: false,
|
|
31
|
-
sourcemap: true,
|
|
32
|
-
outdir: "dist",
|
|
33
|
-
format: "esm",
|
|
34
|
-
});
|
package/dist/markup.d.ts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import type { Dolla } from "./modules/dolla.js";
|
|
2
|
-
import { MaybeSignal, type Signal } from "./signals.js";
|
|
3
|
-
import type { Renderable, Stringable } from "./types.js";
|
|
4
|
-
import { type ViewFunction, type ViewContext, type ViewResult } from "./view.js";
|
|
5
|
-
export interface ElementContext {
|
|
6
|
-
/**
|
|
7
|
-
* The root Dolla instance this element belongs to.
|
|
8
|
-
*/
|
|
9
|
-
root: Dolla;
|
|
10
|
-
/**
|
|
11
|
-
* Whether to create DOM nodes in the SVG namespace. An `<svg>` element will set this to true and pass it down to children.
|
|
12
|
-
*/
|
|
13
|
-
isSVG?: boolean;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Markup is a set of element metadata that hasn't been constructed into a MarkupNode yet.
|
|
17
|
-
*/
|
|
18
|
-
export interface Markup {
|
|
19
|
-
type: string | ViewFunction<any>;
|
|
20
|
-
props?: Record<string, any>;
|
|
21
|
-
children?: Markup[];
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* A DOM node that has been constructed from a Markup object.
|
|
25
|
-
*/
|
|
26
|
-
export interface MarkupNode {
|
|
27
|
-
readonly node?: Node;
|
|
28
|
-
readonly isMounted: boolean;
|
|
29
|
-
mount(parent: Node, after?: Node): void;
|
|
30
|
-
unmount(): void;
|
|
31
|
-
}
|
|
32
|
-
export declare function isMarkup(value: unknown): value is Markup;
|
|
33
|
-
export declare function isNode(value: unknown): value is MarkupNode;
|
|
34
|
-
export declare function toMarkup(renderables: Renderable | Renderable[]): Markup[];
|
|
35
|
-
export interface MarkupAttributes {
|
|
36
|
-
$text: {
|
|
37
|
-
value: MaybeSignal<Stringable>;
|
|
38
|
-
};
|
|
39
|
-
$cond: {
|
|
40
|
-
$predicate: Signal<any>;
|
|
41
|
-
thenContent?: Renderable;
|
|
42
|
-
elseContent?: Renderable;
|
|
43
|
-
};
|
|
44
|
-
$repeat: {
|
|
45
|
-
$items: Signal<any[]>;
|
|
46
|
-
keyFn: (value: any, index: number) => string | number | symbol;
|
|
47
|
-
renderFn: ($item: Signal<any>, $index: Signal<number>, c: ViewContext) => ViewResult;
|
|
48
|
-
};
|
|
49
|
-
$observer: {
|
|
50
|
-
signals: Signal<any>[];
|
|
51
|
-
renderFn: (...items: any) => Renderable;
|
|
52
|
-
};
|
|
53
|
-
$outlet: {
|
|
54
|
-
$children: Signal<MarkupNode[]>;
|
|
55
|
-
};
|
|
56
|
-
$node: {
|
|
57
|
-
value: Node;
|
|
58
|
-
};
|
|
59
|
-
$portal: {
|
|
60
|
-
content: Renderable;
|
|
61
|
-
parent: Node;
|
|
62
|
-
};
|
|
63
|
-
[tag: string]: Record<string, any>;
|
|
64
|
-
}
|
|
65
|
-
export declare function createMarkup<T extends keyof MarkupAttributes>(type: T, attributes: MarkupAttributes[T], ...children: Renderable[]): Markup;
|
|
66
|
-
export declare function createMarkup<I>(type: ViewFunction<I>, attributes?: I, ...children: Renderable[]): Markup;
|
|
67
|
-
/**
|
|
68
|
-
* Generate markup with HTML in a tagged template literal.
|
|
69
|
-
*/
|
|
70
|
-
export declare const html: (strings: TemplateStringsArray, ...values: any[]) => Markup | Markup[];
|
|
71
|
-
/**
|
|
72
|
-
* Displays content conditionally. When `predicate` holds a truthy value, `thenContent` is displayed; when `predicate` holds a falsy value, `elseContent` is displayed.
|
|
73
|
-
*/
|
|
74
|
-
export declare function cond(predicate: MaybeSignal<any>, thenContent?: Renderable, elseContent?: Renderable): Markup;
|
|
75
|
-
/**
|
|
76
|
-
* Calls `renderFn` for each item in `items`. Dynamically adds and removes views as items change.
|
|
77
|
-
* The result of `keyFn` is used to compare items and decide if item was added, removed or updated.
|
|
78
|
-
*/
|
|
79
|
-
export declare function repeat<T>(items: MaybeSignal<T[]>, keyFn: (value: T, index: number) => string | number | symbol, renderFn: ($value: Signal<T>, $index: Signal<number>, ctx: ViewContext) => ViewResult): Markup;
|
|
80
|
-
/**
|
|
81
|
-
* Render `content` into a `parent` node anywhere in the page, rather than at its position in the view.
|
|
82
|
-
*/
|
|
83
|
-
export declare function portal(parent: Node, content: Renderable): Markup;
|
|
84
|
-
/**
|
|
85
|
-
* A special kind of signal exclusively for storing references to DOM nodes.
|
|
86
|
-
*/
|
|
87
|
-
export declare function createRef<T extends Node>(): Ref<T>;
|
|
88
|
-
export declare function isRef<T extends Node>(value: any): value is Ref<T>;
|
|
89
|
-
export interface Ref<T extends Node> extends Signal<T | undefined> {
|
|
90
|
-
node: T | undefined;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Construct Markup metadata into a set of MarkupNodes.
|
|
94
|
-
*/
|
|
95
|
-
export declare function constructMarkup(elementContext: ElementContext, markup: Markup | Markup[]): MarkupNode[];
|
|
96
|
-
/**
|
|
97
|
-
* Combines one or more MarkupNodes into a single MarkupNode.
|
|
98
|
-
*/
|
|
99
|
-
export declare function mergeNodes(nodes: MarkupNode[]): MarkupNode;
|
|
100
|
-
export declare function isRenderable(value: unknown): value is Renderable;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { type Signal } from "../signals.js";
|
|
2
|
-
import type { Stringable } from "../types.js";
|
|
3
|
-
import type { Dolla } from "./dolla.js";
|
|
4
|
-
/**
|
|
5
|
-
* An object where values are either a translated string or another nested Translation object.
|
|
6
|
-
*/
|
|
7
|
-
type LocalizedStrings = Record<string, string | Record<string, string | Record<string, string | Record<string, string>>>>;
|
|
8
|
-
export interface LanguageConfig {
|
|
9
|
-
name: string;
|
|
10
|
-
/**
|
|
11
|
-
* Path to a JSON file with translated strings for this language.
|
|
12
|
-
*/
|
|
13
|
-
path?: string;
|
|
14
|
-
/**
|
|
15
|
-
* A callback function that returns a Promise that resolves to the translation object for this language.
|
|
16
|
-
*/
|
|
17
|
-
fetch?: () => Promise<LocalizedStrings>;
|
|
18
|
-
}
|
|
19
|
-
export type LanguageSetupOptions = {
|
|
20
|
-
/**
|
|
21
|
-
* Default language to load on startup
|
|
22
|
-
*/
|
|
23
|
-
initialLanguage?: string | null;
|
|
24
|
-
languages: LanguageConfig[];
|
|
25
|
-
};
|
|
26
|
-
export declare class Language {
|
|
27
|
-
#private;
|
|
28
|
-
$current: Signal<string | undefined>;
|
|
29
|
-
constructor(dolla: Dolla);
|
|
30
|
-
get supportedLanguages(): string[];
|
|
31
|
-
setup(options: LanguageSetupOptions): void;
|
|
32
|
-
setLanguage(name: string): Promise<void>;
|
|
33
|
-
/**
|
|
34
|
-
* Returns a Signal containing the value at `key`.
|
|
35
|
-
|
|
36
|
-
* @param key - Key to the translated value.
|
|
37
|
-
* @param values - A map of {{placeholder}} names and the values to replace them with.
|
|
38
|
-
*/
|
|
39
|
-
t(key: string, values?: Record<string, Stringable | Signal<Stringable>>): Signal<string>;
|
|
40
|
-
}
|
|
41
|
-
export {};
|
package/dist/modules/render.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Dolla } from "./dolla.js";
|
|
2
|
-
export declare class Render {
|
|
3
|
-
#private;
|
|
4
|
-
constructor(dolla: Dolla);
|
|
5
|
-
/**
|
|
6
|
-
* Queues a callback to run in the next render batch.
|
|
7
|
-
* Running your DOM mutations in update callbacks reduces layout thrashing.
|
|
8
|
-
* Returns a Promise that resolves once the callback has run.
|
|
9
|
-
*/
|
|
10
|
-
update(callback: () => void, key?: string): Promise<void>;
|
|
11
|
-
/**
|
|
12
|
-
* Queues a callback that reads DOM information to run after the next render batch,
|
|
13
|
-
* ensuring all writes have been performed before reading.
|
|
14
|
-
* Returns a Promise that resolves once the callback has run.
|
|
15
|
-
*/
|
|
16
|
-
read(callback: () => void): Promise<void>;
|
|
17
|
-
}
|
package/dist/nodes/cond.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { type MarkupNode, type ElementContext, type Markup } from "../markup.js";
|
|
2
|
-
import { type Signal, type StopFunction } from "../signals.js";
|
|
3
|
-
import { type Renderable } from "../types.js";
|
|
4
|
-
export interface ConditionalConfig {
|
|
5
|
-
$predicate: Signal<any>;
|
|
6
|
-
thenContent?: Renderable;
|
|
7
|
-
elseContent?: Renderable;
|
|
8
|
-
elementContext: ElementContext;
|
|
9
|
-
}
|
|
10
|
-
export declare class Conditional implements MarkupNode {
|
|
11
|
-
node: Node;
|
|
12
|
-
endNode: Node;
|
|
13
|
-
$predicate: Signal<any>;
|
|
14
|
-
stopCallback?: StopFunction;
|
|
15
|
-
thenContent?: Markup[];
|
|
16
|
-
elseContent?: Markup[];
|
|
17
|
-
connectedContent: MarkupNode[];
|
|
18
|
-
elementContext: ElementContext;
|
|
19
|
-
initialUpdateHappened: boolean;
|
|
20
|
-
previousValue?: any;
|
|
21
|
-
constructor(config: ConditionalConfig);
|
|
22
|
-
get isMounted(): boolean;
|
|
23
|
-
mount(parent: Node, after?: Node | undefined): void;
|
|
24
|
-
unmount(): void;
|
|
25
|
-
update(value: any): void;
|
|
26
|
-
}
|
package/dist/nodes/html.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { type MarkupNode, type ElementContext, type Markup, type Ref } from "../markup.js";
|
|
2
|
-
import { type StopFunction } from "../signals.js";
|
|
3
|
-
type HTMLOptions = {
|
|
4
|
-
elementContext: ElementContext;
|
|
5
|
-
tag: string;
|
|
6
|
-
props: Record<string, any>;
|
|
7
|
-
children?: Markup[];
|
|
8
|
-
};
|
|
9
|
-
export declare class HTML implements MarkupNode {
|
|
10
|
-
node: HTMLElement | SVGElement;
|
|
11
|
-
props: Record<string, any>;
|
|
12
|
-
children: MarkupNode[];
|
|
13
|
-
stopCallbacks: StopFunction[];
|
|
14
|
-
elementContext: ElementContext;
|
|
15
|
-
uniqueId: string;
|
|
16
|
-
ref?: Ref<any>;
|
|
17
|
-
canClickAway: boolean;
|
|
18
|
-
get isMounted(): boolean;
|
|
19
|
-
constructor({ tag, props, children, elementContext }: HTMLOptions);
|
|
20
|
-
mount(parent: Node, after?: Node): void;
|
|
21
|
-
unmount(): void;
|
|
22
|
-
getUpdateKey(type: string, value: string | number): string;
|
|
23
|
-
applyProps(element: HTMLElement | SVGElement, props: Record<string, unknown>): void;
|
|
24
|
-
applyStyles(element: HTMLElement | SVGElement, styles: unknown, stopCallbacks: StopFunction[]): () => void;
|
|
25
|
-
applyClasses(element: HTMLElement | SVGElement, classes: unknown, stopCallbacks: StopFunction[]): () => void;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Converts a camelCase string to kebab-case.
|
|
29
|
-
*/
|
|
30
|
-
export declare function camelToKebab(value: string): string;
|
|
31
|
-
export {};
|
package/dist/nodes/observer.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { type MarkupNode, type ElementContext } from "../markup.js";
|
|
2
|
-
import { type Signal } from "../signals.js";
|
|
3
|
-
import type { Renderable } from "../types.js";
|
|
4
|
-
interface ObserverOptions {
|
|
5
|
-
elementContext: ElementContext;
|
|
6
|
-
signals: Signal<any>[];
|
|
7
|
-
renderFn: (...values: any) => Renderable;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Displays dynamic children without a parent element.
|
|
11
|
-
*/
|
|
12
|
-
export declare class Observer implements MarkupNode {
|
|
13
|
-
node: Node;
|
|
14
|
-
endNode: Node;
|
|
15
|
-
connectedViews: MarkupNode[];
|
|
16
|
-
renderFn: (...values: any) => Renderable;
|
|
17
|
-
elementContext: ElementContext;
|
|
18
|
-
observerControls: {
|
|
19
|
-
start: () => void;
|
|
20
|
-
stop: () => void;
|
|
21
|
-
};
|
|
22
|
-
get isMounted(): boolean;
|
|
23
|
-
constructor({ signals, renderFn, elementContext }: ObserverOptions);
|
|
24
|
-
mount(parent: Node, after?: Node): void;
|
|
25
|
-
unmount(): void;
|
|
26
|
-
cleanup(): void;
|
|
27
|
-
update(...children: Renderable[]): void;
|
|
28
|
-
}
|
|
29
|
-
export {};
|
package/dist/nodes/outlet.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type MarkupNode, type ElementContext } from "../markup.js";
|
|
2
|
-
import { type Signal, type StopFunction } from "../signals.js";
|
|
3
|
-
export interface OutletConfig {
|
|
4
|
-
$children: Signal<MarkupNode[]>;
|
|
5
|
-
elementContext: ElementContext;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Manages an array of DOMHandles.
|
|
9
|
-
*/
|
|
10
|
-
export declare class Outlet implements MarkupNode {
|
|
11
|
-
node: Node;
|
|
12
|
-
endNode: Node;
|
|
13
|
-
$children: Signal<MarkupNode[]>;
|
|
14
|
-
stopCallback?: StopFunction;
|
|
15
|
-
connectedChildren: MarkupNode[];
|
|
16
|
-
elementContext: ElementContext;
|
|
17
|
-
constructor(config: OutletConfig);
|
|
18
|
-
get isMounted(): boolean;
|
|
19
|
-
mount(parent: Node, after?: Node | undefined): void;
|
|
20
|
-
unmount(): void;
|
|
21
|
-
update(newChildren: MarkupNode[]): void;
|
|
22
|
-
}
|
package/dist/nodes/portal.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { type MarkupNode, type ElementContext } from "../markup.js";
|
|
2
|
-
import { type Renderable } from "../types.js";
|
|
3
|
-
interface PortalConfig {
|
|
4
|
-
content: Renderable;
|
|
5
|
-
parent: Node;
|
|
6
|
-
elementContext: ElementContext;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Renders content into a specified parent node.
|
|
10
|
-
*/
|
|
11
|
-
export declare class Portal implements MarkupNode {
|
|
12
|
-
config: PortalConfig;
|
|
13
|
-
handle?: MarkupNode;
|
|
14
|
-
get isMounted(): boolean;
|
|
15
|
-
constructor(config: PortalConfig);
|
|
16
|
-
mount(_parent: Node, _after?: Node): void;
|
|
17
|
-
unmount(): void;
|
|
18
|
-
}
|
|
19
|
-
export {};
|
package/dist/nodes/repeat.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { type MarkupNode, type ElementContext } from "../markup.js";
|
|
2
|
-
import { type Signal, type SignalSetter, type StopFunction } from "../signals.js";
|
|
3
|
-
import { type ViewContext, type ViewResult } from "../view.js";
|
|
4
|
-
interface RepeatOptions<T> {
|
|
5
|
-
elementContext: ElementContext;
|
|
6
|
-
$items: Signal<T[]>;
|
|
7
|
-
keyFn: (value: T, index: number) => string | number | symbol;
|
|
8
|
-
renderFn: ($value: Signal<T>, $index: Signal<number>, ctx: ViewContext) => ViewResult;
|
|
9
|
-
}
|
|
10
|
-
type ConnectedItem<T> = {
|
|
11
|
-
key: any;
|
|
12
|
-
$value: Signal<T>;
|
|
13
|
-
setValue: SignalSetter<T>;
|
|
14
|
-
$index: Signal<number>;
|
|
15
|
-
setIndex: SignalSetter<number>;
|
|
16
|
-
handle: MarkupNode;
|
|
17
|
-
};
|
|
18
|
-
export declare class Repeat<T> implements MarkupNode {
|
|
19
|
-
node: Node;
|
|
20
|
-
endNode: Node;
|
|
21
|
-
$items: Signal<T[]>;
|
|
22
|
-
stopCallback?: StopFunction;
|
|
23
|
-
connectedItems: ConnectedItem<T>[];
|
|
24
|
-
elementContext: ElementContext;
|
|
25
|
-
renderFn: ($value: Signal<T>, $index: Signal<number>, ctx: ViewContext) => ViewResult;
|
|
26
|
-
keyFn: (value: T, index: number) => string | number | symbol;
|
|
27
|
-
get isMounted(): boolean;
|
|
28
|
-
constructor({ elementContext, $items, renderFn, keyFn }: RepeatOptions<T>);
|
|
29
|
-
mount(parent: Node, after?: Node): void;
|
|
30
|
-
unmount(): void;
|
|
31
|
-
_cleanup(): void;
|
|
32
|
-
_update(value: T[]): void;
|
|
33
|
-
}
|
|
34
|
-
export {};
|
package/dist/nodes/text.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { type MarkupNode } from "../markup.js";
|
|
2
|
-
import { type MaybeSignal, type StopFunction } from "../signals.js";
|
|
3
|
-
interface Stringable {
|
|
4
|
-
toString(): string;
|
|
5
|
-
}
|
|
6
|
-
interface TextOptions {
|
|
7
|
-
value: MaybeSignal<Stringable>;
|
|
8
|
-
}
|
|
9
|
-
export declare class Text implements MarkupNode {
|
|
10
|
-
node: globalThis.Text;
|
|
11
|
-
value: MaybeSignal<Stringable>;
|
|
12
|
-
stopCallback?: StopFunction;
|
|
13
|
-
get isMounted(): boolean;
|
|
14
|
-
constructor({ value }: TextOptions);
|
|
15
|
-
mount(parent: Node, after?: Node | null): Promise<void>;
|
|
16
|
-
unmount(): Promise<void>;
|
|
17
|
-
update(value?: Stringable): void;
|
|
18
|
-
}
|
|
19
|
-
export {};
|