@neptune3d/dom 0.0.5 → 0.0.6

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/index.d.ts CHANGED
@@ -1,16 +1,66 @@
1
1
  import { PropertiesFallback, Property, Property as CssProperty } from "csstype";
2
2
 
3
- //#region src/MediaRule.d.ts
4
- declare class MediaRule {
5
- constructor(index: number, rule: CSSMediaRule);
6
- protected _index: number;
7
- protected _rule: CSSMediaRule;
8
- protected cssMap: Map<string, number>;
9
- get index(): number;
10
- get rule(): CSSMediaRule;
11
- get length(): number;
12
- getCssRule(selector: string): CSSStyleRule;
13
- delete(index: number): void;
3
+ //#region src/InputCheckbox.d.ts
4
+ declare class InputCheckbox extends DomElement<"input"> {
5
+ constructor();
6
+ name(value: string): this;
7
+ checked(value: boolean): this;
8
+ isChecked(): boolean;
9
+ }
10
+ //#endregion
11
+ //#region src/InputColor.d.ts
12
+ declare class InputColor extends DomElement<"input"> {
13
+ constructor();
14
+ protected _rgb: {
15
+ r: number;
16
+ g: number;
17
+ b: number;
18
+ };
19
+ name(value: string): this;
20
+ value(value: string): this;
21
+ getValue(): string;
22
+ getRGB(): {
23
+ r: number;
24
+ g: number;
25
+ b: number;
26
+ };
27
+ getNormalizedRGB(): {
28
+ r: number;
29
+ g: number;
30
+ b: number;
31
+ };
32
+ }
33
+ //#endregion
34
+ //#region src/InputNumber.d.ts
35
+ declare class InputNumber extends DomElement<"input"> {
36
+ constructor();
37
+ name(value: string): this;
38
+ value(value: number): this;
39
+ getValue(): number;
40
+ min(value: number): this;
41
+ max(value: number): this;
42
+ step(value: number): this;
43
+ placeholder(value: string): this;
44
+ }
45
+ //#endregion
46
+ //#region src/InputRange.d.ts
47
+ declare class InputRange extends DomElement<"input"> {
48
+ constructor();
49
+ name(value: string): this;
50
+ value(value: number): this;
51
+ getValue(): number;
52
+ min(value: number): this;
53
+ max(value: number): this;
54
+ step(value: number): this;
55
+ }
56
+ //#endregion
57
+ //#region src/InputText.d.ts
58
+ declare class InputText extends DomElement<"input"> {
59
+ constructor();
60
+ name(value: string): this;
61
+ value(value: string): this;
62
+ getValue(): string;
63
+ placeholder(value: string): this;
14
64
  }
15
65
  //#endregion
16
66
  //#region src/types.d.ts
@@ -86,502 +136,233 @@ type SvgElementTagNameMap = {
86
136
  view: SVGViewElement;
87
137
  };
88
138
  type DomElementEventMap = HTMLElementEventMap & SVGElementEventMap;
139
+ type InputElementMap = {
140
+ color: InputColor;
141
+ text: InputText;
142
+ number: InputNumber;
143
+ range: InputRange;
144
+ checkbox: InputCheckbox;
145
+ };
89
146
  //#endregion
90
- //#region src/StyleSheet.d.ts
91
- /**
92
- * Manages a dedicated `<style>` element and provides programmatic access to its CSS rules.
93
- * Supports dynamic insertion, retrieval, and deletion of both standard and media-specific rules,
94
- * with internal indexing for fast lookup and reuse.
95
- *
96
- * This class ensures a single shared stylesheet instance via `StyleSheet.getSheet()`,
97
- * and maintains selector-to-index and media-to-rule maps on the global `window` object.
98
- *
99
- * Designed for use with component-level styling systems or DOM abstractions that require
100
- * granular control over rule injection without relying on inline styles.
101
- */
102
- declare class StyleSheet {
103
- constructor(el: HTMLStyleElement);
104
- protected _dom: HTMLStyleElement;
105
- get dom(): HTMLStyleElement;
106
- get sheet(): CSSStyleSheet;
107
- get length(): number;
108
- /**
109
- * Inserts or updates a global CSS rule for a given selector.
110
- * @param selector - A global class selector (e.g., ".list-item").
111
- * @param props - The CSS properties to apply.
112
- */
113
- globalCss(selector: string, props: CssProperties): void;
147
+ //#region src/BaseStyle.d.ts
148
+ declare abstract class BaseStyle {
149
+ protected abstract setStyleProp(name: Autocomplete<keyof CssProperties>, value: string | number | undefined): this;
114
150
  /**
115
- * Inserts or updates a global CSS rule inside a media query.
116
- * @param mediaText - The media query condition (e.g., "max-width: 600px").
117
- * @param selector - The global class selector.
118
- * @param props - The CSS properties to apply.
151
+ * Sets or clears the `padding` style of the element.
152
+ * Accepts any valid CSS padding shorthand (e.g., "10px", "1em 2em").
153
+ * Passing `undefined` removes the padding style.
154
+ *
155
+ * @param value - The padding value to apply, or `undefined` to remove it.
156
+ * @return This instance for chaining.
119
157
  */
120
- globalMediaCss(mediaText: string, selector: string, props: CssProperties): void;
158
+ p(value: Property.Padding | undefined): this;
121
159
  /**
122
- * Retrieves or creates a CSSStyleRule for the given selector.
123
- * If the rule doesn't exist, it is inserted at the end of the stylesheet and cached.
124
- *
125
- * This ensures stable indexing and avoids rule override issues caused by shifting positions.
126
- * The returned rule can be used to modify style declarations programmatically.
160
+ * Sets or clears the `padding-top` style of the element.
161
+ * Accepts any valid CSS value (e.g., "10px", "1em").
162
+ * Passing `undefined` removes the top padding.
127
163
  *
128
- * @param selector - The CSS selector string (e.g., ".button", "#header", "div > span").
129
- * @return The corresponding CSSStyleRule instance.
164
+ * @param value - The top padding value to apply, or `undefined` to remove it.
165
+ * @return This instance for chaining.
130
166
  */
131
- getCssRule(selector: string): CSSStyleRule;
132
- deleteCssRule(selector: string): void;
167
+ pt(value: Property.PaddingTop | undefined): this;
133
168
  /**
134
- * Retrieves or creates a CSSMediaRule for the given media query.
135
- * If the rule doesn't exist, it is inserted at the end of the stylesheet and cached.
136
- *
137
- * This ensures consistent indexing and avoids rule override issues caused by shifting positions.
169
+ * Sets or clears the `padding-right` style of the element.
170
+ * Accepts any valid CSS value (e.g., "10px", "1em").
171
+ * Passing `undefined` removes the right padding.
138
172
  *
139
- * @param mediaText - The media query string (e.g., "screen and (max-width: 600px)").
140
- * @return A MediaRule wrapper containing the index and CSSMediaRule reference.
173
+ * @param value - The right padding value to apply, or `undefined` to remove it.
174
+ * @return This instance for chaining.
141
175
  */
142
- getMediaRule(mediaText: string): MediaRule;
143
- deleteMediaRule(mediaText: string): void;
144
- setRuleCss(rule: CSSStyleRule, props: CssProperties): void;
145
- getStyleValue(name: Autocomplete<keyof CssProperties>, value: string | number): string;
146
- protected getCssMap(): Map<string, number>;
147
- protected getMediaMap(): Map<string, MediaRule>;
176
+ pr(value: Property.PaddingRight | undefined): this;
148
177
  /**
149
- * Retrieves or creates a <style> element with the given ID and wraps it in a StyleSheet instance.
150
- * If no element with the specified ID exists, a new <style> tag is created, appended to <head>,
151
- * and assigned the ID. This allows multiple independently managed stylesheets via custom IDs.
178
+ * Sets or clears the `padding-bottom` style of the element.
179
+ * Accepts any valid CSS value (e.g., "10px", "1em").
180
+ * Passing `undefined` removes the bottom padding.
152
181
  *
153
- * @param id - Optional ID of the <style> element to target. Defaults to DEFAULT_STYLE_ID.
154
- * @return A StyleSheet instance bound to the specified <style> element.
182
+ * @param value - The bottom padding value to apply, or `undefined` to remove it.
183
+ * @return This instance for chaining.
155
184
  */
156
- static getSheet(id?: string): StyleSheet;
185
+ pb(value: Property.PaddingBottom | undefined): this;
157
186
  /**
158
- * The default ID used for the primary stylesheet managed by the StyleSheet class.
159
- * This ensures consistent lookup and avoids collisions with other style elements in the document.
187
+ * Sets or clears the `padding-left` style of the element.
188
+ * Accepts any valid CSS value (e.g., "10px", "1em").
189
+ * Passing `undefined` removes the left padding.
190
+ *
191
+ * @param value - The left padding value to apply, or `undefined` to remove it.
192
+ * @return This instance for chaining.
160
193
  */
161
- static DEFAULT_STYLE_ID: string;
162
- }
163
- //#endregion
164
- //#region src/DomElement.d.ts
165
- /**
166
- * A unified wrapper for HTML and SVG elements that provides a fluent, type-safe API
167
- * for DOM manipulation, styling, and event handling.
168
- *
169
- * Supports both `HTMLElementTagNameMap` and `SVGElementTagNameMap` via the generic `Tag`,
170
- * and automatically handles namespace creation for SVG elements.
171
- *
172
- * Provides ergonomic methods for setting styles, attributes, classes, and event listeners,
173
- * while abstracting away platform-specific quirks (e.g., `className` vs `setAttribute("class")`).
174
- *
175
- * @template Tag - The tag name of the element, inferred from `DomElementTagNameMap`.
176
- */
177
- declare class DomElement<Tag extends keyof DomElementTagNameMap = keyof DomElementTagNameMap> {
194
+ pl(value: Property.PaddingLeft | undefined): this;
178
195
  /**
179
- * Creates a new DomElement instance for the specified tag.
180
- * Automatically detects whether the tag is an SVG element and uses the appropriate namespace.
181
- * Optionally wraps an existing DOM element instead of creating a new one.
196
+ * Sets or clears horizontal padding (`padding-left` and `padding-right`) simultaneously.
197
+ * Accepts any valid CSS value (e.g., "10px", "1em").
198
+ * Passing `undefined` removes both left and right padding.
182
199
  *
183
- * @param tag - The tag name of the element (e.g., "div", "circle", "svg").
184
- * @param el - An optional existing DOM element to wrap. If omitted, a new element is created.
200
+ * @param value - The horizontal padding value to apply, or `undefined` to remove it.
201
+ * @return This instance for chaining.
185
202
  */
186
- constructor(tag: Tag, el?: DomElementTagNameMap[Tag]);
187
- protected _tag: Tag extends "svgA" ? {
188
- svgA: "a";
189
- }[Tag] : Tag;
190
- protected _isSvg: boolean;
191
- protected _dom: DomElementTagNameMap[Tag];
192
- protected _sheet: StyleSheet;
193
- protected _cssClassName: string | undefined;
194
- protected _userClassName: string | undefined;
203
+ px(value: Property.PaddingLeft | undefined): this;
195
204
  /**
196
- * Gets the tag name of the element (e.g., "div", "svg", "circle").
205
+ * Sets or clears vertical padding (`padding-top` and `padding-bottom`) simultaneously.
206
+ * Accepts any valid CSS value (e.g., "10px", "1em").
207
+ * Passing `undefined` removes both top and bottom padding.
208
+ *
209
+ * @param value - The vertical padding value to apply, or `undefined` to remove it.
210
+ * @return This instance for chaining.
197
211
  */
198
- get tag(): Tag extends "svgA" ? {
199
- svgA: "a";
200
- }[Tag] : Tag;
212
+ py(value: Property.PaddingTop | undefined): this;
201
213
  /**
202
- * Indicates whether the element is an SVG element.
203
- * Returns `true` for tags like "svg", "circle", "path", etc.
214
+ * Sets or clears the `margin` style of the element.
215
+ * Accepts any valid CSS margin shorthand (e.g., "10px", "1em 2em").
216
+ * Passing `undefined` removes the margin style.
217
+ *
218
+ * @param value - The margin value to apply, or `undefined` to remove it.
219
+ * @return This instance for chaining.
204
220
  */
205
- get isSvg(): boolean;
221
+ m(value: Property.Margin | undefined): this;
206
222
  /**
207
- * Gets the underlying DOM element instance.
208
- * This will be either an `HTMLElement` or `SVGElement` depending on the tag.
223
+ * Sets or clears the `margin-top` style of the element.
224
+ * Accepts any valid CSS value (e.g., "10px", "auto").
225
+ * Passing `undefined` removes the top margin.
226
+ *
227
+ * @param value - The top margin value to apply, or `undefined` to remove it.
228
+ * @return This instance for chaining.
209
229
  */
210
- get dom(): DomElementTagNameMap[Tag];
211
- get cssClassName(): string;
212
- getText(): string;
230
+ mt(value: Property.MarginTop | undefined): this;
213
231
  /**
214
- * Sets or clears the text content of the element.
215
- * Converts any value to a string before assignment.
216
- * Passing `undefined` or `null` removes the text by setting it to an empty string.
232
+ * Sets or clears the `margin-right` style of the element.
233
+ * Accepts any valid CSS value (e.g., "10px", "auto").
234
+ * Passing `undefined` removes the right margin.
217
235
  *
218
- * @param value - The text content to set, or `undefined`/`null` to clear it.
219
- * @return This DomElement instance for chaining.
236
+ * @param value - The right margin value to apply, or `undefined` to remove it.
237
+ * @return This instance for chaining.
220
238
  */
221
- text(value: any): this;
239
+ mr(value: Property.MarginRight | undefined): this;
222
240
  /**
223
- * Appends one or more child nodes to the element.
224
- * Accepts DomElement instances, regular DOM Nodes, strings, or numbers.
225
- *
226
- * - Strings and numbers are coerced to text nodes.
227
- * - DomElement instances are unwrapped to their native DOM nodes.
228
- * - DOM Nodes are appended directly.
241
+ * Sets or clears the `margin-bottom` style of the element.
242
+ * Accepts any valid CSS value (e.g., "10px", "auto").
243
+ * Passing `undefined` removes the bottom margin.
229
244
  *
230
- * @param nodes - One or more child elements or text values to append.
231
- * @return This DomElement instance for chaining.
245
+ * @param value - The bottom margin value to apply, or `undefined` to remove it.
246
+ * @return This instance for chaining.
232
247
  */
233
- add(...nodes: DomElementChild[]): this;
248
+ mb(value: Property.MarginBottom | undefined): this;
234
249
  /**
235
- * Inserts one or more DomElements into a parent at the specified index.
236
- * Each node is inserted sequentially starting from the given index.
250
+ * Sets or clears the `margin-left` style of the element.
251
+ * Accepts any valid CSS value (e.g., "10px", "auto").
252
+ * Passing `undefined` removes the left margin.
237
253
  *
238
- * @param index - The zero-based index at which to start inserting.
239
- * @param nodes - One or more DomElements to insert.
240
- * @return This DomElement instance.
254
+ * @param value - The left margin value to apply, or `undefined` to remove it.
255
+ * @return This instance for chaining.
241
256
  */
242
- insertAtIndex(index: number, ...nodes: DomElementChild[]): this;
257
+ ml(value: Property.MarginLeft | undefined): this;
243
258
  /**
244
- * Replaces all existing child elements of this DOM node with the provided ones.
245
- * Internally clears the current children and appends the new nodes in order.
246
- *
247
- * @param nodes - One or more DomElement instances to set as children.
248
- * @return This DomElement instance.
259
+ * Sets the overall border radius.
260
+ * @param value - The CSS border-radius value (e.g., "8px", "50%").
261
+ * @return This instance for chaining.
249
262
  */
250
- setChildren(...nodes: DomElementChild[]): this;
263
+ radius(value: Property.BorderRadius | undefined): this;
251
264
  /**
252
- * Replaces child elements starting from the specified index with the provided nodes.
253
- * All children before the index are preserved.
254
- *
255
- * @param index - The zero-based index at which replacement begins.
256
- * @param nodes - One or more DomElement instances to insert.
257
- * @return This DomElement instance.
265
+ * Sets the top-left corner border radius.
266
+ * @param value - The CSS border-top-left-radius value.
267
+ * @return This instance for chaining.
258
268
  */
259
- setChildrenFromIndex(index: number, ...nodes: DomElementChild[]): this;
269
+ radiusTopLeft(value: Property.BorderTopLeftRadius | undefined): this;
260
270
  /**
261
- * Removes the element from the DOM tree.
262
- * Equivalent to calling `element.remove()` on the native DOM node.
263
- *
264
- * This does not dispose internal state or event listeners — use `dispose()` if cleanup is needed.
265
- *
266
- * @return This DomElement instance for chaining.
271
+ * Sets the top-right corner border radius.
272
+ * @param value - The CSS border-top-right-radius value.
273
+ * @return This instance for chaining.
267
274
  */
268
- remove(): void;
269
- /**
270
- * Removes child elements within the specified index range.
271
- * If no range is provided, removes all children.
272
- *
273
- * @param from - The starting index (inclusive). Defaults to 0.
274
- * @param to - The ending index (exclusive). Defaults to all children.
275
- * @returns This DomElement instance.
276
- */
277
- clear(from?: number, to?: number): this;
278
- /**
279
- * Adds an event listener to the element.
280
- * Supports both HTML and SVG elements.
281
- * @param type - The event type (e.g., "click", "input", "mouseenter").
282
- * @param handler - The event handler function.
283
- * @param options - Optional event listener options.
284
- * @return This DomElement instance for chaining.
285
- */
286
- on<T extends keyof DomElementEventMap>(type: T, handler: (ev: DomElementEventMap[T] & {
287
- currentTarget: DomElementTagNameMap[Tag];
288
- }) => void, options?: boolean | AddEventListenerOptions): this;
289
- /**
290
- * Removes an event listener from the element.
291
- * Supports both HTML and SVG elements.
292
- * @param type - The event type to remove.
293
- * @param handler - The original handler function.
294
- * @param options - Optional event listener options.
295
- */
296
- off<T extends keyof DomElementEventMap>(type: T, handler: (ev: DomElementEventMap[T]) => void, options?: boolean | EventListenerOptions): void;
297
- /**
298
- * Retrieves the value of a single attribute.
299
- * @param name - The attribute name to read (e.g. "aria-label", "role").
300
- * @return The attribute value as a string, or null if not present.
301
- */
302
- getAttr(name: string): string | null;
303
- /**
304
- * Sets a single attribute on the element.
305
- * @param name - The attribute name (e.g. "aria-label", "role", "disabled").
306
- * @param value - The attribute value. If undefined, the attribute is removed.
307
- * @return This DomElement instance for chaining.
308
- */
309
- attr(name: string, value: string | number | boolean | undefined): this;
310
- /**
311
- * Sets multiple attributes on the element.
312
- * @param attributes - An object mapping attribute names to values.
313
- * Attributes with undefined values are removed.
314
- * @return This DomElement instance for chaining.
315
- */
316
- attrs(attributes: Record<string, string | number | boolean | undefined>): this;
317
- /**
318
- * Retrieves the value of a single property.
319
- * @param name - The property name to read (e.g. "value", "checked", "disabled").
320
- * @return The property value, or undefined if not present.
321
- */
322
- getProp(name: string): any;
323
- /**
324
- * Sets a single property on the element.
325
- * @param name - The property name (e.g. "checked", "value", "disabled").
326
- * @param value - The property value. If undefined, the property is deleted.
327
- * @return This DomElement instance for chaining.
328
- */
329
- prop(name: string, value: any): this;
330
- /**
331
- * Sets multiple properties on the element.
332
- * @param props - An object mapping property names to values.
333
- * Properties with undefined values are deleted.
334
- * @return This DomElement instance for chaining.
335
- */
336
- props(props: Record<string, any>): this;
337
- /**
338
- * Applies a batch of CSS style properties to the element.
339
- * Delegates each property to `setStyleProp`, which handles value normalization and kebab-case conversion.
340
- *
341
- * - Properties with `undefined` values are removed from the inline style.
342
- * - Numeric values are passed through the style sheet for unit resolution.
343
- * - Supports chainable usage for fluent DOM composition.
344
- *
345
- * @param props - A partial map of CSS properties and their values.
346
- * @returns This DomElement instance for chaining.
347
- */
348
- style(props: CssProperties): this;
349
- /**
350
- * Sets or removes the `id` of the element.
351
- * Passing `undefined` clears the ID by setting it to an empty string.
352
- *
353
- * @param value - The element's ID, or `undefined` to remove it.
354
- * @return This DomElement instance for chaining.
355
- */
356
- id(value: string | undefined): this;
357
- /**
358
- * Sets or removes the user-defined class name and applies it alongside the internal CSS class.
359
- * Uses `setAttribute("class", ...)` for both HTML and SVG elements.
360
- *
361
- * Passing `undefined` removes the user-defined class name entirely.
362
- *
363
- * @param value - The user-defined class name, or `undefined` to remove it.
364
- * @return This DomElement instance for chaining.
365
- */
366
- className(value: string | undefined): this;
367
- /**
368
- * Sets or removes the `htmlFor` property on a <label> element.
369
- * This links the label to a form control by its ID.
370
- *
371
- * Passing `undefined` removes the association.
372
- * Has no effect if the element is not a <label>.
373
- *
374
- * @param value - The ID of the target form control, or `undefined` to remove it.
375
- * @return This DomElement instance for chaining.
376
- */
377
- htmlFor(value: string | undefined): this;
378
- /**
379
- * Sets or removes the `title` attribute on the element.
380
- * Applies to both HTML and SVG elements. Passing `undefined` removes the attribute.
381
- *
382
- * @param value - The tooltip text to show on hover, or `undefined` to remove it.
383
- * @return This DomElement instance for chaining.
384
- */
385
- title(value: string | undefined): this;
386
- /**
387
- * Sets or removes the `disabled` attribute on the element.
388
- * Applicable to form controls like <button>, <input>, <select>, etc.
389
- *
390
- * @param value - If true, sets the `disabled` attribute; if false, removes it.
391
- * @return This DomElement instance for chaining.
392
- */
393
- disabled(value: boolean): this;
394
- /**
395
- * Sets the `disabled` attribute to disable the element.
396
- * Applicable to form controls like <button>, <input>, <select>, etc.
397
- * @return This DomElement instance for chaining.
398
- */
399
- disable(): this;
400
- /**
401
- * Removes the `disabled` attribute to enable the element.
402
- * @return This DomElement instance for chaining.
403
- */
404
- enable(): this;
405
- /**
406
- * Sets or clears the `padding` style of the element.
407
- * Accepts any valid CSS padding shorthand (e.g., "10px", "1em 2em").
408
- * Passing `undefined` removes the padding style.
409
- *
410
- * @param value - The padding value to apply, or `undefined` to remove it.
411
- * @return This DomElement instance for chaining.
412
- */
413
- p(value: Property.Padding | undefined): this;
414
- /**
415
- * Sets or clears the `padding-top` style of the element.
416
- * Accepts any valid CSS value (e.g., "10px", "1em").
417
- * Passing `undefined` removes the top padding.
418
- *
419
- * @param value - The top padding value to apply, or `undefined` to remove it.
420
- * @return This DomElement instance for chaining.
421
- */
422
- pt(value: Property.PaddingTop | undefined): this;
423
- /**
424
- * Sets or clears the `padding-right` style of the element.
425
- * Accepts any valid CSS value (e.g., "10px", "1em").
426
- * Passing `undefined` removes the right padding.
427
- *
428
- * @param value - The right padding value to apply, or `undefined` to remove it.
429
- * @return This DomElement instance for chaining.
430
- */
431
- pr(value: Property.PaddingRight | undefined): this;
432
- /**
433
- * Sets or clears the `padding-bottom` style of the element.
434
- * Accepts any valid CSS value (e.g., "10px", "1em").
435
- * Passing `undefined` removes the bottom padding.
436
- *
437
- * @param value - The bottom padding value to apply, or `undefined` to remove it.
438
- * @return This DomElement instance for chaining.
439
- */
440
- pb(value: Property.PaddingBottom | undefined): this;
441
- /**
442
- * Sets or clears the `padding-left` style of the element.
443
- * Accepts any valid CSS value (e.g., "10px", "1em").
444
- * Passing `undefined` removes the left padding.
445
- *
446
- * @param value - The left padding value to apply, or `undefined` to remove it.
447
- * @return This DomElement instance for chaining.
448
- */
449
- pl(value: Property.PaddingLeft | undefined): this;
450
- /**
451
- * Sets or clears horizontal padding (`padding-left` and `padding-right`) simultaneously.
452
- * Accepts any valid CSS value (e.g., "10px", "1em").
453
- * Passing `undefined` removes both left and right padding.
454
- *
455
- * @param value - The horizontal padding value to apply, or `undefined` to remove it.
456
- * @return This DomElement instance for chaining.
457
- */
458
- px(value: Property.PaddingLeft | undefined): this;
459
- /**
460
- * Sets or clears vertical padding (`padding-top` and `padding-bottom`) simultaneously.
461
- * Accepts any valid CSS value (e.g., "10px", "1em").
462
- * Passing `undefined` removes both top and bottom padding.
463
- *
464
- * @param value - The vertical padding value to apply, or `undefined` to remove it.
465
- * @return This DomElement instance for chaining.
466
- */
467
- py(value: Property.PaddingTop | undefined): this;
468
- /**
469
- * Sets or clears the `margin` style of the element.
470
- * Accepts any valid CSS margin shorthand (e.g., "10px", "1em 2em").
471
- * Passing `undefined` removes the margin style.
472
- *
473
- * @param value - The margin value to apply, or `undefined` to remove it.
474
- * @return This DomElement instance for chaining.
475
- */
476
- m(value: Property.Margin | undefined): this;
477
- /**
478
- * Sets or clears the `margin-top` style of the element.
479
- * Accepts any valid CSS value (e.g., "10px", "auto").
480
- * Passing `undefined` removes the top margin.
481
- *
482
- * @param value - The top margin value to apply, or `undefined` to remove it.
483
- * @return This DomElement instance for chaining.
484
- */
485
- mt(value: Property.MarginTop | undefined): this;
486
- /**
487
- * Sets or clears the `margin-right` style of the element.
488
- * Accepts any valid CSS value (e.g., "10px", "auto").
489
- * Passing `undefined` removes the right margin.
490
- *
491
- * @param value - The right margin value to apply, or `undefined` to remove it.
492
- * @return This DomElement instance for chaining.
493
- */
494
- mr(value: Property.MarginRight | undefined): this;
495
- /**
496
- * Sets or clears the `margin-bottom` style of the element.
497
- * Accepts any valid CSS value (e.g., "10px", "auto").
498
- * Passing `undefined` removes the bottom margin.
499
- *
500
- * @param value - The bottom margin value to apply, or `undefined` to remove it.
501
- * @return This DomElement instance for chaining.
502
- */
503
- mb(value: Property.MarginBottom | undefined): this;
504
- /**
505
- * Sets or clears the `margin-left` style of the element.
506
- * Accepts any valid CSS value (e.g., "10px", "auto").
507
- * Passing `undefined` removes the left margin.
508
- *
509
- * @param value - The left margin value to apply, or `undefined` to remove it.
510
- * @return This DomElement instance for chaining.
511
- */
512
- ml(value: Property.MarginLeft | undefined): this;
513
- /**
514
- * Sets the overall border radius.
515
- * @param value - The CSS border-radius value (e.g., "8px", "50%").
516
- * @return This DomElement instance for chaining.
517
- */
518
- radius(value: Property.BorderRadius | undefined): this;
519
- /**
520
- * Sets the top-left corner border radius.
521
- * @param value - The CSS border-top-left-radius value.
522
- * @return This DomElement instance for chaining.
523
- */
524
- radiusTopLeft(value: Property.BorderTopLeftRadius | undefined): this;
525
- /**
526
- * Sets the top-right corner border radius.
527
- * @param value - The CSS border-top-right-radius value.
528
- * @return This DomElement instance for chaining.
529
- */
530
- radiusTopRight(value: Property.BorderTopRightRadius | undefined): this;
275
+ radiusTopRight(value: Property.BorderTopRightRadius | undefined): this;
531
276
  /**
532
277
  * Sets the bottom-left corner border radius.
533
278
  * @param value - The CSS border-bottom-left-radius value.
534
- * @return This DomElement instance for chaining.
279
+ * @return This instance for chaining.
535
280
  */
536
281
  radiusBottomLeft(value: Property.BorderBottomLeftRadius | undefined): this;
537
282
  /**
538
283
  * Sets the bottom-right corner border radius.
539
284
  * @param value - The CSS border-bottom-right-radius value.
540
- * @return This DomElement instance for chaining.
285
+ * @return This instance for chaining.
541
286
  */
542
287
  radiusBottomRight(value: Property.BorderBottomRightRadius | undefined): this;
543
288
  /**
544
289
  * Sets the border radius for both top corners.
545
290
  * @param value - The CSS border-radius value to apply to top-left and top-right corners.
546
- * @return This DomElement instance for chaining.
291
+ * @return This instance for chaining.
547
292
  */
548
293
  radiusTop(value: Property.BorderTopLeftRadius | undefined): this;
549
294
  /**
550
295
  * Sets the border radius for both bottom corners.
551
296
  * @param value - The CSS border-radius value to apply to bottom-left and bottom-right corners.
552
- * @return This DomElement instance for chaining.
297
+ * @return This instance for chaining.
553
298
  */
554
299
  radiusBottom(value: Property.BorderBottomLeftRadius | undefined): this;
555
300
  /**
556
301
  * Sets the border radius for both left corners.
557
302
  * @param value - The CSS border-radius value to apply to top-left and bottom-left corners.
558
- * @return This DomElement instance for chaining.
303
+ * @return This instance for chaining.
559
304
  */
560
305
  radiusLeft(value: Property.BorderTopLeftRadius | undefined): this;
561
306
  /**
562
307
  * Sets the border radius for both right corners.
563
308
  * @param value - The CSS border-radius value to apply to top-right and bottom-right corners.
564
- * @return This DomElement instance for chaining.
309
+ * @return This instance for chaining.
565
310
  */
566
311
  radiusRight(value: Property.BorderTopRightRadius | undefined): this;
567
312
  /**
568
313
  * Sets the border radius for both left and right sides (horizontal corners).
569
314
  * Applies to top-left, top-right, bottom-left, and bottom-right corners on the X axis.
570
315
  * @param value - The CSS border-radius value to apply horizontally.
571
- * @return This DomElement instance for chaining.
316
+ * @return This instance for chaining.
572
317
  */
573
318
  radiusX(value: Property.BorderRadius | undefined): this;
574
319
  /**
575
320
  * Sets the border radius for both top and bottom sides (vertical corners).
576
321
  * Applies to top-left, top-right, bottom-left, and bottom-right corners on the Y axis.
577
322
  * @param value - The CSS border-radius value to apply vertically.
578
- * @return This DomElement instance for chaining.
323
+ * @return This instance for chaining.
579
324
  */
580
325
  radiusY(value: Property.BorderRadius | undefined): this;
326
+ /**
327
+ * Sets the `display` style of the element.
328
+ * Common values include "block", "inline", "flex", "grid", or "none".
329
+ * Controls the element's layout behavior in the document flow.
330
+ *
331
+ * @param value - The CSS display value, or `undefined` to remove it.
332
+ * @return This instance for chaining.
333
+ */
581
334
  display(value: Property.Display | undefined): this;
335
+ /**
336
+ * Sets the `flex-shrink` style of the element.
337
+ * Defines how much the element should shrink relative to its siblings in a flex container.
338
+ *
339
+ * @param value - A numeric shrink factor (e.g., 0, 1), or `undefined` to remove it.
340
+ * @return This instance for chaining.
341
+ */
582
342
  flexShrink(value: Property.FlexShrink | undefined): this;
343
+ /**
344
+ * Sets the `flex` shorthand style of the element.
345
+ * Combines `flex-grow`, `flex-shrink`, and `flex-basis` into a single declaration.
346
+ *
347
+ * @param value - A flex shorthand value (e.g., "1 0 auto"), or `undefined` to remove it.
348
+ * @return This instance for chaining.
349
+ */
583
350
  flex(value: Property.Flex | undefined): this;
351
+ /**
352
+ * Sets the `background-color` style of the element.
353
+ * Accepts named colors, hex codes, RGB/RGBA values, or CSS variables.
354
+ *
355
+ * @param value - The background color value (e.g., "#fff", "rgba(0,0,0,0.5)"), or `undefined` to remove it.
356
+ * @return This instance for chaining.
357
+ */
584
358
  bgColor(value: Property.BackgroundColor | undefined): this;
359
+ /**
360
+ * Sets the `color` style of the element.
361
+ * Defines the foreground text color using named colors, hex codes, RGB/RGBA values, or CSS variables.
362
+ *
363
+ * @param value - The text color value (e.g., "black", "#333"), or `undefined` to remove it.
364
+ * @return This instance for chaining.
365
+ */
585
366
  color(value: Property.Color | undefined): this;
586
367
  /**
587
368
  * Sets or clears the `width` style of the element.
@@ -589,7 +370,7 @@ declare class DomElement<Tag extends keyof DomElementTagNameMap = keyof DomEleme
589
370
  * Passing `undefined` removes the width style.
590
371
  *
591
372
  * @param value - The width value to apply, or `undefined` to remove it.
592
- * @return This DomElement instance for chaining.
373
+ * @return This instance for chaining.
593
374
  */
594
375
  w(value: Property.Width | number | undefined): this;
595
376
  /**
@@ -598,126 +379,256 @@ declare class DomElement<Tag extends keyof DomElementTagNameMap = keyof DomEleme
598
379
  * Passing `undefined` removes the height style.
599
380
  *
600
381
  * @param value - The height value to apply, or `undefined` to remove it.
601
- * @return This DomElement instance for chaining.
382
+ * @return This instance for chaining.
602
383
  */
603
384
  h(value: Property.Height | number | undefined): this;
604
385
  /**
605
386
  * Sets the full border style.
606
387
  * @param value - The CSS border value (e.g., "1px solid #ccc").
607
- * @return This DomElement instance for chaining.
388
+ * @return This instance for chaining.
608
389
  */
609
390
  b(value: Property.Border | undefined): this;
610
391
  /**
611
392
  * Sets the top border style.
612
393
  * @param value - The CSS border-top value.
613
- * @return This DomElement instance for chaining.
394
+ * @return This instance for chaining.
614
395
  */
615
396
  bt(value: Property.BorderTop | undefined): this;
616
397
  /**
617
398
  * Sets the right border style.
618
399
  * @param value - The CSS border-right value.
619
- * @return This DomElement instance for chaining.
400
+ * @return This instance for chaining.
620
401
  */
621
402
  br(value: Property.BorderRight | undefined): this;
622
403
  /**
623
404
  * Sets the bottom border style.
624
405
  * @param value - The CSS border-bottom value.
625
- * @return This DomElement instance for chaining.
406
+ * @return This instance for chaining.
626
407
  */
627
408
  bb(value: Property.BorderBottom | undefined): this;
628
409
  /**
629
410
  * Sets the left border style.
630
411
  * @param value - The CSS border-left value.
631
- * @return This DomElement instance for chaining.
412
+ * @return This instance for chaining.
632
413
  */
633
414
  bl(value: Property.BorderLeft | undefined): this;
634
415
  /**
635
416
  * Sets the left and right border styles.
636
417
  * @param value - The CSS border value to apply to both left and right sides.
637
- * @return This DomElement instance for chaining.
418
+ * @return This instance for chaining.
638
419
  */
639
420
  bx(value: Property.BorderLeft | Property.BorderRight | undefined): this;
640
421
  /**
641
422
  * Sets the top and bottom border styles.
642
423
  * @param value - The CSS border value to apply to both top and bottom sides.
643
- * @return This DomElement instance for chaining.
424
+ * @return This instance for chaining.
644
425
  */
645
426
  by(value: Property.BorderTop | Property.BorderBottom | undefined): this;
646
427
  /**
647
428
  * Sets the top and left border styles.
648
429
  * @param value - The CSS border value to apply to both top and left sides.
649
- * @return This DomElement instance for chaining.
430
+ * @return This instance for chaining.
650
431
  */
651
432
  btl(value: Property.BorderTop | Property.BorderLeft | undefined): this;
652
433
  /**
653
434
  * Sets the top and right border styles.
654
435
  * @param value - The CSS border value to apply to both top and right sides.
655
- * @return This DomElement instance for chaining.
436
+ * @return This instance for chaining.
656
437
  */
657
438
  btr(value: Property.BorderTop | Property.BorderRight | undefined): this;
658
439
  /**
659
440
  * Sets the bottom and left border styles.
660
441
  * @param value - The CSS border value to apply to both bottom and left sides.
661
- * @return This DomElement instance for chaining.
442
+ * @return This instance for chaining.
662
443
  */
663
444
  bbl(value: Property.BorderBottom | Property.BorderLeft | undefined): this;
664
445
  /**
665
446
  * Sets the bottom and right border styles.
666
447
  * @param value - The CSS border value to apply to both bottom and right sides.
667
- * @return This DomElement instance for chaining.
448
+ * @return This instance for chaining.
668
449
  */
669
450
  bbr(value: Property.BorderBottom | Property.BorderRight | undefined): this;
451
+ /**
452
+ * Sets the `overflow` style of the element.
453
+ * Controls how content that exceeds the element's bounds is handled on both axes.
454
+ * Common values include "visible", "hidden", "scroll", and "auto".
455
+ *
456
+ * @param value - The overflow behavior for both axes, or `undefined` to remove it.
457
+ * @return This instance for chaining.
458
+ */
670
459
  overflow(value: Property.Overflow | undefined): this;
460
+ /**
461
+ * Sets the `overflow-y` style of the element.
462
+ * Controls vertical overflow behavior independently of horizontal overflow.
463
+ * Common values include "visible", "hidden", "scroll", and "auto".
464
+ *
465
+ * @param value - The vertical overflow behavior, or `undefined` to remove it.
466
+ * @return This instance for chaining.
467
+ */
671
468
  overflowY(value: Property.OverflowY | undefined): this;
469
+ /**
470
+ * Sets the `overflow-x` style of the element.
471
+ * Controls horizontal overflow behavior independently of vertical overflow.
472
+ * Common values include "visible", "hidden", "scroll", and "auto".
473
+ *
474
+ * @param value - The horizontal overflow behavior, or `undefined` to remove it.
475
+ * @return This instance for chaining.
476
+ */
672
477
  overflowX(value: Property.OverflowX | undefined): this;
478
+ /**
479
+ * Sets the `font-size` style of the element.
480
+ * Accepts absolute units (e.g., "16px", "1rem") or relative keywords (e.g., "small", "larger").
481
+ *
482
+ * @param value - The font size value, or `undefined` to remove it.
483
+ * @return This instance for chaining.
484
+ */
673
485
  fontSize(value: Property.FontSize | undefined): this;
486
+ /**
487
+ * Sets the `font-weight` style of the element.
488
+ * Accepts numeric weights (e.g., 400, 700) or keywords like "bold", "normal", "lighter".
489
+ *
490
+ * @param value - The font weight value, or `undefined` to remove it.
491
+ * @return This instance for chaining.
492
+ */
674
493
  fontWeight(value: Property.FontWeight | undefined): this;
494
+ /**
495
+ * Sets the `font-family` style of the element.
496
+ * Accepts a comma-separated list of font names or CSS variables.
497
+ *
498
+ * @param value - The font family string (e.g., "Arial, sans-serif"), or `undefined` to remove it.
499
+ * @return This instance for chaining.
500
+ */
675
501
  fontFamily(value: Property.FontFamily | undefined): this;
502
+ /**
503
+ * Sets the `font-style` style of the element.
504
+ * Common values include "normal", "italic", or "oblique".
505
+ *
506
+ * @param value - The font style value, or `undefined` to remove it.
507
+ * @return This instance for chaining.
508
+ */
676
509
  fontStyle(value: Property.FontStyle | undefined): this;
510
+ /**
511
+ * Sets the `text-align` style of the element.
512
+ * Controls horizontal alignment of inline content. Common values include "left", "right", "center", or "justify".
513
+ *
514
+ * @param value - The text alignment value, or `undefined` to remove it.
515
+ * @return This instance for chaining.
516
+ */
677
517
  textAlign(value: Property.TextAlign | undefined): this;
518
+ /**
519
+ * Sets the `text-decoration` style of the element.
520
+ * Common values include "underline", "line-through", "none", or combinations like "underline overline".
521
+ *
522
+ * @param value - The text decoration value, or `undefined` to remove it.
523
+ * @return This instance for chaining.
524
+ */
678
525
  textDecoration(value: Property.TextDecoration | undefined): this;
679
526
  /**
680
527
  * Sets the CSS `position` property.
681
528
  * @param value - The positioning mode (e.g., "absolute", "relative", "fixed").
682
- * @return This DomElement instance for chaining.
529
+ * @return This instance for chaining.
683
530
  */
684
531
  pos(value: Property.Position | undefined): this;
685
532
  /**
686
533
  * Sets the CSS `top` offset.
687
534
  * @param value - The top offset value (e.g., "10px", "50%").
688
- * @return This DomElement instance for chaining.
535
+ * @return This instance for chaining.
689
536
  */
690
- posTop(value: Property.Top | undefined): this;
537
+ posTop(value: Property.Top | number | undefined): this;
691
538
  /**
692
539
  * Sets the CSS `bottom` offset.
693
540
  * @param value - The bottom offset value (e.g., "0", "2rem").
694
- * @return This DomElement instance for chaining.
541
+ * @return This instance for chaining.
695
542
  */
696
- posBottom(value: Property.Bottom | undefined): this;
543
+ posBottom(value: Property.Bottom | number | undefined): this;
697
544
  /**
698
545
  * Sets the CSS `left` offset.
699
546
  * @param value - The left offset value (e.g., "5px", "auto").
700
- * @return This DomElement instance for chaining.
547
+ * @return This instance for chaining.
701
548
  */
702
- posLeft(value: Property.Left | undefined): this;
549
+ posLeft(value: Property.Left | number | undefined): this;
703
550
  /**
704
551
  * Sets the CSS `right` offset.
705
552
  * @param value - The right offset value (e.g., "1em", "0").
706
- * @return This DomElement instance for chaining.
553
+ * @return This instance for chaining.
554
+ */
555
+ posRight(value: Property.Right | number | undefined): this;
556
+ /**
557
+ * Sets the `cursor` style of the element.
558
+ * Controls the mouse cursor appearance when hovering over the element.
559
+ * Common values include "pointer", "default", "text", "move", or "not-allowed".
560
+ *
561
+ * @param value - The cursor style value, or `undefined` to remove it.
562
+ * @return This instance for chaining.
707
563
  */
708
- posRight(value: Property.Right | undefined): this;
709
564
  cursor(value: Property.Cursor | undefined): this;
565
+ /**
566
+ * Sets the `align-items` style of the element.
567
+ * Defines how flex or grid children are aligned along the cross axis.
568
+ * Common values include "flex-start", "center", "baseline", or "stretch".
569
+ *
570
+ * @param value - The alignment value for child items, or `undefined` to remove it.
571
+ * @return This instance for chaining.
572
+ */
710
573
  alignItems(value: Property.AlignItems | undefined): this;
574
+ /**
575
+ * Sets the `justify-content` style of the element.
576
+ * Defines how flex or grid children are distributed along the main axis.
577
+ * Common values include "flex-start", "center", "space-between", or "space-around".
578
+ *
579
+ * @param value - The justification value for child items, or `undefined` to remove it.
580
+ * @return This instance for chaining.
581
+ */
711
582
  justifyContent(value: Property.JustifyContent | undefined): this;
583
+ /**
584
+ * Sets the `gap` style of the element.
585
+ * Defines spacing between flex or grid children, supporting both row and column gaps.
586
+ * Accepts length units (e.g., "10px", "1rem") or shorthand values.
587
+ *
588
+ * @param value - The gap size between child elements, or `undefined` to remove it.
589
+ * @return This instance for chaining.
590
+ */
712
591
  gap(value: Property.Gap | undefined): this;
592
+ /**
593
+ * Sets the `flex-direction` style of the element.
594
+ * Controls the direction of child elements in a flex container.
595
+ * Common values include "row", "column", "row-reverse", or "column-reverse".
596
+ *
597
+ * @param value - The flex direction value, or `undefined` to remove it.
598
+ * @return This instance for chaining.
599
+ */
713
600
  flexDirection(value: Property.FlexDirection | undefined): this;
601
+ /**
602
+ * Sets the `grid-template-columns` style of the element.
603
+ * Defines the column structure of a CSS grid container using track sizes, repeat(), or auto-fit/auto-fill.
604
+ * For example: "1fr 2fr", "repeat(3, 100px)", or "auto-fit, minmax(200px, 1fr)".
605
+ *
606
+ * @param value - The grid column template string, or `undefined` to remove it.
607
+ * @return This instance for chaining.
608
+ */
714
609
  templateColumns(value: Property.GridTemplateColumns | undefined): this;
610
+ /**
611
+ * Sets the `grid-template-rows` style of the element.
612
+ * Defines the row structure of a CSS grid container using track sizes, repeat(), or auto-fit/auto-fill.
613
+ * For example: "100px auto", "repeat(2, 1fr)", or "minmax(50px, auto)".
614
+ *
615
+ * @param value - The grid row template string, or `undefined` to remove it.
616
+ * @return This instance for chaining.
617
+ */
715
618
  templateRows(value: Property.GridTemplateRows | undefined): this;
619
+ /**
620
+ * Sets the `appearance` style of the element.
621
+ * Controls native platform styling of UI elements like buttons and inputs.
622
+ * Common values include "none" to remove default styling, or platform-specific keywords.
623
+ *
624
+ * @param value - The appearance value (e.g., "none", "auto"), or `undefined` to remove it.
625
+ * @return This instance for chaining.
626
+ */
716
627
  appearance(value: Property.Appearance | undefined): this;
717
628
  /**
718
629
  * Sets the CSS `user-select` property to control text selection behavior.
719
630
  * @param value - The user-select value (e.g., "none", "text", "auto", "contain", "all").
720
- * @return This DomElement instance for chaining.
631
+ * @return This instance for chaining.
721
632
  */
722
633
  userSelect(value: Property.UserSelect | undefined): this;
723
634
  /**
@@ -725,9 +636,36 @@ declare class DomElement<Tag extends keyof DomElementTagNameMap = keyof DomEleme
725
636
  * Common values include "middle", "top", "bottom", "baseline", or pixel/em units.
726
637
  *
727
638
  * @param value - The CSS vertical-align value (e.g., "middle", "top", "10px").
728
- * @return This DomElement instance for chaining.
639
+ * @return This instance for chaining.
729
640
  */
730
641
  verticalAlign(value: Property.VerticalAlign | undefined): this;
642
+ /**
643
+ * Sets the `white-space` style of the element.
644
+ * Common values include "normal", "nowrap", "pre", "pre-wrap", or "pre-line".
645
+ * Controls how whitespace and line breaks are handled within the element.
646
+ *
647
+ * @param value - The CSS white-space value (e.g., "nowrap", "pre-wrap"), or `undefined` to remove it.
648
+ * @return This instance for chaining.
649
+ */
650
+ whiteSpace(value: Property.WhiteSpace | undefined): this;
651
+ /**
652
+ * Sets the `text-overflow` style of the element.
653
+ * Common values include "ellipsis", "clip", or "string" for custom overflow indicators.
654
+ * Controls how overflowed inline content is rendered when it exceeds the container bounds.
655
+ *
656
+ * @param value - The CSS text-overflow value (e.g., "ellipsis", "clip"), or `undefined` to remove it.
657
+ * @return This instance for chaining.
658
+ */
659
+ textOverflow(value: Property.TextOverflow | undefined): this;
660
+ /**
661
+ * Sets the `z-index` style of the element.
662
+ * Controls the stacking order of positioned elements. Higher values appear in front of lower ones.
663
+ * Only applies to elements with a position other than `static`.
664
+ *
665
+ * @param value - The z-index value (e.g., 10, 1000), or `undefined` to remove it.
666
+ * @return This instance for chaining.
667
+ */
668
+ zIndex(value: Property.ZIndex | undefined): this;
731
669
  /**
732
670
  * Applies CSS styles to truncate overflowing text with an ellipsis.
733
671
  * Ensures the text stays on a single line and hides overflow.
@@ -739,119 +677,288 @@ declare class DomElement<Tag extends keyof DomElementTagNameMap = keyof DomEleme
739
677
  * text-overflow: ellipsis;
740
678
  * ```
741
679
  *
742
- * @return This DomElement instance for chaining.
680
+ * @return This instance for chaining.
743
681
  */
744
682
  overflowEllipsis(): this;
683
+ /**
684
+ * Applies a batch of CSS style properties to the element.
685
+ * Delegates each property to `setStyleProp`, which handles value normalization and kebab-case conversion.
686
+ *
687
+ * - Properties with `undefined` values are removed from the inline style.
688
+ * - Numeric values are passed through the style sheet for unit resolution.
689
+ * - Supports chainable usage for fluent DOM composition.
690
+ *
691
+ * @param props - A partial map of CSS properties and their values.
692
+ * @returns This instance for chaining.
693
+ */
694
+ style(props: CssProperties): this;
695
+ }
696
+ //#endregion
697
+ //#region src/BaseDom.d.ts
698
+ /**
699
+ * Base class for DOM-backed elements with style and event utilities.
700
+ * Supports both HTML and SVG elements via generic parameter `E`.
701
+ */
702
+ declare abstract class BaseDom<E extends HTMLElement | SVGElement> extends BaseStyle {
703
+ abstract dom: E;
704
+ /**
705
+ * Sets or removes the user-defined class name and applies it alongside the internal CSS class.
706
+ * Uses `setAttribute("class", ...)` for both HTML and SVG elements.
707
+ *
708
+ * Passing `undefined` removes the user-defined class name entirely.
709
+ *
710
+ * @param value - The user-defined class name, or `undefined` to remove it.
711
+ * @return This DomElement instance for chaining.
712
+ */
713
+ className(value: string | undefined): this;
714
+ /**
715
+ * Adds an event listener to the element.
716
+ * @param type - The event type (e.g., "click", "input", "mouseenter").
717
+ * @param handler - The event handler function.
718
+ * @param options - Optional event listener options.
719
+ * @return This DomElement instance for chaining.
720
+ */
721
+ on<T extends keyof DomElementEventMap>(type: T, handler: (ev: DomElementEventMap[T] & {
722
+ currentTarget: E;
723
+ }) => void, options?: boolean | AddEventListenerOptions): this;
724
+ /**
725
+ * Removes an event listener from the element.
726
+ * @param type - The event type to remove.
727
+ * @param handler - The original handler function.
728
+ * @param options - Optional event listener options.
729
+ */
730
+ off<T extends keyof DomElementEventMap>(type: T, handler: (ev: DomElementEventMap[T]) => void, options?: boolean | EventListenerOptions): void;
731
+ /**
732
+ * Appends one or more child nodes to the element.
733
+ * Accepts DomElement instances, regular DOM Nodes, strings, or numbers.
734
+ *
735
+ * - Strings and numbers are coerced to text nodes.
736
+ * - DomElement instances are unwrapped to their native DOM nodes.
737
+ * - DOM Nodes are appended directly.
738
+ *
739
+ * @param nodes - One or more child elements or text values to append.
740
+ * @return This DomElement instance for chaining.
741
+ */
742
+ add(...nodes: DomElementChild[]): this;
743
+ /**
744
+ * Inserts one or more DomElements into a parent at the specified index.
745
+ * Each node is inserted sequentially starting from the given index.
746
+ *
747
+ * @param index - The zero-based index at which to start inserting.
748
+ * @param nodes - One or more DomElements to insert.
749
+ * @return This DomElement instance.
750
+ */
751
+ insertAtIndex(index: number, ...nodes: DomElementChild[]): this;
752
+ /**
753
+ * Replaces all existing child elements of this DOM node with the provided ones.
754
+ * Internally clears the current children and appends the new nodes in order.
755
+ *
756
+ * @param nodes - One or more DomElement instances to set as children.
757
+ * @return This DomElement instance.
758
+ */
759
+ setChildren(...nodes: DomElementChild[]): this;
760
+ /**
761
+ * Replaces child elements starting from the specified index with the provided nodes.
762
+ * All children before the index are preserved.
763
+ *
764
+ * @param index - The zero-based index at which replacement begins.
765
+ * @param nodes - One or more DomElement instances to insert.
766
+ * @return This DomElement instance.
767
+ */
768
+ setChildrenFromIndex(index: number, ...nodes: DomElementChild[]): this;
769
+ /**
770
+ * Removes child elements within the specified index range.
771
+ * If no range is provided, removes all children.
772
+ *
773
+ * @param from - The starting index (inclusive). Defaults to 0.
774
+ * @param to - The ending index (exclusive). Defaults to all children.
775
+ * @returns This DomElement instance.
776
+ */
777
+ clear(from?: number, to?: number): this;
745
778
  ref(refFn: (el: this) => void): this;
779
+ protected resolveNode(child: DomElementChild): Node;
780
+ protected setStyleProp(name: Autocomplete<keyof CssProperties>, value: string | number | undefined): this;
781
+ }
782
+ //#endregion
783
+ //#region src/DomElement.d.ts
784
+ /**
785
+ * A unified wrapper for HTML and SVG elements that provides a fluent, type-safe API
786
+ * for DOM manipulation, styling, and event handling.
787
+ *
788
+ * Supports both `HTMLElementTagNameMap` and `SVGElementTagNameMap` via the generic `Tag`,
789
+ * and automatically handles namespace creation for SVG elements.
790
+ *
791
+ * Provides ergonomic methods for setting styles, attributes, classes, and event listeners,
792
+ * while abstracting away platform-specific quirks (e.g., `className` vs `setAttribute("class")`).
793
+ *
794
+ * @template Tag - The tag name of the element, inferred from `DomElementTagNameMap`.
795
+ */
796
+ declare class DomElement<Tag extends keyof DomElementTagNameMap = keyof DomElementTagNameMap> extends BaseDom<DomElementTagNameMap[Tag]> {
746
797
  /**
747
- * Applies scoped CSS styles to the element using a class-based selector.
748
- * Ensures the element has a unique internal class name, then targets it with the given selector.
798
+ * Creates a new DomElement instance for the specified tag.
799
+ * Automatically detects whether the tag is an SVG element and uses the appropriate namespace.
800
+ * Optionally wraps an existing DOM element instead of creating a new one.
749
801
  *
750
- * For example, calling `css(":hover", { color: "red" })` will generate:
751
- * ```css
752
- * .<internalClassName>:hover { color: red; }
753
- * ```
802
+ * @param tag - The tag name of the element (e.g., "div", "circle", "svg").
803
+ * @param el - An optional existing DOM element to wrap. If omitted, a new element is created.
804
+ */
805
+ constructor(tag: Tag, el?: DomElementTagNameMap[Tag]);
806
+ protected _tag: Tag extends "svgA" ? {
807
+ svgA: "a";
808
+ }[Tag] : Tag;
809
+ protected _isSvg: boolean;
810
+ protected _dom: DomElementTagNameMap[Tag];
811
+ /**
812
+ * Gets the tag name of the element (e.g., "div", "svg", "circle").
813
+ */
814
+ get tag(): Tag extends "svgA" ? {
815
+ svgA: "a";
816
+ }[Tag] : Tag;
817
+ /**
818
+ * Indicates whether the element is an SVG element.
819
+ * Returns `true` for tags like "svg", "circle", "path", etc.
820
+ */
821
+ get isSvg(): boolean;
822
+ /**
823
+ * Gets the underlying DOM element instance.
824
+ * This will be either an `HTMLElement` or `SVGElement` depending on the tag.
825
+ */
826
+ get dom(): DomElementTagNameMap[Tag];
827
+ /**
828
+ * Gets the textContent property of the DOM element.
829
+ */
830
+ getText(): string;
831
+ /**
832
+ * Sets or clears the text content of the element.
833
+ * Converts any value to a string before assignment.
834
+ * Passing `undefined` or `null` removes the text by setting it to an empty string.
835
+ *
836
+ * @param value - The text content to set, or `undefined`/`null` to clear it.
837
+ * @return This DomElement instance for chaining.
838
+ */
839
+ text(value: any): this;
840
+ /**
841
+ * Removes the element from the DOM tree.
842
+ * Equivalent to calling `element.remove()` on the native DOM node.
754
843
  *
755
- * This enables dynamic styling of pseudo-classes, child selectors, or media queries without inline styles.
844
+ * This does not dispose internal state or event listeners use `dispose()` if cleanup is needed.
756
845
  *
757
- * @param selector - A CSS selector suffix (e.g., ":hover", " > span") scoped to the internal class.
758
- * @param props - A map of CSS properties to apply to the generated rule.
759
846
  * @return This DomElement instance for chaining.
760
847
  */
761
- css(selector: string, props: CssProperties): this;
848
+ remove(): void;
849
+ /**
850
+ * Retrieves the value of a single attribute.
851
+ * @param name - The attribute name to read (e.g. "aria-label", "role").
852
+ * @return The attribute value as a string, or null if not present.
853
+ */
854
+ getAttr(name: string): string | null;
855
+ /**
856
+ * Sets a single attribute on the element.
857
+ * @param name - The attribute name (e.g. "aria-label", "role", "disabled").
858
+ * @param value - The attribute value. If undefined, the attribute is removed.
859
+ * @return This DomElement instance for chaining.
860
+ */
861
+ attr(name: string, value: string | number | boolean | undefined): this;
862
+ /**
863
+ * Sets multiple attributes on the element.
864
+ * @param attributes - An object mapping attribute names to values.
865
+ * Attributes with undefined values are removed.
866
+ * @return This DomElement instance for chaining.
867
+ */
868
+ attrs(attributes: Record<string, string | number | boolean | undefined>): this;
869
+ /**
870
+ * Retrieves the value of a single property.
871
+ * @param name - The property name to read (e.g. "value", "checked", "disabled").
872
+ * @return The property value, or undefined if not present.
873
+ */
874
+ getProp(name: string): any;
875
+ /**
876
+ * Sets a single property on the element.
877
+ * @param name - The property name (e.g. "checked", "value", "disabled").
878
+ * @param value - The property value. If undefined, the property is deleted.
879
+ * @return This DomElement instance for chaining.
880
+ */
881
+ prop(name: string, value: any): this;
762
882
  /**
763
- * Applies scoped CSS styles directly to the root selector of the element.
764
- * Equivalent to styling `.className` without any pseudo-classes or combinators.
765
- *
766
- * @param props - A map of CSS properties to apply to the root selector.
883
+ * Sets multiple properties on the element.
884
+ * @param props - An object mapping property names to values.
885
+ * Properties with undefined values are deleted.
767
886
  * @return This DomElement instance for chaining.
768
887
  */
769
- rootCss(props: CssProperties): this;
888
+ props(props: Record<string, any>): this;
770
889
  /**
771
- * Applies scoped CSS styles to the `:hover` state of the element.
772
- * Useful for styling hover interactions without inline styles.
890
+ * Sets or removes the `id` of the element.
891
+ * Passing `undefined` clears the ID by setting it to an empty string.
773
892
  *
774
- * @param props - A map of CSS properties to apply when the element is hovered.
893
+ * @param value - The element's ID, or `undefined` to remove it.
775
894
  * @return This DomElement instance for chaining.
776
895
  */
777
- hoverCss(props: CssProperties): this;
896
+ id(value: string | undefined): this;
778
897
  /**
779
- * Applies scoped CSS styles to the `:active` state of the element.
780
- * Useful for styling active interactions (e.g., mouse down).
898
+ * Sets or removes the `htmlFor` property on a <label> element.
899
+ * This links the label to a form control by its ID.
900
+ *
901
+ * Passing `undefined` removes the association.
902
+ * Has no effect if the element is not a <label>.
781
903
  *
782
- * @param props - A map of CSS properties to apply when the element is active.
904
+ * @param value - The ID of the target form control, or `undefined` to remove it.
783
905
  * @return This DomElement instance for chaining.
784
906
  */
785
- activeCss(props: CssProperties): this;
907
+ htmlFor(value: string | undefined): this;
786
908
  /**
787
- * Applies scoped CSS styles to the `:focus` state of the element.
788
- * Useful for styling keyboard or programmatic focus.
909
+ * Sets or removes the `title` attribute on the element.
910
+ * Applies to both HTML and SVG elements. Passing `undefined` removes the attribute.
789
911
  *
790
- * @param props - A map of CSS properties to apply when the element is focused.
912
+ * @param value - The tooltip text to show on hover, or `undefined` to remove it.
791
913
  * @return This DomElement instance for chaining.
792
914
  */
793
- focusCss(props: CssProperties): this;
915
+ title(value: string | undefined): this;
794
916
  /**
795
- * Applies scoped CSS styles to the `:focus-within` state of the element.
796
- * Useful for styling when any child element has focus.
917
+ * Sets or removes the `disabled` attribute on the element.
918
+ * Applicable to form controls like <button>, <input>, <select>, etc.
797
919
  *
798
- * @param props - A map of CSS properties to apply when the element or its descendants are focused.
920
+ * @param value - If true, sets the `disabled` attribute; if false, removes it.
799
921
  * @return This DomElement instance for chaining.
800
922
  */
801
- focusWithinCss(props: CssProperties): this;
923
+ disabled(value: boolean): this;
802
924
  /**
803
- * Applies scoped CSS styles to the element within a media query block.
804
- * Ensures the element has a unique internal class name, then targets it with the given selector inside the specified media query.
805
- *
806
- * For example, calling `mediaCss("screen and (max-width: 600px)", ":hover", { color: "red" })` will generate:
807
- * ```css
808
- * \@media screen and (max-width: 600px) {
809
- * .<internalClassName>:hover { color: red; }
810
- * }
811
- * ```
812
- *
813
- * This enables responsive styling and conditional behavior based on viewport or device characteristics.
814
- *
815
- * @param mediaText - The media query string (e.g., "screen and (max-width: 600px)").
816
- * @param selector - A CSS selector suffix (e.g., ":hover", " > span") scoped to the internal class.
817
- * @param props - A map of CSS properties to apply within the media rule.
925
+ * Sets the `disabled` attribute to disable the element.
926
+ * Applicable to form controls like <button>, <input>, <select>, etc.
818
927
  * @return This DomElement instance for chaining.
819
928
  */
820
- mediaCss(mediaText: string, selector: string, props: CssProperties): this;
929
+ disable(): this;
821
930
  /**
822
- * Applies scoped CSS styles to the root selector of the element within a media query block.
823
- * Useful for conditionally styling the element based on viewport or device characteristics.
824
- *
825
- * @param mediaText - The media query string (e.g., "screen and (max-width: 600px)").
826
- * @param props - A map of CSS properties to apply within the media rule.
931
+ * Removes the `disabled` attribute to enable the element.
827
932
  * @return This DomElement instance for chaining.
828
933
  */
829
- mediaRootCss(mediaText: string, props: CssProperties): this;
934
+ enable(): this;
830
935
  /**
831
- * Applies scoped CSS styles to the root selector of the element when the viewport width
832
- * meets or exceeds the specified minimum.
936
+ * Sets or removes the `popover` attribute on the element.
937
+ * Applies to HTML elements that support the popover API (e.g., `<div popover>`).
938
+ * Passing `undefined` removes the attribute.
833
939
  *
834
- * Automatically converts numeric values to pixel-based CSS width values.
940
+ * Common values include:
941
+ * - `"auto"` → Automatically shows/hides based on user interaction.
942
+ * - `"manual"` → Requires explicit show/hide via JavaScript.
835
943
  *
836
- * @param minWidth - The minimum width threshold (e.g., 600 or "40em").
837
- * @param props - A map of CSS properties to apply when the condition is met.
944
+ * @param value - The popover mode (`"auto"` or `"manual"`), or `undefined` to remove it.
838
945
  * @return This DomElement instance for chaining.
839
946
  */
840
- minWidthCss(minWidth: number | string, props: CssProperties): this;
947
+ popover(value: "auto" | "manual" | undefined): this;
841
948
  /**
842
- * Applies scoped CSS styles to the root selector of the element when the viewport width
843
- * is less than or equal to the specified maximum.
949
+ * Shows the popover on this element.
950
+ * Requires the element to have a `popover="manual"` attribute and be in the DOM.
844
951
  *
845
- * Automatically converts numeric values to pixel-based CSS width values.
952
+ * @return This DomElement instance for chaining.
953
+ */
954
+ showPopover(): this;
955
+ /**
956
+ * Hides the popover on this element.
957
+ * Requires the element to have a `popover="manual"` attribute and be in the DOM.
846
958
  *
847
- * @param maxWidth - The maximum width threshold (e.g., 600 or "40em").
848
- * @param props - A map of CSS properties to apply when the condition is met.
849
959
  * @return This DomElement instance for chaining.
850
960
  */
851
- maxWidthCss(maxWidth: number | string, props: CssProperties): this;
852
- protected resolveNode(child: DomElementChild): Node;
853
- protected setStyleProp(name: Autocomplete<keyof CssProperties>, value: string | number | undefined): this;
854
- protected setCssClassName(): this;
961
+ hidePopover(): this;
855
962
  }
856
963
  /**
857
964
  * Creates a new DomElement instance for the given tag name.
@@ -872,13 +979,14 @@ declare class AnchorElement extends DomElement<"a"> {
872
979
  constructor();
873
980
  href(value: string): this;
874
981
  }
982
+ declare function $a(): AnchorElement;
875
983
  //#endregion
876
984
  //#region src/Button.d.ts
877
985
  declare class Button extends DomElement<"button"> {
878
986
  constructor();
879
987
  type(value: "button" | "submit" | "reset"): this;
880
- disabledCss(props: CssProperties): this;
881
988
  }
989
+ declare function $btn(): Button;
882
990
  //#endregion
883
991
  //#region src/Canvas.d.ts
884
992
  declare class Canvas extends DomElement<"canvas"> {
@@ -907,6 +1015,7 @@ declare class Canvas extends DomElement<"canvas"> {
907
1015
  z: number;
908
1016
  };
909
1017
  }
1018
+ declare function $canvas(): Canvas;
910
1019
  //#endregion
911
1020
  //#region src/constants.d.ts
912
1021
  declare const UNITLESS_CSS_PROPS: Record<string, 1>;
@@ -917,16 +1026,266 @@ declare const TAG_ALIAS: {
917
1026
  };
918
1027
  type TagAlias = typeof TAG_ALIAS;
919
1028
  //#endregion
1029
+ //#region src/MediaRule.d.ts
1030
+ declare class MediaRule {
1031
+ constructor(sheet: StyleSheet, index: number, rule: CSSMediaRule);
1032
+ protected _sheet: StyleSheet;
1033
+ protected _index: number;
1034
+ protected _rule: CSSMediaRule;
1035
+ /**
1036
+ * Returns the StyleSheet instance that owns this media rule.
1037
+ * Useful for accessing shared rule management and stylesheet-level operations.
1038
+ */
1039
+ get sheet(): StyleSheet;
1040
+ /**
1041
+ * Returns the index of this media rule within its parent stylesheet.
1042
+ * This index is used for rule lookup, insertion, and removal.
1043
+ */
1044
+ get index(): number;
1045
+ /**
1046
+ * Returns the underlying CSSMediaRule object.
1047
+ * Provides direct access to the media query and its nested CSS rules.
1048
+ */
1049
+ get rule(): CSSMediaRule;
1050
+ /**
1051
+ * Returns the number of CSS rules contained within this media block.
1052
+ * Useful for determining insertion index or iterating over nested rules.
1053
+ */
1054
+ get length(): number;
1055
+ /**
1056
+ * Returns the media query string associated with this rule.
1057
+ * For example: "screen and (max-width: 600px)".
1058
+ */
1059
+ get mediaText(): string;
1060
+ /**
1061
+ * Inserts a new CSSStyleRule into this media block at the end of its rule list.
1062
+ * The rule is created with an empty declaration block and wrapped in a CssRule instance for programmatic styling.
1063
+ *
1064
+ * For example, calling `cssRule(".box:hover")` will generate:
1065
+ * ```css
1066
+ * @media ... {
1067
+ * .box:hover {}
1068
+ * }
1069
+ * ```
1070
+ *
1071
+ * @param selector - The CSS selector to target (e.g., ".box", ":hover", "div > span").
1072
+ * @return A CssRule instance representing the newly inserted rule.
1073
+ */
1074
+ cssRule(selector: string): CssRule;
1075
+ /**
1076
+ * Removes this media rule from its parent stylesheet.
1077
+ * Delegates to the StyleSheet instance, which handles cleanup and index management.
1078
+ */
1079
+ remove(): void;
1080
+ /**
1081
+ * Removes a nested CSSStyleRule from this media block.
1082
+ * Uses the rule's index to delete it from the internal rule list.
1083
+ *
1084
+ * @param rule - The CssRule instance to remove from this media query block.
1085
+ */
1086
+ removeRule(rule: CssRule): void;
1087
+ }
1088
+ //#endregion
1089
+ //#region src/StyleSheet.d.ts
1090
+ /**
1091
+ * Manages a dedicated `<style>` element and provides programmatic access to its CSS rules.
1092
+ * Supports dynamic insertion, retrieval, and deletion of both standard and media-specific rules,
1093
+ * with internal indexing for fast lookup and reuse.
1094
+ *
1095
+ * This class ensures a single shared stylesheet instance via `StyleSheet.getSheet()`,
1096
+ * and maintains selector-to-index and media-to-rule maps on the global `window` object.
1097
+ *
1098
+ * Designed for use with component-level styling systems or DOM abstractions that require
1099
+ * granular control over rule injection without relying on inline styles.
1100
+ */
1101
+ declare class StyleSheet {
1102
+ constructor(el: HTMLStyleElement);
1103
+ protected _dom: HTMLStyleElement;
1104
+ /**
1105
+ * Returns the underlying `<style>` DOM element.
1106
+ * This element is used to inject and manage dynamic CSS rules.
1107
+ */
1108
+ get dom(): HTMLStyleElement;
1109
+ /**
1110
+ * Returns the associated `CSSStyleSheet` object for this `<style>` element.
1111
+ * Provides access to rule-level operations like `insertRule()` and `deleteRule()`.
1112
+ * Assumes the sheet is available and attached to the document.
1113
+ */
1114
+ get sheet(): CSSStyleSheet;
1115
+ /**
1116
+ * Returns the number of CSS rules currently defined in the stylesheet.
1117
+ * Useful for indexing, iteration, or conditional rule management.
1118
+ */
1119
+ get length(): number;
1120
+ /**
1121
+ * Inserts a new empty CSS rule into the stylesheet for the given selector.
1122
+ * Returns a `CssRule` wrapper for fluent manipulation of the inserted rule.
1123
+ *
1124
+ * The rule is appended at the end of the current stylesheet (`insertRule()` at index `length`).
1125
+ * This is useful for dynamically constructing scoped styles tied to specific selectors.
1126
+ *
1127
+ * @param selector - The CSS selector to target (e.g., ".btn", "#header", "body > div").
1128
+ * @return A `CssRule` instance representing the inserted rule.
1129
+ */
1130
+ cssRule(selector: string): CssRule;
1131
+ /**
1132
+ * Inserts a new empty `@media` rule into the stylesheet using the provided media query string.
1133
+ * Returns a `MediaRule` wrapper for fluent manipulation of the inserted media block.
1134
+ *
1135
+ * The rule is appended at the end of the current stylesheet (`insertRule()` at index `length`).
1136
+ * Useful for dynamically scoping styles to specific viewport conditions or device capabilities.
1137
+ *
1138
+ * @param mediaText - The media query string (e.g., "screen and (max-width: 600px)").
1139
+ * @return A `MediaRule` instance representing the inserted media rule.
1140
+ */
1141
+ mediaRule(mediaText: string): MediaRule;
1142
+ /**
1143
+ * Inserts a new `@media (min-width: …)` rule into the stylesheet.
1144
+ * Returns a `MediaRule` wrapper for fluent manipulation of styles targeting wider viewports.
1145
+ *
1146
+ * Equivalent to: `mediaRule("min-width: 768px")`
1147
+ *
1148
+ * @param minWidth - The minimum width value (e.g., `768`, `"50em"`, `"80vw"`).
1149
+ * @return A `MediaRule` instance representing the inserted media rule.
1150
+ */
1151
+ mediaMinWidth(minWidth: number | string): MediaRule;
1152
+ /**
1153
+ * Inserts a new `@media (max-width: …)` rule into the stylesheet.
1154
+ * Returns a `MediaRule` wrapper for fluent manipulation of styles targeting narrower viewports.
1155
+ *
1156
+ * Equivalent to: `mediaRule("max-width: 600px")`
1157
+ *
1158
+ * @param maxWidth - The maximum width value (e.g., `600`, `"40em"`, `"80vw"`).
1159
+ * @return A `MediaRule` instance representing the inserted media rule.
1160
+ */
1161
+ mediaMaxWidth(maxWidth: number | string): MediaRule;
1162
+ /**
1163
+ * Removes a CSS rule from the stylesheet by its index.
1164
+ * Accepts either a `CssRule` or `MediaRule` instance, which internally tracks its position.
1165
+ *
1166
+ * This is useful for dynamically cleaning up injected styles or media blocks.
1167
+ * Note: Rule indices may shift after insertion or deletion — ensure index accuracy before calling.
1168
+ *
1169
+ * @param rule - The rule instance to remove (`CssRule` or `MediaRule`).
1170
+ */
1171
+ removeRule(rule: CssRule | MediaRule): void;
1172
+ /**
1173
+ * Retrieves or creates a <style> element with the given ID and wraps it in a StyleSheet instance.
1174
+ * If no element with the specified ID exists, a new <style> tag is created, appended to <head>,
1175
+ * and assigned the ID. This allows multiple independently managed stylesheets via custom IDs.
1176
+ *
1177
+ * @param id - Optional ID of the <style> element to target. Defaults to DEFAULT_STYLE_ID.
1178
+ * @return A StyleSheet instance bound to the specified <style> element.
1179
+ */
1180
+ static getSheet(id?: string): StyleSheet;
1181
+ /**
1182
+ * The default ID used for the primary stylesheet managed by the StyleSheet class.
1183
+ * This ensures consistent lookup and avoids collisions with other style elements in the document.
1184
+ */
1185
+ static DEFAULT_STYLE_ID: string;
1186
+ }
1187
+ //#endregion
1188
+ //#region src/CssRule.d.ts
1189
+ declare class CssRule extends BaseStyle {
1190
+ constructor(sheet: StyleSheet, index: number, rule: CSSStyleRule);
1191
+ protected _sheet: StyleSheet;
1192
+ protected _index: number;
1193
+ protected _rule: CSSStyleRule;
1194
+ /**
1195
+ * Returns the StyleSheet instance that owns this rule.
1196
+ * Useful for accessing rule management utilities or shared configuration.
1197
+ */
1198
+ get sheet(): StyleSheet;
1199
+ /**
1200
+ * Returns the index of this rule within its parent stylesheet.
1201
+ * This index is stable and used for rule lookup and removal.
1202
+ */
1203
+ get index(): number;
1204
+ /**
1205
+ * Returns the underlying CSSStyleRule object.
1206
+ * Provides direct access to selector text and style declarations.
1207
+ */
1208
+ get rule(): CSSStyleRule;
1209
+ /**
1210
+ * Returns the selector text of the underlying CSSStyleRule.
1211
+ * For example: ".box:hover", "div > span", or ".my-class[data-active]".
1212
+ */
1213
+ get selectorText(): string;
1214
+ /**
1215
+ * Removes this rule from its parent stylesheet.
1216
+ * Delegates to the StyleSheet instance to ensure proper cleanup and cache invalidation.
1217
+ */
1218
+ remove(): void;
1219
+ /**
1220
+ * Applies a style property to the underlying CSS rule.
1221
+ * Removes the property if `undefined` is passed.
1222
+ *
1223
+ * @param name - The camelCase CSS property name.
1224
+ * @param value - The value to apply, or `undefined` to remove it.
1225
+ * @return This instance for chaining.
1226
+ */
1227
+ protected setStyleProp(name: Autocomplete<keyof CssProperties>, value: string | number | undefined): this;
1228
+ }
1229
+ //#endregion
920
1230
  //#region src/DomBody.d.ts
921
- declare class DomBody {
1231
+ /**
1232
+ * Wrapper for document.body with style and DOM composition utilities.
1233
+ * Enables fluent styling and child node management.
1234
+ */
1235
+ declare class DomBody extends BaseDom<HTMLBodyElement> {
922
1236
  get dom(): HTMLBodyElement;
923
- style(obj: CssProperties): this;
924
- protected getStyleValue(name: string, value: string | number): string;
925
- add(...nodes: DomElement<any>[]): this;
926
- clear(): this;
927
1237
  }
1238
+ /**
1239
+ * Creates a new DomBody instance bound to `document.body`.
1240
+ * Provides fluent access to body-level styling, DOM composition, and event utilities.
1241
+ *
1242
+ * Useful for global layout scaffolding, dynamic content injection, or body-wide style control.
1243
+ *
1244
+ * @return A DomBody instance wrapping `document.body`.
1245
+ */
928
1246
  declare function $body(): DomBody;
929
1247
  //#endregion
1248
+ //#region src/DomWindow.d.ts
1249
+ /**
1250
+ * Wrapper for the global `window` object with typed event listener utilities.
1251
+ * Useful for managing global events like resize, scroll, or keyboard shortcuts.
1252
+ */
1253
+ declare class DomWindow {
1254
+ /**
1255
+ * Adds an event listener to the window.
1256
+ * @param type - The event type (e.g., "click", "input", "mouseenter").
1257
+ * @param handler - The event handler function.
1258
+ * @param options - Optional event listener options.
1259
+ * @return This instance for chaining.
1260
+ */
1261
+ on<T extends keyof WindowEventMap>(type: T, handler: (ev: WindowEventMap[T] & {
1262
+ currentTarget: Window;
1263
+ }) => void, options?: boolean | AddEventListenerOptions): this;
1264
+ /**
1265
+ * Removes an event listener from the window.
1266
+ * @param type - The event type to remove.
1267
+ * @param handler - The original handler function.
1268
+ * @param options - Optional event listener options.
1269
+ */
1270
+ off<T extends keyof WindowEventMap>(type: T, handler: (ev: WindowEventMap[T]) => void, options?: boolean | EventListenerOptions): void;
1271
+ /**
1272
+ * Dispatches a DOM event on the window object.
1273
+ *
1274
+ * @param event - The corresponding event instance (e.g., `new Event("resize")`, `new KeyboardEvent("keydown")`).
1275
+ * @return This instance for chaining.
1276
+ */
1277
+ dispatch(event: Event): this;
1278
+ }
1279
+ /**
1280
+ * Creates a new DomWindow instance bound to the global `window` object.
1281
+ * Provides typed event listener utilities and fluent dispatching for built-in DOM events.
1282
+ *
1283
+ * Useful for managing global interactions like resize, scroll, keyboard shortcuts, or visibility changes.
1284
+ *
1285
+ * @return A DomWindow instance wrapping the global `window`.
1286
+ */
1287
+ declare function $window(): DomWindow;
1288
+ //#endregion
930
1289
  //#region src/IFrame.d.ts
931
1290
  declare class IFrame extends DomElement<"iframe"> {
932
1291
  constructor();
@@ -937,6 +1296,7 @@ declare class IFrame extends DomElement<"iframe"> {
937
1296
  setSize(width: number, height: number): this;
938
1297
  reload(): void;
939
1298
  }
1299
+ declare function $iframe(): IFrame;
940
1300
  //#endregion
941
1301
  //#region src/ImageElement.d.ts
942
1302
  declare class ImageElement extends DomElement<"img"> {
@@ -947,74 +1307,26 @@ declare class ImageElement extends DomElement<"img"> {
947
1307
  setSize(width: number, height: number): this;
948
1308
  alt(value: string): this;
949
1309
  }
1310
+ declare function $img(): ImageElement;
950
1311
  //#endregion
951
- //#region src/InputCheckbox.d.ts
952
- declare class InputCheckbox extends DomElement<"input"> {
953
- constructor();
954
- name(value: string): this;
955
- checked(value: boolean): this;
956
- isChecked(): boolean;
957
- disabledCss(props: CssProperties): this;
958
- }
959
- //#endregion
960
- //#region src/InputColor.d.ts
961
- declare class InputColor extends DomElement<"input"> {
962
- constructor();
963
- protected _rgb: {
964
- r: number;
965
- g: number;
966
- b: number;
967
- };
968
- name(value: string): this;
969
- value(value: string): this;
970
- getValue(): string;
971
- getRGB(): {
972
- r: number;
973
- g: number;
974
- b: number;
975
- };
976
- getNormalizedRGB(): {
977
- r: number;
978
- g: number;
979
- b: number;
980
- };
981
- disabledCss(props: CssProperties): this;
982
- }
983
- //#endregion
984
- //#region src/InputNumber.d.ts
985
- declare class InputNumber extends DomElement<"input"> {
986
- constructor();
987
- name(value: string): this;
988
- value(value: number): this;
989
- getValue(): number;
990
- min(value: number): this;
991
- max(value: number): this;
992
- step(value: number): this;
993
- placeholder(value: string): this;
994
- disabledCss(props: CssProperties): this;
995
- }
996
- //#endregion
997
- //#region src/InputRange.d.ts
998
- declare class InputRange extends DomElement<"input"> {
999
- constructor();
1000
- name(value: string): this;
1001
- value(value: number): this;
1002
- getValue(): number;
1003
- min(value: number): this;
1004
- max(value: number): this;
1005
- step(value: number): this;
1006
- disabledCss(props: CssProperties): this;
1007
- }
1008
- //#endregion
1009
- //#region src/InputText.d.ts
1010
- declare class InputText extends DomElement<"input"> {
1011
- constructor();
1012
- name(value: string): this;
1013
- value(value: string): this;
1014
- getValue(): string;
1015
- placeholder(value: string): this;
1016
- disabledCss(props: CssProperties): this;
1017
- }
1312
+ //#region src/input.d.ts
1313
+ /**
1314
+ * Creates a typed input element instance based on the specified input type.
1315
+ * Returns a subclass of `DomElement` with type-safe access to input-specific properties and behaviors.
1316
+ *
1317
+ * Supported types include:
1318
+ * - `"text"` → `InputText`
1319
+ * - `"number"` → `InputNumber`
1320
+ * - `"checkbox"` → `InputCheckbox`
1321
+ * - `"color"` → `InputColor`
1322
+ * - `"range"` → `InputRange`
1323
+ *
1324
+ * Each returned instance supports fluent styling, DOM composition, and event binding.
1325
+ *
1326
+ * @param type - The input type to create.
1327
+ * @return A typed input element instance matching the given type.
1328
+ */
1329
+ declare function $input<T$1 extends keyof InputElementMap>(type: T$1): InputElementMap[T$1];
1018
1330
  //#endregion
1019
1331
  //#region src/OptionElement.d.ts
1020
1332
  declare class OptionElement extends DomElement<"option"> {
@@ -1022,6 +1334,7 @@ declare class OptionElement extends DomElement<"option"> {
1022
1334
  value(value: string | number): this;
1023
1335
  getValue(): string;
1024
1336
  }
1337
+ declare function $option(): OptionElement;
1025
1338
  //#endregion
1026
1339
  //#region src/ProgressElement.d.ts
1027
1340
  /**
@@ -1062,6 +1375,7 @@ declare class ProgressElement extends DomElement<"progress"> {
1062
1375
  */
1063
1376
  indeterminate(): this;
1064
1377
  }
1378
+ declare function $progress(): ProgressElement;
1065
1379
  //#endregion
1066
1380
  //#region src/SelectElement.d.ts
1067
1381
  declare class SelectElement extends DomElement<"select"> {
@@ -1070,9 +1384,11 @@ declare class SelectElement extends DomElement<"select"> {
1070
1384
  value(value: string | number): this;
1071
1385
  getValue(): string;
1072
1386
  }
1387
+ declare function $select(): SelectElement;
1073
1388
  //#endregion
1074
1389
  //#region src/utils.d.ts
1075
1390
  declare function uniqueId(): string;
1076
1391
  declare function camelToKebab(prop: string): string;
1392
+ declare function getStyleValue(name: Autocomplete<keyof CssProperties>, value: string | number): string;
1077
1393
  //#endregion
1078
- export { $, $body, $query, AnchorElement, Autocomplete, Button, Canvas, CssProperties, type CssProperty, DomBody, DomElement, DomElementChild, DomElementEventMap, DomElementTagNameMap, IFrame, ImageElement, InputCheckbox, InputColor, InputNumber, InputRange, InputText, MediaRule, OptionElement, ProgressElement, SVG_TAGS, SelectElement, StyleSheet, TAG_ALIAS, TagAlias, UNITLESS_CSS_PROPS, VENDOR_CSS_PROPS, camelToKebab, uniqueId };
1394
+ export { $, $a, $body, $btn, $canvas, $iframe, $img, $input, $option, $progress, $query, $select, $window, AnchorElement, Autocomplete, BaseDom, BaseStyle, Button, Canvas, CssProperties, type CssProperty, CssRule, DomBody, DomElement, DomElementChild, DomElementEventMap, DomElementTagNameMap, DomWindow, IFrame, ImageElement, InputCheckbox, InputColor, InputElementMap, InputNumber, InputRange, InputText, MediaRule, OptionElement, ProgressElement, SVG_TAGS, SelectElement, StyleSheet, TAG_ALIAS, TagAlias, UNITLESS_CSS_PROPS, VENDOR_CSS_PROPS, camelToKebab, getStyleValue, uniqueId };