@medyll/idae-be 0.80.0 → 0.82.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/be.d.ts +6 -0
- package/dist/be.js +6 -0
- package/dist/modules/classes.d.ts +2 -0
- package/dist/modules/classes.js +4 -20
- package/dist/modules/data.d.ts +44 -1
- package/dist/modules/data.js +45 -7
- package/dist/modules/dom.d.ts +10 -2
- package/dist/modules/dom.js +113 -26
- package/dist/modules/position.d.ts +1 -0
- package/dist/modules/position.js +3 -5
- package/dist/modules/props.d.ts +2 -1
- package/dist/modules/props.js +3 -2
- package/dist/modules/styles.d.ts +2 -0
- package/dist/modules/styles.js +19 -10
- package/dist/modules/text.d.ts +8 -8
- package/dist/modules/text.js +46 -20
- package/dist/modules/timers.d.ts +4 -2
- package/dist/modules/timers.js +60 -22
- package/dist/modules/walk.d.ts +2 -0
- package/dist/modules/walk.js +5 -4
- package/package.json +1 -1
package/dist/be.d.ts
CHANGED
|
@@ -57,6 +57,12 @@ export declare class Be {
|
|
|
57
57
|
private textHandler;
|
|
58
58
|
appendText: TextHandler['append'];
|
|
59
59
|
prependText: TextHandler['prepend'];
|
|
60
|
+
updateText: TextHandler['update'];
|
|
61
|
+
replaceText: TextHandler['replace'];
|
|
62
|
+
removeText: TextHandler['remove'];
|
|
63
|
+
clearText: TextHandler['clear'];
|
|
64
|
+
normalizeText: TextHandler['normalize'];
|
|
65
|
+
wrapText: TextHandler['wrap'];
|
|
60
66
|
events: (actions: EventHandlerHandle) => Be;
|
|
61
67
|
private eventHandler;
|
|
62
68
|
on: EventsHandler['on'];
|
package/dist/be.js
CHANGED
|
@@ -32,6 +32,8 @@ export declare class ClassesHandler implements CommonHandler<ClassesHandler, Cla
|
|
|
32
32
|
private beElement;
|
|
33
33
|
static methods: classesMethods[];
|
|
34
34
|
constructor(beElement: Be);
|
|
35
|
+
methods: string[] | keyof ClassesHandler;
|
|
36
|
+
valueOf(): string;
|
|
35
37
|
handle(actions: ClassHandlerHandlerHandle): Be;
|
|
36
38
|
add(className: string | string[]): Be;
|
|
37
39
|
/**
|
package/dist/modules/classes.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { BeUtils } from '../utils.js';
|
|
2
1
|
import { Be } from '../be.js';
|
|
3
2
|
var classesMethods;
|
|
4
3
|
(function (classesMethods) {
|
|
@@ -16,6 +15,10 @@ export class ClassesHandler {
|
|
|
16
15
|
constructor(beElement) {
|
|
17
16
|
this.beElement = beElement;
|
|
18
17
|
}
|
|
18
|
+
methods = ClassesHandler.methods;
|
|
19
|
+
valueOf() {
|
|
20
|
+
return `[ClassesHandler: methods=${this.methods}]`;
|
|
21
|
+
}
|
|
19
22
|
handle(actions) {
|
|
20
23
|
if (!actions)
|
|
21
24
|
return this.beElement;
|
|
@@ -26,25 +29,6 @@ export class ClassesHandler {
|
|
|
26
29
|
break;
|
|
27
30
|
}
|
|
28
31
|
});
|
|
29
|
-
/* this.beElement.eachNode((el) => {
|
|
30
|
-
if (actions.replace) {
|
|
31
|
-
let replacements: [string, string][];
|
|
32
|
-
if (typeof actions.replace === 'string') {
|
|
33
|
-
replacements = actions.replace
|
|
34
|
-
.split(';')
|
|
35
|
-
.map((pair) => pair.trim().split(' ') as [string, string]);
|
|
36
|
-
} else if (Array.isArray(actions.replace) && actions.replace.every(Array.isArray)) {
|
|
37
|
-
replacements = actions.replace as [string, string][];
|
|
38
|
-
} else {
|
|
39
|
-
replacements = [actions.replace.split(' ') as [string, string]];
|
|
40
|
-
}
|
|
41
|
-
replacements.forEach(([oldClass, newClass]) => {
|
|
42
|
-
if (oldClass && newClass) {
|
|
43
|
-
el.classList.replace(oldClass, newClass);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}); */
|
|
48
32
|
return this.beElement;
|
|
49
33
|
}
|
|
50
34
|
add(className) {
|
package/dist/modules/data.d.ts
CHANGED
|
@@ -6,19 +6,62 @@ declare enum dataMethods {
|
|
|
6
6
|
delete = "delete",
|
|
7
7
|
getKey = "getKey"
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Type definition for DataHandler actions.
|
|
11
|
+
*/
|
|
9
12
|
export type DataHandlerHandle = {
|
|
13
|
+
get: (keyOrObject: string | Record<string, string>, value?: string) => Be;
|
|
10
14
|
set: (keyOrObject: string | Record<string, string>, value?: string) => Be;
|
|
11
15
|
delete: (keyOrObject: string | Record<string, string>, value?: string) => Be;
|
|
16
|
+
getKey: (keyOrObject: string | Record<string, string>, value?: string) => Be;
|
|
12
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Handles operations on `data-*` attributes for Be elements.
|
|
20
|
+
*/
|
|
13
21
|
export declare class DataHandler implements CommonHandler<DataHandler> {
|
|
14
22
|
private beElement;
|
|
15
23
|
static methods: dataMethods[];
|
|
24
|
+
/**
|
|
25
|
+
* Initializes the DataHandler with a Be element.
|
|
26
|
+
* @param element - The Be element to operate on.
|
|
27
|
+
*/
|
|
16
28
|
constructor(element: Be);
|
|
29
|
+
methods: string[] | keyof DataHandler;
|
|
30
|
+
/**
|
|
31
|
+
* Handles dynamic method calls for data operations.
|
|
32
|
+
* @param actions - The action to perform (e.g., set, get, delete).
|
|
33
|
+
* @returns The Be element for chaining.
|
|
34
|
+
*/
|
|
17
35
|
handle(actions: Partial<DataHandlerHandle>): Be;
|
|
36
|
+
/**
|
|
37
|
+
* Retrieves the value of a `data-*` attribute.
|
|
38
|
+
* @param key - The key of the `data-*` attribute to retrieve.
|
|
39
|
+
* @returns The value of the attribute, or `null` if not found.
|
|
40
|
+
*/
|
|
18
41
|
get(key: string): string | null;
|
|
42
|
+
/**
|
|
43
|
+
* Sets one or more `data-*` attributes.
|
|
44
|
+
* @param keyOrObject - A key-value pair or an object containing multiple key-value pairs.
|
|
45
|
+
* @param value - The value to set if a single key is provided.
|
|
46
|
+
* @returns The Be element for chaining.
|
|
47
|
+
*/
|
|
19
48
|
set(keyOrObject: string | Record<string, string>, value?: string): Be;
|
|
20
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Deletes one or more `data-*` attributes.
|
|
51
|
+
* @param keyOrObject - A key or an object containing multiple keys to delete.
|
|
52
|
+
* @returns The Be element for chaining.
|
|
53
|
+
*/
|
|
54
|
+
delete(keyOrObject: string | Record<string, string>): Be;
|
|
55
|
+
/**
|
|
56
|
+
* Retrieves the value of a specific `data-*` attribute.
|
|
57
|
+
* @param key - The key of the `data-*` attribute to retrieve.
|
|
58
|
+
* @returns The value of the attribute, or `null` if not found.
|
|
59
|
+
*/
|
|
21
60
|
getKey(key: string | string[]): string | null;
|
|
61
|
+
/**
|
|
62
|
+
* Retrieves all `data-*` attributes as a DOMStringMap.
|
|
63
|
+
* @returns A DOMStringMap containing all `data-*` attributes, or `null` if not applicable.
|
|
64
|
+
*/
|
|
22
65
|
valueOf(): DOMStringMap | null;
|
|
23
66
|
}
|
|
24
67
|
export {};
|
package/dist/modules/data.js
CHANGED
|
@@ -7,14 +7,27 @@ var dataMethods;
|
|
|
7
7
|
dataMethods["delete"] = "delete";
|
|
8
8
|
dataMethods["getKey"] = "getKey";
|
|
9
9
|
})(dataMethods || (dataMethods = {}));
|
|
10
|
+
/**
|
|
11
|
+
* Handles operations on `data-*` attributes for Be elements.
|
|
12
|
+
*/
|
|
10
13
|
export class DataHandler {
|
|
11
14
|
beElement;
|
|
12
15
|
static methods = Object.values(dataMethods);
|
|
16
|
+
/**
|
|
17
|
+
* Initializes the DataHandler with a Be element.
|
|
18
|
+
* @param element - The Be element to operate on.
|
|
19
|
+
*/
|
|
13
20
|
constructor(element) {
|
|
14
21
|
this.beElement = element;
|
|
15
22
|
}
|
|
23
|
+
methods = DataHandler.methods;
|
|
24
|
+
/**
|
|
25
|
+
* Handles dynamic method calls for data operations.
|
|
26
|
+
* @param actions - The action to perform (e.g., set, get, delete).
|
|
27
|
+
* @returns The Be element for chaining.
|
|
28
|
+
*/
|
|
16
29
|
handle(actions) {
|
|
17
|
-
const { method, props } = BeUtils.resolveIndirection(
|
|
30
|
+
const { method, props } = BeUtils.resolveIndirection(this, actions);
|
|
18
31
|
switch (method) {
|
|
19
32
|
case 'set':
|
|
20
33
|
case 'delete':
|
|
@@ -23,12 +36,22 @@ export class DataHandler {
|
|
|
23
36
|
}
|
|
24
37
|
return this.beElement;
|
|
25
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Retrieves the value of a `data-*` attribute.
|
|
41
|
+
* @param key - The key of the `data-*` attribute to retrieve.
|
|
42
|
+
* @returns The value of the attribute, or `null` if not found.
|
|
43
|
+
*/
|
|
26
44
|
get(key) {
|
|
27
|
-
// if space in string
|
|
28
45
|
if (this.beElement.isWhat !== 'element')
|
|
29
46
|
return null;
|
|
30
47
|
return this.beElement.inputNode.dataset[key] || null;
|
|
31
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Sets one or more `data-*` attributes.
|
|
51
|
+
* @param keyOrObject - A key-value pair or an object containing multiple key-value pairs.
|
|
52
|
+
* @param value - The value to set if a single key is provided.
|
|
53
|
+
* @returns The Be element for chaining.
|
|
54
|
+
*/
|
|
32
55
|
set(keyOrObject, value) {
|
|
33
56
|
this.beElement.eachNode((el) => {
|
|
34
57
|
if (typeof keyOrObject === 'string' && value !== undefined) {
|
|
@@ -42,25 +65,40 @@ export class DataHandler {
|
|
|
42
65
|
});
|
|
43
66
|
return this.beElement;
|
|
44
67
|
}
|
|
45
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Deletes one or more `data-*` attributes.
|
|
70
|
+
* @param keyOrObject - A key or an object containing multiple keys to delete.
|
|
71
|
+
* @returns The Be element for chaining.
|
|
72
|
+
*/
|
|
73
|
+
delete(keyOrObject) {
|
|
46
74
|
this.beElement.eachNode((el) => {
|
|
47
|
-
if (typeof keyOrObject === 'string'
|
|
48
|
-
|
|
75
|
+
if (typeof keyOrObject === 'string') {
|
|
76
|
+
// Deletes a single attribute
|
|
77
|
+
delete el.dataset[keyOrObject];
|
|
49
78
|
}
|
|
50
79
|
else if (typeof keyOrObject === 'object') {
|
|
51
|
-
|
|
80
|
+
// Deletes multiple attributes
|
|
81
|
+
Object.keys(keyOrObject).forEach((key) => {
|
|
52
82
|
delete el.dataset[key];
|
|
53
83
|
});
|
|
54
84
|
}
|
|
55
85
|
});
|
|
56
86
|
return this.beElement;
|
|
57
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Retrieves the value of a specific `data-*` attribute.
|
|
90
|
+
* @param key - The key of the `data-*` attribute to retrieve.
|
|
91
|
+
* @returns The value of the attribute, or `null` if not found.
|
|
92
|
+
*/
|
|
58
93
|
getKey(key) {
|
|
59
|
-
// if spaces in string
|
|
60
94
|
if (this.beElement.isWhat !== 'element')
|
|
61
95
|
return null;
|
|
62
96
|
return this.beElement.inputNode.dataset[key] || null;
|
|
63
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Retrieves all `data-*` attributes as a DOMStringMap.
|
|
100
|
+
* @returns A DOMStringMap containing all `data-*` attributes, or `null` if not applicable.
|
|
101
|
+
*/
|
|
64
102
|
valueOf() {
|
|
65
103
|
if (this.beElement.isWhat !== 'element')
|
|
66
104
|
return null;
|
package/dist/modules/dom.d.ts
CHANGED
|
@@ -17,6 +17,11 @@ declare enum domMethods {
|
|
|
17
17
|
}
|
|
18
18
|
type Content = string | HTMLElement | Be;
|
|
19
19
|
export interface DomHandlerHandle {
|
|
20
|
+
insert?: {
|
|
21
|
+
content: string | HTMLElement | Be;
|
|
22
|
+
mode: 'afterbegin' | 'afterend' | 'beforebegin' | 'beforeend';
|
|
23
|
+
callback?: (element: HandlerCallbackProps) => void;
|
|
24
|
+
};
|
|
20
25
|
update?: {
|
|
21
26
|
content: Content;
|
|
22
27
|
callback?: (element: HandlerCallbackProps) => void;
|
|
@@ -65,6 +70,7 @@ export declare class DomHandler implements DomHandlerInterface, CommonHandler<Do
|
|
|
65
70
|
private beElement;
|
|
66
71
|
static methods: domMethods[];
|
|
67
72
|
constructor(element: Be);
|
|
73
|
+
methods: string[] | keyof DomHandler;
|
|
68
74
|
/**
|
|
69
75
|
* Handles various DOM operations on the element(s).
|
|
70
76
|
* @param actions An object specifying the DOM actions to perform.
|
|
@@ -80,8 +86,8 @@ export declare class DomHandler implements DomHandlerInterface, CommonHandler<Do
|
|
|
80
86
|
update(content: string, callback?: HandlerCallBackFn): Be;
|
|
81
87
|
append(content: Content, callback?: HandlerCallBackFn): Be;
|
|
82
88
|
prepend(content: Content, callback?: HandlerCallBackFn): Be;
|
|
83
|
-
insert(mode: 'afterbegin' | 'afterend' | 'beforebegin' | 'beforeend', element: HTMLElement | Be, callback?: HandlerCallBackFn): Be;
|
|
84
|
-
afterBegin(content:
|
|
89
|
+
insert(mode: 'afterbegin' | 'afterend' | 'beforebegin' | 'beforeend', element: HTMLElement | Be | string, callback?: HandlerCallBackFn): Be;
|
|
90
|
+
afterBegin(content: Content, callback?: HandlerCallBackFn): Be;
|
|
85
91
|
afterEnd(content: Content, callback?: HandlerCallBackFn): Be;
|
|
86
92
|
beforeBegin(content: Content, callback?: HandlerCallBackFn): Be;
|
|
87
93
|
beforeEnd(content: Content, callback?: HandlerCallBackFn): Be;
|
|
@@ -91,6 +97,8 @@ export declare class DomHandler implements DomHandlerInterface, CommonHandler<Do
|
|
|
91
97
|
normalize(callback?: HandlerCallBackFn): Be;
|
|
92
98
|
wrap(tag?: string, callback?: HandlerCallBackFn): Be;
|
|
93
99
|
private adjacentElement;
|
|
100
|
+
private normalizeContent;
|
|
101
|
+
private insertContent;
|
|
94
102
|
valueOf(): string | null;
|
|
95
103
|
}
|
|
96
104
|
export {};
|
package/dist/modules/dom.js
CHANGED
|
@@ -21,6 +21,7 @@ export class DomHandler {
|
|
|
21
21
|
constructor(element) {
|
|
22
22
|
this.beElement = element;
|
|
23
23
|
}
|
|
24
|
+
methods = DomHandler.methods;
|
|
24
25
|
/**
|
|
25
26
|
* Handles various DOM operations on the element(s).
|
|
26
27
|
* @param actions An object specifying the DOM actions to perform.
|
|
@@ -79,15 +80,13 @@ export class DomHandler {
|
|
|
79
80
|
append(content, callback) {
|
|
80
81
|
const ret = [];
|
|
81
82
|
this.beElement.eachNode((el) => {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
el.appendChild(child);
|
|
86
|
-
});
|
|
83
|
+
const normalizedContent = this.normalizeContent(content);
|
|
84
|
+
if (normalizedContent instanceof DocumentFragment) {
|
|
85
|
+
el.appendChild(normalizedContent);
|
|
87
86
|
}
|
|
88
87
|
else {
|
|
89
|
-
ret.push(
|
|
90
|
-
el.appendChild(
|
|
88
|
+
ret.push(normalizedContent);
|
|
89
|
+
el.appendChild(normalizedContent);
|
|
91
90
|
}
|
|
92
91
|
});
|
|
93
92
|
callback?.({
|
|
@@ -100,15 +99,13 @@ export class DomHandler {
|
|
|
100
99
|
prepend(content, callback) {
|
|
101
100
|
const ret = [];
|
|
102
101
|
this.beElement.eachNode((el) => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
el.insertBefore(child, el.firstChild);
|
|
107
|
-
});
|
|
102
|
+
const normalizedContent = this.normalizeContent(content);
|
|
103
|
+
if (normalizedContent instanceof DocumentFragment) {
|
|
104
|
+
el.insertBefore(normalizedContent, el.firstChild);
|
|
108
105
|
}
|
|
109
106
|
else {
|
|
110
|
-
ret.push(
|
|
111
|
-
el.insertBefore(
|
|
107
|
+
ret.push(normalizedContent);
|
|
108
|
+
el.insertBefore(normalizedContent, el.firstChild);
|
|
112
109
|
}
|
|
113
110
|
});
|
|
114
111
|
callback?.({
|
|
@@ -128,6 +125,8 @@ export class DomHandler {
|
|
|
128
125
|
return this.beforeBegin(element, callback);
|
|
129
126
|
case 'beforeend':
|
|
130
127
|
return this.beforeEnd(element, callback);
|
|
128
|
+
default:
|
|
129
|
+
throw new Error(`Invalid mode: ${mode}`);
|
|
131
130
|
}
|
|
132
131
|
}
|
|
133
132
|
afterBegin(content, callback) {
|
|
@@ -142,29 +141,51 @@ export class DomHandler {
|
|
|
142
141
|
return this.beElement;
|
|
143
142
|
}
|
|
144
143
|
afterEnd(content, callback) {
|
|
145
|
-
this.
|
|
144
|
+
this.beElement.eachNode((el) => {
|
|
145
|
+
// Insérer après l'élément cible
|
|
146
|
+
el.parentNode?.insertBefore(this.normalizeContent(content), el.nextSibling);
|
|
147
|
+
callback?.({
|
|
148
|
+
fragment: content,
|
|
149
|
+
be: be(el),
|
|
150
|
+
root: this.beElement
|
|
151
|
+
});
|
|
152
|
+
});
|
|
146
153
|
return this.beElement;
|
|
147
154
|
}
|
|
148
155
|
beforeBegin(content, callback) {
|
|
149
|
-
this.
|
|
156
|
+
this.beElement.eachNode((el) => {
|
|
157
|
+
// Insérer avant l'élément cible
|
|
158
|
+
el.parentNode?.insertBefore(this.normalizeContent(content), el);
|
|
159
|
+
callback?.({
|
|
160
|
+
fragment: content,
|
|
161
|
+
be: be(el),
|
|
162
|
+
root: this.beElement
|
|
163
|
+
});
|
|
164
|
+
});
|
|
150
165
|
return this.beElement;
|
|
151
166
|
}
|
|
152
167
|
beforeEnd(content, callback) {
|
|
153
|
-
this.
|
|
168
|
+
this.beElement.eachNode((el) => {
|
|
169
|
+
// Insérer à la fin de l'élément cible
|
|
170
|
+
el.appendChild(this.normalizeContent(content));
|
|
171
|
+
callback?.({
|
|
172
|
+
fragment: content,
|
|
173
|
+
be: be(el),
|
|
174
|
+
root: this.beElement
|
|
175
|
+
});
|
|
176
|
+
});
|
|
154
177
|
return this.beElement;
|
|
155
178
|
}
|
|
156
179
|
replace(content, callback) {
|
|
157
180
|
const ret = [];
|
|
158
181
|
this.beElement.eachNode((el) => {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
el.replaceWith(child);
|
|
163
|
-
});
|
|
182
|
+
const normalizedContent = this.normalizeContent(content);
|
|
183
|
+
if (normalizedContent instanceof DocumentFragment) {
|
|
184
|
+
el.replaceWith(...normalizedContent.childNodes);
|
|
164
185
|
}
|
|
165
186
|
else {
|
|
166
|
-
ret.push(
|
|
167
|
-
el.replaceWith(
|
|
187
|
+
ret.push(normalizedContent);
|
|
188
|
+
el.replaceWith(normalizedContent);
|
|
168
189
|
}
|
|
169
190
|
});
|
|
170
191
|
callback?.({
|
|
@@ -223,8 +244,74 @@ export class DomHandler {
|
|
|
223
244
|
return this.beElement;
|
|
224
245
|
}
|
|
225
246
|
adjacentElement(element, content, mode) {
|
|
226
|
-
|
|
227
|
-
|
|
247
|
+
const normalizedContent = this.normalizeContent(content);
|
|
248
|
+
if (typeof content === 'string') {
|
|
249
|
+
// Si le contenu est une chaîne HTML, utilisez insertAdjacentHTML
|
|
250
|
+
element.insertAdjacentHTML(mode, content);
|
|
251
|
+
}
|
|
252
|
+
else if (normalizedContent instanceof HTMLElement) {
|
|
253
|
+
// Si le contenu est un élément DOM, utilisez insertAdjacentElement
|
|
254
|
+
if (mode === 'afterend') {
|
|
255
|
+
element.parentNode?.insertBefore(normalizedContent, element.nextSibling);
|
|
256
|
+
}
|
|
257
|
+
else if (mode === 'beforebegin') {
|
|
258
|
+
element.parentNode?.insertBefore(normalizedContent, element);
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
element.insertAdjacentElement(mode, normalizedContent);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
else if (normalizedContent instanceof DocumentFragment) {
|
|
265
|
+
// Si le contenu est un fragment, insérez chaque nœud
|
|
266
|
+
Array.from(normalizedContent.childNodes).forEach((node) => {
|
|
267
|
+
if (mode === 'afterbegin' || mode === 'beforeend') {
|
|
268
|
+
element.appendChild(node);
|
|
269
|
+
}
|
|
270
|
+
else if (mode === 'afterend') {
|
|
271
|
+
element.parentNode?.insertBefore(node, element.nextSibling);
|
|
272
|
+
}
|
|
273
|
+
else if (mode === 'beforebegin') {
|
|
274
|
+
element.parentNode?.insertBefore(node, element);
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
normalizeContent(content) {
|
|
280
|
+
if (typeof content === 'string') {
|
|
281
|
+
// Si le contenu est une chaîne HTML, créez un fragment DOM
|
|
282
|
+
const template = document.createElement('template');
|
|
283
|
+
template.innerHTML = content.trim();
|
|
284
|
+
return template.content;
|
|
285
|
+
}
|
|
286
|
+
else if (content instanceof Be) {
|
|
287
|
+
// Si le contenu est une instance de Be, utilisez son premier nœud
|
|
288
|
+
if (Array.isArray(content.node)) {
|
|
289
|
+
const fragment = document.createDocumentFragment();
|
|
290
|
+
content.node.forEach((node) => {
|
|
291
|
+
if (node instanceof HTMLElement) {
|
|
292
|
+
fragment.appendChild(node);
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
return fragment;
|
|
296
|
+
}
|
|
297
|
+
else if (content.node instanceof HTMLElement) {
|
|
298
|
+
return content.node;
|
|
299
|
+
}
|
|
300
|
+
throw new Error('Invalid Be instance: no valid node found.');
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
// Sinon, le contenu est déjà un HTMLElement
|
|
304
|
+
return content;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
insertContent(el, content, mode) {
|
|
308
|
+
const normalizedContent = this.normalizeContent(content);
|
|
309
|
+
if (mode === 'afterEnd') {
|
|
310
|
+
el.parentNode?.insertBefore(normalizedContent, el.nextSibling);
|
|
311
|
+
}
|
|
312
|
+
else if (mode === 'beforeEnd') {
|
|
313
|
+
el.appendChild(normalizedContent);
|
|
314
|
+
}
|
|
228
315
|
}
|
|
229
316
|
valueOf() {
|
|
230
317
|
if (this.beElement.isWhat !== 'element')
|
|
@@ -23,6 +23,7 @@ export declare class PositionHandler implements CommonHandler<PositionHandler, P
|
|
|
23
23
|
private beElement;
|
|
24
24
|
static methods: positionMethods[];
|
|
25
25
|
constructor(beElement: Be);
|
|
26
|
+
methods: string[] | keyof PositionHandler;
|
|
26
27
|
handle(actions: PositionHandlerHandle): Be;
|
|
27
28
|
/**
|
|
28
29
|
* Clones the position of a source element to this element.
|
package/dist/modules/position.js
CHANGED
|
@@ -12,6 +12,7 @@ export class PositionHandler {
|
|
|
12
12
|
constructor(beElement) {
|
|
13
13
|
this.beElement = beElement;
|
|
14
14
|
}
|
|
15
|
+
methods = PositionHandler.methods;
|
|
15
16
|
handle(actions) {
|
|
16
17
|
Object.entries(actions).forEach(([method, props]) => {
|
|
17
18
|
switch (method) {
|
|
@@ -141,11 +142,8 @@ export class PositionHandler {
|
|
|
141
142
|
const sourceRect = this.beElement.inputNode.getBoundingClientRect();
|
|
142
143
|
const targetRect = targetEl.getBoundingClientRect();
|
|
143
144
|
const { sourceAnchor, targetAnchor, offset = { x: 0, y: 0 } } = options;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
[sourceX, sourceY] = BeUtils.calculateAnchorPoint(sourceRect, sourceAnchor);
|
|
147
|
-
// Calculate target anchor point
|
|
148
|
-
[targetX, targetY] = BeUtils.calculateAnchorPoint(targetRect, targetAnchor);
|
|
145
|
+
const [sourceX, sourceY] = BeUtils.calculateAnchorPoint(sourceRect, sourceAnchor);
|
|
146
|
+
const [targetX, targetY] = BeUtils.calculateAnchorPoint(targetRect, targetAnchor);
|
|
149
147
|
// Calculate final position
|
|
150
148
|
const x = targetX - sourceX + offset.x;
|
|
151
149
|
const y = targetY - sourceY + offset.y;
|
package/dist/modules/props.d.ts
CHANGED
|
@@ -17,7 +17,8 @@ export interface PropsHandlerHandle {
|
|
|
17
17
|
export declare class PropsHandler implements CommonHandler<PropsHandler, PropsHandlerHandle> {
|
|
18
18
|
private beElement;
|
|
19
19
|
static methods: PropsMethods[];
|
|
20
|
-
constructor(
|
|
20
|
+
constructor(beElement: Be);
|
|
21
|
+
methods: (keyof PropsHandler)[];
|
|
21
22
|
handle(actions: PropsHandlerHandle): Be;
|
|
22
23
|
get(name: string, callback?: HandlerCallBackFn): any;
|
|
23
24
|
set(nameOrObject: string | Record<string, any>, value?: any, callback?: HandlerCallBackFn): Be;
|
package/dist/modules/props.js
CHANGED
|
@@ -9,9 +9,10 @@ var PropsMethods;
|
|
|
9
9
|
export class PropsHandler {
|
|
10
10
|
beElement;
|
|
11
11
|
static methods = Object.values(PropsMethods);
|
|
12
|
-
constructor(
|
|
13
|
-
this.beElement =
|
|
12
|
+
constructor(beElement) {
|
|
13
|
+
this.beElement = beElement;
|
|
14
14
|
}
|
|
15
|
+
methods = PropsHandler.methods;
|
|
15
16
|
handle(actions) {
|
|
16
17
|
if (!actions)
|
|
17
18
|
return this.beElement;
|
package/dist/modules/styles.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export type BeStylesHandlerMethods = keyof typeof beStyleMethods;
|
|
|
14
14
|
export declare class StylesHandler implements CommonHandler<StylesHandler> {
|
|
15
15
|
private beElement;
|
|
16
16
|
constructor(beElement: Be);
|
|
17
|
+
methods: string[];
|
|
18
|
+
valueOf(): string;
|
|
17
19
|
static methods: beStyleMethods[];
|
|
18
20
|
handle(actions: BeStylesHandler): Be;
|
|
19
21
|
private resolveIndirection;
|
package/dist/modules/styles.js
CHANGED
|
@@ -10,10 +10,14 @@ export class StylesHandler {
|
|
|
10
10
|
constructor(beElement) {
|
|
11
11
|
this.beElement = beElement;
|
|
12
12
|
}
|
|
13
|
+
methods = Object.keys(beStyleMethods);
|
|
14
|
+
valueOf() {
|
|
15
|
+
return `[StylesHandler: ${this.methods.join(', ')}]`;
|
|
16
|
+
}
|
|
13
17
|
static methods = Object.values(beStyleMethods);
|
|
14
18
|
handle(actions) {
|
|
15
19
|
const { method, args } = this.resolveIndirection(actions);
|
|
16
|
-
this.beElement.eachNode((
|
|
20
|
+
this.beElement.eachNode(() => {
|
|
17
21
|
switch (method) {
|
|
18
22
|
case 'set':
|
|
19
23
|
if (typeof args === 'string') {
|
|
@@ -37,7 +41,7 @@ export class StylesHandler {
|
|
|
37
41
|
}
|
|
38
42
|
break;
|
|
39
43
|
case 'get':
|
|
40
|
-
|
|
44
|
+
this.get(args);
|
|
41
45
|
break;
|
|
42
46
|
case 'unset':
|
|
43
47
|
this.unset(args);
|
|
@@ -47,15 +51,16 @@ export class StylesHandler {
|
|
|
47
51
|
return this.beElement;
|
|
48
52
|
}
|
|
49
53
|
resolveIndirection(actions) {
|
|
50
|
-
let method;
|
|
54
|
+
let method = 'get'; // Default to 'get' or any valid method
|
|
51
55
|
let args;
|
|
52
56
|
Object.keys(actions).forEach((action) => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
const actionKey = action;
|
|
58
|
+
if (StylesHandler.methods.includes(actionKey)) {
|
|
59
|
+
method = actionKey;
|
|
60
|
+
args = actions[actionKey];
|
|
56
61
|
}
|
|
57
62
|
});
|
|
58
|
-
return { method, args };
|
|
63
|
+
return { method: method, args };
|
|
59
64
|
}
|
|
60
65
|
/**
|
|
61
66
|
* setStyle Sets one or more CSS styles for the selected element(s), including CSS custom properties.
|
|
@@ -92,7 +97,9 @@ export class StylesHandler {
|
|
|
92
97
|
get(key) {
|
|
93
98
|
let css = null;
|
|
94
99
|
this.beElement.eachNode((el) => {
|
|
100
|
+
// Prioritize inline styles
|
|
95
101
|
css = el.style[key] || null;
|
|
102
|
+
// Fallback to computed styles if inline style is not set
|
|
96
103
|
if (!css) {
|
|
97
104
|
const computedStyle = window.getComputedStyle(el);
|
|
98
105
|
css = computedStyle.getPropertyValue(key).trim();
|
|
@@ -109,9 +116,8 @@ export class StylesHandler {
|
|
|
109
116
|
}
|
|
110
117
|
applyStyle(property, value) {
|
|
111
118
|
this.beElement.eachNode((el) => {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
// console.log(`Setting style ${property}: ${value}`);
|
|
119
|
+
const kebabProperty = toKebabCase(property);
|
|
120
|
+
el.style.setProperty(kebabProperty, value);
|
|
115
121
|
});
|
|
116
122
|
}
|
|
117
123
|
getKey(key) {
|
|
@@ -122,3 +128,6 @@ export class StylesHandler {
|
|
|
122
128
|
return value;
|
|
123
129
|
}
|
|
124
130
|
}
|
|
131
|
+
function toKebabCase(property) {
|
|
132
|
+
return property.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
|
133
|
+
}
|
package/dist/modules/text.d.ts
CHANGED
|
@@ -25,17 +25,17 @@ export declare class TextHandler implements CommonHandler<TextHandler> {
|
|
|
25
25
|
private beElement;
|
|
26
26
|
static methods: textMethods[];
|
|
27
27
|
constructor(element: Be);
|
|
28
|
+
methods: string[] | keyof TextHandler;
|
|
28
29
|
get text(): string | null;
|
|
29
30
|
handle(actions: TextHandlerHandle): Be;
|
|
30
|
-
update(content: TextHandlerHandle['update'], callback?: HandlerCallBackFn):
|
|
31
|
-
updateText(content: TextHandlerHandle['updateText'], callback?: HandlerCallBackFn): void;
|
|
31
|
+
update(content: TextHandlerHandle['update'], callback?: HandlerCallBackFn): Be;
|
|
32
32
|
append(content: TextHandlerHandle['append'], callback?: HandlerCallBackFn): Be;
|
|
33
|
-
prepend(content: TextHandlerHandle['prepend'], callback?: HandlerCallBackFn):
|
|
34
|
-
replace(content: TextHandlerHandle['replace'], callback?: HandlerCallBackFn):
|
|
35
|
-
remove(
|
|
36
|
-
clear(
|
|
37
|
-
normalize(
|
|
38
|
-
wrap(content: TextHandlerHandle['wrap'], callback?: HandlerCallBackFn):
|
|
33
|
+
prepend(content: TextHandlerHandle['prepend'], callback?: HandlerCallBackFn): Be;
|
|
34
|
+
replace(content: TextHandlerHandle['replace'], callback?: HandlerCallBackFn): Be;
|
|
35
|
+
remove(callback?: HandlerCallBackFn): Be;
|
|
36
|
+
clear(callback?: HandlerCallBackFn): Be;
|
|
37
|
+
normalize(callback?: HandlerCallBackFn): Be;
|
|
38
|
+
wrap(content: TextHandlerHandle['wrap'], callback?: HandlerCallBackFn): Be;
|
|
39
39
|
valueOf(): string | null;
|
|
40
40
|
}
|
|
41
41
|
export {};
|
package/dist/modules/text.js
CHANGED
|
@@ -17,6 +17,7 @@ export class TextHandler {
|
|
|
17
17
|
constructor(element) {
|
|
18
18
|
this.beElement = element;
|
|
19
19
|
}
|
|
20
|
+
methods = TextHandler.methods;
|
|
20
21
|
get text() {
|
|
21
22
|
if (this.beElement.isWhat !== 'element')
|
|
22
23
|
return null;
|
|
@@ -24,29 +25,57 @@ export class TextHandler {
|
|
|
24
25
|
}
|
|
25
26
|
handle(actions) {
|
|
26
27
|
this.beElement.eachNode((el) => {
|
|
27
|
-
const { method, props } = BeUtils.resolveIndirection(TextHandler, actions);
|
|
28
|
+
const { method, props } = BeUtils.resolveIndirection(new TextHandler(this.beElement), actions);
|
|
28
29
|
switch (method) {
|
|
29
30
|
case 'update':
|
|
30
|
-
|
|
31
|
+
if (typeof props === 'string') {
|
|
32
|
+
el.innerText = props;
|
|
33
|
+
}
|
|
31
34
|
break;
|
|
32
|
-
case 'prepend':
|
|
33
|
-
|
|
35
|
+
case 'prepend':
|
|
36
|
+
if (typeof props === 'string') {
|
|
37
|
+
el.insertAdjacentHTML('afterbegin', props);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
throw new Error('Invalid props for prepend: must be a string.');
|
|
41
|
+
}
|
|
34
42
|
break;
|
|
35
43
|
case 'append':
|
|
36
|
-
|
|
44
|
+
if (typeof props === 'string') {
|
|
45
|
+
el.insertAdjacentHTML('beforeend', props);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
throw new Error('Invalid props for append: must be a string.');
|
|
49
|
+
}
|
|
37
50
|
break;
|
|
38
51
|
case 'replace':
|
|
39
|
-
|
|
52
|
+
if (typeof props === 'string') {
|
|
53
|
+
el.outerHTML = props;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
throw new Error('Invalid props for replace: must be a string.');
|
|
57
|
+
}
|
|
40
58
|
break;
|
|
41
59
|
case 'remove':
|
|
42
60
|
el.remove();
|
|
43
61
|
break;
|
|
44
62
|
case 'clear':
|
|
45
|
-
el.
|
|
63
|
+
el.innerHTML = '';
|
|
46
64
|
break;
|
|
47
65
|
case 'normalize':
|
|
48
66
|
el.normalize();
|
|
49
67
|
break;
|
|
68
|
+
case 'wrap':
|
|
69
|
+
if (typeof props === 'string') {
|
|
70
|
+
const wrapper = document.createElement('div');
|
|
71
|
+
wrapper.innerHTML = props.trim();
|
|
72
|
+
const parent = wrapper.firstElementChild;
|
|
73
|
+
if (parent) {
|
|
74
|
+
el.parentNode?.insertBefore(parent, el);
|
|
75
|
+
parent.appendChild(el);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
break;
|
|
50
79
|
}
|
|
51
80
|
actions?.callback?.({
|
|
52
81
|
fragment: props,
|
|
@@ -57,31 +86,28 @@ export class TextHandler {
|
|
|
57
86
|
return this.beElement;
|
|
58
87
|
}
|
|
59
88
|
update(content, callback) {
|
|
60
|
-
this.handle({ update: content, callback });
|
|
61
|
-
}
|
|
62
|
-
updateText(content, callback) {
|
|
63
|
-
this.handle({ updateText: content, callback });
|
|
89
|
+
return this.handle({ update: content, callback });
|
|
64
90
|
}
|
|
65
91
|
append(content, callback) {
|
|
66
92
|
return this.handle({ append: content, callback });
|
|
67
93
|
}
|
|
68
94
|
prepend(content, callback) {
|
|
69
|
-
this.handle({ prepend: content, callback });
|
|
95
|
+
return this.handle({ prepend: content, callback });
|
|
70
96
|
}
|
|
71
97
|
replace(content, callback) {
|
|
72
|
-
this.handle({ replace: content, callback });
|
|
98
|
+
return this.handle({ replace: content, callback });
|
|
73
99
|
}
|
|
74
|
-
remove(
|
|
75
|
-
this.handle({ remove:
|
|
100
|
+
remove(callback) {
|
|
101
|
+
return this.handle({ remove: undefined, callback });
|
|
76
102
|
}
|
|
77
|
-
clear(
|
|
78
|
-
this.handle({ clear:
|
|
103
|
+
clear(callback) {
|
|
104
|
+
return this.handle({ clear: undefined, callback });
|
|
79
105
|
}
|
|
80
|
-
normalize(
|
|
81
|
-
this.handle({ normalize:
|
|
106
|
+
normalize(callback) {
|
|
107
|
+
return this.handle({ normalize: undefined, callback });
|
|
82
108
|
}
|
|
83
109
|
wrap(content, callback) {
|
|
84
|
-
this.handle({ wrap: content, callback });
|
|
110
|
+
return this.handle({ wrap: content, callback });
|
|
85
111
|
}
|
|
86
112
|
valueOf() {
|
|
87
113
|
if (this.beElement.isWhat !== 'element')
|
package/dist/modules/timers.d.ts
CHANGED
|
@@ -15,10 +15,12 @@ export declare class TimersHandler implements CommonHandler<TimersHandler> {
|
|
|
15
15
|
_timer: NodeJS.Timeout | null;
|
|
16
16
|
_interval: NodeJS.Timeout | null;
|
|
17
17
|
constructor(element: Be);
|
|
18
|
+
methods: string[] | keyof TimersHandler;
|
|
19
|
+
valueOf(): unknown;
|
|
18
20
|
handle(actions: TimerHandlerHandle): Be;
|
|
19
21
|
timeout(value: TimerHandlerHandle['timeout'], callback?: HandlerCallBackFn): Be;
|
|
20
22
|
interval(value: TimerHandlerHandle['interval'], callback?: HandlerCallBackFn): Be;
|
|
21
|
-
clearTimeout(callback?: HandlerCallBackFn):
|
|
22
|
-
clearInterval(callback?: HandlerCallBackFn):
|
|
23
|
+
clearTimeout(callback?: HandlerCallBackFn): Be;
|
|
24
|
+
clearInterval(callback?: HandlerCallBackFn): Be;
|
|
23
25
|
}
|
|
24
26
|
export {};
|
package/dist/modules/timers.js
CHANGED
|
@@ -14,6 +14,14 @@ export class TimersHandler {
|
|
|
14
14
|
constructor(element) {
|
|
15
15
|
this.beElement = element;
|
|
16
16
|
}
|
|
17
|
+
methods = TimersHandler.methods;
|
|
18
|
+
valueOf() {
|
|
19
|
+
return {
|
|
20
|
+
methods: this.methods,
|
|
21
|
+
timer: this._timer,
|
|
22
|
+
interval: this._interval
|
|
23
|
+
};
|
|
24
|
+
}
|
|
17
25
|
handle(actions) {
|
|
18
26
|
if (!actions)
|
|
19
27
|
return this.beElement;
|
|
@@ -32,7 +40,15 @@ export class TimersHandler {
|
|
|
32
40
|
return this.beElement;
|
|
33
41
|
}
|
|
34
42
|
timeout(value, callback) {
|
|
35
|
-
this.beElement.
|
|
43
|
+
this.beElement.BeTimer = setTimeout(() => {
|
|
44
|
+
callback?.({
|
|
45
|
+
method: 'timeout',
|
|
46
|
+
fragment: this.beElement.BeTimer,
|
|
47
|
+
be: this.beElement,
|
|
48
|
+
root: this.beElement
|
|
49
|
+
});
|
|
50
|
+
}, value);
|
|
51
|
+
/* this.beElement.eachNode((el: HTMLElement) => {
|
|
36
52
|
const aug = be(el);
|
|
37
53
|
aug.BeTimer = setTimeout(() => {
|
|
38
54
|
callback?.({
|
|
@@ -42,43 +58,65 @@ export class TimersHandler {
|
|
|
42
58
|
root: this.beElement
|
|
43
59
|
});
|
|
44
60
|
}, value);
|
|
45
|
-
});
|
|
61
|
+
}); */
|
|
46
62
|
return this.beElement;
|
|
47
63
|
}
|
|
48
64
|
interval(value, callback) {
|
|
49
|
-
this.beElement.
|
|
65
|
+
this.beElement.BeInterval = setInterval(() => {
|
|
66
|
+
callback?.({
|
|
67
|
+
method: 'interval',
|
|
68
|
+
fragment: this.beElement.BeInterval,
|
|
69
|
+
be: this.beElement,
|
|
70
|
+
root: this.beElement
|
|
71
|
+
});
|
|
72
|
+
}, value);
|
|
73
|
+
/* this.beElement.eachNode((el: HTMLElement) => {
|
|
50
74
|
const aug = be(el);
|
|
51
|
-
aug.
|
|
75
|
+
aug.BeInterval = setInterval(() => {
|
|
52
76
|
callback?.({
|
|
53
77
|
method: 'interval',
|
|
54
|
-
fragment: aug.
|
|
78
|
+
fragment: aug.BeInterval,
|
|
55
79
|
be: be(el),
|
|
56
80
|
root: this.beElement
|
|
57
81
|
});
|
|
58
82
|
}, value);
|
|
59
|
-
});
|
|
83
|
+
}); */
|
|
60
84
|
return this.beElement;
|
|
61
85
|
}
|
|
62
86
|
clearTimeout(callback) {
|
|
63
|
-
this.beElement
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
87
|
+
clearTimeout(this.beElement?.BeTimer);
|
|
88
|
+
this.beElement.BeTimer = null;
|
|
89
|
+
/* this.beElement.eachNode((el: HTMLElement) => {
|
|
90
|
+
const aug = be(el);
|
|
91
|
+
if (aug.BeTimer !== null) {
|
|
92
|
+
clearTimeout(aug.BeTimer);
|
|
93
|
+
aug.BeTimer = null;
|
|
94
|
+
}
|
|
95
|
+
}); */
|
|
96
|
+
callback?.({
|
|
97
|
+
method: 'clearTimeout',
|
|
98
|
+
fragment: null,
|
|
99
|
+
be: this.beElement,
|
|
100
|
+
root: this.beElement
|
|
71
101
|
});
|
|
102
|
+
return this.beElement;
|
|
72
103
|
}
|
|
73
104
|
clearInterval(callback) {
|
|
74
|
-
this.beElement
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
105
|
+
clearInterval(this.beElement?.BeInterval);
|
|
106
|
+
this.beElement.BeInterval = null;
|
|
107
|
+
/* this.beElement.eachNode((el: HTMLElement) => {
|
|
108
|
+
const aug = be(el);
|
|
109
|
+
if (aug.BeInterval !== null) {
|
|
110
|
+
clearInterval(aug.BeInterval);
|
|
111
|
+
aug.BeInterval = null;
|
|
112
|
+
}
|
|
113
|
+
}); */
|
|
114
|
+
callback?.({
|
|
115
|
+
method: 'clearInterval',
|
|
116
|
+
fragment: null,
|
|
117
|
+
be: this.beElement,
|
|
118
|
+
root: this.beElement
|
|
82
119
|
});
|
|
120
|
+
return this.beElement;
|
|
83
121
|
}
|
|
84
122
|
}
|
package/dist/modules/walk.d.ts
CHANGED
|
@@ -101,6 +101,8 @@ export declare class WalkHandler implements WalkHandlerInterface, CommonHandler<
|
|
|
101
101
|
* @param beElement - The Be element to operate on.
|
|
102
102
|
*/
|
|
103
103
|
constructor(beElement: Be);
|
|
104
|
+
methods: string[];
|
|
105
|
+
valueOf(): unknown;
|
|
104
106
|
/**
|
|
105
107
|
* Handles multiple walk operations.
|
|
106
108
|
* @param actions - The actions to perform.
|
package/dist/modules/walk.js
CHANGED
|
@@ -29,6 +29,10 @@ export class WalkHandler {
|
|
|
29
29
|
constructor(beElement) {
|
|
30
30
|
this.beElement = beElement;
|
|
31
31
|
}
|
|
32
|
+
methods = WalkHandler.methods;
|
|
33
|
+
valueOf() {
|
|
34
|
+
return this.beElement;
|
|
35
|
+
}
|
|
32
36
|
/**
|
|
33
37
|
* Handles multiple walk operations.
|
|
34
38
|
* @param actions - The actions to perform.
|
|
@@ -114,7 +118,6 @@ export class WalkHandler {
|
|
|
114
118
|
this.beElement.eachNode((el) => {
|
|
115
119
|
if (el.parentNode) {
|
|
116
120
|
const siblings = Array.from(el.parentNode.children).filter((child) => child !== el);
|
|
117
|
-
console.log('siblings found:', siblings); // Debug
|
|
118
121
|
ret.push(...siblings.filter((sibling) => !qy || sibling.matches(qy)));
|
|
119
122
|
}
|
|
120
123
|
});
|
|
@@ -188,7 +191,6 @@ export class WalkHandler {
|
|
|
188
191
|
const ret = [];
|
|
189
192
|
this.beElement.eachNode((el) => {
|
|
190
193
|
const found = el.querySelector(qy);
|
|
191
|
-
console.log('find result:', found); // Debug
|
|
192
194
|
if (found)
|
|
193
195
|
ret.push(found);
|
|
194
196
|
});
|
|
@@ -231,7 +233,6 @@ export class WalkHandler {
|
|
|
231
233
|
const ret = [];
|
|
232
234
|
this.beElement.eachNode((el) => {
|
|
233
235
|
const result = this.selectWhile(el, method, qy);
|
|
234
|
-
console.log(`methodize result for ${method}:`, typeof result, result); // Debug
|
|
235
236
|
if (result)
|
|
236
237
|
ret.push(...(Array.isArray(result) ? result : [result]));
|
|
237
238
|
});
|
|
@@ -245,7 +246,7 @@ export class WalkHandler {
|
|
|
245
246
|
return resultBe;
|
|
246
247
|
}
|
|
247
248
|
catch (e) {
|
|
248
|
-
console.error(`Error in methodize for ${method}:`, e);
|
|
249
|
+
console.error(`Error in methodize for ${method}:`, e);
|
|
249
250
|
}
|
|
250
251
|
return this.beElement;
|
|
251
252
|
};
|
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.82.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",
|