@neptune3d/dom 0.0.5 → 0.0.7

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,45 @@ 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;
669
+ /**
670
+ * Sets the `opacity` style of the element.
671
+ * Controls the transparency level, where `1` is fully opaque and `0` is fully transparent.
672
+ * Accepts fractional values between `0` and `1`, or `undefined` to remove the style.
673
+ *
674
+ * @param value - The opacity value (e.g., `0.5`, `1`), or `undefined` to remove it.
675
+ * @return This instance for chaining.
676
+ */
677
+ opacity(value: Property.Opacity | undefined): this;
731
678
  /**
732
679
  * Applies CSS styles to truncate overflowing text with an ellipsis.
733
680
  * Ensures the text stays on a single line and hides overflow.
@@ -739,119 +686,288 @@ declare class DomElement<Tag extends keyof DomElementTagNameMap = keyof DomEleme
739
686
  * text-overflow: ellipsis;
740
687
  * ```
741
688
  *
742
- * @return This DomElement instance for chaining.
689
+ * @return This instance for chaining.
743
690
  */
744
691
  overflowEllipsis(): this;
745
- ref(refFn: (el: this) => void): this;
746
692
  /**
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.
693
+ * Applies a batch of CSS style properties to the element.
694
+ * Delegates each property to `setStyleProp`, which handles value normalization and kebab-case conversion.
749
695
  *
750
- * For example, calling `css(":hover", { color: "red" })` will generate:
751
- * ```css
752
- * .<internalClassName>:hover { color: red; }
753
- * ```
696
+ * - Properties with `undefined` values are removed from the inline style.
697
+ * - Numeric values are passed through the style sheet for unit resolution.
698
+ * - Supports chainable usage for fluent DOM composition.
699
+ *
700
+ * @param props - A partial map of CSS properties and their values.
701
+ * @returns This instance for chaining.
702
+ */
703
+ style(props: CssProperties): this;
704
+ }
705
+ //#endregion
706
+ //#region src/BaseDom.d.ts
707
+ /**
708
+ * Base class for DOM-backed elements with style and event utilities.
709
+ * Supports both HTML and SVG elements via generic parameter `E`.
710
+ */
711
+ declare abstract class BaseDom<E extends HTMLElement | SVGElement> extends BaseStyle {
712
+ abstract dom: E;
713
+ /**
714
+ * Sets or removes the user-defined class name and applies it alongside the internal CSS class.
715
+ * Uses `setAttribute("class", ...)` for both HTML and SVG elements.
754
716
  *
755
- * This enables dynamic styling of pseudo-classes, child selectors, or media queries without inline styles.
717
+ * Passing `undefined` removes the user-defined class name entirely.
756
718
  *
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.
719
+ * @param value - The user-defined class name, or `undefined` to remove it.
759
720
  * @return This DomElement instance for chaining.
760
721
  */
761
- css(selector: string, props: CssProperties): this;
722
+ className(value: string | undefined): this;
762
723
  /**
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.
724
+ * Adds an event listener to the element.
725
+ * @param type - The event type (e.g., "click", "input", "mouseenter").
726
+ * @param handler - The event handler function.
727
+ * @param options - Optional event listener options.
767
728
  * @return This DomElement instance for chaining.
768
729
  */
769
- rootCss(props: CssProperties): this;
730
+ on<T extends keyof DomElementEventMap>(type: T, handler: (ev: DomElementEventMap[T] & {
731
+ currentTarget: E;
732
+ }) => void, options?: boolean | AddEventListenerOptions): this;
733
+ /**
734
+ * Removes an event listener from the element.
735
+ * @param type - The event type to remove.
736
+ * @param handler - The original handler function.
737
+ * @param options - Optional event listener options.
738
+ */
739
+ off<T extends keyof DomElementEventMap>(type: T, handler: (ev: DomElementEventMap[T]) => void, options?: boolean | EventListenerOptions): void;
770
740
  /**
771
- * Applies scoped CSS styles to the `:hover` state of the element.
772
- * Useful for styling hover interactions without inline styles.
741
+ * Appends one or more child nodes to the element.
742
+ * Accepts DomElement instances, regular DOM Nodes, strings, or numbers.
743
+ *
744
+ * - Strings and numbers are coerced to text nodes.
745
+ * - DomElement instances are unwrapped to their native DOM nodes.
746
+ * - DOM Nodes are appended directly.
773
747
  *
774
- * @param props - A map of CSS properties to apply when the element is hovered.
748
+ * @param nodes - One or more child elements or text values to append.
775
749
  * @return This DomElement instance for chaining.
776
750
  */
777
- hoverCss(props: CssProperties): this;
751
+ add(...nodes: DomElementChild[]): this;
752
+ /**
753
+ * Inserts one or more DomElements into a parent at the specified index.
754
+ * Each node is inserted sequentially starting from the given index.
755
+ *
756
+ * @param index - The zero-based index at which to start inserting.
757
+ * @param nodes - One or more DomElements to insert.
758
+ * @return This DomElement instance.
759
+ */
760
+ insertAtIndex(index: number, ...nodes: DomElementChild[]): this;
761
+ /**
762
+ * Replaces all existing child elements of this DOM node with the provided ones.
763
+ * Internally clears the current children and appends the new nodes in order.
764
+ *
765
+ * @param nodes - One or more DomElement instances to set as children.
766
+ * @return This DomElement instance.
767
+ */
768
+ setChildren(...nodes: DomElementChild[]): this;
769
+ /**
770
+ * Replaces child elements starting from the specified index with the provided nodes.
771
+ * All children before the index are preserved.
772
+ *
773
+ * @param index - The zero-based index at which replacement begins.
774
+ * @param nodes - One or more DomElement instances to insert.
775
+ * @return This DomElement instance.
776
+ */
777
+ setChildrenFromIndex(index: number, ...nodes: DomElementChild[]): this;
778
+ /**
779
+ * Removes child elements within the specified index range.
780
+ * If no range is provided, removes all children.
781
+ *
782
+ * @param from - The starting index (inclusive). Defaults to 0.
783
+ * @param to - The ending index (exclusive). Defaults to all children.
784
+ * @returns This DomElement instance.
785
+ */
786
+ clear(from?: number, to?: number): this;
787
+ ref(refFn: (el: this) => void): this;
788
+ protected resolveNode(child: DomElementChild): Node;
789
+ protected setStyleProp(name: Autocomplete<keyof CssProperties>, value: string | number | undefined): this;
790
+ }
791
+ //#endregion
792
+ //#region src/DomElement.d.ts
793
+ /**
794
+ * A unified wrapper for HTML and SVG elements that provides a fluent, type-safe API
795
+ * for DOM manipulation, styling, and event handling.
796
+ *
797
+ * Supports both `HTMLElementTagNameMap` and `SVGElementTagNameMap` via the generic `Tag`,
798
+ * and automatically handles namespace creation for SVG elements.
799
+ *
800
+ * Provides ergonomic methods for setting styles, attributes, classes, and event listeners,
801
+ * while abstracting away platform-specific quirks (e.g., `className` vs `setAttribute("class")`).
802
+ *
803
+ * @template Tag - The tag name of the element, inferred from `DomElementTagNameMap`.
804
+ */
805
+ declare class DomElement<Tag extends keyof DomElementTagNameMap = keyof DomElementTagNameMap> extends BaseDom<DomElementTagNameMap[Tag]> {
806
+ /**
807
+ * Creates a new DomElement instance for the specified tag.
808
+ * Automatically detects whether the tag is an SVG element and uses the appropriate namespace.
809
+ * Optionally wraps an existing DOM element instead of creating a new one.
810
+ *
811
+ * @param tag - The tag name of the element (e.g., "div", "circle", "svg").
812
+ * @param el - An optional existing DOM element to wrap. If omitted, a new element is created.
813
+ */
814
+ constructor(tag: Tag, el?: DomElementTagNameMap[Tag]);
815
+ protected _tag: Tag extends "svgA" ? {
816
+ svgA: "a";
817
+ }[Tag] : Tag;
818
+ protected _isSvg: boolean;
819
+ protected _dom: DomElementTagNameMap[Tag];
820
+ /**
821
+ * Gets the tag name of the element (e.g., "div", "svg", "circle").
822
+ */
823
+ get tag(): Tag extends "svgA" ? {
824
+ svgA: "a";
825
+ }[Tag] : Tag;
826
+ /**
827
+ * Indicates whether the element is an SVG element.
828
+ * Returns `true` for tags like "svg", "circle", "path", etc.
829
+ */
830
+ get isSvg(): boolean;
831
+ /**
832
+ * Gets the underlying DOM element instance.
833
+ * This will be either an `HTMLElement` or `SVGElement` depending on the tag.
834
+ */
835
+ get dom(): DomElementTagNameMap[Tag];
836
+ /**
837
+ * Gets the textContent property of the DOM element.
838
+ */
839
+ getText(): string;
778
840
  /**
779
- * Applies scoped CSS styles to the `:active` state of the element.
780
- * Useful for styling active interactions (e.g., mouse down).
841
+ * Sets or clears the text content of the element.
842
+ * Converts any value to a string before assignment.
843
+ * Passing `undefined` or `null` removes the text by setting it to an empty string.
781
844
  *
782
- * @param props - A map of CSS properties to apply when the element is active.
845
+ * @param value - The text content to set, or `undefined`/`null` to clear it.
783
846
  * @return This DomElement instance for chaining.
784
847
  */
785
- activeCss(props: CssProperties): this;
848
+ text(value: any): this;
786
849
  /**
787
- * Applies scoped CSS styles to the `:focus` state of the element.
788
- * Useful for styling keyboard or programmatic focus.
850
+ * Removes the element from the DOM tree.
851
+ * Equivalent to calling `element.remove()` on the native DOM node.
789
852
  *
790
- * @param props - A map of CSS properties to apply when the element is focused.
853
+ * This does not dispose internal state or event listeners use `dispose()` if cleanup is needed.
854
+ *
855
+ * @return This DomElement instance for chaining.
856
+ */
857
+ remove(): void;
858
+ /**
859
+ * Retrieves the value of a single attribute.
860
+ * @param name - The attribute name to read (e.g. "aria-label", "role").
861
+ * @return The attribute value as a string, or null if not present.
862
+ */
863
+ getAttr(name: string): string | null;
864
+ /**
865
+ * Sets a single attribute on the element.
866
+ * @param name - The attribute name (e.g. "aria-label", "role", "disabled").
867
+ * @param value - The attribute value. If undefined, the attribute is removed.
868
+ * @return This DomElement instance for chaining.
869
+ */
870
+ attr(name: string, value: string | number | boolean | undefined): this;
871
+ /**
872
+ * Sets multiple attributes on the element.
873
+ * @param attributes - An object mapping attribute names to values.
874
+ * Attributes with undefined values are removed.
875
+ * @return This DomElement instance for chaining.
876
+ */
877
+ attrs(attributes: Record<string, string | number | boolean | undefined>): this;
878
+ /**
879
+ * Retrieves the value of a single property.
880
+ * @param name - The property name to read (e.g. "value", "checked", "disabled").
881
+ * @return The property value, or undefined if not present.
882
+ */
883
+ getProp(name: string): any;
884
+ /**
885
+ * Sets a single property on the element.
886
+ * @param name - The property name (e.g. "checked", "value", "disabled").
887
+ * @param value - The property value. If undefined, the property is deleted.
888
+ * @return This DomElement instance for chaining.
889
+ */
890
+ prop(name: string, value: any): this;
891
+ /**
892
+ * Sets multiple properties on the element.
893
+ * @param props - An object mapping property names to values.
894
+ * Properties with undefined values are deleted.
791
895
  * @return This DomElement instance for chaining.
792
896
  */
793
- focusCss(props: CssProperties): this;
897
+ props(props: Record<string, any>): this;
794
898
  /**
795
- * Applies scoped CSS styles to the `:focus-within` state of the element.
796
- * Useful for styling when any child element has focus.
899
+ * Sets or removes the `id` of the element.
900
+ * Passing `undefined` clears the ID by setting it to an empty string.
797
901
  *
798
- * @param props - A map of CSS properties to apply when the element or its descendants are focused.
902
+ * @param value - The element's ID, or `undefined` to remove it.
799
903
  * @return This DomElement instance for chaining.
800
904
  */
801
- focusWithinCss(props: CssProperties): this;
905
+ id(value: string | undefined): this;
802
906
  /**
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.
907
+ * Sets or removes the `htmlFor` property on a <label> element.
908
+ * This links the label to a form control by its ID.
805
909
  *
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
- * ```
910
+ * Passing `undefined` removes the association.
911
+ * Has no effect if the element is not a <label>.
912
+ *
913
+ * @param value - The ID of the target form control, or `undefined` to remove it.
914
+ * @return This DomElement instance for chaining.
915
+ */
916
+ htmlFor(value: string | undefined): this;
917
+ /**
918
+ * Sets or removes the `title` attribute on the element.
919
+ * Applies to both HTML and SVG elements. Passing `undefined` removes the attribute.
812
920
  *
813
- * This enables responsive styling and conditional behavior based on viewport or device characteristics.
921
+ * @param value - The tooltip text to show on hover, or `undefined` to remove it.
922
+ * @return This DomElement instance for chaining.
923
+ */
924
+ title(value: string | undefined): this;
925
+ /**
926
+ * Sets or removes the `disabled` attribute on the element.
927
+ * Applicable to form controls like <button>, <input>, <select>, etc.
814
928
  *
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.
929
+ * @param value - If true, sets the `disabled` attribute; if false, removes it.
930
+ * @return This DomElement instance for chaining.
931
+ */
932
+ disabled(value: boolean): this;
933
+ /**
934
+ * Sets the `disabled` attribute to disable the element.
935
+ * Applicable to form controls like <button>, <input>, <select>, etc.
818
936
  * @return This DomElement instance for chaining.
819
937
  */
820
- mediaCss(mediaText: string, selector: string, props: CssProperties): this;
938
+ disable(): this;
821
939
  /**
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.
940
+ * Removes the `disabled` attribute to enable the element.
827
941
  * @return This DomElement instance for chaining.
828
942
  */
829
- mediaRootCss(mediaText: string, props: CssProperties): this;
943
+ enable(): this;
830
944
  /**
831
- * Applies scoped CSS styles to the root selector of the element when the viewport width
832
- * meets or exceeds the specified minimum.
945
+ * Sets or removes the `popover` attribute on the element.
946
+ * Applies to HTML elements that support the popover API (e.g., `<div popover>`).
947
+ * Passing `undefined` removes the attribute.
833
948
  *
834
- * Automatically converts numeric values to pixel-based CSS width values.
949
+ * Common values include:
950
+ * - `"auto"` → Automatically shows/hides based on user interaction.
951
+ * - `"manual"` → Requires explicit show/hide via JavaScript.
835
952
  *
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.
953
+ * @param value - The popover mode (`"auto"` or `"manual"`), or `undefined` to remove it.
838
954
  * @return This DomElement instance for chaining.
839
955
  */
840
- minWidthCss(minWidth: number | string, props: CssProperties): this;
956
+ popover(value: "auto" | "manual" | undefined): this;
841
957
  /**
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.
958
+ * Shows the popover on this element.
959
+ * Requires the element to have a `popover="manual"` attribute and be in the DOM.
844
960
  *
845
- * Automatically converts numeric values to pixel-based CSS width values.
961
+ * @return This DomElement instance for chaining.
962
+ */
963
+ showPopover(): this;
964
+ /**
965
+ * Hides the popover on this element.
966
+ * Requires the element to have a `popover="manual"` attribute and be in the DOM.
846
967
  *
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
968
  * @return This DomElement instance for chaining.
850
969
  */
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;
970
+ hidePopover(): this;
855
971
  }
856
972
  /**
857
973
  * Creates a new DomElement instance for the given tag name.
@@ -872,13 +988,14 @@ declare class AnchorElement extends DomElement<"a"> {
872
988
  constructor();
873
989
  href(value: string): this;
874
990
  }
991
+ declare function $a(): AnchorElement;
875
992
  //#endregion
876
993
  //#region src/Button.d.ts
877
994
  declare class Button extends DomElement<"button"> {
878
995
  constructor();
879
996
  type(value: "button" | "submit" | "reset"): this;
880
- disabledCss(props: CssProperties): this;
881
997
  }
998
+ declare function $btn(): Button;
882
999
  //#endregion
883
1000
  //#region src/Canvas.d.ts
884
1001
  declare class Canvas extends DomElement<"canvas"> {
@@ -907,6 +1024,7 @@ declare class Canvas extends DomElement<"canvas"> {
907
1024
  z: number;
908
1025
  };
909
1026
  }
1027
+ declare function $canvas(): Canvas;
910
1028
  //#endregion
911
1029
  //#region src/constants.d.ts
912
1030
  declare const UNITLESS_CSS_PROPS: Record<string, 1>;
@@ -917,16 +1035,344 @@ declare const TAG_ALIAS: {
917
1035
  };
918
1036
  type TagAlias = typeof TAG_ALIAS;
919
1037
  //#endregion
1038
+ //#region src/MediaRule.d.ts
1039
+ declare class MediaRule {
1040
+ constructor(sheet: StyleSheet, index: number, rule: CSSMediaRule);
1041
+ protected _sheet: StyleSheet;
1042
+ protected _index: number;
1043
+ protected _rule: CSSMediaRule;
1044
+ /**
1045
+ * Returns the StyleSheet instance that owns this media rule.
1046
+ * Useful for accessing shared rule management and stylesheet-level operations.
1047
+ */
1048
+ get sheet(): StyleSheet;
1049
+ /**
1050
+ * Returns the index of this media rule within its parent stylesheet.
1051
+ * This index is used for rule lookup, insertion, and removal.
1052
+ */
1053
+ get index(): number;
1054
+ /**
1055
+ * Returns the underlying CSSMediaRule object.
1056
+ * Provides direct access to the media query and its nested CSS rules.
1057
+ */
1058
+ get rule(): CSSMediaRule;
1059
+ /**
1060
+ * Returns the number of CSS rules contained within this media block.
1061
+ * Useful for determining insertion index or iterating over nested rules.
1062
+ */
1063
+ get length(): number;
1064
+ /**
1065
+ * Returns the media query string associated with this rule.
1066
+ * For example: "screen and (max-width: 600px)".
1067
+ */
1068
+ get mediaText(): string;
1069
+ /**
1070
+ * Inserts a new CSSStyleRule into this media block at the end of its rule list.
1071
+ * The rule is created with an empty declaration block and wrapped in a CssRule instance for programmatic styling.
1072
+ *
1073
+ * For example, calling `cssRule(".box:hover")` will generate:
1074
+ * ```css
1075
+ * @media ... {
1076
+ * .box:hover {}
1077
+ * }
1078
+ * ```
1079
+ *
1080
+ * @param selector - The CSS selector to target (e.g., ".box", ":hover", "div > span").
1081
+ * @return A CssRule instance representing the newly inserted rule.
1082
+ */
1083
+ cssRule(selector: string): CssRule;
1084
+ /**
1085
+ * Removes this media rule from its parent stylesheet.
1086
+ * Delegates to the StyleSheet instance, which handles cleanup and index management.
1087
+ */
1088
+ remove(): void;
1089
+ /**
1090
+ * Removes a nested CSSStyleRule from this media block.
1091
+ * Uses the rule's index to delete it from the internal rule list.
1092
+ *
1093
+ * @param rule - The CssRule instance to remove from this media query block.
1094
+ */
1095
+ removeRule(rule: CssRule): void;
1096
+ }
1097
+ //#endregion
1098
+ //#region src/StyleSheet.d.ts
1099
+ /**
1100
+ * Manages a dedicated `<style>` element and provides programmatic access to its CSS rules.
1101
+ * Supports dynamic insertion, retrieval, and deletion of both standard and media-specific rules,
1102
+ * with internal indexing for fast lookup and reuse.
1103
+ *
1104
+ * This class ensures a single shared stylesheet instance via `StyleSheet.getSheet()`,
1105
+ * and maintains selector-to-index and media-to-rule maps on the global `window` object.
1106
+ *
1107
+ * Designed for use with component-level styling systems or DOM abstractions that require
1108
+ * granular control over rule injection without relying on inline styles.
1109
+ */
1110
+ declare class StyleSheet {
1111
+ constructor(el: HTMLStyleElement);
1112
+ protected _dom: HTMLStyleElement;
1113
+ /**
1114
+ * Returns the underlying `<style>` DOM element.
1115
+ * This element is used to inject and manage dynamic CSS rules.
1116
+ */
1117
+ get dom(): HTMLStyleElement;
1118
+ /**
1119
+ * Returns the associated `CSSStyleSheet` object for this `<style>` element.
1120
+ * Provides access to rule-level operations like `insertRule()` and `deleteRule()`.
1121
+ * Assumes the sheet is available and attached to the document.
1122
+ */
1123
+ get sheet(): CSSStyleSheet;
1124
+ /**
1125
+ * Returns the number of CSS rules currently defined in the stylesheet.
1126
+ * Useful for indexing, iteration, or conditional rule management.
1127
+ */
1128
+ get length(): number;
1129
+ /**
1130
+ * Inserts a new empty CSS rule into the stylesheet for the given selector.
1131
+ * Returns a `CssRule` wrapper for fluent manipulation of the inserted rule.
1132
+ *
1133
+ * The rule is appended at the end of the current stylesheet (`insertRule()` at index `length`).
1134
+ * This is useful for dynamically constructing scoped styles tied to specific selectors.
1135
+ *
1136
+ * @param selector - The CSS selector to target (e.g., ".btn", "#header", "body > div").
1137
+ * @return A `CssRule` instance representing the inserted rule.
1138
+ */
1139
+ cssRule(selector: string): CssRule;
1140
+ /**
1141
+ * Inserts a new empty `@media` rule into the stylesheet using the provided media query string.
1142
+ * Returns a `MediaRule` wrapper for fluent manipulation of the inserted media block.
1143
+ *
1144
+ * The rule is appended at the end of the current stylesheet (`insertRule()` at index `length`).
1145
+ * Useful for dynamically scoping styles to specific viewport conditions or device capabilities.
1146
+ *
1147
+ * @param mediaText - The media query string (e.g., "screen and (max-width: 600px)").
1148
+ * @return A `MediaRule` instance representing the inserted media rule.
1149
+ */
1150
+ mediaRule(mediaText: string): MediaRule;
1151
+ /**
1152
+ * Inserts a new `@media (min-width: …)` rule into the stylesheet.
1153
+ * Returns a `MediaRule` wrapper for fluent manipulation of styles targeting wider viewports.
1154
+ *
1155
+ * Equivalent to: `mediaRule("min-width: 768px")`
1156
+ *
1157
+ * @param minWidth - The minimum width value (e.g., `768`, `"50em"`, `"80vw"`).
1158
+ * @return A `MediaRule` instance representing the inserted media rule.
1159
+ */
1160
+ mediaMinWidth(minWidth: number | string): MediaRule;
1161
+ /**
1162
+ * Inserts a new `@media (max-width: …)` rule into the stylesheet.
1163
+ * Returns a `MediaRule` wrapper for fluent manipulation of styles targeting narrower viewports.
1164
+ *
1165
+ * Equivalent to: `mediaRule("max-width: 600px")`
1166
+ *
1167
+ * @param maxWidth - The maximum width value (e.g., `600`, `"40em"`, `"80vw"`).
1168
+ * @return A `MediaRule` instance representing the inserted media rule.
1169
+ */
1170
+ mediaMaxWidth(maxWidth: number | string): MediaRule;
1171
+ /**
1172
+ * Removes a CSS rule from the stylesheet by its index.
1173
+ * Accepts either a `CssRule` or `MediaRule` instance, which internally tracks its position.
1174
+ *
1175
+ * This is useful for dynamically cleaning up injected styles or media blocks.
1176
+ * Note: Rule indices may shift after insertion or deletion — ensure index accuracy before calling.
1177
+ *
1178
+ * @param rule - The rule instance to remove (`CssRule` or `MediaRule`).
1179
+ */
1180
+ removeRule(rule: CssRule | MediaRule): void;
1181
+ /**
1182
+ * Retrieves or creates a <style> element with the given ID and wraps it in a StyleSheet instance.
1183
+ * If no element with the specified ID exists, a new <style> tag is created, appended to <head>,
1184
+ * and assigned the ID. This allows multiple independently managed stylesheets via custom IDs.
1185
+ *
1186
+ * @param id - Optional ID of the <style> element to target. Defaults to DEFAULT_STYLE_ID.
1187
+ * @return A StyleSheet instance bound to the specified <style> element.
1188
+ */
1189
+ static getSheet(id?: string): StyleSheet;
1190
+ /**
1191
+ * The default ID used for the primary stylesheet managed by the StyleSheet class.
1192
+ * This ensures consistent lookup and avoids collisions with other style elements in the document.
1193
+ */
1194
+ static DEFAULT_STYLE_ID: string;
1195
+ }
1196
+ //#endregion
1197
+ //#region src/CssRule.d.ts
1198
+ declare class CssRule extends BaseStyle {
1199
+ constructor(sheet: StyleSheet, index: number, rule: CSSStyleRule);
1200
+ protected _sheet: StyleSheet;
1201
+ protected _index: number;
1202
+ protected _rule: CSSStyleRule;
1203
+ /**
1204
+ * Returns the StyleSheet instance that owns this rule.
1205
+ * Useful for accessing rule management utilities or shared configuration.
1206
+ */
1207
+ get sheet(): StyleSheet;
1208
+ /**
1209
+ * Returns the index of this rule within its parent stylesheet.
1210
+ * This index is stable and used for rule lookup and removal.
1211
+ */
1212
+ get index(): number;
1213
+ /**
1214
+ * Returns the underlying CSSStyleRule object.
1215
+ * Provides direct access to selector text and style declarations.
1216
+ */
1217
+ get rule(): CSSStyleRule;
1218
+ /**
1219
+ * Returns the selector text of the underlying CSSStyleRule.
1220
+ * For example: ".box:hover", "div > span", or ".my-class[data-active]".
1221
+ */
1222
+ get selectorText(): string;
1223
+ /**
1224
+ * Removes this rule from its parent stylesheet.
1225
+ * Delegates to the StyleSheet instance to ensure proper cleanup and cache invalidation.
1226
+ */
1227
+ remove(): void;
1228
+ /**
1229
+ * Creates a new CssRule for a pseudo-selector extending this rule’s selector.
1230
+ * For example, `.btn:hover`, `.input:focus`, `.card:active`.
1231
+ *
1232
+ * @param pseudo - The pseudo-class to append (e.g., ":hover", ":focus").
1233
+ * @return A new CssRule instance targeting the extended selector.
1234
+ */
1235
+ pseudo(pseudo: `:${string}`): CssRule;
1236
+ /**
1237
+ * Creates a `:hover` rule for this selector.
1238
+ * @return A new CssRule instance for the `:hover` state.
1239
+ */
1240
+ hover(): CssRule;
1241
+ /**
1242
+ * Creates a `:focus` rule for this selector.
1243
+ * @return A new CssRule instance for the `:focus` state.
1244
+ */
1245
+ focus(): CssRule;
1246
+ /**
1247
+ * Creates a `:focus-within` rule for this selector.
1248
+ * Useful for styling parent containers when any child element receives focus.
1249
+ *
1250
+ * @return A new CssRule instance for the `:focus-within` state.
1251
+ */
1252
+ focusWithin(): CssRule;
1253
+ /**
1254
+ * Creates an `:active` rule for this selector.
1255
+ * @return A new CssRule instance for the `:active` state.
1256
+ */
1257
+ active(): CssRule;
1258
+ /**
1259
+ * Creates a `:disabled` rule for this selector.
1260
+ * Useful for styling form controls or buttons in a disabled state.
1261
+ *
1262
+ * @return A new CssRule instance for the `:disabled` state.
1263
+ */
1264
+ disabled(): CssRule;
1265
+ /**
1266
+ * Applies a style property to the underlying CSS rule.
1267
+ * Removes the property if `undefined` is passed.
1268
+ *
1269
+ * @param name - The camelCase CSS property name.
1270
+ * @param value - The value to apply, or `undefined` to remove it.
1271
+ * @return This instance for chaining.
1272
+ */
1273
+ protected setStyleProp(name: Autocomplete<keyof CssProperties>, value: string | number | undefined): this;
1274
+ }
1275
+ //#endregion
920
1276
  //#region src/DomBody.d.ts
921
- declare class DomBody {
1277
+ /**
1278
+ * Wrapper for document.body with style and DOM composition utilities.
1279
+ * Enables fluent styling and child node management.
1280
+ */
1281
+ declare class DomBody extends BaseDom<HTMLBodyElement> {
922
1282
  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
1283
  }
1284
+ /**
1285
+ * Creates a new DomBody instance bound to `document.body`.
1286
+ * Provides fluent access to body-level styling, DOM composition, and event utilities.
1287
+ *
1288
+ * Useful for global layout scaffolding, dynamic content injection, or body-wide style control.
1289
+ *
1290
+ * @return A DomBody instance wrapping `document.body`.
1291
+ */
928
1292
  declare function $body(): DomBody;
929
1293
  //#endregion
1294
+ //#region src/DomDocument.d.ts
1295
+ /**
1296
+ * Wrapper for the global `document` object with typed event listener utilities.
1297
+ * Useful for managing document-level events like visibility changes, selection, or clipboard interactions.
1298
+ */
1299
+ declare class DomDocument {
1300
+ /**
1301
+ * Adds an event listener to the document.
1302
+ * @param type - The event type (e.g., "visibilitychange", "copy", "selectionchange").
1303
+ * @param handler - The event handler function.
1304
+ * @param options - Optional event listener options.
1305
+ * @return This instance for chaining.
1306
+ */
1307
+ on<T extends keyof DocumentEventMap>(type: T, handler: (ev: DocumentEventMap[T] & {
1308
+ currentTarget: Document;
1309
+ }) => void, options?: boolean | AddEventListenerOptions): this;
1310
+ /**
1311
+ * Removes an event listener from the document.
1312
+ * @param type - The event type to remove.
1313
+ * @param handler - The original handler function.
1314
+ * @param options - Optional event listener options.
1315
+ */
1316
+ off<T extends keyof DocumentEventMap>(type: T, handler: (ev: DocumentEventMap[T]) => void, options?: boolean | EventListenerOptions): void;
1317
+ /**
1318
+ * Dispatches a DOM event on the document object.
1319
+ *
1320
+ * @param event - The corresponding event instance (e.g., `new Event("visibilitychange")`, `new ClipboardEvent("copy")`).
1321
+ * @return This instance for chaining.
1322
+ */
1323
+ dispatch(event: Event): this;
1324
+ }
1325
+ /**
1326
+ * Creates a new DomDocument instance bound to the global `document` object.
1327
+ * Provides typed event listener utilities and fluent dispatching for document-level DOM events.
1328
+ *
1329
+ * Useful for managing visibility state, clipboard interactions, selection changes, or custom document-wide signaling.
1330
+ *
1331
+ * @return A DomDocument instance wrapping the global `document`.
1332
+ */
1333
+ declare function $document(): DomDocument;
1334
+ //#endregion
1335
+ //#region src/DomWindow.d.ts
1336
+ /**
1337
+ * Wrapper for the global `window` object with typed event listener utilities.
1338
+ * Useful for managing global events like resize, scroll, or keyboard shortcuts.
1339
+ */
1340
+ declare class DomWindow {
1341
+ /**
1342
+ * Adds an event listener to the window.
1343
+ * @param type - The event type (e.g., "click", "input", "mouseenter").
1344
+ * @param handler - The event handler function.
1345
+ * @param options - Optional event listener options.
1346
+ * @return This instance for chaining.
1347
+ */
1348
+ on<T extends keyof WindowEventMap>(type: T, handler: (ev: WindowEventMap[T] & {
1349
+ currentTarget: Window;
1350
+ }) => void, options?: boolean | AddEventListenerOptions): this;
1351
+ /**
1352
+ * Removes an event listener from the window.
1353
+ * @param type - The event type to remove.
1354
+ * @param handler - The original handler function.
1355
+ * @param options - Optional event listener options.
1356
+ */
1357
+ off<T extends keyof WindowEventMap>(type: T, handler: (ev: WindowEventMap[T]) => void, options?: boolean | EventListenerOptions): void;
1358
+ /**
1359
+ * Dispatches a DOM event on the window object.
1360
+ *
1361
+ * @param event - The corresponding event instance (e.g., `new Event("resize")`, `new KeyboardEvent("keydown")`).
1362
+ * @return This instance for chaining.
1363
+ */
1364
+ dispatch(event: Event): this;
1365
+ }
1366
+ /**
1367
+ * Creates a new DomWindow instance bound to the global `window` object.
1368
+ * Provides typed event listener utilities and fluent dispatching for built-in DOM events.
1369
+ *
1370
+ * Useful for managing global interactions like resize, scroll, keyboard shortcuts, or visibility changes.
1371
+ *
1372
+ * @return A DomWindow instance wrapping the global `window`.
1373
+ */
1374
+ declare function $window(): DomWindow;
1375
+ //#endregion
930
1376
  //#region src/IFrame.d.ts
931
1377
  declare class IFrame extends DomElement<"iframe"> {
932
1378
  constructor();
@@ -937,6 +1383,7 @@ declare class IFrame extends DomElement<"iframe"> {
937
1383
  setSize(width: number, height: number): this;
938
1384
  reload(): void;
939
1385
  }
1386
+ declare function $iframe(): IFrame;
940
1387
  //#endregion
941
1388
  //#region src/ImageElement.d.ts
942
1389
  declare class ImageElement extends DomElement<"img"> {
@@ -947,74 +1394,26 @@ declare class ImageElement extends DomElement<"img"> {
947
1394
  setSize(width: number, height: number): this;
948
1395
  alt(value: string): this;
949
1396
  }
1397
+ declare function $img(): ImageElement;
950
1398
  //#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
- }
1399
+ //#region src/input.d.ts
1400
+ /**
1401
+ * Creates a typed input element instance based on the specified input type.
1402
+ * Returns a subclass of `DomElement` with type-safe access to input-specific properties and behaviors.
1403
+ *
1404
+ * Supported types include:
1405
+ * - `"text"` → `InputText`
1406
+ * - `"number"` → `InputNumber`
1407
+ * - `"checkbox"` → `InputCheckbox`
1408
+ * - `"color"` → `InputColor`
1409
+ * - `"range"` → `InputRange`
1410
+ *
1411
+ * Each returned instance supports fluent styling, DOM composition, and event binding.
1412
+ *
1413
+ * @param type - The input type to create.
1414
+ * @return A typed input element instance matching the given type.
1415
+ */
1416
+ declare function $input<T$1 extends keyof InputElementMap>(type: T$1): InputElementMap[T$1];
1018
1417
  //#endregion
1019
1418
  //#region src/OptionElement.d.ts
1020
1419
  declare class OptionElement extends DomElement<"option"> {
@@ -1022,6 +1421,7 @@ declare class OptionElement extends DomElement<"option"> {
1022
1421
  value(value: string | number): this;
1023
1422
  getValue(): string;
1024
1423
  }
1424
+ declare function $option(): OptionElement;
1025
1425
  //#endregion
1026
1426
  //#region src/ProgressElement.d.ts
1027
1427
  /**
@@ -1062,6 +1462,7 @@ declare class ProgressElement extends DomElement<"progress"> {
1062
1462
  */
1063
1463
  indeterminate(): this;
1064
1464
  }
1465
+ declare function $progress(): ProgressElement;
1065
1466
  //#endregion
1066
1467
  //#region src/SelectElement.d.ts
1067
1468
  declare class SelectElement extends DomElement<"select"> {
@@ -1070,9 +1471,11 @@ declare class SelectElement extends DomElement<"select"> {
1070
1471
  value(value: string | number): this;
1071
1472
  getValue(): string;
1072
1473
  }
1474
+ declare function $select(): SelectElement;
1073
1475
  //#endregion
1074
1476
  //#region src/utils.d.ts
1075
1477
  declare function uniqueId(): string;
1076
1478
  declare function camelToKebab(prop: string): string;
1479
+ declare function getStyleValue(name: Autocomplete<keyof CssProperties>, value: string | number): string;
1077
1480
  //#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 };
1481
+ export { $, $a, $body, $btn, $canvas, $document, $iframe, $img, $input, $option, $progress, $query, $select, $window, AnchorElement, Autocomplete, BaseDom, BaseStyle, Button, Canvas, CssProperties, type CssProperty, CssRule, DomBody, DomDocument, 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 };