@manyducks.co/dolla 2.0.0-alpha.1 → 2.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  export function jsxDEV(element: any, props: any, key: any, isStaticChildren: any, source: any, self: any): import("./markup.ts").Markup;
2
- export { Fragment } from "./views/fragment.ts";
2
+ export { Passthrough as Fragment } from "./views/passthrough.ts";
@@ -1,5 +1,5 @@
1
- import { j as s } from "./fragment-DHJiX0-a.js";
2
- import { F as m } from "./fragment-DHJiX0-a.js";
1
+ import { r as s } from "./passthrough-DrtCifRF.js";
2
+ import { P as m } from "./passthrough-DrtCifRF.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.ts\";\nexport { Fragment } from \"./views/fragment.ts\";\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;"}
1
+ {"version":3,"file":"jsx-dev-runtime.js","sources":["../src/jsx-dev-runtime.js"],"sourcesContent":["import { createMarkup } from \"./markup.ts\";\nexport { Passthrough as Fragment } from \"./views/passthrough.ts\";\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;"}
@@ -6,4 +6,4 @@ export function jsx(element: any, props: any, key: any): import("./markup.ts").M
6
6
  * JSX function for elements with static children.
7
7
  */
8
8
  export function jsxs(element: any, props: any, key: any): import("./markup.ts").Markup;
9
- export { Fragment } from "./views/fragment.ts";
9
+ export { Passthrough as Fragment } from "./views/passthrough.ts";
@@ -1,5 +1,5 @@
1
- import { j as t } from "./fragment-DHJiX0-a.js";
2
- import { F as l } from "./fragment-DHJiX0-a.js";
1
+ import { r as t } from "./passthrough-DrtCifRF.js";
2
+ import { P as l } from "./passthrough-DrtCifRF.js";
3
3
  function d(n, e, r) {
4
4
  return t(n, e ? { ...u(["children", "key"], e) } : void 0, e.children);
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"jsx-runtime.js","sources":["../src/jsx-runtime.js"],"sourcesContent":["import { createMarkup } from \"./markup.ts\";\nexport { Fragment } from \"./views/fragment.ts\";\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;"}
1
+ {"version":3,"file":"jsx-runtime.js","sources":["../src/jsx-runtime.js"],"sourcesContent":["import { createMarkup } from \"./markup.ts\";\nexport { Passthrough as Fragment } from \"./views/passthrough.ts\";\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/markup.d.ts CHANGED
@@ -13,7 +13,7 @@ export interface ElementContext {
13
13
  isSVG?: boolean;
14
14
  }
15
15
  /**
16
- * Markup is a set of element metadata that hasn't been rendered to a DOMHandle yet.
16
+ * Markup is a set of element metadata that hasn't been constructed into a MarkupNode yet.
17
17
  */
18
18
  export interface Markup {
19
19
  type: string | ViewFunction<any>;
@@ -21,17 +21,16 @@ export interface Markup {
21
21
  children?: Markup[];
22
22
  }
23
23
  /**
24
- * DOMHandle is the generic interface for an element that can be manipulated by the framework.
24
+ * A DOM node that has been constructed from a Markup object.
25
25
  */
26
- export interface DOMHandle {
26
+ export interface MarkupNode {
27
27
  readonly node?: Node;
28
- readonly connected: boolean;
29
- connect(parent: Node, after?: Node): void;
30
- disconnect(): void;
31
- setChildren(children: DOMHandle[]): void;
28
+ readonly isMounted: boolean;
29
+ mount(parent: Node, after?: Node): void;
30
+ unmount(): void;
32
31
  }
33
32
  export declare function isMarkup(value: unknown): value is Markup;
34
- export declare function isDOMHandle(value: unknown): value is DOMHandle;
33
+ export declare function isNode(value: unknown): value is MarkupNode;
35
34
  export declare function toMarkup(renderables: Renderable | Renderable[]): Markup[];
36
35
  export interface MarkupAttributes {
37
36
  $text: {
@@ -52,7 +51,7 @@ export interface MarkupAttributes {
52
51
  renderFn: (...items: any) => Renderable;
53
52
  };
54
53
  $outlet: {
55
- $children: Signal<DOMHandle[]>;
54
+ $children: Signal<MarkupNode[]>;
56
55
  };
57
56
  $node: {
58
57
  value: Node;
@@ -65,6 +64,10 @@ export interface MarkupAttributes {
65
64
  }
66
65
  export declare function createMarkup<T extends keyof MarkupAttributes>(type: T, attributes: MarkupAttributes[T], ...children: Renderable[]): Markup;
67
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[];
68
71
  /**
69
72
  * Displays content conditionally. When `predicate` holds a truthy value, `thenContent` is displayed; when `predicate` holds a falsy value, `elseContent` is displayed.
70
73
  */
@@ -77,7 +80,7 @@ export declare function repeat<T>(items: MaybeSignal<T[]>, keyFn: (value: T, ind
77
80
  /**
78
81
  * Render `content` into a `parent` node anywhere in the page, rather than at its position in the view.
79
82
  */
80
- export declare function portal(content: Renderable, parent: Node): Markup;
83
+ export declare function portal(parent: Node, content: Renderable): Markup;
81
84
  /**
82
85
  * A special kind of signal exclusively for storing references to DOM nodes.
83
86
  */
@@ -86,9 +89,12 @@ export declare function isRef<T extends Node>(value: any): value is Ref<T>;
86
89
  export interface Ref<T extends Node> extends Signal<T | undefined> {
87
90
  node: T | undefined;
88
91
  }
89
- export declare function renderMarkupToDOM(markup: Markup | Markup[], elementContext: ElementContext): DOMHandle[];
90
92
  /**
91
- * Combines one or more DOMHandles into a single DOMHandle.
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.
92
98
  */
93
- export declare function getRenderHandle(handles: DOMHandle[]): DOMHandle;
99
+ export declare function mergeNodes(nodes: MarkupNode[]): MarkupNode;
94
100
  export declare function isRenderable(value: unknown): value is Renderable;
@@ -1,6 +1,7 @@
1
- import { createRef, isRef, type DOMHandle, type Markup } from "../markup.js";
1
+ import { createRef, isRef, MarkupNode, type Markup } from "../markup.js";
2
2
  import { createSettableSignal, createSignal, derive, designalify, signalify, toSettableSignal, watch, type Signal } from "../signals.js";
3
- import { type ViewFunction } from "../view.js";
3
+ import { type ViewFunction, type ViewNode } from "../view.js";
4
+ import { type CrashViewProps } from "../views/default-crash-view.js";
4
5
  import { HTTP } from "./http.js";
5
6
  import { Language } from "./language.js";
6
7
  import { Render } from "./render.js";
@@ -39,10 +40,10 @@ export type LoggerOptions = {
39
40
  };
40
41
  export declare class Dolla {
41
42
  #private;
42
- http: HTTP;
43
- language: Language;
44
- render: Render;
45
- router: Router;
43
+ readonly http: HTTP;
44
+ readonly language: Language;
45
+ readonly render: Render;
46
+ readonly router: Router;
46
47
  constructor();
47
48
  createSignal: typeof createSignal;
48
49
  createSettableSignal: typeof createSettableSignal;
@@ -53,9 +54,25 @@ export declare class Dolla {
53
54
  watch: typeof watch;
54
55
  createRef: typeof createRef;
55
56
  isRef: typeof isRef;
57
+ /**
58
+ * True when the app is connected to a DOM node and displayed to the user.
59
+ */
56
60
  get isMounted(): boolean;
57
- get env(): Environment;
58
- set env(value: Environment);
61
+ /**
62
+ * Get the current environment that this app is running in.
63
+ * Environment affects which log messages will print and how much debugging info is included in the DOM.
64
+ */
65
+ getEnv(): Environment;
66
+ /**
67
+ * Sets the environment that this app is running in.
68
+ * Environment affects which log messages will print and how much debugging info is included in the DOM.
69
+ */
70
+ setEnv(value: Environment): void;
71
+ /**
72
+ * Sets the view that will be shown when the `crash` method is called on any logger.
73
+ * When a crash is reported the app will be unmounted and replaced with this crash page.
74
+ */
75
+ setCrashView(view: ViewFunction<CrashViewProps>): void;
59
76
  mount(selector: string, view?: ViewFunction<any>): Promise<void>;
60
77
  mount(element: HTMLElement, view?: ViewFunction<any>): Promise<void>;
61
78
  unmount(): Promise<void>;
@@ -83,5 +100,12 @@ export declare class Dolla {
83
100
  setLoggles(options: Partial<Loggles>): void;
84
101
  setLogFilter(filter: string | RegExp): void;
85
102
  createLogger(name: string | Signal<string>, options?: LoggerOptions): Logger;
86
- constructView<P>(view: ViewFunction<P>, props: P, children?: Markup[]): DOMHandle;
103
+ /**
104
+ *
105
+ */
106
+ constructView<P>(view: ViewFunction<P>, props: P, children?: Markup[]): ViewNode;
107
+ /**
108
+ *
109
+ */
110
+ constructMarkup(markup: Markup | Markup[]): MarkupNode;
87
111
  }
@@ -1,6 +1,5 @@
1
- import { type DOMHandle, type Markup } from "../markup.js";
2
1
  import { type Stringable } from "../types.js";
3
- import { type ViewFunction } from "../view.js";
2
+ import { ViewNode, type ViewFunction } from "../view.js";
4
3
  import type { Dolla } from "./dolla.js";
5
4
  export interface RouteMatchContext {
6
5
  /**
@@ -41,7 +40,7 @@ export interface RouteConfig {
41
40
  }
42
41
  export interface RouteLayer {
43
42
  id: number;
44
- markup: Markup;
43
+ view: ViewFunction<{}>;
45
44
  }
46
45
  /**
47
46
  * Object passed to redirect callbacks. Contains information useful for determining how to redirect.
@@ -101,7 +100,7 @@ export interface RouterSetupOptions {
101
100
  }
102
101
  export interface RouterElements {
103
102
  readonly rootElement?: HTMLElement;
104
- readonly rootView?: DOMHandle;
103
+ readonly rootView?: ViewNode;
105
104
  }
106
105
  export declare class Router {
107
106
  #private;
@@ -1,4 +1,4 @@
1
- import { type DOMHandle, type ElementContext, type Markup } from "../markup.js";
1
+ import { type MarkupNode, type ElementContext, type Markup } from "../markup.js";
2
2
  import { type Signal, type StopFunction } from "../signals.js";
3
3
  import { type Renderable } from "../types.js";
4
4
  export interface ConditionalConfig {
@@ -7,21 +7,20 @@ export interface ConditionalConfig {
7
7
  elseContent?: Renderable;
8
8
  elementContext: ElementContext;
9
9
  }
10
- export declare class Conditional implements DOMHandle {
10
+ export declare class Conditional implements MarkupNode {
11
11
  node: Node;
12
12
  endNode: Node;
13
13
  $predicate: Signal<any>;
14
14
  stopCallback?: StopFunction;
15
15
  thenContent?: Markup[];
16
16
  elseContent?: Markup[];
17
- connectedContent: DOMHandle[];
17
+ connectedContent: MarkupNode[];
18
18
  elementContext: ElementContext;
19
19
  initialUpdateHappened: boolean;
20
20
  previousValue?: any;
21
21
  constructor(config: ConditionalConfig);
22
- get connected(): boolean;
23
- connect(parent: Node, after?: Node | undefined): void;
24
- disconnect(): void;
22
+ get isMounted(): boolean;
23
+ mount(parent: Node, after?: Node | undefined): void;
24
+ unmount(): void;
25
25
  update(value: any): void;
26
- setChildren(children: DOMHandle[]): Promise<void>;
27
26
  }
@@ -1,24 +1,23 @@
1
- import { type DOMHandle, type ElementContext, type Markup } from "../markup.js";
1
+ import { type MarkupNode, type ElementContext, type Markup } from "../markup.js";
2
2
  import { type StopFunction } from "../signals.js";
3
3
  type HTMLOptions = {
4
4
  elementContext: ElementContext;
5
5
  tag: string;
6
- props?: any;
6
+ props: Record<string, any>;
7
7
  children?: Markup[];
8
8
  };
9
- export declare class HTML implements DOMHandle {
9
+ export declare class HTML implements MarkupNode {
10
10
  node: HTMLElement | SVGElement;
11
11
  props: Record<string, any>;
12
- children: DOMHandle[];
12
+ children: MarkupNode[];
13
13
  stopCallbacks: StopFunction[];
14
14
  elementContext: ElementContext;
15
15
  uniqueId: string;
16
16
  canClickAway: boolean;
17
- get connected(): boolean;
17
+ get isMounted(): boolean;
18
18
  constructor({ tag, props, children, elementContext }: HTMLOptions);
19
- connect(parent: Node, after?: Node): void;
20
- disconnect(): void;
21
- setChildren(next: DOMHandle[]): void;
19
+ mount(parent: Node, after?: Node): void;
20
+ unmount(): void;
22
21
  getUpdateKey(type: string, value: string | number): string;
23
22
  applyProps(element: HTMLElement | SVGElement, props: Record<string, unknown>): void;
24
23
  applyStyles(element: HTMLElement | SVGElement, styles: string | Record<string, any>, stopCallbacks: StopFunction[]): () => void;
@@ -1,4 +1,4 @@
1
- import { type DOMHandle, type ElementContext } from "../markup.js";
1
+ import { type MarkupNode, type ElementContext } from "../markup.js";
2
2
  import { type Signal } from "../signals.js";
3
3
  import type { Renderable } from "../types.js";
4
4
  interface ObserverOptions {
@@ -9,21 +9,20 @@ interface ObserverOptions {
9
9
  /**
10
10
  * Displays dynamic children without a parent element.
11
11
  */
12
- export declare class Observer implements DOMHandle {
12
+ export declare class Observer implements MarkupNode {
13
13
  node: Node;
14
14
  endNode: Node;
15
- connectedViews: DOMHandle[];
15
+ connectedViews: MarkupNode[];
16
16
  renderFn: (...values: any) => Renderable;
17
17
  elementContext: ElementContext;
18
18
  observerControls: {
19
19
  start: () => void;
20
20
  stop: () => void;
21
21
  };
22
- get connected(): boolean;
22
+ get isMounted(): boolean;
23
23
  constructor({ signals, renderFn, elementContext }: ObserverOptions);
24
- connect(parent: Node, after?: Node): void;
25
- disconnect(): void;
26
- setChildren(): Promise<void>;
24
+ mount(parent: Node, after?: Node): void;
25
+ unmount(): void;
27
26
  cleanup(): void;
28
27
  update(...children: Renderable[]): void;
29
28
  }
@@ -1,23 +1,22 @@
1
- import { type DOMHandle, type ElementContext } from "../markup.js";
1
+ import { type MarkupNode, type ElementContext } from "../markup.js";
2
2
  import { type Signal, type StopFunction } from "../signals.js";
3
3
  export interface OutletConfig {
4
- $children: Signal<DOMHandle[]>;
4
+ $children: Signal<MarkupNode[]>;
5
5
  elementContext: ElementContext;
6
6
  }
7
7
  /**
8
8
  * Manages an array of DOMHandles.
9
9
  */
10
- export declare class Outlet implements DOMHandle {
10
+ export declare class Outlet implements MarkupNode {
11
11
  node: Node;
12
12
  endNode: Node;
13
- $children: Signal<DOMHandle[]>;
13
+ $children: Signal<MarkupNode[]>;
14
14
  stopCallback?: StopFunction;
15
- connectedChildren: DOMHandle[];
15
+ connectedChildren: MarkupNode[];
16
16
  elementContext: ElementContext;
17
17
  constructor(config: OutletConfig);
18
- get connected(): boolean;
19
- connect(parent: Node, after?: Node | undefined): void;
20
- disconnect(): void;
21
- update(newChildren: DOMHandle[]): void;
22
- setChildren(children: DOMHandle[]): void;
18
+ get isMounted(): boolean;
19
+ mount(parent: Node, after?: Node | undefined): void;
20
+ unmount(): void;
21
+ update(newChildren: MarkupNode[]): void;
23
22
  }
@@ -1,4 +1,4 @@
1
- import { type DOMHandle, type ElementContext } from "../markup.js";
1
+ import { type MarkupNode, type ElementContext } from "../markup.js";
2
2
  import { type Renderable } from "../types.js";
3
3
  interface PortalConfig {
4
4
  content: Renderable;
@@ -8,13 +8,12 @@ interface PortalConfig {
8
8
  /**
9
9
  * Renders content into a specified parent node.
10
10
  */
11
- export declare class Portal implements DOMHandle {
11
+ export declare class Portal implements MarkupNode {
12
12
  config: PortalConfig;
13
- handle?: DOMHandle;
14
- get connected(): boolean;
13
+ handle?: MarkupNode;
14
+ get isMounted(): boolean;
15
15
  constructor(config: PortalConfig);
16
- connect(_parent: Node, _after?: Node): void;
17
- disconnect(): void;
18
- setChildren(children: DOMHandle[]): void;
16
+ mount(_parent: Node, _after?: Node): void;
17
+ unmount(): void;
19
18
  }
20
19
  export {};
@@ -1,4 +1,4 @@
1
- import { type DOMHandle, type ElementContext } from "../markup.js";
1
+ import { type MarkupNode, type ElementContext } from "../markup.js";
2
2
  import { type Signal, type SignalSetter, type StopFunction } from "../signals.js";
3
3
  import { type ViewContext, type ViewResult } from "../view.js";
4
4
  interface RepeatOptions<T> {
@@ -13,9 +13,9 @@ type ConnectedItem<T> = {
13
13
  setValue: SignalSetter<T>;
14
14
  $index: Signal<number>;
15
15
  setIndex: SignalSetter<number>;
16
- handle: DOMHandle;
16
+ handle: MarkupNode;
17
17
  };
18
- export declare class Repeat<T> implements DOMHandle {
18
+ export declare class Repeat<T> implements MarkupNode {
19
19
  node: Node;
20
20
  endNode: Node;
21
21
  $items: Signal<T[]>;
@@ -24,11 +24,10 @@ export declare class Repeat<T> implements DOMHandle {
24
24
  elementContext: ElementContext;
25
25
  renderFn: ($value: Signal<T>, $index: Signal<number>, ctx: ViewContext) => ViewResult;
26
26
  keyFn: (value: T, index: number) => string | number | symbol;
27
- get connected(): boolean;
27
+ get isMounted(): boolean;
28
28
  constructor({ elementContext, $items, renderFn, keyFn }: RepeatOptions<T>);
29
- connect(parent: Node, after?: Node): void;
30
- disconnect(): void;
31
- setChildren(): void;
29
+ mount(parent: Node, after?: Node): void;
30
+ unmount(): void;
32
31
  _cleanup(): void;
33
32
  _update(value: T[]): void;
34
33
  }
@@ -1,4 +1,4 @@
1
- import { type DOMHandle } from "../markup.js";
1
+ import { type MarkupNode } from "../markup.js";
2
2
  import { type MaybeSignal, type StopFunction } from "../signals.js";
3
3
  interface Stringable {
4
4
  toString(): string;
@@ -6,15 +6,14 @@ interface Stringable {
6
6
  interface TextOptions {
7
7
  value: MaybeSignal<Stringable>;
8
8
  }
9
- export declare class Text implements DOMHandle {
9
+ export declare class Text implements MarkupNode {
10
10
  node: globalThis.Text;
11
11
  value: MaybeSignal<Stringable>;
12
12
  stopCallback?: StopFunction;
13
- get connected(): boolean;
13
+ get isMounted(): boolean;
14
14
  constructor({ value }: TextOptions);
15
- connect(parent: Node, after?: Node | null): Promise<void>;
16
- disconnect(): Promise<void>;
15
+ mount(parent: Node, after?: Node | null): Promise<void>;
16
+ unmount(): Promise<void>;
17
17
  update(value?: Stringable): void;
18
- setChildren(): Promise<void>;
19
18
  }
20
19
  export {};