1+ import { Reactive } from './reactivity.js'
2+
13/**
24 * A chainable builder class for DOM elements.
35 */
@@ -7,138 +9,141 @@ export class ElementBuilder {
79 * @see {@link _ } for the function to create an instance of this class.
810 * @param {string } type The type of DOM element to create. div by default.
911 */
10- constructor ( type ?: string ) ;
11- _domEl : HTMLElement ;
12+ constructor ( type ?: string )
13+ _domEl : HTMLElement
1214 /**
1315 * Sets the text content of this element.
1416 * @param {string | Reactive } content The content to be set.
1517 * @returns The same elementBuilder it was called on.
1618 */
17- text ( content : string | Reactive ) : this;
19+ text ( content : string | Reactive ) : this
1820 /**
1921 * Inserts another elementBuilder as a child of this element.
2022 * @param {ElementBuilder| Reactive } element The elementBuilder to insert.
2123 * @returns {ElementBuilder } The same elementBuilder it was called on.
2224 */
23- insert ( element : ElementBuilder | Reactive ) : ElementBuilder ;
25+ insert ( element : ElementBuilder | Reactive ) : ElementBuilder
2426 /**
2527 * Adds an event listener to this element.
2628 * @param {string } type The event to listen for.
2729 * @param {function | Reactive } handler The function to handle the event.
2830 * @returns {ElementBuilder } The same elementBuilder it was called on.
2931 */
30- handle ( type : string , handler : Function | Reactive ) : ElementBuilder ;
32+ handle ( type : string , handler : Function | Reactive ) : ElementBuilder
3133 /**
3234 * Sets a css style property on this element.
3335 * @param {string } property The css property to set.
3436 * @param {* } value The value to set it to.
3537 * @returns {ElementBuilder } The same elementBuilder it was called on.
3638 */
37- style ( property : string , value : any ) : ElementBuilder ;
38- set_cssvar ( property : any , value : any ) : this;
39- get_cssvar ( property : any ) : string ;
39+ style ( property : string , value : any ) : ElementBuilder
40+ set_cssvar ( property : any , value : any ) : this
41+ get_cssvar ( property : any ) : string
4042 /**
4143 * Sets a html attribute on this element.
4244 * @param {string } property The property to set.
4345 * @param {* | Reactive } value The value to set it to.
4446 * @returns {ElementBuilder } The same elementBuilder it was called on.
4547 */
46- set_prop ( property : string , value : any | Reactive ) : ElementBuilder ;
48+ set_prop ( property : string , value : any | Reactive ) : ElementBuilder
4749 /**
4850 * Gets the value of a html attribute on this element.
4951 * @param {* } property The property of who's value to get.
5052 * @returns The value of the specified property.
5153 */
52- get_prop ( property : any ) : string ;
53- bind_prop ( property : any , variable : any , event : any ) : this;
54+ get_prop ( property : any ) : string
55+ bind_prop ( property : any , variable : any , event : any ) : this
5456 /**
5557 * Subscribe to an arbitrary somethingjs reactive value but get this element as an argument to the callback as well.
5658 * @param {* } variable The reactive value to subscribe to.
5759 * @param {* } callback The callback to subscribe with.
5860 * @returns {ElementBuilder } The same elementBuilder it was called on.
5961 */
60- sub ( variable : any , callback : any ) : ElementBuilder ;
62+ sub ( variable : any , callback : any ) : ElementBuilder
6163 /**
6264 * Sets the id of this element.
6365 * @param {string } id The id to set on the element.
6466 * @returns {ElementBuilder } The same elementBuilder it was called on.
6567 */
66- id ( id : string ) : ElementBuilder ;
68+ id ( id : string ) : ElementBuilder
6769 /**
6870 * Adds a class to this element.
6971 * @param {string | Reactive } name The classname to add.
7072 * @returns {ElementBuilder } The same elementBuilder it was called on.
7173 */
72- add_class ( name : string | Reactive ) : ElementBuilder ;
74+ add_class ( name : string | Reactive ) : ElementBuilder
7375 /**
7476 * Removes a class from this element.
7577 * @param {string } name The name of the class to remove.
7678 * @returns {ElementBuilder } The same elementBuilder it was called on.
7779 */
78- remove_class ( name : string ) : ElementBuilder ;
80+ remove_class ( name : string ) : ElementBuilder
7981 /**
8082 * Replaces a class on this element.
8183 * @param {string } oldClass The class to be replaced.
8284 * @param {string } newClass The class to replace with.
8385 * @returns {ElementBuilder } The same elementBuilder it was called on.
8486 */
85- replace_class ( oldClass : string , newClass : string ) : ElementBuilder ;
87+ replace_class ( oldClass : string , newClass : string ) : ElementBuilder
8688 /**
8789 * Toggles a class on this element.
8890 * @param {string } name The class to be toggled
8991 * @returns {ElementBuilder } The same elementBuilder it was called on.
9092 */
91- toggle_class ( name : string ) : ElementBuilder ;
93+ toggle_class ( name : string ) : ElementBuilder
9294 /**
9395 * Runs different code based on whether a class exists on this element.
9496 * @param {string } name The class to check.
9597 * @param {* } yescb Code to run if the class is present.
9698 * @param {* } nocb Code to run if the class is not present.
9799 * @returns {ElementBuilder } The same elementBuilder it was called on.
98100 */
99- if_class ( name : string , yescb : any , nocb : any ) : ElementBuilder ;
101+ if_class ( name : string , yescb : any , nocb : any ) : ElementBuilder
100102 /**
101103 * Completely clears the contents of this element.
102104 * @returns {ElementBuilder } The same elementBuilder it was called on.
103105 */
104- clear ( ) : ElementBuilder ;
106+ clear ( ) : ElementBuilder
105107 /**
106108 * Loops over an array and adds children to this element.
107109 * @param {Array<*> | Reactive } list The array to iterate over.
108110 * @param {* } itemcallback A callback to call for each item, which returns an elementBuilder to be inserted.
109111 * @param {* } blankcallback A callback to call in the case of the array having 0 items, which returns an elementBuilder to be inserted.
110112 * @returns {ElementBuilder } The same elementBuilder it was called on.
111113 */
112- loop ( list : Array < any > | Reactive , itemcallback : any , blankcallback : any , some_wrapper ?: boolean ) : ElementBuilder ;
114+ loop (
115+ list : Array < any > | Reactive ,
116+ itemcallback : any ,
117+ blankcallback : any ,
118+ some_wrapper ?: boolean
119+ ) : ElementBuilder
113120 /**
114121 * Checks whether this element has a class.
115122 * @param {string } name The class to check for the presence of.
116123 * @returns {boolean } Whether this element has that class
117124 */
118- has_class ( name : string ) : boolean ;
125+ has_class ( name : string ) : boolean
119126 /**
120127 * Gets the list of all classes on this element.
121128 * @returns {Array } All the classes on this element.
122129 */
123- classes ( ) : any [ ] ;
130+ classes ( ) : any [ ]
124131 /**
125132 * Gets a copy of this element.
126133 * @returns {ElementBuilder } A copy of this element
127134 */
128- get ( ) : ElementBuilder ;
135+ get ( ) : ElementBuilder
129136 /**
130137 * Attaches this elementBuilder to another dom element.
131138 * @param {* } element The DOM element to attach to.
132139 * @returns {ElementBuilder } The same elementBuilder it was called on.
133140 */
134- from_dom ( element : any ) : ElementBuilder ;
141+ from_dom ( element : any ) : ElementBuilder
135142 /**
136143 * Gets the underlying DOM element of this elementBuilder.
137144 * @returns The underlying DOM element of this elementBuilder.
138145 */
139- to_dom ( ) : HTMLElement ;
140- if ( condition : any , handler : any ) : this;
141- process ( handler : any ) : this;
146+ to_dom ( ) : HTMLElement
147+ if ( condition : any , handler : any ) : this
148+ process ( handler : any ) : this
142149}
143- import { Reactive } from './reactivity.js' ;
144- //# sourceMappingURL=element.d.ts.map
0 commit comments