@neptune3d/dom 0.0.7 → 0.0.9
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/README.md +22 -14
- package/dist/index.d.ts +650 -29
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Helper classes and functions for fluent DOM manipulation, styling, and event handling.
|
|
4
4
|
|
|
5
|
+
[](https://www.npmjs.com/package/@neptune3d/dom)
|
|
6
|
+
|
|
5
7
|
## 🚀 Getting Started
|
|
6
8
|
|
|
7
9
|
Install the package:
|
|
@@ -54,16 +56,16 @@ $body().add(checkbox);
|
|
|
54
56
|
## 🎯 Popover API
|
|
55
57
|
|
|
56
58
|
```ts
|
|
57
|
-
const
|
|
59
|
+
const popup = $("div")
|
|
58
60
|
.text("Popover content")
|
|
59
61
|
.popover("manual")
|
|
60
|
-
.
|
|
62
|
+
.style({ padding: "1rem", background: "#222", color: "#fff" });
|
|
61
63
|
|
|
62
|
-
$body().add(
|
|
64
|
+
$body().add(popup);
|
|
63
65
|
|
|
64
66
|
// Show/hide programmatically
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
popup.showPopover();
|
|
68
|
+
popup.hidePopover();
|
|
67
69
|
```
|
|
68
70
|
|
|
69
71
|
## 🎨 Stylesheet Rules
|
|
@@ -73,18 +75,24 @@ import { StyleSheet } from "neptune3d/dom";
|
|
|
73
75
|
|
|
74
76
|
const sheet = StyleSheet.getSheet();
|
|
75
77
|
|
|
76
|
-
//
|
|
78
|
+
// insert a css rule
|
|
77
79
|
const rule = sheet.cssRule(".list-item");
|
|
78
|
-
rule.
|
|
79
|
-
padding: "0.5rem",
|
|
80
|
-
borderBottom: "1px solid #ccc",
|
|
81
|
-
});
|
|
80
|
+
rule.p("0.5rem").bb("1px solid #ccc");
|
|
82
81
|
|
|
83
|
-
//
|
|
82
|
+
// insert a media rule
|
|
84
83
|
const media = sheet.mediaRule("screen and (max-width: 600px)");
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
|
|
85
|
+
// insert a css rule into the media rule
|
|
86
|
+
media.cssRule(".list-item").textAlign("center").fontSize(24);
|
|
87
|
+
|
|
88
|
+
// extend a css rule
|
|
89
|
+
rule.extend("> div.child").opacity(0.6);
|
|
90
|
+
|
|
91
|
+
// predefined extensions for common pseudo selectors / elements
|
|
92
|
+
|
|
93
|
+
rule.hover().bgColor("red");
|
|
94
|
+
|
|
95
|
+
rule.focus().outline("1px dashed blue");
|
|
88
96
|
```
|
|
89
97
|
|
|
90
98
|
## 🌍 Global Event Wrappers
|
package/dist/index.d.ts
CHANGED
|
@@ -44,14 +44,113 @@ declare class InputNumber extends DomElement<"input"> {
|
|
|
44
44
|
}
|
|
45
45
|
//#endregion
|
|
46
46
|
//#region src/InputRange.d.ts
|
|
47
|
+
/**
|
|
48
|
+
* Represents a styled `<input type="range">` element with fluent configuration methods.
|
|
49
|
+
* Inherits DOM manipulation and style capabilities from `DomElement`, `BaseDom`, and `BaseStyle`.
|
|
50
|
+
* Provides ergonomic setters for common range input attributes (`min`, `max`, `step`, `value`, `name`),
|
|
51
|
+
* and exposes a typed `getValue()` accessor for reading the current numeric value.
|
|
52
|
+
*
|
|
53
|
+
* Designed for declarative UI composition and chaining, with full support for styling, layout, and interactivity.
|
|
54
|
+
*
|
|
55
|
+
* Example usage:
|
|
56
|
+
* new InputRange()
|
|
57
|
+
* .min(0)
|
|
58
|
+
* .max(100)
|
|
59
|
+
* .step(5)
|
|
60
|
+
* .value(50)
|
|
61
|
+
* .bWidth(1)
|
|
62
|
+
* .bStyle("solid")
|
|
63
|
+
* .bColor("#ccc");
|
|
64
|
+
*/
|
|
47
65
|
declare class InputRange extends DomElement<"input"> {
|
|
48
66
|
constructor();
|
|
67
|
+
/**
|
|
68
|
+
* Returns the current numeric value of the range input.
|
|
69
|
+
* Converts the underlying string value to a number for type-safe access.
|
|
70
|
+
* Useful for reading user-selected values in event handlers or form logic.
|
|
71
|
+
*
|
|
72
|
+
* @return The current value as a number.
|
|
73
|
+
*/
|
|
74
|
+
getValue(): number;
|
|
75
|
+
/**
|
|
76
|
+
* Returns the configured minimum value of the range input.
|
|
77
|
+
* Converts the string `min` attribute to a number.
|
|
78
|
+
* Useful for validation, clamping, or dynamic UI feedback.
|
|
79
|
+
*
|
|
80
|
+
* @return The minimum value as a number.
|
|
81
|
+
*/
|
|
82
|
+
getMin(): number;
|
|
83
|
+
/**
|
|
84
|
+
* Returns the configured maximum value of the range input.
|
|
85
|
+
* Converts the string `max` attribute to a number.
|
|
86
|
+
* Useful for validation, clamping, or dynamic UI feedback.
|
|
87
|
+
*
|
|
88
|
+
* @return The maximum value as a number.
|
|
89
|
+
*/
|
|
90
|
+
getMax(): number;
|
|
91
|
+
/**
|
|
92
|
+
* Returns the configured step increment of the range input.
|
|
93
|
+
* Converts the string `step` attribute to a number.
|
|
94
|
+
* Useful for calculating snap points or enforcing input granularity.
|
|
95
|
+
*
|
|
96
|
+
* @return The step value as a number.
|
|
97
|
+
*/
|
|
98
|
+
getStep(): number;
|
|
99
|
+
/**
|
|
100
|
+
* Sets the `name` attribute of the range input.
|
|
101
|
+
* Useful for form serialization, accessibility, and identifying the input in event handlers or submissions.
|
|
102
|
+
*
|
|
103
|
+
* @param value - The name to assign to the input element.
|
|
104
|
+
* @return This instance for chaining.
|
|
105
|
+
*/
|
|
49
106
|
name(value: string): this;
|
|
107
|
+
/**
|
|
108
|
+
* Sets the current value of the range input.
|
|
109
|
+
* Converts the number to a string for DOM compatibility.
|
|
110
|
+
* Useful for initializing or programmatically updating the slider position.
|
|
111
|
+
*
|
|
112
|
+
* @param value - The numeric value to assign to the input.
|
|
113
|
+
* @return This instance for chaining.
|
|
114
|
+
*/
|
|
50
115
|
value(value: number): this;
|
|
51
|
-
|
|
116
|
+
/**
|
|
117
|
+
* Sets the `min` attribute of the range input.
|
|
118
|
+
* Defines the lowest selectable value in the range.
|
|
119
|
+
* Converts the number to a string for DOM compatibility.
|
|
120
|
+
*
|
|
121
|
+
* @param value - The minimum value allowed by the input.
|
|
122
|
+
* @return This instance for chaining.
|
|
123
|
+
*/
|
|
52
124
|
min(value: number): this;
|
|
125
|
+
/**
|
|
126
|
+
* Sets the `max` attribute of the range input.
|
|
127
|
+
* Defines the highest selectable value in the range.
|
|
128
|
+
* Converts the number to a string for DOM compatibility.
|
|
129
|
+
*
|
|
130
|
+
* @param value - The maximum value allowed by the input.
|
|
131
|
+
* @return This instance for chaining.
|
|
132
|
+
*/
|
|
53
133
|
max(value: number): this;
|
|
134
|
+
/**
|
|
135
|
+
* Sets the `step` attribute of the range input.
|
|
136
|
+
* Controls the increment between selectable values.
|
|
137
|
+
* Converts the number to a string for DOM compatibility.
|
|
138
|
+
*
|
|
139
|
+
* @param value - The step size between values.
|
|
140
|
+
* @return This instance for chaining.
|
|
141
|
+
*/
|
|
54
142
|
step(value: number): this;
|
|
143
|
+
/**
|
|
144
|
+
* Sets the `min`, `max`, and `step` attributes of the range input.
|
|
145
|
+
* Accepts individual numeric parameters for ergonomic and explicit configuration.
|
|
146
|
+
* Useful for declaratively defining the full range boundaries.
|
|
147
|
+
*
|
|
148
|
+
* @param min - The minimum value of the range.
|
|
149
|
+
* @param max - The maximum value of the range.
|
|
150
|
+
* @param step - The step increment between values.
|
|
151
|
+
* @return This instance for chaining.
|
|
152
|
+
*/
|
|
153
|
+
bounds(min: number, max: number, step: number): this;
|
|
55
154
|
}
|
|
56
155
|
//#endregion
|
|
57
156
|
//#region src/InputText.d.ts
|
|
@@ -155,7 +254,7 @@ declare abstract class BaseStyle {
|
|
|
155
254
|
* @param value - The padding value to apply, or `undefined` to remove it.
|
|
156
255
|
* @return This instance for chaining.
|
|
157
256
|
*/
|
|
158
|
-
p(value: Property.Padding | undefined): this;
|
|
257
|
+
p(value: Property.Padding | number | undefined): this;
|
|
159
258
|
/**
|
|
160
259
|
* Sets or clears the `padding-top` style of the element.
|
|
161
260
|
* Accepts any valid CSS value (e.g., "10px", "1em").
|
|
@@ -227,7 +326,7 @@ declare abstract class BaseStyle {
|
|
|
227
326
|
* @param value - The top margin value to apply, or `undefined` to remove it.
|
|
228
327
|
* @return This instance for chaining.
|
|
229
328
|
*/
|
|
230
|
-
mt(value: Property.MarginTop | undefined): this;
|
|
329
|
+
mt(value: Property.MarginTop | number | undefined): this;
|
|
231
330
|
/**
|
|
232
331
|
* Sets or clears the `margin-right` style of the element.
|
|
233
332
|
* Accepts any valid CSS value (e.g., "10px", "auto").
|
|
@@ -236,7 +335,7 @@ declare abstract class BaseStyle {
|
|
|
236
335
|
* @param value - The right margin value to apply, or `undefined` to remove it.
|
|
237
336
|
* @return This instance for chaining.
|
|
238
337
|
*/
|
|
239
|
-
mr(value: Property.MarginRight | undefined): this;
|
|
338
|
+
mr(value: Property.MarginRight | number | undefined): this;
|
|
240
339
|
/**
|
|
241
340
|
* Sets or clears the `margin-bottom` style of the element.
|
|
242
341
|
* Accepts any valid CSS value (e.g., "10px", "auto").
|
|
@@ -245,7 +344,7 @@ declare abstract class BaseStyle {
|
|
|
245
344
|
* @param value - The bottom margin value to apply, or `undefined` to remove it.
|
|
246
345
|
* @return This instance for chaining.
|
|
247
346
|
*/
|
|
248
|
-
mb(value: Property.MarginBottom | undefined): this;
|
|
347
|
+
mb(value: Property.MarginBottom | number | undefined): this;
|
|
249
348
|
/**
|
|
250
349
|
* Sets or clears the `margin-left` style of the element.
|
|
251
350
|
* Accepts any valid CSS value (e.g., "10px", "auto").
|
|
@@ -254,75 +353,75 @@ declare abstract class BaseStyle {
|
|
|
254
353
|
* @param value - The left margin value to apply, or `undefined` to remove it.
|
|
255
354
|
* @return This instance for chaining.
|
|
256
355
|
*/
|
|
257
|
-
ml(value: Property.MarginLeft | undefined): this;
|
|
356
|
+
ml(value: Property.MarginLeft | number | undefined): this;
|
|
258
357
|
/**
|
|
259
358
|
* Sets the overall border radius.
|
|
260
359
|
* @param value - The CSS border-radius value (e.g., "8px", "50%").
|
|
261
360
|
* @return This instance for chaining.
|
|
262
361
|
*/
|
|
263
|
-
radius(value: Property.BorderRadius | undefined): this;
|
|
362
|
+
radius(value: Property.BorderRadius | number | undefined): this;
|
|
264
363
|
/**
|
|
265
364
|
* Sets the top-left corner border radius.
|
|
266
365
|
* @param value - The CSS border-top-left-radius value.
|
|
267
366
|
* @return This instance for chaining.
|
|
268
367
|
*/
|
|
269
|
-
radiusTopLeft(value: Property.BorderTopLeftRadius | undefined): this;
|
|
368
|
+
radiusTopLeft(value: Property.BorderTopLeftRadius | number | undefined): this;
|
|
270
369
|
/**
|
|
271
370
|
* Sets the top-right corner border radius.
|
|
272
371
|
* @param value - The CSS border-top-right-radius value.
|
|
273
372
|
* @return This instance for chaining.
|
|
274
373
|
*/
|
|
275
|
-
radiusTopRight(value: Property.BorderTopRightRadius | undefined): this;
|
|
374
|
+
radiusTopRight(value: Property.BorderTopRightRadius | number | undefined): this;
|
|
276
375
|
/**
|
|
277
376
|
* Sets the bottom-left corner border radius.
|
|
278
377
|
* @param value - The CSS border-bottom-left-radius value.
|
|
279
378
|
* @return This instance for chaining.
|
|
280
379
|
*/
|
|
281
|
-
radiusBottomLeft(value: Property.BorderBottomLeftRadius | undefined): this;
|
|
380
|
+
radiusBottomLeft(value: Property.BorderBottomLeftRadius | number | undefined): this;
|
|
282
381
|
/**
|
|
283
382
|
* Sets the bottom-right corner border radius.
|
|
284
383
|
* @param value - The CSS border-bottom-right-radius value.
|
|
285
384
|
* @return This instance for chaining.
|
|
286
385
|
*/
|
|
287
|
-
radiusBottomRight(value: Property.BorderBottomRightRadius | undefined): this;
|
|
386
|
+
radiusBottomRight(value: Property.BorderBottomRightRadius | number | undefined): this;
|
|
288
387
|
/**
|
|
289
388
|
* Sets the border radius for both top corners.
|
|
290
389
|
* @param value - The CSS border-radius value to apply to top-left and top-right corners.
|
|
291
390
|
* @return This instance for chaining.
|
|
292
391
|
*/
|
|
293
|
-
radiusTop(value: Property.BorderTopLeftRadius | undefined): this;
|
|
392
|
+
radiusTop(value: Property.BorderTopLeftRadius | number | undefined): this;
|
|
294
393
|
/**
|
|
295
394
|
* Sets the border radius for both bottom corners.
|
|
296
395
|
* @param value - The CSS border-radius value to apply to bottom-left and bottom-right corners.
|
|
297
396
|
* @return This instance for chaining.
|
|
298
397
|
*/
|
|
299
|
-
radiusBottom(value: Property.BorderBottomLeftRadius | undefined): this;
|
|
398
|
+
radiusBottom(value: Property.BorderBottomLeftRadius | number | undefined): this;
|
|
300
399
|
/**
|
|
301
400
|
* Sets the border radius for both left corners.
|
|
302
401
|
* @param value - The CSS border-radius value to apply to top-left and bottom-left corners.
|
|
303
402
|
* @return This instance for chaining.
|
|
304
403
|
*/
|
|
305
|
-
radiusLeft(value: Property.BorderTopLeftRadius | undefined): this;
|
|
404
|
+
radiusLeft(value: Property.BorderTopLeftRadius | number | undefined): this;
|
|
306
405
|
/**
|
|
307
406
|
* Sets the border radius for both right corners.
|
|
308
407
|
* @param value - The CSS border-radius value to apply to top-right and bottom-right corners.
|
|
309
408
|
* @return This instance for chaining.
|
|
310
409
|
*/
|
|
311
|
-
radiusRight(value: Property.BorderTopRightRadius | undefined): this;
|
|
410
|
+
radiusRight(value: Property.BorderTopRightRadius | number | undefined): this;
|
|
312
411
|
/**
|
|
313
412
|
* Sets the border radius for both left and right sides (horizontal corners).
|
|
314
413
|
* Applies to top-left, top-right, bottom-left, and bottom-right corners on the X axis.
|
|
315
414
|
* @param value - The CSS border-radius value to apply horizontally.
|
|
316
415
|
* @return This instance for chaining.
|
|
317
416
|
*/
|
|
318
|
-
radiusX(value: Property.BorderRadius | undefined): this;
|
|
417
|
+
radiusX(value: Property.BorderRadius | number | undefined): this;
|
|
319
418
|
/**
|
|
320
419
|
* Sets the border radius for both top and bottom sides (vertical corners).
|
|
321
420
|
* Applies to top-left, top-right, bottom-left, and bottom-right corners on the Y axis.
|
|
322
421
|
* @param value - The CSS border-radius value to apply vertically.
|
|
323
422
|
* @return This instance for chaining.
|
|
324
423
|
*/
|
|
325
|
-
radiusY(value: Property.BorderRadius | undefined): this;
|
|
424
|
+
radiusY(value: Property.BorderRadius | number | undefined): this;
|
|
326
425
|
/**
|
|
327
426
|
* Sets the `display` style of the element.
|
|
328
427
|
* Common values include "block", "inline", "flex", "grid", or "none".
|
|
@@ -382,36 +481,212 @@ declare abstract class BaseStyle {
|
|
|
382
481
|
* @return This instance for chaining.
|
|
383
482
|
*/
|
|
384
483
|
h(value: Property.Height | number | undefined): this;
|
|
484
|
+
/**
|
|
485
|
+
* Sets or clears the `min-width` style of the element.
|
|
486
|
+
* Accepts CSS width values (e.g., "100px", "50%") or numeric pixel values.
|
|
487
|
+
* Passing `undefined` removes the min-width style.
|
|
488
|
+
*
|
|
489
|
+
* @param value - The minimum width value to apply, or `undefined` to remove it.
|
|
490
|
+
* @return This instance for chaining.
|
|
491
|
+
*/
|
|
492
|
+
minW(value: Property.MinWidth | number | undefined): this;
|
|
493
|
+
/**
|
|
494
|
+
* Sets or clears the `max-width` style of the element.
|
|
495
|
+
* Accepts CSS width values (e.g., "100px", "100%") or numeric pixel values.
|
|
496
|
+
* Passing `undefined` removes the max-width style.
|
|
497
|
+
*
|
|
498
|
+
* @param value - The maximum width value to apply, or `undefined` to remove it.
|
|
499
|
+
* @return This instance for chaining.
|
|
500
|
+
*/
|
|
501
|
+
maxW(value: Property.MaxWidth | number | undefined): this;
|
|
502
|
+
/**
|
|
503
|
+
* Sets or clears the `min-height` style of the element.
|
|
504
|
+
* Accepts CSS height values (e.g., "100px", "50vh") or numeric pixel values.
|
|
505
|
+
* Passing `undefined` removes the min-height style.
|
|
506
|
+
*
|
|
507
|
+
* @param value - The minimum height value to apply, or `undefined` to remove it.
|
|
508
|
+
* @return This instance for chaining.
|
|
509
|
+
*/
|
|
510
|
+
minH(value: Property.MinHeight | number | undefined): this;
|
|
511
|
+
/**
|
|
512
|
+
* Sets or clears the `max-height` style of the element.
|
|
513
|
+
* Accepts CSS height values (e.g., "100px", "100%") or numeric pixel values.
|
|
514
|
+
* Passing `undefined` removes the max-height style.
|
|
515
|
+
*
|
|
516
|
+
* @param value - The maximum height value to apply, or `undefined` to remove it.
|
|
517
|
+
* @return This instance for chaining.
|
|
518
|
+
*/
|
|
519
|
+
maxH(value: Property.MaxHeight | number | undefined): this;
|
|
385
520
|
/**
|
|
386
521
|
* Sets the full border style.
|
|
387
522
|
* @param value - The CSS border value (e.g., "1px solid #ccc").
|
|
388
523
|
* @return This instance for chaining.
|
|
389
524
|
*/
|
|
390
525
|
b(value: Property.Border | undefined): this;
|
|
526
|
+
/**
|
|
527
|
+
* Sets the `border-width` of the element.
|
|
528
|
+
* Controls the thickness of the border. Accepts any valid CSS length (e.g., "1px", "0.2em") or a number (interpreted as pixels).
|
|
529
|
+
* Passing `undefined` removes the border width.
|
|
530
|
+
*
|
|
531
|
+
* @param value - The border width to apply, or `undefined` to remove it.
|
|
532
|
+
* @return This instance for chaining.
|
|
533
|
+
*/
|
|
534
|
+
bWidth(value: Property.BorderWidth | number | undefined): this;
|
|
535
|
+
/**
|
|
536
|
+
* Sets the `border-style` of the element.
|
|
537
|
+
* Controls the visual style of the border (e.g., solid, dashed, dotted, double).
|
|
538
|
+
* Accepts any valid CSS border-style value, or `undefined` to remove the style.
|
|
539
|
+
*
|
|
540
|
+
* @param value - The border style to apply (e.g., "solid", "dashed", "none"), or `undefined` to remove it.
|
|
541
|
+
* @return This instance for chaining.
|
|
542
|
+
*/
|
|
543
|
+
bStyle(value: Property.BorderStyle | undefined): this;
|
|
544
|
+
/**
|
|
545
|
+
* Sets the `border-color` of the element.
|
|
546
|
+
* Controls the color of the element’s border.
|
|
547
|
+
* Accepts named colors, hex codes, RGB/RGBA values, or CSS variables.
|
|
548
|
+
* Passing `undefined` removes the border color.
|
|
549
|
+
*
|
|
550
|
+
* @param value - The border color to apply (e.g., "#000", "rgba(0,0,0,0.2)", "var(--border-color)"), or `undefined` to remove it.
|
|
551
|
+
* @return This instance for chaining.
|
|
552
|
+
*/
|
|
553
|
+
bColor(value: Property.BorderColor | undefined): this;
|
|
391
554
|
/**
|
|
392
555
|
* Sets the top border style.
|
|
393
556
|
* @param value - The CSS border-top value.
|
|
394
557
|
* @return This instance for chaining.
|
|
395
558
|
*/
|
|
396
559
|
bt(value: Property.BorderTop | undefined): this;
|
|
560
|
+
/**
|
|
561
|
+
* Sets the `border-top-width` of the element.
|
|
562
|
+
* Controls the thickness of the top border. Accepts any valid CSS length or a number (interpreted as pixels).
|
|
563
|
+
* Passing `undefined` removes the top border width.
|
|
564
|
+
*
|
|
565
|
+
* @param value - The top border width to apply, or `undefined` to remove it.
|
|
566
|
+
* @return This instance for chaining.
|
|
567
|
+
*/
|
|
568
|
+
btWidth(value: Property.BorderTopWidth | number | undefined): this;
|
|
569
|
+
/**
|
|
570
|
+
* Sets the `border-top-style` of the element.
|
|
571
|
+
* Controls the visual style of the top border (e.g., solid, dashed, dotted).
|
|
572
|
+
* Passing `undefined` removes the top border style.
|
|
573
|
+
*
|
|
574
|
+
* @param value - The top border style to apply, or `undefined` to remove it.
|
|
575
|
+
* @return This instance for chaining.
|
|
576
|
+
*/
|
|
577
|
+
btStyle(value: Property.BorderTopStyle | undefined): this;
|
|
578
|
+
/**
|
|
579
|
+
* Sets the `border-top-color` of the element.
|
|
580
|
+
* Controls the color of the top border.
|
|
581
|
+
* Accepts named colors, hex codes, RGB/RGBA values, or CSS variables.
|
|
582
|
+
* Passing `undefined` removes the top border color.
|
|
583
|
+
*
|
|
584
|
+
* @param value - The top border color to apply, or `undefined` to remove it.
|
|
585
|
+
* @return This instance for chaining.
|
|
586
|
+
*/
|
|
587
|
+
btColor(value: Property.BorderTopColor | undefined): this;
|
|
397
588
|
/**
|
|
398
589
|
* Sets the right border style.
|
|
399
590
|
* @param value - The CSS border-right value.
|
|
400
591
|
* @return This instance for chaining.
|
|
401
592
|
*/
|
|
402
593
|
br(value: Property.BorderRight | undefined): this;
|
|
594
|
+
/**
|
|
595
|
+
* Sets the `border-right-width` of the element.
|
|
596
|
+
* Controls the thickness of the right border. Accepts any valid CSS length or a number (interpreted as pixels).
|
|
597
|
+
* Passing `undefined` removes the right border width.
|
|
598
|
+
*
|
|
599
|
+
* @param value - The right border width to apply, or `undefined` to remove it.
|
|
600
|
+
* @return This instance for chaining.
|
|
601
|
+
*/
|
|
602
|
+
brWidth(value: Property.BorderRightWidth | number | undefined): this;
|
|
603
|
+
/**
|
|
604
|
+
* Sets the `border-right-style` of the element.
|
|
605
|
+
* Controls the visual style of the right border (e.g., solid, dashed, dotted).
|
|
606
|
+
* Passing `undefined` removes the right border style.
|
|
607
|
+
*
|
|
608
|
+
* @param value - The right border style to apply, or `undefined` to remove it.
|
|
609
|
+
* @return This instance for chaining.
|
|
610
|
+
*/
|
|
611
|
+
brStyle(value: Property.BorderRightStyle | undefined): this;
|
|
612
|
+
/**
|
|
613
|
+
* Sets the `border-right-color` of the element.
|
|
614
|
+
* Controls the color of the right border.
|
|
615
|
+
* Accepts named colors, hex codes, RGB/RGBA values, or CSS variables.
|
|
616
|
+
* Passing `undefined` removes the right border color.
|
|
617
|
+
*
|
|
618
|
+
* @param value - The right border color to apply, or `undefined` to remove it.
|
|
619
|
+
* @return This instance for chaining.
|
|
620
|
+
*/
|
|
621
|
+
brColor(value: Property.BorderRightColor | undefined): this;
|
|
403
622
|
/**
|
|
404
623
|
* Sets the bottom border style.
|
|
405
624
|
* @param value - The CSS border-bottom value.
|
|
406
625
|
* @return This instance for chaining.
|
|
407
626
|
*/
|
|
408
627
|
bb(value: Property.BorderBottom | undefined): this;
|
|
628
|
+
/**
|
|
629
|
+
* Sets the `border-bottom-width` of the element.
|
|
630
|
+
* Controls the thickness of the bottom border. Accepts any valid CSS length or a number (interpreted as pixels).
|
|
631
|
+
* Passing `undefined` removes the bottom border width.
|
|
632
|
+
*
|
|
633
|
+
* @param value - The bottom border width to apply, or `undefined` to remove it.
|
|
634
|
+
* @return This instance for chaining.
|
|
635
|
+
*/
|
|
636
|
+
bbWidth(value: Property.BorderBottomWidth | number | undefined): this;
|
|
637
|
+
/**
|
|
638
|
+
* Sets the `border-bottom-style` of the element.
|
|
639
|
+
* Controls the visual style of the bottom border (e.g., solid, dashed, dotted).
|
|
640
|
+
* Passing `undefined` removes the bottom border style.
|
|
641
|
+
*
|
|
642
|
+
* @param value - The bottom border style to apply, or `undefined` to remove it.
|
|
643
|
+
* @return This instance for chaining.
|
|
644
|
+
*/
|
|
645
|
+
bbStyle(value: Property.BorderBottomStyle | undefined): this;
|
|
646
|
+
/**
|
|
647
|
+
* Sets the `border-bottom-color` of the element.
|
|
648
|
+
* Controls the color of the bottom border.
|
|
649
|
+
* Accepts named colors, hex codes, RGB/RGBA values, or CSS variables.
|
|
650
|
+
* Passing `undefined` removes the bottom border color.
|
|
651
|
+
*
|
|
652
|
+
* @param value - The bottom border color to apply, or `undefined` to remove it.
|
|
653
|
+
* @return This instance for chaining.
|
|
654
|
+
*/
|
|
655
|
+
bbColor(value: Property.BorderBottomColor | undefined): this;
|
|
409
656
|
/**
|
|
410
657
|
* Sets the left border style.
|
|
411
658
|
* @param value - The CSS border-left value.
|
|
412
659
|
* @return This instance for chaining.
|
|
413
660
|
*/
|
|
414
661
|
bl(value: Property.BorderLeft | undefined): this;
|
|
662
|
+
/**
|
|
663
|
+
* Sets the `border-left-width` of the element.
|
|
664
|
+
* Controls the thickness of the left border. Accepts any valid CSS length or a number (interpreted as pixels).
|
|
665
|
+
* Passing `undefined` removes the left border width.
|
|
666
|
+
*
|
|
667
|
+
* @param value - The left border width to apply, or `undefined` to remove it.
|
|
668
|
+
* @return This instance for chaining.
|
|
669
|
+
*/
|
|
670
|
+
blWidth(value: Property.BorderLeftWidth | number | undefined): this;
|
|
671
|
+
/**
|
|
672
|
+
* Sets the `border-left-style` of the element.
|
|
673
|
+
* Controls the visual style of the left border (e.g., solid, dashed, dotted).
|
|
674
|
+
* Passing `undefined` removes the left border style.
|
|
675
|
+
*
|
|
676
|
+
* @param value - The left border style to apply, or `undefined` to remove it.
|
|
677
|
+
* @return This instance for chaining.
|
|
678
|
+
*/
|
|
679
|
+
blStyle(value: Property.BorderLeftStyle | undefined): this;
|
|
680
|
+
/**
|
|
681
|
+
* Sets the `border-left-color` of the element.
|
|
682
|
+
* Controls the color of the left border.
|
|
683
|
+
* Accepts named colors, hex codes, RGB/RGBA values, or CSS variables.
|
|
684
|
+
* Passing `undefined` removes the left border color.
|
|
685
|
+
*
|
|
686
|
+
* @param value - The left border color to apply, or `undefined` to remove it.
|
|
687
|
+
* @return This instance for chaining.
|
|
688
|
+
*/
|
|
689
|
+
blColor(value: Property.BorderLeftColor | undefined): this;
|
|
415
690
|
/**
|
|
416
691
|
* Sets the left and right border styles.
|
|
417
692
|
* @param value - The CSS border value to apply to both left and right sides.
|
|
@@ -534,25 +809,25 @@ declare abstract class BaseStyle {
|
|
|
534
809
|
* @param value - The top offset value (e.g., "10px", "50%").
|
|
535
810
|
* @return This instance for chaining.
|
|
536
811
|
*/
|
|
537
|
-
|
|
812
|
+
top(value: Property.Top | number | undefined): this;
|
|
538
813
|
/**
|
|
539
814
|
* Sets the CSS `bottom` offset.
|
|
540
815
|
* @param value - The bottom offset value (e.g., "0", "2rem").
|
|
541
816
|
* @return This instance for chaining.
|
|
542
817
|
*/
|
|
543
|
-
|
|
818
|
+
bottom(value: Property.Bottom | number | undefined): this;
|
|
544
819
|
/**
|
|
545
820
|
* Sets the CSS `left` offset.
|
|
546
821
|
* @param value - The left offset value (e.g., "5px", "auto").
|
|
547
822
|
* @return This instance for chaining.
|
|
548
823
|
*/
|
|
549
|
-
|
|
824
|
+
left(value: Property.Left | number | undefined): this;
|
|
550
825
|
/**
|
|
551
826
|
* Sets the CSS `right` offset.
|
|
552
827
|
* @param value - The right offset value (e.g., "1em", "0").
|
|
553
828
|
* @return This instance for chaining.
|
|
554
829
|
*/
|
|
555
|
-
|
|
830
|
+
right(value: Property.Right | number | undefined): this;
|
|
556
831
|
/**
|
|
557
832
|
* Sets the `cursor` style of the element.
|
|
558
833
|
* Controls the mouse cursor appearance when hovering over the element.
|
|
@@ -675,6 +950,215 @@ declare abstract class BaseStyle {
|
|
|
675
950
|
* @return This instance for chaining.
|
|
676
951
|
*/
|
|
677
952
|
opacity(value: Property.Opacity | undefined): this;
|
|
953
|
+
/**
|
|
954
|
+
* Sets the `transform` style of the element.
|
|
955
|
+
* Applies visual transformations such as translation, rotation, scaling, or skewing.
|
|
956
|
+
* Accepts any valid CSS transform string (e.g., `"translateX(10px)"`, `"scale(1.2)"`), or `undefined` to remove it.
|
|
957
|
+
*
|
|
958
|
+
* @param value - The transform string to apply, or `undefined` to remove the style.
|
|
959
|
+
* @return This instance for chaining.
|
|
960
|
+
*/
|
|
961
|
+
transform(value: Property.Transform | undefined): this;
|
|
962
|
+
/**
|
|
963
|
+
* Sets the `transform` style to a `translate(x, y)` value.
|
|
964
|
+
* Accepts either pixel numbers or full CSS unit strings (e.g., `"10px"`, `"50%"`, `"2em"`).
|
|
965
|
+
* Automatically appends `"px"` to numeric values.
|
|
966
|
+
* Overwrites any existing `transform` style — use with care if combining multiple transforms.
|
|
967
|
+
*
|
|
968
|
+
* @param x - Horizontal offset as a number (pixels) or CSS string.
|
|
969
|
+
* @param y - Vertical offset as a number (pixels) or CSS string.
|
|
970
|
+
* @return This instance for chaining.
|
|
971
|
+
*/
|
|
972
|
+
translate(x: string | number, y: string | number): this;
|
|
973
|
+
/**
|
|
974
|
+
* Sets the `transform` style to a `translateX(x)` value.
|
|
975
|
+
* Moves the element horizontally using pixel or CSS units.
|
|
976
|
+
* Accepts either a number (pixels) or a full CSS unit string (e.g., `"50%"`, `"2em"`).
|
|
977
|
+
* Overwrites any existing `transform` style — use with care if combining multiple transforms.
|
|
978
|
+
*
|
|
979
|
+
* @param x - Horizontal offset as a number or CSS string.
|
|
980
|
+
* @return This instance for chaining.
|
|
981
|
+
*/
|
|
982
|
+
translateX(x: string | number): this;
|
|
983
|
+
/**
|
|
984
|
+
* Sets the `transform` style to a `translateY(y)` value.
|
|
985
|
+
* Moves the element vertically using pixel or CSS units.
|
|
986
|
+
* Accepts either a number (pixels) or a full CSS unit string (e.g., `"50%"`, `"2em"`).
|
|
987
|
+
* Overwrites any existing `transform` style — use with care if combining multiple transforms.
|
|
988
|
+
*
|
|
989
|
+
* @param y - Vertical offset as a number or CSS string.
|
|
990
|
+
* @return This instance for chaining.
|
|
991
|
+
*/
|
|
992
|
+
translateY(y: string | number): this;
|
|
993
|
+
/**
|
|
994
|
+
* Sets the `transform` style to a `scale(x, y)` value.
|
|
995
|
+
* Scales the element along the X and Y axes.
|
|
996
|
+
* Accepts either numeric scale factors (e.g., `1.2`) or full CSS unit strings (e.g., `"1.5"`).
|
|
997
|
+
* Automatically converts numeric values to string format.
|
|
998
|
+
* Overwrites any existing `transform` style — use with care if combining multiple transforms.
|
|
999
|
+
*
|
|
1000
|
+
* @param x - Horizontal scale factor as a number or string.
|
|
1001
|
+
* @param y - Vertical scale factor as a number or string.
|
|
1002
|
+
* @return This instance for chaining.
|
|
1003
|
+
*/
|
|
1004
|
+
scale(x: string | number, y: string | number): this;
|
|
1005
|
+
/**
|
|
1006
|
+
* Sets the `transform` style to a `scaleX(x)` value.
|
|
1007
|
+
* Scales the element horizontally. Accepts numeric scale factors (e.g., `1.2`) or string values (e.g., `"1.5"`).
|
|
1008
|
+
* Automatically converts numeric values to string format.
|
|
1009
|
+
* Overwrites any existing `transform` style — use with care if combining multiple transforms.
|
|
1010
|
+
*
|
|
1011
|
+
* @param x - Horizontal scale factor as a number or string.
|
|
1012
|
+
* @return This instance for chaining.
|
|
1013
|
+
*/
|
|
1014
|
+
scaleX(x: string | number): this;
|
|
1015
|
+
/**
|
|
1016
|
+
* Sets the `transform` style to a `scaleY(y)` value.
|
|
1017
|
+
* Scales the element vertically. Accepts numeric scale factors (e.g., `0.8`) or string values (e.g., `"1.25"`).
|
|
1018
|
+
* Automatically converts numeric values to string format.
|
|
1019
|
+
* Overwrites any existing `transform` style — use with care if combining multiple transforms.
|
|
1020
|
+
*
|
|
1021
|
+
* @param y - Vertical scale factor as a number or string.
|
|
1022
|
+
* @return This instance for chaining.
|
|
1023
|
+
*/
|
|
1024
|
+
scaleY(y: string | number): this;
|
|
1025
|
+
/**
|
|
1026
|
+
* Sets the `transform` style to a `rotate(angle)` value.
|
|
1027
|
+
* Rotates the element clockwise by the specified angle.
|
|
1028
|
+
* Accepts either a number (interpreted as degrees) or a full CSS angle string (e.g., `"45deg"`, `"0.5turn"`).
|
|
1029
|
+
* Automatically appends `"deg"` to numeric values.
|
|
1030
|
+
* Overwrites any existing `transform` style — use with care if combining multiple transforms.
|
|
1031
|
+
*
|
|
1032
|
+
* @param angle - Rotation angle as a number (degrees) or CSS string.
|
|
1033
|
+
* @return This instance for chaining.
|
|
1034
|
+
*/
|
|
1035
|
+
rotate(angle: string | number): this;
|
|
1036
|
+
/**
|
|
1037
|
+
* Sets the `transform` style to a `rotateX(angle)` value.
|
|
1038
|
+
* Rotates the element around the X-axis in 3D space.
|
|
1039
|
+
* Accepts either a number (degrees) or a full CSS angle string (e.g., `"45deg"`, `"1rad"`).
|
|
1040
|
+
* Automatically appends `"deg"` to numeric values.
|
|
1041
|
+
* Overwrites any existing `transform` style — use with care if combining multiple transforms.
|
|
1042
|
+
*
|
|
1043
|
+
* @param angle - Rotation angle as a number or CSS string.
|
|
1044
|
+
* @return This instance for chaining.
|
|
1045
|
+
*/
|
|
1046
|
+
rotateX(angle: string | number): this;
|
|
1047
|
+
/**
|
|
1048
|
+
* Sets the `transform` style to a `rotateY(angle)` value.
|
|
1049
|
+
* Rotates the element around the Y-axis in 3D space.
|
|
1050
|
+
* Accepts either a number (degrees) or a full CSS angle string (e.g., `"90deg"`, `"0.5turn"`).
|
|
1051
|
+
* Automatically appends `"deg"` to numeric values.
|
|
1052
|
+
* Overwrites any existing `transform` style — use with care if combining multiple transforms.
|
|
1053
|
+
*
|
|
1054
|
+
* @param angle - Rotation angle as a number or CSS string.
|
|
1055
|
+
* @return This instance for chaining.
|
|
1056
|
+
*/
|
|
1057
|
+
rotateY(angle: string | number): this;
|
|
1058
|
+
/**
|
|
1059
|
+
* Sets the `transform` style to a `rotateZ(angle)` value.
|
|
1060
|
+
* Rotates the element around the Z-axis in 3D space (same as 2D rotation).
|
|
1061
|
+
* Accepts either a number (degrees) or a full CSS angle string (e.g., `"30deg"`, `"1rad"`).
|
|
1062
|
+
* Automatically appends `"deg"` to numeric values.
|
|
1063
|
+
* Overwrites any existing `transform` style — use with care if combining multiple transforms.
|
|
1064
|
+
*
|
|
1065
|
+
* @param angle - Rotation angle as a number or CSS string.
|
|
1066
|
+
* @return This instance for chaining.
|
|
1067
|
+
*/
|
|
1068
|
+
rotateZ(angle: string | number): this;
|
|
1069
|
+
/**
|
|
1070
|
+
* Sets the `transform-origin` style of the element.
|
|
1071
|
+
* Defines the pivot point for CSS transforms such as rotation, scaling, or skewing.
|
|
1072
|
+
* Accepts any valid CSS origin string (e.g., `"center"`, `"top left"`, `"50% 50%"`), or `undefined` to remove it.
|
|
1073
|
+
*
|
|
1074
|
+
* @param value - The transform origin to apply, or `undefined` to remove the style.
|
|
1075
|
+
* @return This instance for chaining.
|
|
1076
|
+
*/
|
|
1077
|
+
transformOrigin(value: Property.TransformOrigin | undefined): this;
|
|
1078
|
+
/**
|
|
1079
|
+
* Sets the `transition` style of the element.
|
|
1080
|
+
* Defines how style changes are animated over time, including duration, timing function, and delay.
|
|
1081
|
+
* Accepts any valid CSS transition string (e.g., `"opacity 0.3s ease"`, `"all 200ms linear"`), or `undefined` to remove it.
|
|
1082
|
+
*
|
|
1083
|
+
* @param value - The transition string to apply, or `undefined` to remove the style.
|
|
1084
|
+
* @return This instance for chaining.
|
|
1085
|
+
*/
|
|
1086
|
+
transition(value: Property.Transition | undefined): this;
|
|
1087
|
+
/**
|
|
1088
|
+
* Sets the `will-change` style of the element.
|
|
1089
|
+
* Provides a hint to the browser about which properties are likely to change,
|
|
1090
|
+
* allowing it to optimize rendering and performance ahead of time.
|
|
1091
|
+
* Accepts any valid CSS property name or list (e.g., `"transform"`, `"opacity, left"`), or `undefined` to remove it.
|
|
1092
|
+
*
|
|
1093
|
+
* @param value - The will-change hint to apply, or `undefined` to remove the style.
|
|
1094
|
+
* @return This instance for chaining.
|
|
1095
|
+
*/
|
|
1096
|
+
willChange(value: Property.WillChange | undefined): this;
|
|
1097
|
+
/**
|
|
1098
|
+
* Sets the `box-shadow` style of the element.
|
|
1099
|
+
* Applies shadow effects around the element's frame, supporting offsets, blur radius, spread, and color.
|
|
1100
|
+
* Accepts any valid CSS box-shadow string (e.g., `"0 2px 4px rgba(0,0,0,0.1)"`), or `undefined` to remove it.
|
|
1101
|
+
*
|
|
1102
|
+
* @param value - The box-shadow value to apply, or `undefined` to remove the style.
|
|
1103
|
+
* @return This instance for chaining.
|
|
1104
|
+
*/
|
|
1105
|
+
boxShadow(value: Property.BoxShadow | undefined): this;
|
|
1106
|
+
/**
|
|
1107
|
+
* Sets the `box-sizing` style of the element.
|
|
1108
|
+
* Controls how the element’s total width and height are calculated — either including or excluding padding and border.
|
|
1109
|
+
* Accepts any valid CSS box-sizing value (e.g., `"border-box"`, `"content-box"`), or `undefined` to remove it.
|
|
1110
|
+
*
|
|
1111
|
+
* @param value - The box-sizing value to apply, or `undefined` to remove the style.
|
|
1112
|
+
* @return This instance for chaining.
|
|
1113
|
+
*/
|
|
1114
|
+
boxSizing(value: Property.BoxSizing | undefined): this;
|
|
1115
|
+
/**
|
|
1116
|
+
* Sets the `background` shorthand style of the element.
|
|
1117
|
+
* Accepts any valid CSS background value, including colors, gradients, images, positions, and repeat modes.
|
|
1118
|
+
* Useful for applying complex background styles in a single declaration.
|
|
1119
|
+
* Passing `undefined` removes the background style.
|
|
1120
|
+
*
|
|
1121
|
+
* @param value - The background value to apply (e.g., "#fff", "linear-gradient(...)", "url(...)", "center/cover"), or `undefined` to remove it.
|
|
1122
|
+
* @return This instance for chaining.
|
|
1123
|
+
*/
|
|
1124
|
+
background(value: Property.Background | undefined): this;
|
|
1125
|
+
/**
|
|
1126
|
+
* Sets the `outline` shorthand property of the element.
|
|
1127
|
+
* Controls the outline's width, style, and color in a single call.
|
|
1128
|
+
* Unlike borders, outlines do not affect layout and can extend beyond element bounds.
|
|
1129
|
+
* Passing `undefined` removes the outline.
|
|
1130
|
+
*
|
|
1131
|
+
* @param value - A valid CSS outline shorthand (e.g. "2px dashed red"), or `undefined` to remove it.
|
|
1132
|
+
* @return This instance for chaining.
|
|
1133
|
+
*/
|
|
1134
|
+
outline(value: Property.Outline | undefined): this;
|
|
1135
|
+
/**
|
|
1136
|
+
* Sets the `outline-width` of the element.
|
|
1137
|
+
* Controls the thickness of the outline. Accepts any valid CSS length or a number (interpreted as pixels).
|
|
1138
|
+
* Passing `undefined` removes the outline width.
|
|
1139
|
+
*
|
|
1140
|
+
* @param value - The outline width to apply, or `undefined` to remove it.
|
|
1141
|
+
* @return This instance for chaining.
|
|
1142
|
+
*/
|
|
1143
|
+
outlineWidth(value: Property.OutlineWidth | number | undefined): this;
|
|
1144
|
+
/**
|
|
1145
|
+
* Sets the `outline-style` of the element.
|
|
1146
|
+
* Controls the visual style of the outline (e.g., solid, dashed, dotted).
|
|
1147
|
+
* Passing `undefined` removes the outline style.
|
|
1148
|
+
*
|
|
1149
|
+
* @param value - The outline style to apply, or `undefined` to remove it.
|
|
1150
|
+
* @return This instance for chaining.
|
|
1151
|
+
*/
|
|
1152
|
+
outlineStyle(value: Property.OutlineStyle | undefined): this;
|
|
1153
|
+
/**
|
|
1154
|
+
* Sets the `outline-color` of the element.
|
|
1155
|
+
* Controls the color of the outline. Accepts named colors, hex codes, RGB/RGBA values, or CSS variables.
|
|
1156
|
+
* Passing `undefined` removes the outline color.
|
|
1157
|
+
*
|
|
1158
|
+
* @param value - The outline color to apply, or `undefined` to remove it.
|
|
1159
|
+
* @return This instance for chaining.
|
|
1160
|
+
*/
|
|
1161
|
+
outlineColor(value: Property.OutlineColor | undefined): this;
|
|
678
1162
|
/**
|
|
679
1163
|
* Applies CSS styles to truncate overflowing text with an ellipsis.
|
|
680
1164
|
* Ensures the text stays on a single line and hides overflow.
|
|
@@ -689,6 +1173,16 @@ declare abstract class BaseStyle {
|
|
|
689
1173
|
* @return This instance for chaining.
|
|
690
1174
|
*/
|
|
691
1175
|
overflowEllipsis(): this;
|
|
1176
|
+
/**
|
|
1177
|
+
* Sets the `background` style to a linear gradient.
|
|
1178
|
+
* Accepts a direction and one or more color stops to construct a valid CSS `linear-gradient(...)` string.
|
|
1179
|
+
* Automatically joins color stops and applies the full gradient string to `background`.
|
|
1180
|
+
*
|
|
1181
|
+
* @param direction - The gradient direction (e.g., `"to right"`, `"45deg"`).
|
|
1182
|
+
* @param stops - An array of color stops (e.g., `"#0ea5e9"`, `"#3b82f6 50%"`, `"rgba(0,0,0,0.2)"`).
|
|
1183
|
+
* @return This instance for chaining.
|
|
1184
|
+
*/
|
|
1185
|
+
linearGradient(direction: string, ...stops: string[]): this;
|
|
692
1186
|
/**
|
|
693
1187
|
* Applies a batch of CSS style properties to the element.
|
|
694
1188
|
* Delegates each property to `setStyleProp`, which handles value normalization and kebab-case conversion.
|
|
@@ -704,12 +1198,42 @@ declare abstract class BaseStyle {
|
|
|
704
1198
|
}
|
|
705
1199
|
//#endregion
|
|
706
1200
|
//#region src/BaseDom.d.ts
|
|
1201
|
+
declare const _isBaseDom: unique symbol;
|
|
707
1202
|
/**
|
|
708
1203
|
* Base class for DOM-backed elements with style and event utilities.
|
|
709
1204
|
* Supports both HTML and SVG elements via generic parameter `E`.
|
|
710
1205
|
*/
|
|
711
1206
|
declare abstract class BaseDom<E extends HTMLElement | SVGElement> extends BaseStyle {
|
|
1207
|
+
protected readonly [_isBaseDom] = true;
|
|
712
1208
|
abstract dom: E;
|
|
1209
|
+
/**
|
|
1210
|
+
* Returns the `clientWidth` of the element.
|
|
1211
|
+
* For HTML elements, this is the inner width excluding borders and scrollbars.
|
|
1212
|
+
* For SVG elements, this may return `0` unless the element has layout box dimensions.
|
|
1213
|
+
*/
|
|
1214
|
+
getClientWidth(): number;
|
|
1215
|
+
/**
|
|
1216
|
+
* Returns the `clientHeight` of the element.
|
|
1217
|
+
* For HTML elements, this is the inner height excluding borders and scrollbars.
|
|
1218
|
+
* For SVG elements, this may return `0` unless the element has layout box dimensions.
|
|
1219
|
+
*/
|
|
1220
|
+
getClientHeight(): number;
|
|
1221
|
+
/**
|
|
1222
|
+
* Returns the bounding box of the element using `getBoundingClientRect()`.
|
|
1223
|
+
* Works reliably for both HTML and SVG elements.
|
|
1224
|
+
*
|
|
1225
|
+
* @return A DOMRect object with `width`, `height`, `top`, `left`, etc.
|
|
1226
|
+
*/
|
|
1227
|
+
getRect(): DOMRect;
|
|
1228
|
+
/**
|
|
1229
|
+
* Returns the computed styles of this element.
|
|
1230
|
+
* Useful for reading resolved values of inherited, cascaded, or shorthand CSS properties.
|
|
1231
|
+
*
|
|
1232
|
+
* Wraps `window.getComputedStyle()` and returns a `CSSStyleDeclaration` for inspection.
|
|
1233
|
+
*
|
|
1234
|
+
* @return The computed style object for this element.
|
|
1235
|
+
*/
|
|
1236
|
+
getComputedStyle(): CSSStyleDeclaration;
|
|
713
1237
|
/**
|
|
714
1238
|
* Sets or removes the user-defined class name and applies it alongside the internal CSS class.
|
|
715
1239
|
* Uses `setAttribute("class", ...)` for both HTML and SVG elements.
|
|
@@ -720,6 +1244,16 @@ declare abstract class BaseDom<E extends HTMLElement | SVGElement> extends BaseS
|
|
|
720
1244
|
* @return This DomElement instance for chaining.
|
|
721
1245
|
*/
|
|
722
1246
|
className(value: string | undefined): this;
|
|
1247
|
+
/**
|
|
1248
|
+
* Toggles a CSS class on the element.
|
|
1249
|
+
* Adds the class if it’s not present, removes it if it is.
|
|
1250
|
+
* Uses `classList.toggle()` for safe DOM-backed mutation.
|
|
1251
|
+
*
|
|
1252
|
+
* @param className - The class name to toggle.
|
|
1253
|
+
* @param force - Optional boolean to force add (`true`) or remove (`false`) the class.
|
|
1254
|
+
* @return This instance for chaining.
|
|
1255
|
+
*/
|
|
1256
|
+
toggleClass(className: string, force?: boolean): this;
|
|
723
1257
|
/**
|
|
724
1258
|
* Adds an event listener to the element.
|
|
725
1259
|
* @param type - The event type (e.g., "click", "input", "mouseenter").
|
|
@@ -735,8 +1269,9 @@ declare abstract class BaseDom<E extends HTMLElement | SVGElement> extends BaseS
|
|
|
735
1269
|
* @param type - The event type to remove.
|
|
736
1270
|
* @param handler - The original handler function.
|
|
737
1271
|
* @param options - Optional event listener options.
|
|
1272
|
+
* @return This DomElement instance for chaining.
|
|
738
1273
|
*/
|
|
739
|
-
off<T extends keyof DomElementEventMap>(type: T, handler: (ev: DomElementEventMap[T]) => void, options?: boolean | EventListenerOptions):
|
|
1274
|
+
off<T extends keyof DomElementEventMap>(type: T, handler: (ev: DomElementEventMap[T]) => void, options?: boolean | EventListenerOptions): this;
|
|
740
1275
|
/**
|
|
741
1276
|
* Appends one or more child nodes to the element.
|
|
742
1277
|
* Accepts DomElement instances, regular DOM Nodes, strings, or numbers.
|
|
@@ -784,9 +1319,27 @@ declare abstract class BaseDom<E extends HTMLElement | SVGElement> extends BaseS
|
|
|
784
1319
|
* @returns This DomElement instance.
|
|
785
1320
|
*/
|
|
786
1321
|
clear(from?: number, to?: number): this;
|
|
1322
|
+
/**
|
|
1323
|
+
* Checks whether this element contains the given target node.
|
|
1324
|
+
* Accepts either a raw DOM node or another `BaseDom` instance.
|
|
1325
|
+
*
|
|
1326
|
+
* Useful for containment checks, event delegation, or visibility logic.
|
|
1327
|
+
*
|
|
1328
|
+
* @param target - A DOM node or `BaseDom` instance to test.
|
|
1329
|
+
* @return `true` if this element contains the target, otherwise `false`.
|
|
1330
|
+
*/
|
|
1331
|
+
contains(target: Node | BaseDom<any>): boolean;
|
|
787
1332
|
ref(refFn: (el: this) => void): this;
|
|
788
1333
|
protected resolveNode(child: DomElementChild): Node;
|
|
789
1334
|
protected setStyleProp(name: Autocomplete<keyof CssProperties>, value: string | number | undefined): this;
|
|
1335
|
+
/**
|
|
1336
|
+
* Checks whether a value is a `BaseDom` instance.
|
|
1337
|
+
* Uses a symbol-based identity marker and avoids the `in` operator.
|
|
1338
|
+
*
|
|
1339
|
+
* @param value - The value to check.
|
|
1340
|
+
* @return `true` if the value is a `BaseDom` instance, otherwise `false`.
|
|
1341
|
+
*/
|
|
1342
|
+
static isBaseDom(value: unknown): value is BaseDom<HTMLElement | SVGElement>;
|
|
790
1343
|
}
|
|
791
1344
|
//#endregion
|
|
792
1345
|
//#region src/DomElement.d.ts
|
|
@@ -1226,13 +1779,14 @@ declare class CssRule extends BaseStyle {
|
|
|
1226
1779
|
*/
|
|
1227
1780
|
remove(): void;
|
|
1228
1781
|
/**
|
|
1229
|
-
* Creates a new CssRule
|
|
1230
|
-
*
|
|
1782
|
+
* Creates a new `CssRule` by extending this rule’s selector.
|
|
1783
|
+
* Appends the given selector fragment to the current selector.
|
|
1784
|
+
* Useful for pseudo-classes (e.g., `:hover`), combinators (e.g., ` > span`), or attribute filters (e.g., `[data-active]`).
|
|
1231
1785
|
*
|
|
1232
|
-
* @param
|
|
1233
|
-
* @return A new CssRule instance targeting the extended selector.
|
|
1786
|
+
* @param extension - The selector fragment to append (e.g., `:hover`, ` > span`, `[data-active]`).
|
|
1787
|
+
* @return A new `CssRule` instance targeting the extended selector.
|
|
1234
1788
|
*/
|
|
1235
|
-
|
|
1789
|
+
extend(extension: string): CssRule;
|
|
1236
1790
|
/**
|
|
1237
1791
|
* Creates a `:hover` rule for this selector.
|
|
1238
1792
|
* @return A new CssRule instance for the `:hover` state.
|
|
@@ -1312,8 +1866,9 @@ declare class DomDocument {
|
|
|
1312
1866
|
* @param type - The event type to remove.
|
|
1313
1867
|
* @param handler - The original handler function.
|
|
1314
1868
|
* @param options - Optional event listener options.
|
|
1869
|
+
* @return This instance for chaining.
|
|
1315
1870
|
*/
|
|
1316
|
-
off<T extends keyof DocumentEventMap>(type: T, handler: (ev: DocumentEventMap[T]) => void, options?: boolean | EventListenerOptions):
|
|
1871
|
+
off<T extends keyof DocumentEventMap>(type: T, handler: (ev: DocumentEventMap[T]) => void, options?: boolean | EventListenerOptions): this;
|
|
1317
1872
|
/**
|
|
1318
1873
|
* Dispatches a DOM event on the document object.
|
|
1319
1874
|
*
|
|
@@ -1353,8 +1908,9 @@ declare class DomWindow {
|
|
|
1353
1908
|
* @param type - The event type to remove.
|
|
1354
1909
|
* @param handler - The original handler function.
|
|
1355
1910
|
* @param options - Optional event listener options.
|
|
1911
|
+
* @return This DomElement instance for chaining.
|
|
1356
1912
|
*/
|
|
1357
|
-
off<T extends keyof WindowEventMap>(type: T, handler: (ev: WindowEventMap[T]) => void, options?: boolean | EventListenerOptions):
|
|
1913
|
+
off<T extends keyof WindowEventMap>(type: T, handler: (ev: WindowEventMap[T]) => void, options?: boolean | EventListenerOptions): this;
|
|
1358
1914
|
/**
|
|
1359
1915
|
* Dispatches a DOM event on the window object.
|
|
1360
1916
|
*
|
|
@@ -1386,14 +1942,79 @@ declare class IFrame extends DomElement<"iframe"> {
|
|
|
1386
1942
|
declare function $iframe(): IFrame;
|
|
1387
1943
|
//#endregion
|
|
1388
1944
|
//#region src/ImageElement.d.ts
|
|
1945
|
+
/**
|
|
1946
|
+
* Fluent wrapper for an `<img>` element.
|
|
1947
|
+
* Provides chainable methods for setting image source, dimensions, and alt text.
|
|
1948
|
+
* Inherits style and event utilities from `DomElement` and `BaseDom`.
|
|
1949
|
+
*
|
|
1950
|
+
* Useful for programmatically constructing image elements with ergonomic, declarative syntax.
|
|
1951
|
+
*/
|
|
1389
1952
|
declare class ImageElement extends DomElement<"img"> {
|
|
1390
1953
|
constructor();
|
|
1954
|
+
/**
|
|
1955
|
+
* Returns the `naturalWidth` of the image.
|
|
1956
|
+
* This is the intrinsic width of the image resource in pixels, unaffected by CSS or layout.
|
|
1957
|
+
* Returns `0` if the image has not loaded or failed to decode.
|
|
1958
|
+
*
|
|
1959
|
+
* @return The natural width in pixels.
|
|
1960
|
+
*/
|
|
1961
|
+
getNaturalWidth(): number;
|
|
1962
|
+
/**
|
|
1963
|
+
* Returns the `naturalHeight` of the image.
|
|
1964
|
+
* This is the intrinsic height of the image resource in pixels, unaffected by CSS or layout.
|
|
1965
|
+
* Returns `0` if the image has not loaded or failed to decode.
|
|
1966
|
+
*
|
|
1967
|
+
* @return The natural height in pixels.
|
|
1968
|
+
*/
|
|
1969
|
+
getNaturalHeight(): number;
|
|
1970
|
+
/**
|
|
1971
|
+
* Sets the `src` attribute of the `<img>` element.
|
|
1972
|
+
* Defines the image source URL or path to be loaded.
|
|
1973
|
+
*
|
|
1974
|
+
* @param value - The image source (e.g., "/logo.png", "https://example.com/photo.jpg").
|
|
1975
|
+
* @return This instance for chaining.
|
|
1976
|
+
*/
|
|
1391
1977
|
src(value: string): this;
|
|
1978
|
+
/**
|
|
1979
|
+
* Sets the `width` attribute of the `<img>` element in pixels.
|
|
1980
|
+
* This controls the rendered width of the image, independent of its intrinsic size.
|
|
1981
|
+
*
|
|
1982
|
+
* @param value - The width in pixels.
|
|
1983
|
+
* @return This instance for chaining.
|
|
1984
|
+
*/
|
|
1392
1985
|
width(value: number): this;
|
|
1986
|
+
/**
|
|
1987
|
+
* Sets the `height` attribute of the `<img>` element in pixels.
|
|
1988
|
+
* This controls the rendered height of the image, independent of its intrinsic size.
|
|
1989
|
+
*
|
|
1990
|
+
* @param value - The height in pixels.
|
|
1991
|
+
* @return This instance for chaining.
|
|
1992
|
+
*/
|
|
1393
1993
|
height(value: number): this;
|
|
1994
|
+
/**
|
|
1995
|
+
* Sets both the `width` and `height` attributes of the `<img>` element in pixels.
|
|
1996
|
+
* Useful for explicitly sizing the image without relying on CSS.
|
|
1997
|
+
*
|
|
1998
|
+
* @param width - The width in pixels.
|
|
1999
|
+
* @param height - The height in pixels.
|
|
2000
|
+
* @return This instance for chaining.
|
|
2001
|
+
*/
|
|
1394
2002
|
setSize(width: number, height: number): this;
|
|
2003
|
+
/**
|
|
2004
|
+
* Sets the `alt` attribute of the `<img>` element.
|
|
2005
|
+
* Provides alternative text for accessibility and fallback rendering.
|
|
2006
|
+
*
|
|
2007
|
+
* @param value - The alt text (e.g., "User avatar", "Company logo").
|
|
2008
|
+
* @return This instance for chaining.
|
|
2009
|
+
*/
|
|
1395
2010
|
alt(value: string): this;
|
|
1396
2011
|
}
|
|
2012
|
+
/**
|
|
2013
|
+
* Creates a new `ImageElement` instance.
|
|
2014
|
+
* Equivalent to: `new ImageElement()`, but more expressive in fluent DOM construction.
|
|
2015
|
+
*
|
|
2016
|
+
* @return A new `ImageElement` instance.
|
|
2017
|
+
*/
|
|
1397
2018
|
declare function $img(): ImageElement;
|
|
1398
2019
|
//#endregion
|
|
1399
2020
|
//#region src/input.d.ts
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=class{p(e){return this.setStyleProp(`padding`,e)}pt(e){return this.setStyleProp(`paddingTop`,e)}pr(e){return this.setStyleProp(`paddingRight`,e)}pb(e){return this.setStyleProp(`paddingBottom`,e)}pl(e){return this.setStyleProp(`paddingLeft`,e)}px(e){return this.pl(e).pr(e)}py(e){return this.pt(e).pb(e)}m(e){return this.setStyleProp(`margin`,e)}mt(e){return this.setStyleProp(`marginTop`,e)}mr(e){return this.setStyleProp(`marginRight`,e)}mb(e){return this.setStyleProp(`marginBottom`,e)}ml(e){return this.setStyleProp(`marginLeft`,e)}radius(e){return this.setStyleProp(`borderRadius`,e)}radiusTopLeft(e){return this.setStyleProp(`borderTopLeftRadius`,e)}radiusTopRight(e){return this.setStyleProp(`borderTopRightRadius`,e)}radiusBottomLeft(e){return this.setStyleProp(`borderBottomLeftRadius`,e)}radiusBottomRight(e){return this.setStyleProp(`borderBottomRightRadius`,e)}radiusTop(e){return this.radiusTopLeft(e).radiusTopRight(e)}radiusBottom(e){return this.radiusBottomLeft(e).radiusBottomRight(e)}radiusLeft(e){return this.radiusTopLeft(e).radiusBottomLeft(e)}radiusRight(e){return this.radiusTopRight(e).radiusBottomRight(e)}radiusX(e){return this.radiusLeft(e).radiusRight(e)}radiusY(e){return this.radiusTop(e).radiusBottom(e)}display(e){return this.setStyleProp(`display`,e)}flexShrink(e){return this.setStyleProp(`flexShrink`,e)}flex(e){return this.setStyleProp(`flex`,e)}bgColor(e){return this.setStyleProp(`backgroundColor`,e)}color(e){return this.setStyleProp(`color`,e)}w(e){return this.setStyleProp(`width`,e)}h(e){return this.setStyleProp(`height`,e)}b(e){return this.setStyleProp(`border`,e)}bt(e){return this.setStyleProp(`borderTop`,e)}br(e){return this.setStyleProp(`borderRight`,e)}bb(e){return this.setStyleProp(`borderBottom`,e)}bl(e){return this.setStyleProp(`borderLeft`,e)}bx(e){return this.setStyleProp(`borderLeft`,e),this.setStyleProp(`borderRight`,e),this}by(e){return this.setStyleProp(`borderTop`,e),this.setStyleProp(`borderBottom`,e),this}btl(e){return this.setStyleProp(`borderTop`,e),this.setStyleProp(`borderLeft`,e),this}btr(e){return this.setStyleProp(`borderTop`,e),this.setStyleProp(`borderRight`,e),this}bbl(e){return this.setStyleProp(`borderBottom`,e),this.setStyleProp(`borderLeft`,e),this}bbr(e){return this.setStyleProp(`borderBottom`,e),this.setStyleProp(`borderRight`,e),this}overflow(e){return this.setStyleProp(`overflow`,e)}overflowY(e){return this.setStyleProp(`overflowY`,e)}overflowX(e){return this.setStyleProp(`overflowX`,e)}fontSize(e){return this.setStyleProp(`fontSize`,e)}fontWeight(e){return this.setStyleProp(`fontWeight`,e)}fontFamily(e){return this.setStyleProp(`fontFamily`,e)}fontStyle(e){return this.setStyleProp(`fontStyle`,e)}textAlign(e){return this.setStyleProp(`textAlign`,e)}textDecoration(e){return this.setStyleProp(`textDecoration`,e)}pos(e){return this.setStyleProp(`position`,e)}posTop(e){return this.setStyleProp(`top`,e)}posBottom(e){return this.setStyleProp(`bottom`,e)}posLeft(e){return this.setStyleProp(`left`,e)}posRight(e){return this.setStyleProp(`right`,e)}cursor(e){return this.setStyleProp(`cursor`,e)}alignItems(e){return this.setStyleProp(`alignItems`,e)}justifyContent(e){return this.setStyleProp(`justifyContent`,e)}gap(e){return this.setStyleProp(`gap`,e)}flexDirection(e){return this.setStyleProp(`flexDirection`,e)}templateColumns(e){return this.setStyleProp(`gridTemplateColumns`,e)}templateRows(e){return this.setStyleProp(`gridTemplateRows`,e)}appearance(e){return this.setStyleProp(`appearance`,e)}userSelect(e){return this.setStyleProp(`userSelect`,e)}verticalAlign(e){return this.setStyleProp(`verticalAlign`,e)}whiteSpace(e){return this.setStyleProp(`whiteSpace`,e)}textOverflow(e){return this.setStyleProp(`textOverflow`,e)}zIndex(e){return this.setStyleProp(`zIndex`,e)}opacity(e){return this.setStyleProp(`opacity`,e)}overflowEllipsis(){return this.overflow(`hidden`).whiteSpace(`nowrap`).textOverflow(`ellipsis`)}style(e){for(let t of Object.keys(e))this.setStyleProp(t,e[t]);return this}};const t={opacity:1,zIndex:1,fontWeight:1,lineHeight:1,flexGrow:1,flexShrink:1,order:1,zoom:1,scale:1,counterIncrement:1,counterReset:1,tabSize:1,orphans:1,widows:1,columns:1,columnCount:1,gridRow:1,gridColumn:1},n={WebkitAppearance:1},r=`svg.svgA.animate.animateMotion.animateTransform.circle.clipPath.defs.desc.ellipse.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.filter.foreignObject.g.image.line.linearGradient.marker.mask.metadata.mpath.path.pattern.polygon.polyline.radialGradient.rect.script.set.stop.style.switch.symbol.text.textPath.title.tspan.use.view`.split(`.`),i={svgA:`a`};function a(){return`${Date.now().toString(36)}-${(o++).toString(36)}`}let o=0;function s(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}function c(e,n){return typeof n==`number`?t[e]?String(n):`${n}px`:n}var l=class extends e{className(e){return e==null?this.dom.removeAttribute(`class`):this.dom.setAttribute(`class`,e),this}on(e,t,n){return this.dom.addEventListener(e,t,n),this}off(e,t,n){this.dom.removeEventListener(e,t,n)}add(...e){return this.dom.append(...e.map(e=>this.resolveNode(e))),this}insertAtIndex(e,...t){let n=Array.from(this.dom.children),r=Math.max(0,Math.min(e,n.length));for(let e of t){let t=n[r]??null;this.dom.insertBefore(this.resolveNode(e),t),r++}return this}setChildren(...e){return this.clear().add(...e)}setChildrenFromIndex(e,...t){let n=Array.from(this.dom.children),r=n.length,i=Math.max(0,Math.min(e,r));for(let e=i;e<r;e++)this.dom.removeChild(n[e]);let a=this.dom.children[i]??null;for(let e of t)this.dom.insertBefore(this.resolveNode(e),a);return this}clear(e,t){let n=Array.from(this.dom.children),r=Math.max(0,e??0),i=Math.min(n.length,t??n.length);for(let e=r;e<i;e++)this.dom.removeChild(n[e]);return this}ref(e){return e(this),this}resolveNode(e){return typeof e==`string`||typeof e==`number`?document.createTextNode(String(e)):`dom`in e?e.dom:e}setStyleProp(e,t){return t===void 0?(this.dom.style.removeProperty(s(e)),this):(this.dom.style.setProperty(s(e),c(e,t)),this)}},u=class extends l{constructor(e,t){super(),this._tag=i[e]??e,this._isSvg=r.includes(this._tag),this._dom=t??(this._isSvg?document.createElementNS(`http://www.w3.org/2000/svg`,this._tag):document.createElement(this._tag))}_tag;_isSvg;_dom;get tag(){return this._tag}get isSvg(){return this._isSvg}get dom(){return this._dom}getText(){return this._dom.textContent}text(e){return this._dom.textContent=e==null?``:String(e),this}remove(){this.dom.remove()}getAttr(e){return this.dom.getAttribute(e)}attr(e,t){return t===void 0?this.dom.removeAttribute(e):this.dom.setAttribute(e,String(t)),this}attrs(e){for(let[t,n]of Object.entries(e))this.attr(t,n);return this}getProp(e){return this.dom[e]}prop(e,t){return this.dom[e]=t,this}props(e){for(let[t,n]of Object.entries(e))this.prop(t,n);return this}id(e){return this._dom.id=e??``,this}htmlFor(e){return this.tag===`label`&&(this.dom.htmlFor=e??``),this}title(e){return e===void 0?this.dom.removeAttribute(`title`):this.dom.setAttribute(`title`,e),this}disabled(e){return e?this.dom.setAttribute(`disabled`,``):this.dom.removeAttribute(`disabled`),this}disable(){return this.disabled(!0)}enable(){return this.disabled(!1)}popover(e){return e===void 0?this.dom.removeAttribute(`popover`):this.dom.setAttribute(`popover`,e),this}showPopover(){return this.dom.showPopover(),this}hidePopover(){return this.dom.hidePopover(),this}};function d(e){return new u(e)}function f(e){let t=document.querySelector(e);return new u(t.tagName.toLowerCase(),t)}var p=class extends u{constructor(){super(`a`)}href(e){return this.dom.href=e,this}};function m(){return new p}var h=class extends u{constructor(){super(`button`)}type(e){return this.dom.type=e,this}};function g(){return new h}var _=class extends u{constructor(e){super(`canvas`,e)}_size={width:this.dom.width,height:this.dom.height};getWidth(){return this.dom.width}getHeight(){return this.dom.height}width(e){return this.dom.width=e,this}height(e){return this.dom.height=e,this}setSize(e,t){return this.dom.width=e,this.dom.height=t,this}getSize(){return this._size.width=this.dom.width,this._size.height=this.dom.height,this._size}getAspect(){return this.dom.width/this.dom.height}getAspectScale(e){let t=this.dom.width/this.dom.height,n,r,i;return t>=1?(n=1/t,r=1,i=1):(n=1,r=t,i=1),e.x=n,e.y=r,e.z=i,e}};function v(){return new _}var y=class extends e{constructor(e,t,n){super(),this._sheet=e,this._index=t,this._rule=n}_sheet;_index;_rule;get sheet(){return this._sheet}get index(){return this._index}get rule(){return this._rule}get selectorText(){return this._rule.selectorText}remove(){this._sheet.removeRule(this)}pseudo(e){return this.sheet.cssRule(`${this.selectorText}${e}`)}hover(){return this.pseudo(`:hover`)}focus(){return this.pseudo(`:focus`)}focusWithin(){return this.pseudo(`:focus-within`)}active(){return this.pseudo(`:active`)}disabled(){return this.pseudo(`:disabled`)}setStyleProp(e,t){return t===void 0?(this.rule.style.removeProperty(s(e)),this):(this.rule.style.setProperty(s(e),c(e,t)),this)}},b=class extends l{get dom(){return document.body}};function x(){return new b}var S=class{on(e,t,n){return document.addEventListener(e,t,n),this}off(e,t,n){document.removeEventListener(e,t,n)}dispatch(e){return document.dispatchEvent(e),this}};function C(){return new S}var w=class{on(e,t,n){return window.addEventListener(e,t,n),this}off(e,t,n){window.removeEventListener(e,t,n)}dispatch(e){return window.dispatchEvent(e),this}};function T(){return new w}var E=class extends u{constructor(){super(`iframe`)}src(e){return this.dom.src=e,this}allowFullscreen(e=!0){return this.dom.allowFullscreen=e,this}width(e){return this.dom.width=c(`width`,e),this}height(e){return this.dom.height=c(`height`,e),this}setSize(e,t){return this.dom.width=c(`width`,e),this.dom.height=c(`height`,t),this}reload(){this.dom.src=this.dom.src}};function D(){return new E}var O=class extends u{constructor(){super(`img`)}src(e){return this.dom.src=e,this}width(e){return this.dom.width=e,this}height(e){return this.dom.height=e,this}setSize(e,t){return this.dom.width=e,this.dom.height=t,this}alt(e){return this.dom.alt=e,this}};function k(){return new O}var A=class extends u{constructor(){super(`input`),this.dom.type=`checkbox`}name(e){return this.dom.name=e,this}checked(e){return this.prop(`checked`,e),this}isChecked(){return this.getProp(`checked`)}},j=class extends u{constructor(){super(`input`),this._dom.type=`color`}_rgb={r:1,g:1,b:1};name(e){return this._dom.name=e,this}value(e){return this._dom.value=e,this}getValue(){return this._dom.value}getRGB(){let e=this._dom.value,t=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),r=parseInt(e.slice(5,7),16);return this._rgb.r=t,this._rgb.g=n,this._rgb.b=r,this._rgb}getNormalizedRGB(){let e=this._dom.value,t=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),r=parseInt(e.slice(5,7),16);return this._rgb.r=t/255,this._rgb.g=n/255,this._rgb.b=r/255,this._rgb}},M=class extends u{constructor(){super(`input`),this.dom.type=`number`}name(e){return this.dom.name=e,this}value(e){return this.dom.value=String(e),this}getValue(){return Number(this.dom.value)}min(e){return this.dom.min=String(e),this}max(e){return this.dom.max=String(e),this}step(e){return this.dom.step=String(e),this}placeholder(e){return this.dom.placeholder=e,this}},N=class extends u{constructor(){super(`input`),this.dom.type=`range`}name(e){return this.dom.name=e,this}value(e){return this.dom.value=String(e),this}getValue(){return Number(this.dom.value)}min(e){return this.dom.min=String(e),this}max(e){return this.dom.max=String(e),this}step(e){return this.dom.step=String(e),this}},P=class extends u{constructor(){super(`input`),this.dom.type=`text`}name(e){return this.dom.name=e,this}value(e){return this.dom.value=e,this}getValue(){return this.dom.value}placeholder(e){return this.dom.placeholder=e,this}};function F(e){switch(e){case`text`:return new P;case`number`:return new M;case`checkbox`:return new A;case`color`:return new j;case`range`:return new N}}var I=class{constructor(e,t,n){this._sheet=e,this._index=t,this._rule=n}_sheet;_index;_rule;get sheet(){return this._sheet}get index(){return this._index}get rule(){return this._rule}get length(){return this._rule.cssRules.length}get mediaText(){return this._rule.media.mediaText}cssRule(e){let t=this.length;return this.rule.insertRule(`${e}{}`,t),new y(this.sheet,t,this.rule.cssRules.item(t))}remove(){this.sheet.removeRule(this)}removeRule(e){this.rule.deleteRule(e.index)}},L=class extends u{constructor(){super(`option`)}value(e){return this.dom.value=String(e),this}getValue(){return this.dom.value}};function R(){return new L}var z=class extends u{constructor(){super(`progress`)}value(e){return this.dom.value=e,this}getValue(){return this.dom.value}max(e){return this.dom.max=e,this}getMax(){return this.dom.max}indeterminate(){return this.dom.removeAttribute(`value`),this}};function B(){return new z}var V=class extends u{constructor(){super(`select`)}name(e){return this.dom.name=e,this}value(e){return this.dom.value=String(e),this}getValue(){return this.dom.value}};function H(){return new V}var U=class e{constructor(e){this._dom=e}_dom;get dom(){return this._dom}get sheet(){return this.dom.sheet}get length(){return this.sheet.cssRules.length}cssRule(e){let t=this.length;return this.sheet.insertRule(`${e}{}`,t),new y(this,t,this.sheet.cssRules.item(t))}mediaRule(e){let t=this.length;return this.sheet.insertRule(`@media(${e}){}`,t),new I(this,t,this.sheet.cssRules.item(t))}mediaMinWidth(e){return this.mediaRule(`min-width: ${c(`min-width`,e)}`)}mediaMaxWidth(e){return this.mediaRule(`max-width: ${c(`max-width`,e)}`)}removeRule(e){this.sheet.deleteRule(e.index)}static getSheet(t=e.DEFAULT_STYLE_ID){let n=document.head.querySelector(`#${t}`);if(n==null){let n=document.createElement(`style`);return n.id=t,n.setAttribute(`type`,`text/css`),document.head.append(n),new e(n)}else return new e(n)}static DEFAULT_STYLE_ID=`__neptune-style__`};export{d as $,m as $a,x as $body,g as $btn,v as $canvas,C as $document,D as $iframe,k as $img,F as $input,R as $option,B as $progress,f as $query,H as $select,T as $window,p as AnchorElement,l as BaseDom,e as BaseStyle,h as Button,_ as Canvas,y as CssRule,b as DomBody,S as DomDocument,u as DomElement,w as DomWindow,E as IFrame,O as ImageElement,A as InputCheckbox,j as InputColor,M as InputNumber,N as InputRange,P as InputText,I as MediaRule,L as OptionElement,z as ProgressElement,r as SVG_TAGS,V as SelectElement,U as StyleSheet,i as TAG_ALIAS,t as UNITLESS_CSS_PROPS,n as VENDOR_CSS_PROPS,s as camelToKebab,c as getStyleValue,a as uniqueId};
|
|
1
|
+
var e=class{p(e){return this.setStyleProp(`padding`,e)}pt(e){return this.setStyleProp(`paddingTop`,e)}pr(e){return this.setStyleProp(`paddingRight`,e)}pb(e){return this.setStyleProp(`paddingBottom`,e)}pl(e){return this.setStyleProp(`paddingLeft`,e)}px(e){return this.pl(e).pr(e)}py(e){return this.pt(e).pb(e)}m(e){return this.setStyleProp(`margin`,e)}mt(e){return this.setStyleProp(`marginTop`,e)}mr(e){return this.setStyleProp(`marginRight`,e)}mb(e){return this.setStyleProp(`marginBottom`,e)}ml(e){return this.setStyleProp(`marginLeft`,e)}radius(e){return this.setStyleProp(`borderRadius`,e)}radiusTopLeft(e){return this.setStyleProp(`borderTopLeftRadius`,e)}radiusTopRight(e){return this.setStyleProp(`borderTopRightRadius`,e)}radiusBottomLeft(e){return this.setStyleProp(`borderBottomLeftRadius`,e)}radiusBottomRight(e){return this.setStyleProp(`borderBottomRightRadius`,e)}radiusTop(e){return this.radiusTopLeft(e).radiusTopRight(e)}radiusBottom(e){return this.radiusBottomLeft(e).radiusBottomRight(e)}radiusLeft(e){return this.radiusTopLeft(e).radiusBottomLeft(e)}radiusRight(e){return this.radiusTopRight(e).radiusBottomRight(e)}radiusX(e){return this.radiusLeft(e).radiusRight(e)}radiusY(e){return this.radiusTop(e).radiusBottom(e)}display(e){return this.setStyleProp(`display`,e)}flexShrink(e){return this.setStyleProp(`flexShrink`,e)}flex(e){return this.setStyleProp(`flex`,e)}bgColor(e){return this.setStyleProp(`backgroundColor`,e)}color(e){return this.setStyleProp(`color`,e)}w(e){return this.setStyleProp(`width`,e)}h(e){return this.setStyleProp(`height`,e)}minW(e){return this.setStyleProp(`minWidth`,e)}maxW(e){return this.setStyleProp(`maxWidth`,e)}minH(e){return this.setStyleProp(`minHeight`,e)}maxH(e){return this.setStyleProp(`maxHeight`,e)}b(e){return this.setStyleProp(`border`,e)}bWidth(e){let t=typeof e==`number`?`${e}px`:e;return this.setStyleProp(`borderWidth`,t)}bStyle(e){return this.setStyleProp(`borderStyle`,e)}bColor(e){return this.setStyleProp(`borderColor`,e)}bt(e){return this.setStyleProp(`borderTop`,e)}btWidth(e){let t=typeof e==`number`?`${e}px`:e;return this.setStyleProp(`borderTopWidth`,t)}btStyle(e){return this.setStyleProp(`borderTopStyle`,e)}btColor(e){return this.setStyleProp(`borderTopColor`,e)}br(e){return this.setStyleProp(`borderRight`,e)}brWidth(e){let t=typeof e==`number`?`${e}px`:e;return this.setStyleProp(`borderRightWidth`,t)}brStyle(e){return this.setStyleProp(`borderRightStyle`,e)}brColor(e){return this.setStyleProp(`borderRightColor`,e)}bb(e){return this.setStyleProp(`borderBottom`,e)}bbWidth(e){let t=typeof e==`number`?`${e}px`:e;return this.setStyleProp(`borderBottomWidth`,t)}bbStyle(e){return this.setStyleProp(`borderBottomStyle`,e)}bbColor(e){return this.setStyleProp(`borderBottomColor`,e)}bl(e){return this.setStyleProp(`borderLeft`,e)}blWidth(e){let t=typeof e==`number`?`${e}px`:e;return this.setStyleProp(`borderLeftWidth`,t)}blStyle(e){return this.setStyleProp(`borderLeftStyle`,e)}blColor(e){return this.setStyleProp(`borderLeftColor`,e)}bx(e){return this.setStyleProp(`borderLeft`,e),this.setStyleProp(`borderRight`,e),this}by(e){return this.setStyleProp(`borderTop`,e),this.setStyleProp(`borderBottom`,e),this}btl(e){return this.setStyleProp(`borderTop`,e),this.setStyleProp(`borderLeft`,e),this}btr(e){return this.setStyleProp(`borderTop`,e),this.setStyleProp(`borderRight`,e),this}bbl(e){return this.setStyleProp(`borderBottom`,e),this.setStyleProp(`borderLeft`,e),this}bbr(e){return this.setStyleProp(`borderBottom`,e),this.setStyleProp(`borderRight`,e),this}overflow(e){return this.setStyleProp(`overflow`,e)}overflowY(e){return this.setStyleProp(`overflowY`,e)}overflowX(e){return this.setStyleProp(`overflowX`,e)}fontSize(e){return this.setStyleProp(`fontSize`,e)}fontWeight(e){return this.setStyleProp(`fontWeight`,e)}fontFamily(e){return this.setStyleProp(`fontFamily`,e)}fontStyle(e){return this.setStyleProp(`fontStyle`,e)}textAlign(e){return this.setStyleProp(`textAlign`,e)}textDecoration(e){return this.setStyleProp(`textDecoration`,e)}pos(e){return this.setStyleProp(`position`,e)}top(e){return this.setStyleProp(`top`,e)}bottom(e){return this.setStyleProp(`bottom`,e)}left(e){return this.setStyleProp(`left`,e)}right(e){return this.setStyleProp(`right`,e)}cursor(e){return this.setStyleProp(`cursor`,e)}alignItems(e){return this.setStyleProp(`alignItems`,e)}justifyContent(e){return this.setStyleProp(`justifyContent`,e)}gap(e){return this.setStyleProp(`gap`,e)}flexDirection(e){return this.setStyleProp(`flexDirection`,e)}templateColumns(e){return this.setStyleProp(`gridTemplateColumns`,e)}templateRows(e){return this.setStyleProp(`gridTemplateRows`,e)}appearance(e){return this.setStyleProp(`appearance`,e)}userSelect(e){return this.setStyleProp(`userSelect`,e)}verticalAlign(e){return this.setStyleProp(`verticalAlign`,e)}whiteSpace(e){return this.setStyleProp(`whiteSpace`,e)}textOverflow(e){return this.setStyleProp(`textOverflow`,e)}zIndex(e){return this.setStyleProp(`zIndex`,e)}opacity(e){return this.setStyleProp(`opacity`,e)}transform(e){return this.setStyleProp(`transform`,e)}translate(e,t){let n=typeof e==`number`?`${e}px`:e,r=typeof t==`number`?`${t}px`:t;return this.setStyleProp(`transform`,`translate(${n}, ${r})`)}translateX(e){let t=typeof e==`number`?`${e}px`:e;return this.setStyleProp(`transform`,`translateX(${t})`)}translateY(e){let t=typeof e==`number`?`${e}px`:e;return this.setStyleProp(`transform`,`translateY(${t})`)}scale(e,t){let n=typeof e==`number`?e.toString():e,r=typeof t==`number`?t.toString():t;return this.setStyleProp(`transform`,`scale(${n}, ${r})`)}scaleX(e){let t=typeof e==`number`?e.toString():e;return this.setStyleProp(`transform`,`scaleX(${t})`)}scaleY(e){let t=typeof e==`number`?e.toString():e;return this.setStyleProp(`transform`,`scaleY(${t})`)}rotate(e){let t=typeof e==`number`?`${e}deg`:e;return this.setStyleProp(`transform`,`rotate(${t})`)}rotateX(e){let t=typeof e==`number`?`${e}deg`:e;return this.setStyleProp(`transform`,`rotateX(${t})`)}rotateY(e){let t=typeof e==`number`?`${e}deg`:e;return this.setStyleProp(`transform`,`rotateY(${t})`)}rotateZ(e){let t=typeof e==`number`?`${e}deg`:e;return this.setStyleProp(`transform`,`rotateZ(${t})`)}transformOrigin(e){return this.setStyleProp(`transformOrigin`,e)}transition(e){return this.setStyleProp(`transition`,e)}willChange(e){return this.setStyleProp(`willChange`,e)}boxShadow(e){return this.setStyleProp(`boxShadow`,e)}boxSizing(e){return this.setStyleProp(`boxSizing`,e)}background(e){return this.setStyleProp(`background`,e)}outline(e){return this.setStyleProp(`outline`,e)}outlineWidth(e){let t=typeof e==`number`?`${e}px`:e;return this.setStyleProp(`outlineWidth`,t)}outlineStyle(e){return this.setStyleProp(`outlineStyle`,e)}outlineColor(e){return this.setStyleProp(`outlineColor`,e)}overflowEllipsis(){return this.overflow(`hidden`).whiteSpace(`nowrap`).textOverflow(`ellipsis`)}linearGradient(e,...t){let n=`linear-gradient(${e}, ${t.join(`, `)})`;return this.setStyleProp(`background`,n)}style(e){for(let t of Object.keys(e))this.setStyleProp(t,e[t]);return this}};const t={opacity:1,zIndex:1,fontWeight:1,lineHeight:1,flexGrow:1,flexShrink:1,order:1,zoom:1,scale:1,counterIncrement:1,counterReset:1,tabSize:1,orphans:1,widows:1,columns:1,columnCount:1,gridRow:1,gridColumn:1},n={WebkitAppearance:1},r=`svg.svgA.animate.animateMotion.animateTransform.circle.clipPath.defs.desc.ellipse.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.filter.foreignObject.g.image.line.linearGradient.marker.mask.metadata.mpath.path.pattern.polygon.polyline.radialGradient.rect.script.set.stop.style.switch.symbol.text.textPath.title.tspan.use.view`.split(`.`),i={svgA:`a`};function a(){return`${Date.now().toString(36)}-${(o++).toString(36)}`}let o=0;function s(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}function c(e,n){return typeof n==`number`?t[e]?String(n):`${n}px`:n}const l=Symbol(`BaseDomIdentity`);var u=class t extends e{[l]=!0;getClientWidth(){return this.dom.clientWidth??0}getClientHeight(){return this.dom.clientHeight??0}getRect(){return this.dom.getBoundingClientRect()}getComputedStyle(){return window.getComputedStyle(this.dom)}className(e){return e==null?this.dom.removeAttribute(`class`):this.dom.setAttribute(`class`,e),this}toggleClass(e,t){return this.dom.classList.toggle(e,t),this}on(e,t,n){return this.dom.addEventListener(e,t,n),this}off(e,t,n){return this.dom.removeEventListener(e,t,n),this}add(...e){return this.dom.append(...e.map(e=>this.resolveNode(e))),this}insertAtIndex(e,...t){let n=Array.from(this.dom.children),r=Math.max(0,Math.min(e,n.length));for(let e of t){let t=n[r]??null;this.dom.insertBefore(this.resolveNode(e),t),r++}return this}setChildren(...e){return this.clear().add(...e)}setChildrenFromIndex(e,...t){let n=Array.from(this.dom.children),r=n.length,i=Math.max(0,Math.min(e,r));for(let e=i;e<r;e++)this.dom.removeChild(n[e]);let a=this.dom.children[i]??null;for(let e of t)this.dom.insertBefore(this.resolveNode(e),a);return this}clear(e,t){let n=Array.from(this.dom.children),r=Math.max(0,e??0),i=Math.min(n.length,t??n.length);for(let e=r;e<i;e++)this.dom.removeChild(n[e]);return this}contains(e){let n=e instanceof t?e.dom:e;return this.dom.contains(n)}ref(e){return e(this),this}resolveNode(e){return typeof e==`string`||typeof e==`number`?document.createTextNode(String(e)):t.isBaseDom(e)?e.dom:e}setStyleProp(e,t){return t===void 0?(this.dom.style.removeProperty(s(e)),this):(this.dom.style.setProperty(s(e),c(e,t)),this)}static isBaseDom(e){return typeof e!=`object`||!e?!1:Object.getOwnPropertySymbols(e).includes(l)}},d=class extends u{constructor(e,t){super(),this._tag=i[e]??e,this._isSvg=r.includes(this._tag),this._dom=t??(this._isSvg?document.createElementNS(`http://www.w3.org/2000/svg`,this._tag):document.createElement(this._tag))}_tag;_isSvg;_dom;get tag(){return this._tag}get isSvg(){return this._isSvg}get dom(){return this._dom}getText(){return this._dom.textContent}text(e){return this._dom.textContent=e==null?``:String(e),this}remove(){this.dom.remove()}getAttr(e){return this.dom.getAttribute(e)}attr(e,t){return t===void 0?this.dom.removeAttribute(e):this.dom.setAttribute(e,String(t)),this}attrs(e){for(let[t,n]of Object.entries(e))this.attr(t,n);return this}getProp(e){return this.dom[e]}prop(e,t){return this.dom[e]=t,this}props(e){for(let[t,n]of Object.entries(e))this.prop(t,n);return this}id(e){return this._dom.id=e??``,this}htmlFor(e){return this.tag===`label`&&(this.dom.htmlFor=e??``),this}title(e){return e===void 0?this.dom.removeAttribute(`title`):this.dom.setAttribute(`title`,e),this}disabled(e){return e?this.dom.setAttribute(`disabled`,``):this.dom.removeAttribute(`disabled`),this}disable(){return this.disabled(!0)}enable(){return this.disabled(!1)}popover(e){return e===void 0?this.dom.removeAttribute(`popover`):this.dom.setAttribute(`popover`,e),this}showPopover(){return this.dom.showPopover(),this}hidePopover(){return this.dom.hidePopover(),this}};function f(e){return new d(e)}function p(e){let t=document.querySelector(e);return new d(t.tagName.toLowerCase(),t)}var m=class extends d{constructor(){super(`a`)}href(e){return this.dom.href=e,this}};function h(){return new m}var g=class extends d{constructor(){super(`button`)}type(e){return this.dom.type=e,this}};function _(){return new g}var v=class extends d{constructor(e){super(`canvas`,e)}_size={width:this.dom.width,height:this.dom.height};getWidth(){return this.dom.width}getHeight(){return this.dom.height}width(e){return this.dom.width=e,this}height(e){return this.dom.height=e,this}setSize(e,t){return this.dom.width=e,this.dom.height=t,this}getSize(){return this._size.width=this.dom.width,this._size.height=this.dom.height,this._size}getAspect(){return this.dom.width/this.dom.height}getAspectScale(e){let t=this.dom.width/this.dom.height,n,r,i;return t>=1?(n=1/t,r=1,i=1):(n=1,r=t,i=1),e.x=n,e.y=r,e.z=i,e}};function y(){return new v}var b=class extends e{constructor(e,t,n){super(),this._sheet=e,this._index=t,this._rule=n}_sheet;_index;_rule;get sheet(){return this._sheet}get index(){return this._index}get rule(){return this._rule}get selectorText(){return this._rule.selectorText}remove(){this._sheet.removeRule(this)}extend(e){return this.sheet.cssRule(`${this.selectorText}${e}`)}hover(){return this.extend(`:hover`)}focus(){return this.extend(`:focus`)}focusWithin(){return this.extend(`:focus-within`)}active(){return this.extend(`:active`)}disabled(){return this.extend(`:disabled`)}setStyleProp(e,t){return t===void 0?(this.rule.style.removeProperty(s(e)),this):(this.rule.style.setProperty(s(e),c(e,t)),this)}},x=class extends u{get dom(){return document.body}};function S(){return new x}var C=class{on(e,t,n){return document.addEventListener(e,t,n),this}off(e,t,n){return document.removeEventListener(e,t,n),this}dispatch(e){return document.dispatchEvent(e),this}};function w(){return new C}var T=class{on(e,t,n){return window.addEventListener(e,t,n),this}off(e,t,n){return window.removeEventListener(e,t,n),this}dispatch(e){return window.dispatchEvent(e),this}};function E(){return new T}var D=class extends d{constructor(){super(`iframe`)}src(e){return this.dom.src=e,this}allowFullscreen(e=!0){return this.dom.allowFullscreen=e,this}width(e){return this.dom.width=c(`width`,e),this}height(e){return this.dom.height=c(`height`,e),this}setSize(e,t){return this.dom.width=c(`width`,e),this.dom.height=c(`height`,t),this}reload(){this.dom.src=this.dom.src}};function O(){return new D}var k=class extends d{constructor(){super(`img`)}getNaturalWidth(){return this.dom.naturalWidth??0}getNaturalHeight(){return this.dom.naturalHeight??0}src(e){return this.dom.src=e,this}width(e){return this.dom.width=e,this}height(e){return this.dom.height=e,this}setSize(e,t){return this.width(e).height(t)}alt(e){return this.dom.alt=e,this}};function A(){return new k}var j=class extends d{constructor(){super(`input`),this.dom.type=`checkbox`}name(e){return this.dom.name=e,this}checked(e){return this.prop(`checked`,e),this}isChecked(){return this.getProp(`checked`)}},M=class extends d{constructor(){super(`input`),this._dom.type=`color`}_rgb={r:1,g:1,b:1};name(e){return this._dom.name=e,this}value(e){return this._dom.value=e,this}getValue(){return this._dom.value}getRGB(){let e=this._dom.value,t=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),r=parseInt(e.slice(5,7),16);return this._rgb.r=t,this._rgb.g=n,this._rgb.b=r,this._rgb}getNormalizedRGB(){let e=this._dom.value,t=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),r=parseInt(e.slice(5,7),16);return this._rgb.r=t/255,this._rgb.g=n/255,this._rgb.b=r/255,this._rgb}},N=class extends d{constructor(){super(`input`),this.dom.type=`number`}name(e){return this.dom.name=e,this}value(e){return this.dom.value=String(e),this}getValue(){return Number(this.dom.value)}min(e){return this.dom.min=String(e),this}max(e){return this.dom.max=String(e),this}step(e){return this.dom.step=String(e),this}placeholder(e){return this.dom.placeholder=e,this}},P=class extends d{constructor(){super(`input`),this.dom.type=`range`}getValue(){return Number(this.dom.value)}getMin(){return Number(this.dom.min)}getMax(){return Number(this.dom.max)}getStep(){return Number(this.dom.step)}name(e){return this.dom.name=e,this}value(e){return this.dom.value=String(e),this}min(e){return this.dom.min=String(e),this}max(e){return this.dom.max=String(e),this}step(e){return this.dom.step=String(e),this}bounds(e,t,n){return this.min(e).max(t).step(n)}},F=class extends d{constructor(){super(`input`),this.dom.type=`text`}name(e){return this.dom.name=e,this}value(e){return this.dom.value=e,this}getValue(){return this.dom.value}placeholder(e){return this.dom.placeholder=e,this}};function I(e){switch(e){case`text`:return new F;case`number`:return new N;case`checkbox`:return new j;case`color`:return new M;case`range`:return new P}}var L=class{constructor(e,t,n){this._sheet=e,this._index=t,this._rule=n}_sheet;_index;_rule;get sheet(){return this._sheet}get index(){return this._index}get rule(){return this._rule}get length(){return this._rule.cssRules.length}get mediaText(){return this._rule.media.mediaText}cssRule(e){let t=this.length;return this.rule.insertRule(`${e}{}`,t),new b(this.sheet,t,this.rule.cssRules.item(t))}remove(){this.sheet.removeRule(this)}removeRule(e){this.rule.deleteRule(e.index)}},R=class extends d{constructor(){super(`option`)}value(e){return this.dom.value=String(e),this}getValue(){return this.dom.value}};function z(){return new R}var B=class extends d{constructor(){super(`progress`)}value(e){return this.dom.value=e,this}getValue(){return this.dom.value}max(e){return this.dom.max=e,this}getMax(){return this.dom.max}indeterminate(){return this.dom.removeAttribute(`value`),this}};function V(){return new B}var H=class extends d{constructor(){super(`select`)}name(e){return this.dom.name=e,this}value(e){return this.dom.value=String(e),this}getValue(){return this.dom.value}};function U(){return new H}var W=class e{constructor(e){this._dom=e}_dom;get dom(){return this._dom}get sheet(){return this.dom.sheet}get length(){return this.sheet.cssRules.length}cssRule(e){let t=this.length;return this.sheet.insertRule(`${e}{}`,t),new b(this,t,this.sheet.cssRules.item(t))}mediaRule(e){let t=this.length;return this.sheet.insertRule(`@media(${e}){}`,t),new L(this,t,this.sheet.cssRules.item(t))}mediaMinWidth(e){return this.mediaRule(`min-width: ${c(`min-width`,e)}`)}mediaMaxWidth(e){return this.mediaRule(`max-width: ${c(`max-width`,e)}`)}removeRule(e){this.sheet.deleteRule(e.index)}static getSheet(t=e.DEFAULT_STYLE_ID){let n=document.head.querySelector(`#${t}`);if(n==null){let n=document.createElement(`style`);return n.id=t,n.setAttribute(`type`,`text/css`),document.head.append(n),new e(n)}else return new e(n)}static DEFAULT_STYLE_ID=`__neptune-style__`};export{f as $,h as $a,S as $body,_ as $btn,y as $canvas,w as $document,O as $iframe,A as $img,I as $input,z as $option,V as $progress,p as $query,U as $select,E as $window,m as AnchorElement,u as BaseDom,e as BaseStyle,g as Button,v as Canvas,b as CssRule,x as DomBody,C as DomDocument,d as DomElement,T as DomWindow,D as IFrame,k as ImageElement,j as InputCheckbox,M as InputColor,N as InputNumber,P as InputRange,F as InputText,L as MediaRule,R as OptionElement,B as ProgressElement,r as SVG_TAGS,H as SelectElement,W as StyleSheet,i as TAG_ALIAS,t as UNITLESS_CSS_PROPS,n as VENDOR_CSS_PROPS,s as camelToKebab,c as getStyleValue,a as uniqueId};
|