@medyll/idae-be 0.82.0 → 0.83.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 +2 -5
- package/dist/be.js +2 -10
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/modules/attrs.js +1 -1
- package/dist/modules/text.js +3 -3
- package/dist/modules/timers.d.ts +1 -2
- package/dist/modules/timers.js +14 -12
- package/package.json +1 -1
- package/dist/modules/props.d.ts +0 -29
- package/dist/modules/props.js +0 -68
package/dist/be.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import type { IsWhat } from './types.js';
|
|
|
4
4
|
import { type DataHandlerHandle, DataHandler } from './modules/data.js';
|
|
5
5
|
import { EventsHandler, type EventHandlerHandle } from './modules/events.js';
|
|
6
6
|
import { type ClassHandlerHandler, ClassesHandler } from './modules/classes.js';
|
|
7
|
-
import { type PropsHandlerHandle } from './modules/props.js';
|
|
8
7
|
import { DomHandler, type DomHandlerHandle } from './modules/dom.js';
|
|
9
8
|
import { PositionHandler, type PositionHandlerHandle } from './modules/position.js';
|
|
10
9
|
import { WalkHandler } from './modules/walk.js';
|
|
@@ -13,15 +12,13 @@ import { TimersHandler } from './modules/timers.js';
|
|
|
13
12
|
export declare class Be {
|
|
14
13
|
inputNode: HTMLElement | HTMLElement[] | string;
|
|
15
14
|
isWhat: IsWhat;
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
timerOut: NodeJS.Timeout | null;
|
|
16
|
+
timerInterval: NodeJS.Timeout | null;
|
|
18
17
|
styles: (actions: BeStylesHandler) => Be;
|
|
19
18
|
private styleHandler;
|
|
20
19
|
setStyle: StylesHandler['set'];
|
|
21
20
|
getStyle: StylesHandler['get'];
|
|
22
21
|
unsetStyle: StylesHandler['unset'];
|
|
23
|
-
props: (actions: PropsHandlerHandle) => Be;
|
|
24
|
-
private propHandler;
|
|
25
22
|
data: (actions: DataHandlerHandle) => Be;
|
|
26
23
|
private dataHandler;
|
|
27
24
|
setData: DataHandler['set'];
|
package/dist/be.js
CHANGED
|
@@ -4,7 +4,6 @@ import { BeUtils } from './utils.js';
|
|
|
4
4
|
import { DataHandler } from './modules/data.js';
|
|
5
5
|
import { EventsHandler } from './modules/events.js';
|
|
6
6
|
import { ClassesHandler } from './modules/classes.js';
|
|
7
|
-
import { PropsHandler } from './modules/props.js';
|
|
8
7
|
import { DomHandler } from './modules/dom.js';
|
|
9
8
|
import { PositionHandler } from './modules/position.js';
|
|
10
9
|
import { WalkHandler } from './modules/walk.js';
|
|
@@ -14,17 +13,14 @@ export class Be {
|
|
|
14
13
|
inputNode;
|
|
15
14
|
isWhat;
|
|
16
15
|
//
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
timerOut = null;
|
|
17
|
+
timerInterval = null;
|
|
19
18
|
// styles
|
|
20
19
|
styles;
|
|
21
20
|
styleHandler;
|
|
22
21
|
setStyle;
|
|
23
22
|
getStyle;
|
|
24
23
|
unsetStyle;
|
|
25
|
-
// properties
|
|
26
|
-
props;
|
|
27
|
-
propHandler;
|
|
28
24
|
// dataSet
|
|
29
25
|
data;
|
|
30
26
|
dataHandler;
|
|
@@ -120,10 +116,6 @@ export class Be {
|
|
|
120
116
|
this.styleHandler = new StylesHandler(this);
|
|
121
117
|
this.styles = this.handle(this.styleHandler);
|
|
122
118
|
this.attach(StylesHandler, 'Style');
|
|
123
|
-
// properties
|
|
124
|
-
this.propHandler = new PropsHandler(this);
|
|
125
|
-
this.props = this.handle(this.styleHandler);
|
|
126
|
-
this.attach(PropsHandler, 'Prop');
|
|
127
119
|
// dataSet
|
|
128
120
|
this.dataHandler = new DataHandler(this);
|
|
129
121
|
this.data = this.handle(this.styleHandler);
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ export * from './modules/walk.js';
|
|
|
5
5
|
export * from './modules/timers.js';
|
|
6
6
|
export * from './modules/text.js';
|
|
7
7
|
export * from './modules/styles.js';
|
|
8
|
-
export * from './modules/props.js';
|
|
9
8
|
export * from './modules/position.js';
|
|
10
9
|
export * from './modules/events.js';
|
|
11
10
|
export * from './modules/dom.js';
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,6 @@ export * from './modules/walk.js';
|
|
|
6
6
|
export * from './modules/timers.js';
|
|
7
7
|
export * from './modules/text.js';
|
|
8
8
|
export * from './modules/styles.js';
|
|
9
|
-
export * from './modules/props.js';
|
|
10
9
|
export * from './modules/position.js';
|
|
11
10
|
export * from './modules/events.js';
|
|
12
11
|
export * from './modules/dom.js';
|
package/dist/modules/attrs.js
CHANGED
|
@@ -47,7 +47,7 @@ export class AttrHandler {
|
|
|
47
47
|
el.removeAttribute(nameOrObject);
|
|
48
48
|
}
|
|
49
49
|
else if (typeof nameOrObject === 'object') {
|
|
50
|
-
Object.entries(nameOrObject).forEach(([name
|
|
50
|
+
Object.entries(nameOrObject).forEach(([name]) => {
|
|
51
51
|
el.removeAttribute(name);
|
|
52
52
|
});
|
|
53
53
|
}
|
package/dist/modules/text.js
CHANGED
|
@@ -34,7 +34,7 @@ export class TextHandler {
|
|
|
34
34
|
break;
|
|
35
35
|
case 'prepend':
|
|
36
36
|
if (typeof props === 'string') {
|
|
37
|
-
el.
|
|
37
|
+
el.insertAdjacentText('afterbegin', props);
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
40
|
throw new Error('Invalid props for prepend: must be a string.');
|
|
@@ -42,7 +42,7 @@ export class TextHandler {
|
|
|
42
42
|
break;
|
|
43
43
|
case 'append':
|
|
44
44
|
if (typeof props === 'string') {
|
|
45
|
-
el.
|
|
45
|
+
el.insertAdjacentText('beforeend', props);
|
|
46
46
|
}
|
|
47
47
|
else {
|
|
48
48
|
throw new Error('Invalid props for append: must be a string.');
|
|
@@ -50,7 +50,7 @@ export class TextHandler {
|
|
|
50
50
|
break;
|
|
51
51
|
case 'replace':
|
|
52
52
|
if (typeof props === 'string') {
|
|
53
|
-
el.
|
|
53
|
+
el.textContent = props;
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
56
|
throw new Error('Invalid props for replace: must be a string.');
|
package/dist/modules/timers.d.ts
CHANGED
|
@@ -10,10 +10,9 @@ type cd = Record<'timeout' | 'interval', number> & HandlerCallBack;
|
|
|
10
10
|
type cds = Record<'clearTimeout' | 'clearInterval', HandlerCallBackFn>;
|
|
11
11
|
type TimerHandlerHandle = cd & cds;
|
|
12
12
|
export declare class TimersHandler implements CommonHandler<TimersHandler> {
|
|
13
|
+
#private;
|
|
13
14
|
private beElement;
|
|
14
15
|
static methods: timersMethods[];
|
|
15
|
-
_timer: NodeJS.Timeout | null;
|
|
16
|
-
_interval: NodeJS.Timeout | null;
|
|
17
16
|
constructor(element: Be);
|
|
18
17
|
methods: string[] | keyof TimersHandler;
|
|
19
18
|
valueOf(): unknown;
|
package/dist/modules/timers.js
CHANGED
|
@@ -9,8 +9,8 @@ var timersMethods;
|
|
|
9
9
|
export class TimersHandler {
|
|
10
10
|
beElement;
|
|
11
11
|
static methods = Object.values(timersMethods);
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
#timer = null;
|
|
13
|
+
#interval = null;
|
|
14
14
|
constructor(element) {
|
|
15
15
|
this.beElement = element;
|
|
16
16
|
}
|
|
@@ -18,8 +18,8 @@ export class TimersHandler {
|
|
|
18
18
|
valueOf() {
|
|
19
19
|
return {
|
|
20
20
|
methods: this.methods,
|
|
21
|
-
timer: this
|
|
22
|
-
interval: this
|
|
21
|
+
timer: this.#timer,
|
|
22
|
+
interval: this.#interval
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
handle(actions) {
|
|
@@ -40,10 +40,10 @@ export class TimersHandler {
|
|
|
40
40
|
return this.beElement;
|
|
41
41
|
}
|
|
42
42
|
timeout(value, callback) {
|
|
43
|
-
this.beElement.
|
|
43
|
+
this.beElement.timerOut = setTimeout(() => {
|
|
44
44
|
callback?.({
|
|
45
45
|
method: 'timeout',
|
|
46
|
-
fragment: this.beElement.
|
|
46
|
+
fragment: this.beElement.timerOut,
|
|
47
47
|
be: this.beElement,
|
|
48
48
|
root: this.beElement
|
|
49
49
|
});
|
|
@@ -62,10 +62,10 @@ export class TimersHandler {
|
|
|
62
62
|
return this.beElement;
|
|
63
63
|
}
|
|
64
64
|
interval(value, callback) {
|
|
65
|
-
this.beElement.
|
|
65
|
+
this.beElement.timerInterval = setInterval(() => {
|
|
66
66
|
callback?.({
|
|
67
67
|
method: 'interval',
|
|
68
|
-
fragment: this.beElement.
|
|
68
|
+
fragment: this.beElement.timerInterval,
|
|
69
69
|
be: this.beElement,
|
|
70
70
|
root: this.beElement
|
|
71
71
|
});
|
|
@@ -84,8 +84,9 @@ export class TimersHandler {
|
|
|
84
84
|
return this.beElement;
|
|
85
85
|
}
|
|
86
86
|
clearTimeout(callback) {
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
if (this.beElement.timerOut)
|
|
88
|
+
clearTimeout(this.beElement.timerOut);
|
|
89
|
+
this.beElement.timerOut = null;
|
|
89
90
|
/* this.beElement.eachNode((el: HTMLElement) => {
|
|
90
91
|
const aug = be(el);
|
|
91
92
|
if (aug.BeTimer !== null) {
|
|
@@ -102,8 +103,9 @@ export class TimersHandler {
|
|
|
102
103
|
return this.beElement;
|
|
103
104
|
}
|
|
104
105
|
clearInterval(callback) {
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
if (this.beElement.timerInterval)
|
|
107
|
+
clearInterval(this.beElement.timerInterval);
|
|
108
|
+
this.beElement.timerInterval = null;
|
|
107
109
|
/* this.beElement.eachNode((el: HTMLElement) => {
|
|
108
110
|
const aug = be(el);
|
|
109
111
|
if (aug.BeInterval !== null) {
|
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.83.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",
|
package/dist/modules/props.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Be } from '../be.js';
|
|
2
|
-
import type { CommonHandler, HandlerCallBack, HandlerCallBackFn } from '../types.js';
|
|
3
|
-
declare enum PropsMethods {
|
|
4
|
-
set = "set",
|
|
5
|
-
get = "get",
|
|
6
|
-
delete = "delete",
|
|
7
|
-
getKey = "getKey"
|
|
8
|
-
}
|
|
9
|
-
export interface PropsHandlerHandle {
|
|
10
|
-
set?: {
|
|
11
|
-
[key: string]: unknown;
|
|
12
|
-
} & HandlerCallBack;
|
|
13
|
-
delete?: {
|
|
14
|
-
keys: string[];
|
|
15
|
-
} & HandlerCallBack;
|
|
16
|
-
}
|
|
17
|
-
export declare class PropsHandler implements CommonHandler<PropsHandler, PropsHandlerHandle> {
|
|
18
|
-
private beElement;
|
|
19
|
-
static methods: PropsMethods[];
|
|
20
|
-
constructor(beElement: Be);
|
|
21
|
-
methods: (keyof PropsHandler)[];
|
|
22
|
-
handle(actions: PropsHandlerHandle): Be;
|
|
23
|
-
get(name: string, callback?: HandlerCallBackFn): any;
|
|
24
|
-
set(nameOrObject: string | Record<string, any>, value?: any, callback?: HandlerCallBackFn): Be;
|
|
25
|
-
delete(name: string, callback?: HandlerCallBackFn): Be;
|
|
26
|
-
getKey(key: string, callback?: HandlerCallBackFn): string | null;
|
|
27
|
-
valueOf(): Record<string, any> | null;
|
|
28
|
-
}
|
|
29
|
-
export {};
|
package/dist/modules/props.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { Be } from '../be.js';
|
|
2
|
-
var PropsMethods;
|
|
3
|
-
(function (PropsMethods) {
|
|
4
|
-
PropsMethods["set"] = "set";
|
|
5
|
-
PropsMethods["get"] = "get";
|
|
6
|
-
PropsMethods["delete"] = "delete";
|
|
7
|
-
PropsMethods["getKey"] = "getKey";
|
|
8
|
-
})(PropsMethods || (PropsMethods = {}));
|
|
9
|
-
export class PropsHandler {
|
|
10
|
-
beElement;
|
|
11
|
-
static methods = Object.values(PropsMethods);
|
|
12
|
-
constructor(beElement) {
|
|
13
|
-
this.beElement = beElement;
|
|
14
|
-
}
|
|
15
|
-
methods = PropsHandler.methods;
|
|
16
|
-
handle(actions) {
|
|
17
|
-
if (!actions)
|
|
18
|
-
return this.beElement;
|
|
19
|
-
Object.entries(actions).forEach(([method, props]) => {
|
|
20
|
-
switch (method) {
|
|
21
|
-
case 'set':
|
|
22
|
-
{
|
|
23
|
-
const [key, val] = Object.entries(props)[0];
|
|
24
|
-
this.set(key, val, props.callback);
|
|
25
|
-
}
|
|
26
|
-
break;
|
|
27
|
-
case 'delete':
|
|
28
|
-
this.delete(props.delete);
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
return this.beElement;
|
|
33
|
-
}
|
|
34
|
-
get(name, callback) {
|
|
35
|
-
if (this.beElement.isWhat !== 'element')
|
|
36
|
-
return null;
|
|
37
|
-
return this.beElement.inputNode[name];
|
|
38
|
-
}
|
|
39
|
-
set(nameOrObject, value, callback) {
|
|
40
|
-
this.beElement.eachNode((el) => {
|
|
41
|
-
if (typeof nameOrObject === 'string' && value !== undefined) {
|
|
42
|
-
el[nameOrObject] = value;
|
|
43
|
-
}
|
|
44
|
-
else if (typeof nameOrObject === 'object') {
|
|
45
|
-
Object.entries(nameOrObject).forEach(([name, val]) => {
|
|
46
|
-
el[name] = val;
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
return this.beElement;
|
|
51
|
-
}
|
|
52
|
-
delete(name, callback) { }
|
|
53
|
-
getKey(key, callback) {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
valueOf() {
|
|
57
|
-
if (this.beElement.isWhat !== 'element')
|
|
58
|
-
return null;
|
|
59
|
-
const el = this.beElement.inputNode;
|
|
60
|
-
const props = {};
|
|
61
|
-
for (let prop in el) {
|
|
62
|
-
if (el.hasOwnProperty(prop)) {
|
|
63
|
-
props[prop] = el[prop];
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return props;
|
|
67
|
-
}
|
|
68
|
-
}
|