@bquery/bquery 1.0.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/LICENSE.md +21 -0
- package/README.md +266 -0
- package/dist/component/index.d.ts +155 -0
- package/dist/component/index.d.ts.map +1 -0
- package/dist/component.es.mjs +128 -0
- package/dist/component.es.mjs.map +1 -0
- package/dist/core/collection.d.ts +198 -0
- package/dist/core/collection.d.ts.map +1 -0
- package/dist/core/element.d.ts +301 -0
- package/dist/core/element.d.ts.map +1 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/selector.d.ts +11 -0
- package/dist/core/selector.d.ts.map +1 -0
- package/dist/core/shared.d.ts +7 -0
- package/dist/core/shared.d.ts.map +1 -0
- package/dist/core/utils.d.ts +300 -0
- package/dist/core/utils.d.ts.map +1 -0
- package/dist/core.es.mjs +1015 -0
- package/dist/core.es.mjs.map +1 -0
- package/dist/full.d.ts +48 -0
- package/dist/full.d.ts.map +1 -0
- package/dist/full.es.mjs +43 -0
- package/dist/full.es.mjs.map +1 -0
- package/dist/full.iife.js +2 -0
- package/dist/full.iife.js.map +1 -0
- package/dist/full.umd.js +2 -0
- package/dist/full.umd.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es.mjs +43 -0
- package/dist/index.es.mjs.map +1 -0
- package/dist/motion/index.d.ts +145 -0
- package/dist/motion/index.d.ts.map +1 -0
- package/dist/motion.es.mjs +104 -0
- package/dist/motion.es.mjs.map +1 -0
- package/dist/platform/buckets.d.ts +44 -0
- package/dist/platform/buckets.d.ts.map +1 -0
- package/dist/platform/cache.d.ts +71 -0
- package/dist/platform/cache.d.ts.map +1 -0
- package/dist/platform/index.d.ts +15 -0
- package/dist/platform/index.d.ts.map +1 -0
- package/dist/platform/notifications.d.ts +52 -0
- package/dist/platform/notifications.d.ts.map +1 -0
- package/dist/platform/storage.d.ts +69 -0
- package/dist/platform/storage.d.ts.map +1 -0
- package/dist/platform.es.mjs +245 -0
- package/dist/platform.es.mjs.map +1 -0
- package/dist/reactive/index.d.ts +8 -0
- package/dist/reactive/index.d.ts.map +1 -0
- package/dist/reactive/signal.d.ts +204 -0
- package/dist/reactive/signal.d.ts.map +1 -0
- package/dist/reactive.es.mjs +123 -0
- package/dist/reactive.es.mjs.map +1 -0
- package/dist/security/index.d.ts +8 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/sanitize.d.ts +99 -0
- package/dist/security/sanitize.d.ts.map +1 -0
- package/dist/security.es.mjs +194 -0
- package/dist/security.es.mjs.map +1 -0
- package/package.json +120 -0
- package/src/component/index.ts +360 -0
- package/src/core/collection.ts +339 -0
- package/src/core/element.ts +493 -0
- package/src/core/index.ts +4 -0
- package/src/core/selector.ts +29 -0
- package/src/core/shared.ts +13 -0
- package/src/core/utils.ts +425 -0
- package/src/full.ts +101 -0
- package/src/index.ts +27 -0
- package/src/motion/index.ts +365 -0
- package/src/platform/buckets.ts +115 -0
- package/src/platform/cache.ts +130 -0
- package/src/platform/index.ts +18 -0
- package/src/platform/notifications.ts +87 -0
- package/src/platform/storage.ts +208 -0
- package/src/reactive/index.ts +9 -0
- package/src/reactive/signal.ts +347 -0
- package/src/security/index.ts +18 -0
- package/src/security/sanitize.ts +446 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { BQueryElement } from './element';
|
|
2
|
+
/**
|
|
3
|
+
* Wrapper for multiple DOM elements.
|
|
4
|
+
* Provides batch operations on a collection of elements with chainable API.
|
|
5
|
+
*
|
|
6
|
+
* This class enables jQuery-like operations across multiple elements:
|
|
7
|
+
* - All mutating methods apply to every element in the collection
|
|
8
|
+
* - Getter methods return data from the first element
|
|
9
|
+
* - Supports iteration via forEach, map, filter, and reduce
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* $$('.items')
|
|
14
|
+
* .addClass('highlight')
|
|
15
|
+
* .css({ opacity: '0.8' })
|
|
16
|
+
* .on('click', () => console.log('clicked'));
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare class BQueryCollection {
|
|
20
|
+
readonly elements: Element[];
|
|
21
|
+
/**
|
|
22
|
+
* Creates a new collection wrapper.
|
|
23
|
+
* @param elements - Array of DOM elements to wrap
|
|
24
|
+
*/
|
|
25
|
+
constructor(elements: Element[]);
|
|
26
|
+
/**
|
|
27
|
+
* Gets the number of elements in the collection.
|
|
28
|
+
*/
|
|
29
|
+
get length(): number;
|
|
30
|
+
/**
|
|
31
|
+
* Gets the first element in the collection, if any.
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
private first;
|
|
35
|
+
/**
|
|
36
|
+
* Gets a single element as a BQueryElement wrapper.
|
|
37
|
+
*
|
|
38
|
+
* @param index - Zero-based index of the element
|
|
39
|
+
* @returns BQueryElement wrapper or undefined if out of range
|
|
40
|
+
*/
|
|
41
|
+
eq(index: number): BQueryElement | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Gets the first element as a BQueryElement wrapper.
|
|
44
|
+
*
|
|
45
|
+
* @returns BQueryElement wrapper or undefined if empty
|
|
46
|
+
*/
|
|
47
|
+
firstEl(): BQueryElement | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Gets the last element as a BQueryElement wrapper.
|
|
50
|
+
*
|
|
51
|
+
* @returns BQueryElement wrapper or undefined if empty
|
|
52
|
+
*/
|
|
53
|
+
lastEl(): BQueryElement | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Iterates over each element in the collection.
|
|
56
|
+
*
|
|
57
|
+
* @param callback - Function to call for each wrapped element
|
|
58
|
+
* @returns The instance for method chaining
|
|
59
|
+
*/
|
|
60
|
+
each(callback: (element: BQueryElement, index: number) => void): this;
|
|
61
|
+
/**
|
|
62
|
+
* Maps each element to a new value.
|
|
63
|
+
*
|
|
64
|
+
* @param callback - Function to transform each element
|
|
65
|
+
* @returns Array of transformed values
|
|
66
|
+
*/
|
|
67
|
+
map<T>(callback: (element: Element, index: number) => T): T[];
|
|
68
|
+
/**
|
|
69
|
+
* Filters elements based on a predicate.
|
|
70
|
+
*
|
|
71
|
+
* @param predicate - Function to test each element
|
|
72
|
+
* @returns New BQueryCollection with matching elements
|
|
73
|
+
*/
|
|
74
|
+
filter(predicate: (element: Element, index: number) => boolean): BQueryCollection;
|
|
75
|
+
/**
|
|
76
|
+
* Reduces the collection to a single value.
|
|
77
|
+
*
|
|
78
|
+
* @param callback - Reducer function
|
|
79
|
+
* @param initialValue - Initial accumulator value
|
|
80
|
+
* @returns Accumulated result
|
|
81
|
+
*/
|
|
82
|
+
reduce<T>(callback: (accumulator: T, element: Element, index: number) => T, initialValue: T): T;
|
|
83
|
+
/**
|
|
84
|
+
* Converts the collection to an array of BQueryElement wrappers.
|
|
85
|
+
*
|
|
86
|
+
* @returns Array of BQueryElement instances
|
|
87
|
+
*/
|
|
88
|
+
toArray(): BQueryElement[];
|
|
89
|
+
/** Add one or more classes to all elements. */
|
|
90
|
+
addClass(...classNames: string[]): this;
|
|
91
|
+
/** Remove one or more classes from all elements. */
|
|
92
|
+
removeClass(...classNames: string[]): this;
|
|
93
|
+
/** Toggle a class on all elements. */
|
|
94
|
+
toggleClass(className: string, force?: boolean): this;
|
|
95
|
+
/**
|
|
96
|
+
* Sets an attribute on all elements or gets from first.
|
|
97
|
+
*
|
|
98
|
+
* @param name - Attribute name
|
|
99
|
+
* @param value - Value to set (optional)
|
|
100
|
+
* @returns Attribute value when getting, instance when setting
|
|
101
|
+
*/
|
|
102
|
+
attr(name: string, value?: string): string | this;
|
|
103
|
+
/**
|
|
104
|
+
* Removes an attribute from all elements.
|
|
105
|
+
*
|
|
106
|
+
* @param name - Attribute name to remove
|
|
107
|
+
* @returns The instance for method chaining
|
|
108
|
+
*/
|
|
109
|
+
removeAttr(name: string): this;
|
|
110
|
+
/**
|
|
111
|
+
* Sets text content on all elements or gets from first.
|
|
112
|
+
*
|
|
113
|
+
* @param value - Text to set (optional)
|
|
114
|
+
* @returns Text content when getting, instance when setting
|
|
115
|
+
*/
|
|
116
|
+
text(value?: string): string | this;
|
|
117
|
+
/**
|
|
118
|
+
* Sets sanitized HTML on all elements or gets from first.
|
|
119
|
+
*
|
|
120
|
+
* @param value - HTML to set (optional, will be sanitized)
|
|
121
|
+
* @returns HTML content when getting, instance when setting
|
|
122
|
+
*/
|
|
123
|
+
html(value?: string): string | this;
|
|
124
|
+
/**
|
|
125
|
+
* Sets HTML on all elements without sanitization.
|
|
126
|
+
*
|
|
127
|
+
* @param value - Raw HTML to set
|
|
128
|
+
* @returns The instance for method chaining
|
|
129
|
+
* @warning Bypasses XSS protection
|
|
130
|
+
*/
|
|
131
|
+
htmlUnsafe(value: string): this;
|
|
132
|
+
/**
|
|
133
|
+
* Applies CSS styles to all elements.
|
|
134
|
+
*
|
|
135
|
+
* @param property - Property name or object of properties
|
|
136
|
+
* @param value - Value when setting single property
|
|
137
|
+
* @returns The instance for method chaining
|
|
138
|
+
*/
|
|
139
|
+
css(property: string | Record<string, string>, value?: string): this;
|
|
140
|
+
/**
|
|
141
|
+
* Shows all elements.
|
|
142
|
+
*
|
|
143
|
+
* @param display - Optional display value (default: '')
|
|
144
|
+
* @returns The instance for method chaining
|
|
145
|
+
*/
|
|
146
|
+
show(display?: string): this;
|
|
147
|
+
/**
|
|
148
|
+
* Hides all elements.
|
|
149
|
+
*
|
|
150
|
+
* @returns The instance for method chaining
|
|
151
|
+
*/
|
|
152
|
+
hide(): this;
|
|
153
|
+
/**
|
|
154
|
+
* Adds an event listener to all elements.
|
|
155
|
+
*
|
|
156
|
+
* @param event - Event type
|
|
157
|
+
* @param handler - Event handler
|
|
158
|
+
* @returns The instance for method chaining
|
|
159
|
+
*/
|
|
160
|
+
on(event: string, handler: EventListenerOrEventListenerObject): this;
|
|
161
|
+
/**
|
|
162
|
+
* Adds a one-time event listener to all elements.
|
|
163
|
+
*
|
|
164
|
+
* @param event - Event type
|
|
165
|
+
* @param handler - Event handler
|
|
166
|
+
* @returns The instance for method chaining
|
|
167
|
+
*/
|
|
168
|
+
once(event: string, handler: EventListener): this;
|
|
169
|
+
/**
|
|
170
|
+
* Removes an event listener from all elements.
|
|
171
|
+
*
|
|
172
|
+
* @param event - Event type
|
|
173
|
+
* @param handler - The handler to remove
|
|
174
|
+
* @returns The instance for method chaining
|
|
175
|
+
*/
|
|
176
|
+
off(event: string, handler: EventListenerOrEventListenerObject): this;
|
|
177
|
+
/**
|
|
178
|
+
* Triggers a custom event on all elements.
|
|
179
|
+
*
|
|
180
|
+
* @param event - Event type
|
|
181
|
+
* @param detail - Optional event detail
|
|
182
|
+
* @returns The instance for method chaining
|
|
183
|
+
*/
|
|
184
|
+
trigger(event: string, detail?: unknown): this;
|
|
185
|
+
/**
|
|
186
|
+
* Removes all elements from the DOM.
|
|
187
|
+
*
|
|
188
|
+
* @returns The instance for method chaining
|
|
189
|
+
*/
|
|
190
|
+
remove(): this;
|
|
191
|
+
/**
|
|
192
|
+
* Clears all child nodes from all elements.
|
|
193
|
+
*
|
|
194
|
+
* @returns The instance for method chaining
|
|
195
|
+
*/
|
|
196
|
+
empty(): this;
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=collection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../src/core/collection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG1C;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,gBAAgB;aAKC,QAAQ,EAAE,OAAO,EAAE;IAJ/C;;;OAGG;gBACyB,QAAQ,EAAE,OAAO,EAAE;IAE/C;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;;OAGG;IACH,OAAO,CAAC,KAAK;IAIb;;;;;OAKG;IACH,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAK5C;;;;OAIG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,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAWnC;;;;;;OAMG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAO/B;;;;;;OAMG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAkBpE;;;;;OAKG;IACH,IAAI,CAAC,OAAO,GAAE,MAAW,GAAG,IAAI;IAQhC;;;;OAIG;IACH,IAAI,IAAI,IAAI;IAOZ;;;;;;OAMG;IACH,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,GAAG,IAAI;IAKpE;;;;;;OAMG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI;IAKjD;;;;;;OAMG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,GAAG,IAAI;IAKrE;;;;;;OAMG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI;IAO9C;;;;OAIG;IACH,MAAM,IAAI,IAAI;IAKd;;;;OAIG;IACH,KAAK,IAAI,IAAI;CAMd"}
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrapper for a single DOM element.
|
|
3
|
+
* Provides a chainable, jQuery-like API for DOM manipulation.
|
|
4
|
+
*
|
|
5
|
+
* This class encapsulates a DOM element and provides methods for:
|
|
6
|
+
* - Class manipulation (addClass, removeClass, toggleClass)
|
|
7
|
+
* - Attribute and property access (attr, prop, data)
|
|
8
|
+
* - Content manipulation (text, html, append, prepend)
|
|
9
|
+
* - Style manipulation (css)
|
|
10
|
+
* - Event handling (on, off, once, trigger)
|
|
11
|
+
* - DOM traversal (find, closest, parent, children, siblings)
|
|
12
|
+
*
|
|
13
|
+
* All mutating methods return `this` for method chaining.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* $('#button')
|
|
18
|
+
* .addClass('active')
|
|
19
|
+
* .css({ color: 'blue' })
|
|
20
|
+
* .on('click', () => console.log('clicked'));
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare class BQueryElement {
|
|
24
|
+
private readonly element;
|
|
25
|
+
/**
|
|
26
|
+
* Creates a new BQueryElement wrapper.
|
|
27
|
+
* @param element - The DOM element to wrap
|
|
28
|
+
*/
|
|
29
|
+
constructor(element: Element);
|
|
30
|
+
/**
|
|
31
|
+
* Exposes the raw DOM element when direct access is needed.
|
|
32
|
+
* Use sparingly; prefer the wrapper methods for consistency.
|
|
33
|
+
*/
|
|
34
|
+
get raw(): Element;
|
|
35
|
+
/**
|
|
36
|
+
* Exposes the underlying DOM element.
|
|
37
|
+
* Provided for spec compatibility and read-only access.
|
|
38
|
+
*/
|
|
39
|
+
get node(): Element;
|
|
40
|
+
/** Add one or more classes. */
|
|
41
|
+
addClass(...classNames: string[]): this;
|
|
42
|
+
/** Remove one or more classes. */
|
|
43
|
+
removeClass(...classNames: string[]): this;
|
|
44
|
+
/** Toggle a class by name. */
|
|
45
|
+
toggleClass(className: string, force?: boolean): this;
|
|
46
|
+
/** Get or set an attribute. */
|
|
47
|
+
attr(name: string, value?: string): string | this;
|
|
48
|
+
/** Get or set a property. */
|
|
49
|
+
prop<T extends keyof Element>(name: T, value?: Element[T]): Element[T] | this;
|
|
50
|
+
/** Read or write data attributes in camelCase. */
|
|
51
|
+
data(name: string, value?: string): string | this;
|
|
52
|
+
/** Get or set text content. */
|
|
53
|
+
text(value?: string): string | this;
|
|
54
|
+
/** Set HTML content using a sanitized string. */
|
|
55
|
+
/**
|
|
56
|
+
* Sets sanitized HTML content on the element.
|
|
57
|
+
* Uses the security module to sanitize input and prevent XSS attacks.
|
|
58
|
+
*
|
|
59
|
+
* @param value - The HTML string to set (will be sanitized)
|
|
60
|
+
* @returns The instance for method chaining
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* $('#content').html('<strong>Hello</strong>');
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
html(value: string): this;
|
|
68
|
+
/**
|
|
69
|
+
* Sets HTML content without sanitization.
|
|
70
|
+
* Use only when you trust the HTML source completely.
|
|
71
|
+
*
|
|
72
|
+
* @param value - The raw HTML string to set
|
|
73
|
+
* @returns The instance for method chaining
|
|
74
|
+
*
|
|
75
|
+
* @warning This method bypasses XSS protection. Use with caution.
|
|
76
|
+
*/
|
|
77
|
+
htmlUnsafe(value: string): this;
|
|
78
|
+
/**
|
|
79
|
+
* Gets or sets CSS styles on the element.
|
|
80
|
+
*
|
|
81
|
+
* @param property - A CSS property name or an object of property-value pairs
|
|
82
|
+
* @param value - The value when setting a single property
|
|
83
|
+
* @returns The instance for method chaining
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* // Single property
|
|
88
|
+
* $('#box').css('color', 'red');
|
|
89
|
+
*
|
|
90
|
+
* // Multiple properties
|
|
91
|
+
* $('#box').css({ color: 'red', 'font-size': '16px' });
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
css(property: string | Record<string, string>, value?: string): this;
|
|
95
|
+
/**
|
|
96
|
+
* Appends HTML or elements to the end of the element.
|
|
97
|
+
*
|
|
98
|
+
* @param content - HTML string or element(s) to append
|
|
99
|
+
* @returns The instance for method chaining
|
|
100
|
+
*/
|
|
101
|
+
append(content: string | Element | Element[]): this;
|
|
102
|
+
/**
|
|
103
|
+
* Prepends HTML or elements to the beginning of the element.
|
|
104
|
+
*
|
|
105
|
+
* @param content - HTML string or element(s) to prepend
|
|
106
|
+
* @returns The instance for method chaining
|
|
107
|
+
*/
|
|
108
|
+
prepend(content: string | Element | Element[]): this;
|
|
109
|
+
/**
|
|
110
|
+
* Inserts content before this element.
|
|
111
|
+
*
|
|
112
|
+
* @param content - HTML string or element(s) to insert
|
|
113
|
+
* @returns The instance for method chaining
|
|
114
|
+
*/
|
|
115
|
+
before(content: string | Element | Element[]): this;
|
|
116
|
+
/**
|
|
117
|
+
* Inserts content after this element.
|
|
118
|
+
*
|
|
119
|
+
* @param content - HTML string or element(s) to insert
|
|
120
|
+
* @returns The instance for method chaining
|
|
121
|
+
*/
|
|
122
|
+
after(content: string | Element | Element[]): this;
|
|
123
|
+
/**
|
|
124
|
+
* Removes the element from the DOM.
|
|
125
|
+
*
|
|
126
|
+
* @returns The instance for method chaining (though element is now detached)
|
|
127
|
+
*/
|
|
128
|
+
remove(): this;
|
|
129
|
+
/**
|
|
130
|
+
* Clears all child nodes from the element.
|
|
131
|
+
*
|
|
132
|
+
* @returns The instance for method chaining
|
|
133
|
+
*/
|
|
134
|
+
empty(): this;
|
|
135
|
+
/**
|
|
136
|
+
* Clones the element, optionally with all descendants.
|
|
137
|
+
*
|
|
138
|
+
* @param deep - If true, clone all descendants (default: true)
|
|
139
|
+
* @returns A new BQueryElement wrapping the cloned element
|
|
140
|
+
*/
|
|
141
|
+
clone(deep?: boolean): BQueryElement;
|
|
142
|
+
/**
|
|
143
|
+
* Finds all descendant elements matching the selector.
|
|
144
|
+
*
|
|
145
|
+
* @param selector - CSS selector to match
|
|
146
|
+
* @returns Array of matching elements
|
|
147
|
+
*/
|
|
148
|
+
find(selector: string): Element[];
|
|
149
|
+
/**
|
|
150
|
+
* Finds the first descendant element matching the selector.
|
|
151
|
+
*
|
|
152
|
+
* @param selector - CSS selector to match
|
|
153
|
+
* @returns The first matching element or null
|
|
154
|
+
*/
|
|
155
|
+
findOne(selector: string): Element | null;
|
|
156
|
+
/**
|
|
157
|
+
* Finds the closest ancestor matching the selector.
|
|
158
|
+
*
|
|
159
|
+
* @param selector - CSS selector to match
|
|
160
|
+
* @returns The matching ancestor or null
|
|
161
|
+
*/
|
|
162
|
+
closest(selector: string): Element | null;
|
|
163
|
+
/**
|
|
164
|
+
* Gets the parent element.
|
|
165
|
+
*
|
|
166
|
+
* @returns The parent element or null
|
|
167
|
+
*/
|
|
168
|
+
parent(): Element | null;
|
|
169
|
+
/**
|
|
170
|
+
* Gets all child elements.
|
|
171
|
+
*
|
|
172
|
+
* @returns Array of child elements
|
|
173
|
+
*/
|
|
174
|
+
children(): Element[];
|
|
175
|
+
/**
|
|
176
|
+
* Gets all sibling elements.
|
|
177
|
+
*
|
|
178
|
+
* @returns Array of sibling elements (excluding this element)
|
|
179
|
+
*/
|
|
180
|
+
siblings(): Element[];
|
|
181
|
+
/**
|
|
182
|
+
* Gets the next sibling element.
|
|
183
|
+
*
|
|
184
|
+
* @returns The next sibling element or null
|
|
185
|
+
*/
|
|
186
|
+
next(): Element | null;
|
|
187
|
+
/**
|
|
188
|
+
* Gets the previous sibling element.
|
|
189
|
+
*
|
|
190
|
+
* @returns The previous sibling element or null
|
|
191
|
+
*/
|
|
192
|
+
prev(): Element | null;
|
|
193
|
+
/**
|
|
194
|
+
* Adds an event listener.
|
|
195
|
+
*
|
|
196
|
+
* @param event - Event type to listen for
|
|
197
|
+
* @param handler - Event handler function
|
|
198
|
+
* @returns The instance for method chaining
|
|
199
|
+
*/
|
|
200
|
+
on(event: string, handler: EventListenerOrEventListenerObject): this;
|
|
201
|
+
/**
|
|
202
|
+
* Adds a one-time event listener that removes itself after firing.
|
|
203
|
+
*
|
|
204
|
+
* @param event - Event type to listen for
|
|
205
|
+
* @param handler - Event handler function
|
|
206
|
+
* @returns The instance for method chaining
|
|
207
|
+
*/
|
|
208
|
+
once(event: string, handler: EventListener): this;
|
|
209
|
+
/**
|
|
210
|
+
* Removes an event listener.
|
|
211
|
+
*
|
|
212
|
+
* @param event - Event type
|
|
213
|
+
* @param handler - The handler to remove
|
|
214
|
+
* @returns The instance for method chaining
|
|
215
|
+
*/
|
|
216
|
+
off(event: string, handler: EventListenerOrEventListenerObject): this;
|
|
217
|
+
/**
|
|
218
|
+
* Triggers a custom event on the element.
|
|
219
|
+
*
|
|
220
|
+
* @param event - Event type to trigger
|
|
221
|
+
* @param detail - Optional detail data to include with the event
|
|
222
|
+
* @returns The instance for method chaining
|
|
223
|
+
*/
|
|
224
|
+
trigger(event: string, detail?: unknown): this;
|
|
225
|
+
/**
|
|
226
|
+
* Checks if the element matches a CSS selector.
|
|
227
|
+
*
|
|
228
|
+
* @param selector - CSS selector to match against
|
|
229
|
+
* @returns True if the element matches the selector
|
|
230
|
+
*/
|
|
231
|
+
matches(selector: string): boolean;
|
|
232
|
+
/**
|
|
233
|
+
* Checks if the element has a specific class.
|
|
234
|
+
*
|
|
235
|
+
* @param className - Class name to check
|
|
236
|
+
* @returns True if the element has the class
|
|
237
|
+
*/
|
|
238
|
+
hasClass(className: string): boolean;
|
|
239
|
+
/**
|
|
240
|
+
* Shows the element by removing the hidden attribute and setting display.
|
|
241
|
+
*
|
|
242
|
+
* @param display - Optional display value (default: '')
|
|
243
|
+
* @returns The instance for method chaining
|
|
244
|
+
*/
|
|
245
|
+
show(display?: string): this;
|
|
246
|
+
/**
|
|
247
|
+
* Hides the element by setting display to 'none'.
|
|
248
|
+
*
|
|
249
|
+
* @returns The instance for method chaining
|
|
250
|
+
*/
|
|
251
|
+
hide(): this;
|
|
252
|
+
/**
|
|
253
|
+
* Toggles the visibility of the element.
|
|
254
|
+
*
|
|
255
|
+
* @param force - Optional force show (true) or hide (false)
|
|
256
|
+
* @returns The instance for method chaining
|
|
257
|
+
*/
|
|
258
|
+
toggle(force?: boolean): this;
|
|
259
|
+
/**
|
|
260
|
+
* Focuses the element.
|
|
261
|
+
*
|
|
262
|
+
* @returns The instance for method chaining
|
|
263
|
+
*/
|
|
264
|
+
focus(): this;
|
|
265
|
+
/**
|
|
266
|
+
* Blurs (unfocuses) the element.
|
|
267
|
+
*
|
|
268
|
+
* @returns The instance for method chaining
|
|
269
|
+
*/
|
|
270
|
+
blur(): this;
|
|
271
|
+
/**
|
|
272
|
+
* Gets or sets the value of form elements.
|
|
273
|
+
*
|
|
274
|
+
* @param newValue - Optional value to set
|
|
275
|
+
* @returns The current value when getting, or the instance when setting
|
|
276
|
+
*/
|
|
277
|
+
val(newValue?: string): string | this;
|
|
278
|
+
/**
|
|
279
|
+
* Gets the bounding client rectangle of the element.
|
|
280
|
+
*
|
|
281
|
+
* @returns The element's bounding rectangle
|
|
282
|
+
*/
|
|
283
|
+
rect(): DOMRect;
|
|
284
|
+
/**
|
|
285
|
+
* Gets the offset dimensions (width, height, top, left).
|
|
286
|
+
*
|
|
287
|
+
* @returns Object with offset dimensions
|
|
288
|
+
*/
|
|
289
|
+
offset(): {
|
|
290
|
+
width: number;
|
|
291
|
+
height: number;
|
|
292
|
+
top: number;
|
|
293
|
+
left: number;
|
|
294
|
+
};
|
|
295
|
+
/**
|
|
296
|
+
* Internal method to insert content at a specified position.
|
|
297
|
+
* @internal
|
|
298
|
+
*/
|
|
299
|
+
private insertContent;
|
|
300
|
+
}
|
|
301
|
+
//# sourceMappingURL=element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../src/core/element.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,aAAa;IAKZ,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJpC;;;OAGG;gBAC0B,OAAO,EAAE,OAAO;IAE7C;;;OAGG;IACH,IAAI,GAAG,IAAI,OAAO,CAEjB;IAED;;;OAGG;IACH,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,+BAA+B;IAC/B,QAAQ,CAAC,GAAG,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI;IAKvC,kCAAkC;IAClC,WAAW,CAAC,GAAG,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI;IAK1C,8BAA8B;IAC9B,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;IAKrD,+BAA+B;IAC/B,IAAI,CA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b;;;;OAIG;IACH,IAAI,IAAI,IAAI;IAKZ;;;;;OAKG;IACH,GAAG,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IASrC;;;;OAIG;IACH,IAAI,IAAI,OAAO;IAIf;;;;OAIG;IACH,MAAM,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;IAUtE;;;OAGG;IACH,OAAO,CAAC,aAAa;CAWtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BQueryCollection } from './collection';
|
|
2
|
+
import { BQueryElement } from './element';
|
|
3
|
+
/**
|
|
4
|
+
* Select a single element. Returns a wrapper for chainable operations.
|
|
5
|
+
*/
|
|
6
|
+
export declare const $: (selector: string | Element) => BQueryElement;
|
|
7
|
+
/**
|
|
8
|
+
* Select multiple elements. Returns a collection wrapper.
|
|
9
|
+
*/
|
|
10
|
+
export declare const $$: (selector: string | Element[] | NodeListOf<Element>) => BQueryCollection;
|
|
11
|
+
//# sourceMappingURL=selector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selector.d.ts","sourceRoot":"","sources":["../../src/core/selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C;;GAEG;AACH,eAAO,MAAM,CAAC,GAAI,UAAU,MAAM,GAAG,OAAO,KAAG,aAS9C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,EAAE,GAAI,UAAU,MAAM,GAAG,OAAO,EAAE,GAAG,UAAU,CAAC,OAAO,CAAC,KAAG,gBAQvE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helpers for element wrappers.
|
|
3
|
+
*/
|
|
4
|
+
export type ElementList = Element[];
|
|
5
|
+
export declare const toElementList: (input: Element | ElementList) => ElementList;
|
|
6
|
+
export declare const applyAll: (elements: ElementList, action: (el: Element) => void) => void;
|
|
7
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/core/shared.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,EAAE,CAAC;AAEpC,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,GAAG,WAAW,KAAG,WACrB,CAAC;AAEzC,eAAO,MAAM,QAAQ,GAAI,UAAU,WAAW,EAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,KAAK,IAAI,SAI5E,CAAC"}
|