dothtml-interfaces 1.0.0 → 6.0.5

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/package.json CHANGED
@@ -1,12 +1,21 @@
1
1
  {
2
2
  "name": "dothtml-interfaces",
3
- "version": "1.0.0",
3
+ "version": "6.0.5",
4
4
  "description": "Dependency injection interfaces for DOTHtml.",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
7
7
  "scripts": {},
8
- "author": "",
8
+ "author": "Joshua Sideris",
9
9
  "license": "ISC",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/JSideris/DOThtml.git",
13
+ "directory": "packages/interfaces"
14
+ },
15
+ "homepage": "https://dothtml.org/",
16
+ "bugs": {
17
+ "url": "https://github.com/JSideris/DOThtml/issues"
18
+ },
10
19
  "devDependencies": {
11
20
  "typescript": "^5.3.2"
12
21
  },
@@ -1,5 +1,9 @@
1
1
  import { IWatcher } from "./i-watcher";
2
+ import { DotContent } from "../i-dot";
2
3
 
3
4
  export interface IRef<T = any> extends IWatcher<T | null> {
4
5
  get element(): T;
6
+ ready(): Promise<T>;
7
+ append(content: DotContent): this;
8
+ prepend(content: DotContent): this;
5
9
  }
package/src/i-dot.ts CHANGED
@@ -8,7 +8,7 @@ import { IWatcher } from "./bindings/i-watcher";
8
8
  import IDotcssProp from "./styles/i-css-prop";
9
9
  import { IRef } from "./bindings/i-ref";
10
10
 
11
- type DotContentPrimitive = string | number | boolean | undefined | null;
11
+ export type DotContentPrimitive = string | number | boolean | undefined | null;
12
12
  type DotContentBasic = DotContentPrimitive | Node | Element | NodeList | IDotComponent | IDotDocument//typeof DotDocument;
13
13
  export type DotContent = DotContentBasic | Array<DotContent> | IReactive;//|(()=>DotContent);
14
14
 
@@ -37,9 +37,9 @@ export interface IDotDocument {
37
37
  /**
38
38
  * Cast any document to any other element type. This can be used to access attributes when dotHTML doesn't know the type.
39
39
  * @example
40
- * dot("#my-input").as(dot.input).value("Hello, world!")
40
+ * dot("#my-input").as(dot.input).attr("value", "Hello, world!")
41
41
  * @example
42
- * dot.h("<a>Click me!</a>").as(dot.a).hRef("https://dothtml.com/")
42
+ * dot.h("<a>Click me!</a>").as(dot.a).attr("href", "https://dothtml.com/")
43
43
  */
44
44
  as<T extends IDotDocument>(dotElement: (...props: any[]) => T): T;
45
45
  /**
@@ -51,19 +51,27 @@ export interface IDotDocument {
51
51
  /**
52
52
  * Creates a generic HTML node that can render a string, HTML nodes, or dotHTML content.
53
53
  */
54
- html(content: string | number | boolean | IReactive): IDotDocument;
54
+ html(content: DotContentPrimitive | IReactive): IDotDocument;
55
55
  /**
56
56
  * Creates a text node that will render as a string, rather than being parsed as markup.
57
57
  */
58
- text(content: string | number | boolean | IReactive): IDotDocument;
58
+ text(content: DotContentPrimitive | IReactive): IDotDocument;
59
59
  /**
60
60
  * Creates a text node that will render as a string, rather than being parsed as markup.
61
61
  */
62
- md(content: string | number | boolean | IReactive): IDotDocument;
62
+ md(content: DotContentPrimitive | IReactive): IDotDocument;
63
63
  /**
64
- * Mounts a component.
64
+ * Mounts a component or appends content.
65
65
  */
66
- mount<T extends IDotComponent>(component: T, ...args: any[]): IDotDocument;
66
+ mount(content: DotContent, ...args: any[]): IDotDocument;
67
+ /**
68
+ * Appends content to the current document.
69
+ */
70
+ append(content: DotContent): this;
71
+ /**
72
+ * Prepends content to the current document.
73
+ */
74
+ prepend(content: DotContent): this;
67
75
  slot(name?: string | any, fallback?: any): IDotDocument;
68
76
  // mount<T extends IComponent>(init: (c: IMountedComponent<T>) => IMountedComponent<T> | void, component: T): IDotDocument;
69
77
  // mount(component: IComponent, init: (init=>IMountedComponent): IMountedComponent|void): IDotDocument;
@@ -87,7 +95,6 @@ export interface IDotDocument {
87
95
  remove(): void;
88
96
 
89
97
  style(c: string | ISignal<any> | IBinding<any, any> | IDotCss | ((s: IDotCss) => void)): this;
90
- class(name: string, condition?: any): this;
91
98
  attr(name: string, value: any): this;
92
99
  on(event: string, callback: (e: any) => void): this;
93
100
  onEnter(callback: (el: HTMLElement) => void): this;