@medyll/idae-be 0.84.0 → 0.86.0
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/dist/modules/attrs.d.ts +54 -1
- package/dist/modules/attrs.js +60 -4
- package/dist/modules/classes.d.ts +31 -5
- package/dist/modules/classes.js +31 -5
- package/dist/modules/data.d.ts +25 -0
- package/dist/modules/data.js +25 -0
- package/dist/modules/dom.d.ts +107 -0
- package/dist/modules/dom.js +107 -0
- package/dist/modules/events.d.ts +38 -0
- package/dist/modules/events.js +38 -0
- package/dist/modules/position.d.ts +34 -15
- package/dist/modules/position.js +34 -16
- package/dist/modules/styles.d.ts +25 -6
- package/dist/modules/styles.js +25 -7
- package/dist/modules/text.d.ts +77 -0
- package/dist/modules/text.js +77 -0
- package/dist/modules/timers.d.ts +40 -0
- package/dist/modules/timers.js +40 -0
- package/dist/modules/walk.d.ts +24 -0
- package/dist/modules/walk.js +24 -0
- package/package.json +1 -1
package/dist/modules/text.js
CHANGED
|
@@ -85,27 +85,104 @@ export class TextHandler {
|
|
|
85
85
|
});
|
|
86
86
|
return this.beElement;
|
|
87
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Updates the text content of the element(s).
|
|
90
|
+
* @param content - The new text content to set.
|
|
91
|
+
* @param callback - Optional callback function.
|
|
92
|
+
* @returns The Be instance for method chaining.
|
|
93
|
+
* @example
|
|
94
|
+
* // HTML: <div id="test">Original</div>
|
|
95
|
+
* const beInstance = be('#test');
|
|
96
|
+
* beInstance.updateText('Updated'); // Updates the text content to "Updated"
|
|
97
|
+
*/
|
|
88
98
|
update(content, callback) {
|
|
89
99
|
return this.handle({ update: content, callback });
|
|
90
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Appends text content to the element(s).
|
|
103
|
+
* @param content - The text content to append.
|
|
104
|
+
* @param callback - Optional callback function.
|
|
105
|
+
* @returns The Be instance for method chaining.
|
|
106
|
+
* @example
|
|
107
|
+
* // HTML: <div id="test">Original</div>
|
|
108
|
+
* const beInstance = be('#test');
|
|
109
|
+
* beInstance.appendText(' Appended'); // Appends " Appended" to the text content
|
|
110
|
+
*/
|
|
91
111
|
append(content, callback) {
|
|
92
112
|
return this.handle({ append: content, callback });
|
|
93
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Prepends text content to the element(s).
|
|
116
|
+
* @param content - The text content to prepend.
|
|
117
|
+
* @param callback - Optional callback function.
|
|
118
|
+
* @returns The Be instance for method chaining.
|
|
119
|
+
* @example
|
|
120
|
+
* // HTML: <div id="test">Original</div>
|
|
121
|
+
* const beInstance = be('#test');
|
|
122
|
+
* beInstance.prependText('Prepended '); // Prepends "Prepended " to the text content
|
|
123
|
+
*/
|
|
94
124
|
prepend(content, callback) {
|
|
95
125
|
return this.handle({ prepend: content, callback });
|
|
96
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Replaces the text content of the element(s).
|
|
129
|
+
* @param content - The new text content to replace with.
|
|
130
|
+
* @param callback - Optional callback function.
|
|
131
|
+
* @returns The Be instance for method chaining.
|
|
132
|
+
* @example
|
|
133
|
+
* // HTML: <div id="test">Original</div>
|
|
134
|
+
* const beInstance = be('#test');
|
|
135
|
+
* beInstance.replaceText('Replaced'); // Replaces the text content with "Replaced"
|
|
136
|
+
*/
|
|
97
137
|
replace(content, callback) {
|
|
98
138
|
return this.handle({ replace: content, callback });
|
|
99
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Removes the element(s) from the DOM.
|
|
142
|
+
* @param callback - Optional callback function.
|
|
143
|
+
* @returns The Be instance for method chaining.
|
|
144
|
+
* @example
|
|
145
|
+
* // HTML: <div id="test">To be removed</div>
|
|
146
|
+
* const beInstance = be('#test');
|
|
147
|
+
* beInstance.removeText(); // Removes the element
|
|
148
|
+
*/
|
|
100
149
|
remove(callback) {
|
|
101
150
|
return this.handle({ remove: undefined, callback });
|
|
102
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Clears the text content of the element(s).
|
|
154
|
+
* @param callback - Optional callback function.
|
|
155
|
+
* @returns The Be instance for method chaining.
|
|
156
|
+
* @example
|
|
157
|
+
* // HTML: <div id="test">Content</div>
|
|
158
|
+
* const beInstance = be('#test');
|
|
159
|
+
* beInstance.clearText(); // Clears the text content
|
|
160
|
+
*/
|
|
103
161
|
clear(callback) {
|
|
104
162
|
return this.handle({ clear: undefined, callback });
|
|
105
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Normalizes the text content of the element(s).
|
|
166
|
+
* @param callback - Optional callback function.
|
|
167
|
+
* @returns The Be instance for method chaining.
|
|
168
|
+
* @example
|
|
169
|
+
* // HTML: <div id="test">Text <span>Fragment</span> Text</div>
|
|
170
|
+
* const beInstance = be('#test');
|
|
171
|
+
* beInstance.normalizeText(); // Normalizes the text content
|
|
172
|
+
*/
|
|
106
173
|
normalize(callback) {
|
|
107
174
|
return this.handle({ normalize: undefined, callback });
|
|
108
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Wraps the element(s) with a new element.
|
|
178
|
+
* @param content - The wrapper element as a string or HTMLElement.
|
|
179
|
+
* @param callback - Optional callback function.
|
|
180
|
+
* @returns The Be instance for method chaining.
|
|
181
|
+
* @example
|
|
182
|
+
* // HTML: <div id="test">Content</div>
|
|
183
|
+
* const beInstance = be('#test');
|
|
184
|
+
* beInstance.wrapText('<div class="wrapper"></div>'); // Wraps the element with a <div>
|
|
185
|
+
*/
|
|
109
186
|
wrap(content, callback) {
|
|
110
187
|
return this.handle({ wrap: content, callback });
|
|
111
188
|
}
|
package/dist/modules/timers.d.ts
CHANGED
|
@@ -17,9 +17,49 @@ export declare class TimersHandler implements CommonHandler<TimersHandler> {
|
|
|
17
17
|
methods: string[] | keyof TimersHandler;
|
|
18
18
|
valueOf(): unknown;
|
|
19
19
|
handle(actions: TimerHandlerHandle): Be;
|
|
20
|
+
/**
|
|
21
|
+
* Sets a timeout for the element(s).
|
|
22
|
+
* @param value - The timeout duration in milliseconds.
|
|
23
|
+
* @param callback - The callback function to execute after the timeout.
|
|
24
|
+
* @returns The Be instance for method chaining.
|
|
25
|
+
* @example
|
|
26
|
+
* // HTML: <div id="test"></div>
|
|
27
|
+
* const beInstance = be('#test');
|
|
28
|
+
* beInstance.timeout(1000, () => console.log('Timeout executed')); // Sets a 1-second timeout
|
|
29
|
+
*/
|
|
20
30
|
timeout(value: TimerHandlerHandle['timeout'], callback?: HandlerCallBackFn): Be;
|
|
31
|
+
/**
|
|
32
|
+
* Sets an interval for the element(s).
|
|
33
|
+
* @param value - The interval duration in milliseconds.
|
|
34
|
+
* @param callback - The callback function to execute at each interval.
|
|
35
|
+
* @returns The Be instance for method chaining.
|
|
36
|
+
* @example
|
|
37
|
+
* // HTML: <div id="test"></div>
|
|
38
|
+
* const beInstance = be('#test');
|
|
39
|
+
* beInstance.interval(500, () => console.log('Interval executed')); // Sets a 500ms interval
|
|
40
|
+
*/
|
|
21
41
|
interval(value: TimerHandlerHandle['interval'], callback?: HandlerCallBackFn): Be;
|
|
42
|
+
/**
|
|
43
|
+
* Clears the timeout for the element(s).
|
|
44
|
+
* @param callback - Optional callback function.
|
|
45
|
+
* @returns The Be instance for method chaining.
|
|
46
|
+
* @example
|
|
47
|
+
* // HTML: <div id="test"></div>
|
|
48
|
+
* const beInstance = be('#test');
|
|
49
|
+
* beInstance.timeout(1000, () => console.log('Timeout executed'));
|
|
50
|
+
* beInstance.clearTimeout(); // Clears the timeout
|
|
51
|
+
*/
|
|
22
52
|
clearTimeout(callback?: HandlerCallBackFn): Be;
|
|
53
|
+
/**
|
|
54
|
+
* Clears the interval for the element(s).
|
|
55
|
+
* @param callback - Optional callback function.
|
|
56
|
+
* @returns The Be instance for method chaining.
|
|
57
|
+
* @example
|
|
58
|
+
* // HTML: <div id="test"></div>
|
|
59
|
+
* const beInstance = be('#test');
|
|
60
|
+
* beInstance.interval(500, () => console.log('Interval executed'));
|
|
61
|
+
* beInstance.clearInterval(); // Clears the interval
|
|
62
|
+
*/
|
|
23
63
|
clearInterval(callback?: HandlerCallBackFn): Be;
|
|
24
64
|
}
|
|
25
65
|
export {};
|
package/dist/modules/timers.js
CHANGED
|
@@ -39,6 +39,16 @@ export class TimersHandler {
|
|
|
39
39
|
});
|
|
40
40
|
return this.beElement;
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Sets a timeout for the element(s).
|
|
44
|
+
* @param value - The timeout duration in milliseconds.
|
|
45
|
+
* @param callback - The callback function to execute after the timeout.
|
|
46
|
+
* @returns The Be instance for method chaining.
|
|
47
|
+
* @example
|
|
48
|
+
* // HTML: <div id="test"></div>
|
|
49
|
+
* const beInstance = be('#test');
|
|
50
|
+
* beInstance.timeout(1000, () => console.log('Timeout executed')); // Sets a 1-second timeout
|
|
51
|
+
*/
|
|
42
52
|
timeout(value, callback) {
|
|
43
53
|
this.beElement.timerOut = setTimeout(() => {
|
|
44
54
|
callback?.({
|
|
@@ -61,6 +71,16 @@ export class TimersHandler {
|
|
|
61
71
|
}); */
|
|
62
72
|
return this.beElement;
|
|
63
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Sets an interval for the element(s).
|
|
76
|
+
* @param value - The interval duration in milliseconds.
|
|
77
|
+
* @param callback - The callback function to execute at each interval.
|
|
78
|
+
* @returns The Be instance for method chaining.
|
|
79
|
+
* @example
|
|
80
|
+
* // HTML: <div id="test"></div>
|
|
81
|
+
* const beInstance = be('#test');
|
|
82
|
+
* beInstance.interval(500, () => console.log('Interval executed')); // Sets a 500ms interval
|
|
83
|
+
*/
|
|
64
84
|
interval(value, callback) {
|
|
65
85
|
this.beElement.timerInterval = setInterval(() => {
|
|
66
86
|
callback?.({
|
|
@@ -83,6 +103,16 @@ export class TimersHandler {
|
|
|
83
103
|
}); */
|
|
84
104
|
return this.beElement;
|
|
85
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Clears the timeout for the element(s).
|
|
108
|
+
* @param callback - Optional callback function.
|
|
109
|
+
* @returns The Be instance for method chaining.
|
|
110
|
+
* @example
|
|
111
|
+
* // HTML: <div id="test"></div>
|
|
112
|
+
* const beInstance = be('#test');
|
|
113
|
+
* beInstance.timeout(1000, () => console.log('Timeout executed'));
|
|
114
|
+
* beInstance.clearTimeout(); // Clears the timeout
|
|
115
|
+
*/
|
|
86
116
|
clearTimeout(callback) {
|
|
87
117
|
if (this.beElement.timerOut)
|
|
88
118
|
clearTimeout(this.beElement.timerOut);
|
|
@@ -102,6 +132,16 @@ export class TimersHandler {
|
|
|
102
132
|
});
|
|
103
133
|
return this.beElement;
|
|
104
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Clears the interval for the element(s).
|
|
137
|
+
* @param callback - Optional callback function.
|
|
138
|
+
* @returns The Be instance for method chaining.
|
|
139
|
+
* @example
|
|
140
|
+
* // HTML: <div id="test"></div>
|
|
141
|
+
* const beInstance = be('#test');
|
|
142
|
+
* beInstance.interval(500, () => console.log('Interval executed'));
|
|
143
|
+
* beInstance.clearInterval(); // Clears the interval
|
|
144
|
+
*/
|
|
105
145
|
clearInterval(callback) {
|
|
106
146
|
if (this.beElement.timerInterval)
|
|
107
147
|
clearInterval(this.beElement.timerInterval);
|
package/dist/modules/walk.d.ts
CHANGED
|
@@ -114,6 +114,10 @@ export declare class WalkHandler implements WalkHandlerInterface, CommonHandler<
|
|
|
114
114
|
* @param qy - Optional selector or callback function.
|
|
115
115
|
* @param callback - Optional callback function.
|
|
116
116
|
* @returns The Be instance for method chaining.
|
|
117
|
+
* @example
|
|
118
|
+
* // HTML: <div id="child"></div><div id="parent"><div id="child"></div></div>
|
|
119
|
+
* const beInstance = be('#child');
|
|
120
|
+
* beInstance.up(); // Traverses to the parent element
|
|
117
121
|
*/
|
|
118
122
|
up(qy?: string | HandlerCallBackFn, callback?: HandlerCallBackFn): Be;
|
|
119
123
|
/**
|
|
@@ -121,6 +125,10 @@ export declare class WalkHandler implements WalkHandlerInterface, CommonHandler<
|
|
|
121
125
|
* @param qy - Optional selector or callback function.
|
|
122
126
|
* @param callback - Optional callback function.
|
|
123
127
|
* @returns The Be instance for method chaining.
|
|
128
|
+
* @example
|
|
129
|
+
* // HTML: <div id="sibling1"></div><div id="sibling2"></div>
|
|
130
|
+
* const beInstance = be('#sibling1');
|
|
131
|
+
* beInstance.next(); // Traverses to the next sibling
|
|
124
132
|
*/
|
|
125
133
|
next(qy?: string | HandlerCallBackFn, callback?: HandlerCallBackFn): Be;
|
|
126
134
|
/**
|
|
@@ -128,6 +136,10 @@ export declare class WalkHandler implements WalkHandlerInterface, CommonHandler<
|
|
|
128
136
|
* @param qy - Optional selector or callback function.
|
|
129
137
|
* @param callback - Optional callback function.
|
|
130
138
|
* @returns The Be instance for method chaining.
|
|
139
|
+
* @example
|
|
140
|
+
* // HTML: <div id="sibling1"></div><div id="sibling2"></div>
|
|
141
|
+
* const beInstance = be('#sibling2');
|
|
142
|
+
* beInstance.previous(); // Traverses to the previous sibling
|
|
131
143
|
*/
|
|
132
144
|
previous(qy?: string | HandlerCallBackFn, callback?: HandlerCallBackFn): Be;
|
|
133
145
|
/**
|
|
@@ -142,6 +154,10 @@ export declare class WalkHandler implements WalkHandlerInterface, CommonHandler<
|
|
|
142
154
|
* @param qy - Optional selector or callback function.
|
|
143
155
|
* @param callback - Optional callback function.
|
|
144
156
|
* @returns The Be instance for method chaining.
|
|
157
|
+
* @example
|
|
158
|
+
* // HTML: <div id="sibling1"></div><div id="sibling2"></div>
|
|
159
|
+
* const beInstance = be('#sibling1');
|
|
160
|
+
* beInstance.siblings(); // Finds all sibling elements
|
|
145
161
|
*/
|
|
146
162
|
siblings(qy?: string | HandlerCallBackFn, callback?: HandlerCallBackFn): Be;
|
|
147
163
|
/**
|
|
@@ -149,6 +165,10 @@ export declare class WalkHandler implements WalkHandlerInterface, CommonHandler<
|
|
|
149
165
|
* @param qy - Optional selector or callback function.
|
|
150
166
|
* @param callback - Optional callback function.
|
|
151
167
|
* @returns The Be instance for method chaining.
|
|
168
|
+
* @example
|
|
169
|
+
* // HTML: <div id="parent"><div id="child"></div></div>
|
|
170
|
+
* const beInstance = be('#parent');
|
|
171
|
+
* beInstance.children(); // Finds all child elements
|
|
152
172
|
*/
|
|
153
173
|
children(qy?: string | HandlerCallBackFn, callback?: HandlerCallBackFn): Be;
|
|
154
174
|
/**
|
|
@@ -156,6 +176,10 @@ export declare class WalkHandler implements WalkHandlerInterface, CommonHandler<
|
|
|
156
176
|
* @param qy - Optional selector or callback function.
|
|
157
177
|
* @param callback - Optional callback function.
|
|
158
178
|
* @returns The Be instance for method chaining.
|
|
179
|
+
* @example
|
|
180
|
+
* // HTML: <div id="ancestor"><div id="parent"><div id="child"></div></div></div>
|
|
181
|
+
* const beInstance = be('#child');
|
|
182
|
+
* beInstance.closest('#ancestor'); // Finds the closest ancestor matching the selector
|
|
159
183
|
*/
|
|
160
184
|
closest(qy?: string | HandlerCallBackFn, callback?: HandlerCallBackFn): Be;
|
|
161
185
|
/**
|
package/dist/modules/walk.js
CHANGED
|
@@ -47,6 +47,10 @@ export class WalkHandler {
|
|
|
47
47
|
* @param qy - Optional selector or callback function.
|
|
48
48
|
* @param callback - Optional callback function.
|
|
49
49
|
* @returns The Be instance for method chaining.
|
|
50
|
+
* @example
|
|
51
|
+
* // HTML: <div id="child"></div><div id="parent"><div id="child"></div></div>
|
|
52
|
+
* const beInstance = be('#child');
|
|
53
|
+
* beInstance.up(); // Traverses to the parent element
|
|
50
54
|
*/
|
|
51
55
|
up(qy, callback) {
|
|
52
56
|
if (typeof qy === 'function') {
|
|
@@ -60,6 +64,10 @@ export class WalkHandler {
|
|
|
60
64
|
* @param qy - Optional selector or callback function.
|
|
61
65
|
* @param callback - Optional callback function.
|
|
62
66
|
* @returns The Be instance for method chaining.
|
|
67
|
+
* @example
|
|
68
|
+
* // HTML: <div id="sibling1"></div><div id="sibling2"></div>
|
|
69
|
+
* const beInstance = be('#sibling1');
|
|
70
|
+
* beInstance.next(); // Traverses to the next sibling
|
|
63
71
|
*/
|
|
64
72
|
next(qy, callback) {
|
|
65
73
|
if (typeof qy === 'function') {
|
|
@@ -73,6 +81,10 @@ export class WalkHandler {
|
|
|
73
81
|
* @param qy - Optional selector or callback function.
|
|
74
82
|
* @param callback - Optional callback function.
|
|
75
83
|
* @returns The Be instance for method chaining.
|
|
84
|
+
* @example
|
|
85
|
+
* // HTML: <div id="sibling1"></div><div id="sibling2"></div>
|
|
86
|
+
* const beInstance = be('#sibling2');
|
|
87
|
+
* beInstance.previous(); // Traverses to the previous sibling
|
|
76
88
|
*/
|
|
77
89
|
previous(qy, callback) {
|
|
78
90
|
if (typeof qy === 'function') {
|
|
@@ -108,6 +120,10 @@ export class WalkHandler {
|
|
|
108
120
|
* @param qy - Optional selector or callback function.
|
|
109
121
|
* @param callback - Optional callback function.
|
|
110
122
|
* @returns The Be instance for method chaining.
|
|
123
|
+
* @example
|
|
124
|
+
* // HTML: <div id="sibling1"></div><div id="sibling2"></div>
|
|
125
|
+
* const beInstance = be('#sibling1');
|
|
126
|
+
* beInstance.siblings(); // Finds all sibling elements
|
|
111
127
|
*/
|
|
112
128
|
siblings(qy, callback) {
|
|
113
129
|
if (typeof qy === 'function') {
|
|
@@ -134,6 +150,10 @@ export class WalkHandler {
|
|
|
134
150
|
* @param qy - Optional selector or callback function.
|
|
135
151
|
* @param callback - Optional callback function.
|
|
136
152
|
* @returns The Be instance for method chaining.
|
|
153
|
+
* @example
|
|
154
|
+
* // HTML: <div id="parent"><div id="child"></div></div>
|
|
155
|
+
* const beInstance = be('#parent');
|
|
156
|
+
* beInstance.children(); // Finds all child elements
|
|
137
157
|
*/
|
|
138
158
|
children(qy, callback) {
|
|
139
159
|
if (typeof qy === 'function') {
|
|
@@ -147,6 +167,10 @@ export class WalkHandler {
|
|
|
147
167
|
* @param qy - Optional selector or callback function.
|
|
148
168
|
* @param callback - Optional callback function.
|
|
149
169
|
* @returns The Be instance for method chaining.
|
|
170
|
+
* @example
|
|
171
|
+
* // HTML: <div id="ancestor"><div id="parent"><div id="child"></div></div></div>
|
|
172
|
+
* const beInstance = be('#child');
|
|
173
|
+
* beInstance.closest('#ancestor'); // Finds the closest ancestor matching the selector
|
|
150
174
|
*/
|
|
151
175
|
closest(qy, callback) {
|
|
152
176
|
if (typeof qy === 'function') {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medyll/idae-be",
|
|
3
3
|
"scope": "@medyll",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.86.0",
|
|
5
5
|
"description": "A powerful DOM manipulation library with a callback-based approach for precise element targeting. Provides consistent chaining, comprehensive DOM traversal, event handling, style management, and more. Written in TypeScript for modern browsers.",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite dev",
|