@neptune3d/dom 0.0.10 → 0.0.11
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 +1411 -98
- package/dist/index.js +1 -1
- package/package.json +4 -1
package/dist/index.d.ts
CHANGED
|
@@ -291,6 +291,38 @@ type InputElementMap = {
|
|
|
291
291
|
* Includes keyword-based directions (e.g., "to right") and angle-based values (e.g., "45deg").
|
|
292
292
|
*/
|
|
293
293
|
type LinearGradientDirection = "to top" | "to top right" | "to right top" | "to right" | "to bottom right" | "to right bottom" | "to bottom" | "to bottom left" | "to left bottom" | "to left" | "to top left" | "to left top" | `${number}deg` | `${number}grad` | `${number}rad` | `${number}turn`;
|
|
294
|
+
/**
|
|
295
|
+
* Declarative type for building a Content Security Policy.
|
|
296
|
+
* Each directive maps to a space-separated string of sources or values.
|
|
297
|
+
*/
|
|
298
|
+
interface ContentSecurityPolicy {
|
|
299
|
+
"default-src"?: string;
|
|
300
|
+
"script-src"?: string;
|
|
301
|
+
"style-src"?: string;
|
|
302
|
+
"img-src"?: string;
|
|
303
|
+
"font-src"?: string;
|
|
304
|
+
"connect-src"?: string;
|
|
305
|
+
"media-src"?: string;
|
|
306
|
+
"object-src"?: string;
|
|
307
|
+
"frame-src"?: string;
|
|
308
|
+
"child-src"?: string;
|
|
309
|
+
"worker-src"?: string;
|
|
310
|
+
"manifest-src"?: string;
|
|
311
|
+
"prefetch-src"?: string;
|
|
312
|
+
"form-action"?: string;
|
|
313
|
+
"base-uri"?: string;
|
|
314
|
+
"frame-ancestors"?: string;
|
|
315
|
+
"navigate-to"?: string;
|
|
316
|
+
"require-trusted-types-for"?: string;
|
|
317
|
+
"trusted-types"?: string;
|
|
318
|
+
sandbox?: string;
|
|
319
|
+
"upgrade-insecure-requests"?: string;
|
|
320
|
+
"block-all-mixed-content"?: string;
|
|
321
|
+
"report-uri"?: string;
|
|
322
|
+
"report-to"?: string;
|
|
323
|
+
}
|
|
324
|
+
type IFrameSandboxFlag = "allow-forms" | "allow-modals" | "allow-orientation-lock" | "allow-pointer-lock" | "allow-popups" | "allow-popups-to-escape-sandbox" | "allow-presentation" | "allow-same-origin" | "allow-scripts" | "allow-storage-access-by-user-activation" | "allow-top-navigation" | "allow-top-navigation-by-user-activation";
|
|
325
|
+
type TextAreaWrapMode = "soft" | "hard" | "off";
|
|
294
326
|
//#endregion
|
|
295
327
|
//#region src/BaseStyle.d.ts
|
|
296
328
|
declare abstract class BaseStyle {
|
|
@@ -1208,6 +1240,54 @@ declare abstract class BaseStyle {
|
|
|
1208
1240
|
* @return This instance for chaining.
|
|
1209
1241
|
*/
|
|
1210
1242
|
outlineColor(value: Property.OutlineColor | undefined): this;
|
|
1243
|
+
/**
|
|
1244
|
+
* Sets the `outline-offset` style of the element.
|
|
1245
|
+
* Controls the space between the outline and the element's edge.
|
|
1246
|
+
* Accepts length units (e.g. px, em, rem) or CSS variables.
|
|
1247
|
+
* Passing `undefined` removes the outline-offset style.
|
|
1248
|
+
*
|
|
1249
|
+
* @param value - The offset distance to apply, or `undefined` to remove it.
|
|
1250
|
+
* @return This instance for chaining.
|
|
1251
|
+
*/
|
|
1252
|
+
outlineOffset(value: Property.OutlineOffset | undefined): this;
|
|
1253
|
+
/**
|
|
1254
|
+
* Sets the `line-height` of the element.
|
|
1255
|
+
* Controls vertical spacing between lines of text. Accepts unitless numbers, length units, percentages, or CSS variables.
|
|
1256
|
+
* Passing `undefined` removes the line-height style.
|
|
1257
|
+
*
|
|
1258
|
+
* @param value - The line-height to apply, or `undefined` to remove it.
|
|
1259
|
+
* @return This instance for chaining.
|
|
1260
|
+
*/
|
|
1261
|
+
lineHeight(value: Property.LineHeight | undefined): this;
|
|
1262
|
+
/**
|
|
1263
|
+
* Sets the `word-wrap` style of the element.
|
|
1264
|
+
* Controls how long words or URLs break and wrap within the container.
|
|
1265
|
+
* Accepts values like `"normal"`, `"break-word"`, or CSS variables.
|
|
1266
|
+
* Passing `undefined` removes the word-wrap style.
|
|
1267
|
+
*
|
|
1268
|
+
* @param value - The word-wrap value to apply, or `undefined` to remove it.
|
|
1269
|
+
* @return This instance for chaining.
|
|
1270
|
+
*/
|
|
1271
|
+
wordWrap(value: Property.WordWrap | undefined): this;
|
|
1272
|
+
/**
|
|
1273
|
+
* Sets the `tab-size` style of the element.
|
|
1274
|
+
* Controls the visual width of tab characters in spaces. Accepts unitless numbers or CSS variables.
|
|
1275
|
+
* Passing `undefined` removes the tab-size style.
|
|
1276
|
+
*
|
|
1277
|
+
* @param value - The tab size to apply, or `undefined` to remove it.
|
|
1278
|
+
* @return This instance for chaining.
|
|
1279
|
+
*/
|
|
1280
|
+
tabSize(value: Property.TabSize | undefined): this;
|
|
1281
|
+
/**
|
|
1282
|
+
* Sets the `resize` style of the element.
|
|
1283
|
+
* Controls whether and how the element is resizable by the user.
|
|
1284
|
+
* Accepts values like `"none"`, `"both"`, `"horizontal"`, `"vertical"`, or CSS variables.
|
|
1285
|
+
* Passing `undefined` removes the resize style.
|
|
1286
|
+
*
|
|
1287
|
+
* @param value - The resize behavior to apply, or `undefined` to remove it.
|
|
1288
|
+
* @return This instance for chaining.
|
|
1289
|
+
*/
|
|
1290
|
+
resize(value: Property.Resize | undefined): this;
|
|
1211
1291
|
/**
|
|
1212
1292
|
* Applies CSS styles to truncate overflowing text with an ellipsis.
|
|
1213
1293
|
* Ensures the text stays on a single line and hides overflow.
|
|
@@ -1283,6 +1363,136 @@ declare abstract class BaseDom<E extends HTMLElement | SVGElement> extends BaseS
|
|
|
1283
1363
|
* @return The computed style object for this element.
|
|
1284
1364
|
*/
|
|
1285
1365
|
getComputedStyle(): CSSStyleDeclaration;
|
|
1366
|
+
/**
|
|
1367
|
+
* Returns the child element at the specified index.
|
|
1368
|
+
* Uses `children`, which excludes text, comment, and other non-element nodes.
|
|
1369
|
+
* Returns `null` if the index is out of bounds.
|
|
1370
|
+
*
|
|
1371
|
+
* @param index - The zero-based index of the child element.
|
|
1372
|
+
* @return The child `Element` at the given index, or `null` if not found.
|
|
1373
|
+
*/
|
|
1374
|
+
getChildAt(index: number): Element | null;
|
|
1375
|
+
/**
|
|
1376
|
+
* Returns the child node at the specified index.
|
|
1377
|
+
* Uses `childNodes`, which includes elements, text nodes, comments, and other node types.
|
|
1378
|
+
* Returns `null` if the index is out of bounds.
|
|
1379
|
+
*
|
|
1380
|
+
* @param index - The zero-based index of the child node.
|
|
1381
|
+
* @return The child `Node` at the given index, or `null` if not found.
|
|
1382
|
+
*/
|
|
1383
|
+
getNodeAt(index: number): Node | null;
|
|
1384
|
+
/**
|
|
1385
|
+
* Returns a static array of all child elements.
|
|
1386
|
+
* Excludes text nodes, comments, and other non-element nodes.
|
|
1387
|
+
* Useful for DOM traversal, filtering, or batch operations.
|
|
1388
|
+
*
|
|
1389
|
+
* @return An array of child `Element` nodes.
|
|
1390
|
+
*/
|
|
1391
|
+
getChildren(): Element[];
|
|
1392
|
+
/**
|
|
1393
|
+
* Returns a static array of all child nodes.
|
|
1394
|
+
* Includes elements, text nodes, comments, and other node types.
|
|
1395
|
+
* Useful for low-level DOM inspection or mixed-content manipulation.
|
|
1396
|
+
*
|
|
1397
|
+
* @return An array of child `Node` instances.
|
|
1398
|
+
*/
|
|
1399
|
+
getNodes(): Node[];
|
|
1400
|
+
/**
|
|
1401
|
+
* Gets the textContent property of the DOM element.
|
|
1402
|
+
*/
|
|
1403
|
+
getText(): string;
|
|
1404
|
+
/**
|
|
1405
|
+
* Retrieves the value of a single attribute.
|
|
1406
|
+
* @param name - The attribute name to read (e.g. "aria-label", "role").
|
|
1407
|
+
* @return The attribute value as a string, or null if not present.
|
|
1408
|
+
*/
|
|
1409
|
+
getAttr(name: string): string | null;
|
|
1410
|
+
/**
|
|
1411
|
+
* Retrieves the value of a single property.
|
|
1412
|
+
* @param name - The property name to read (e.g. "value", "checked", "disabled").
|
|
1413
|
+
* @return The property value, or undefined if not present.
|
|
1414
|
+
*/
|
|
1415
|
+
getProp(name: string): any;
|
|
1416
|
+
/**
|
|
1417
|
+
* Checks whether the element has the specified CSS class.
|
|
1418
|
+
* Useful for conditional logic, toggling, or state inspection.
|
|
1419
|
+
*
|
|
1420
|
+
* @param name - The class name to check.
|
|
1421
|
+
* @return `true` if the class is present, otherwise `false`.
|
|
1422
|
+
*/
|
|
1423
|
+
hasClass(name: string): boolean;
|
|
1424
|
+
/**
|
|
1425
|
+
* Sets the `textContent` of the element using any value.
|
|
1426
|
+
* If the value is `null` or `undefined`, clears the content.
|
|
1427
|
+
* Otherwise, converts the value to a string and assigns it.
|
|
1428
|
+
* Useful for rendering dynamic values safely, including numbers, booleans, or objects.
|
|
1429
|
+
*
|
|
1430
|
+
* @param value - The value to assign as plain text, or `null`/`undefined` to clear.
|
|
1431
|
+
* @return This instance for chaining.
|
|
1432
|
+
*/
|
|
1433
|
+
text(value: any): this;
|
|
1434
|
+
/**
|
|
1435
|
+
* Sets the `innerHTML` of the element.
|
|
1436
|
+
* Replaces all existing child nodes with the provided HTML string.
|
|
1437
|
+
* Useful for injecting markup, templated content, or resetting the DOM structure.
|
|
1438
|
+
*
|
|
1439
|
+
* @param content - The HTML string to assign as the element's inner content.
|
|
1440
|
+
* @return This instance for chaining.
|
|
1441
|
+
*/
|
|
1442
|
+
html(content: string): this;
|
|
1443
|
+
/**
|
|
1444
|
+
* Sets or removes the `id` of the element.
|
|
1445
|
+
* Passing `undefined` clears the ID by setting it to an empty string.
|
|
1446
|
+
*
|
|
1447
|
+
* @param value - The element's ID, or `undefined` to remove it.
|
|
1448
|
+
* @return This DomElement instance for chaining.
|
|
1449
|
+
*/
|
|
1450
|
+
id(value: string | undefined): this;
|
|
1451
|
+
/**
|
|
1452
|
+
* Sets a single attribute on the element.
|
|
1453
|
+
* For boolean attributes (e.g. "disabled", "checked"), presence alone determines truthiness.
|
|
1454
|
+
* If `value` is `true`, the attribute is added with no value.
|
|
1455
|
+
* If `value` is `false` or `undefined`, the attribute is removed.
|
|
1456
|
+
*
|
|
1457
|
+
* @param name - The attribute name (e.g. "aria-label", "role", "disabled").
|
|
1458
|
+
* @param value - The attribute value. If `undefined` or `false`, the attribute is removed.
|
|
1459
|
+
* @return This DomElement instance for chaining.
|
|
1460
|
+
*/
|
|
1461
|
+
attr(name: string, value: string | number | boolean | undefined): this;
|
|
1462
|
+
/**
|
|
1463
|
+
* Sets multiple attributes on the element.
|
|
1464
|
+
* Delegates to `.attr()` for each key-value pair to ensure consistent handling.
|
|
1465
|
+
*
|
|
1466
|
+
* @param map - A record of attribute names and values.
|
|
1467
|
+
* @return This instance for chaining.
|
|
1468
|
+
*/
|
|
1469
|
+
attrs(map: Record<string, string | number | boolean | undefined>): this;
|
|
1470
|
+
/**
|
|
1471
|
+
* Toggles the presence of a boolean attribute on the element.
|
|
1472
|
+
* Uses the native `toggleAttribute` method for clarity and correctness.
|
|
1473
|
+
* If `force` is `true`, ensures the attribute is present.
|
|
1474
|
+
* If `force` is `false`, ensures the attribute is removed.
|
|
1475
|
+
* If `force` is omitted, toggles the current state.
|
|
1476
|
+
*
|
|
1477
|
+
* @param name - The attribute name (e.g. "disabled", "checked", "readonly").
|
|
1478
|
+
* @param force - Optional boolean to force add (`true`) or remove (`false`) the attribute.
|
|
1479
|
+
* @return This instance for chaining.
|
|
1480
|
+
*/
|
|
1481
|
+
toggleAttr(name: string, force?: boolean): this;
|
|
1482
|
+
/**
|
|
1483
|
+
* Sets a single property on the element.
|
|
1484
|
+
* @param name - The property name (e.g. "checked", "value", "disabled").
|
|
1485
|
+
* @param value - The property value. If undefined, the property is deleted.
|
|
1486
|
+
* @return This DomElement instance for chaining.
|
|
1487
|
+
*/
|
|
1488
|
+
prop(name: string, value: any): this;
|
|
1489
|
+
/**
|
|
1490
|
+
* Sets multiple properties on the element.
|
|
1491
|
+
* @param props - An object mapping property names to values.
|
|
1492
|
+
* Properties with undefined values are deleted.
|
|
1493
|
+
* @return This DomElement instance for chaining.
|
|
1494
|
+
*/
|
|
1495
|
+
props(props: Record<string, any>): this;
|
|
1286
1496
|
/**
|
|
1287
1497
|
* Sets or removes the user-defined class name and applies it alongside the internal CSS class.
|
|
1288
1498
|
* Uses `setAttribute("class", ...)` for both HTML and SVG elements.
|
|
@@ -1359,15 +1569,22 @@ declare abstract class BaseDom<E extends HTMLElement | SVGElement> extends BaseS
|
|
|
1359
1569
|
* @return This DomElement instance.
|
|
1360
1570
|
*/
|
|
1361
1571
|
setChildrenFromIndex(index: number, ...nodes: DomElementChild[]): this;
|
|
1572
|
+
/**
|
|
1573
|
+
* Removes all child nodes from the element by doing `dom.textContent = ""`.
|
|
1574
|
+
*
|
|
1575
|
+
* @return This instance for chaining.
|
|
1576
|
+
*/
|
|
1577
|
+
clear(): this;
|
|
1362
1578
|
/**
|
|
1363
1579
|
* Removes child elements within the specified index range.
|
|
1364
|
-
*
|
|
1580
|
+
* Behaves like `Array.prototype.slice(from, to)` — `from` is inclusive, `to` is exclusive.
|
|
1581
|
+
* If `from` is omitted, defaults to 0. If `to` is omitted, removes to the end.
|
|
1365
1582
|
*
|
|
1366
1583
|
* @param from - The starting index (inclusive). Defaults to 0.
|
|
1367
|
-
* @param to - The ending index (exclusive). Defaults to all children.
|
|
1368
|
-
* @
|
|
1584
|
+
* @param to - The ending index (exclusive). Defaults to all remaining children.
|
|
1585
|
+
* @return This instance for chaining.
|
|
1369
1586
|
*/
|
|
1370
|
-
|
|
1587
|
+
clearRange(from?: number, to?: number): this;
|
|
1371
1588
|
/**
|
|
1372
1589
|
* Checks whether this element contains the given target node.
|
|
1373
1590
|
* Accepts either a raw DOM node or another `BaseDom` instance.
|
|
@@ -1378,6 +1595,16 @@ declare abstract class BaseDom<E extends HTMLElement | SVGElement> extends BaseS
|
|
|
1378
1595
|
* @return `true` if this element contains the target, otherwise `false`.
|
|
1379
1596
|
*/
|
|
1380
1597
|
contains(target: Node | BaseDom<any>): boolean;
|
|
1598
|
+
/**
|
|
1599
|
+
* Queries this element's subtree for a single matching descendant and wraps it in a `DomElement`.
|
|
1600
|
+
* Returns `null` if no match is found.
|
|
1601
|
+
*
|
|
1602
|
+
* This enables fluent DOM composition and manipulation within scoped components.
|
|
1603
|
+
*
|
|
1604
|
+
* @param selector - A valid CSS selector string.
|
|
1605
|
+
* @return A `DomElement` wrapper for the matched element, or `null` if not found.
|
|
1606
|
+
*/
|
|
1607
|
+
query<T extends keyof DomElementTagNameMap>(selector: string): DomElement<T> | null;
|
|
1381
1608
|
ref(refFn: (el: this) => void): this;
|
|
1382
1609
|
protected resolveNode(child: DomElementChild): Node;
|
|
1383
1610
|
protected setStyleProp(name: Autocomplete<keyof CssProperties>, value: string | number | undefined): this;
|
|
@@ -1435,19 +1662,6 @@ declare class DomElement<Tag extends keyof DomElementTagNameMap = keyof DomEleme
|
|
|
1435
1662
|
* This will be either an `HTMLElement` or `SVGElement` depending on the tag.
|
|
1436
1663
|
*/
|
|
1437
1664
|
get dom(): DomElementTagNameMap[Tag];
|
|
1438
|
-
/**
|
|
1439
|
-
* Gets the textContent property of the DOM element.
|
|
1440
|
-
*/
|
|
1441
|
-
getText(): string;
|
|
1442
|
-
/**
|
|
1443
|
-
* Sets or clears the text content of the element.
|
|
1444
|
-
* Converts any value to a string before assignment.
|
|
1445
|
-
* Passing `undefined` or `null` removes the text by setting it to an empty string.
|
|
1446
|
-
*
|
|
1447
|
-
* @param value - The text content to set, or `undefined`/`null` to clear it.
|
|
1448
|
-
* @return This DomElement instance for chaining.
|
|
1449
|
-
*/
|
|
1450
|
-
text(value: any): this;
|
|
1451
1665
|
/**
|
|
1452
1666
|
* Removes the element from the DOM tree.
|
|
1453
1667
|
* Equivalent to calling `element.remove()` on the native DOM node.
|
|
@@ -1457,54 +1671,6 @@ declare class DomElement<Tag extends keyof DomElementTagNameMap = keyof DomEleme
|
|
|
1457
1671
|
* @return This DomElement instance for chaining.
|
|
1458
1672
|
*/
|
|
1459
1673
|
remove(): void;
|
|
1460
|
-
/**
|
|
1461
|
-
* Retrieves the value of a single attribute.
|
|
1462
|
-
* @param name - The attribute name to read (e.g. "aria-label", "role").
|
|
1463
|
-
* @return The attribute value as a string, or null if not present.
|
|
1464
|
-
*/
|
|
1465
|
-
getAttr(name: string): string | null;
|
|
1466
|
-
/**
|
|
1467
|
-
* Sets a single attribute on the element.
|
|
1468
|
-
* @param name - The attribute name (e.g. "aria-label", "role", "disabled").
|
|
1469
|
-
* @param value - The attribute value. If undefined, the attribute is removed.
|
|
1470
|
-
* @return This DomElement instance for chaining.
|
|
1471
|
-
*/
|
|
1472
|
-
attr(name: string, value: string | number | boolean | undefined): this;
|
|
1473
|
-
/**
|
|
1474
|
-
* Sets multiple attributes on the element.
|
|
1475
|
-
* @param attributes - An object mapping attribute names to values.
|
|
1476
|
-
* Attributes with undefined values are removed.
|
|
1477
|
-
* @return This DomElement instance for chaining.
|
|
1478
|
-
*/
|
|
1479
|
-
attrs(attributes: Record<string, string | number | boolean | undefined>): this;
|
|
1480
|
-
/**
|
|
1481
|
-
* Retrieves the value of a single property.
|
|
1482
|
-
* @param name - The property name to read (e.g. "value", "checked", "disabled").
|
|
1483
|
-
* @return The property value, or undefined if not present.
|
|
1484
|
-
*/
|
|
1485
|
-
getProp(name: string): any;
|
|
1486
|
-
/**
|
|
1487
|
-
* Sets a single property on the element.
|
|
1488
|
-
* @param name - The property name (e.g. "checked", "value", "disabled").
|
|
1489
|
-
* @param value - The property value. If undefined, the property is deleted.
|
|
1490
|
-
* @return This DomElement instance for chaining.
|
|
1491
|
-
*/
|
|
1492
|
-
prop(name: string, value: any): this;
|
|
1493
|
-
/**
|
|
1494
|
-
* Sets multiple properties on the element.
|
|
1495
|
-
* @param props - An object mapping property names to values.
|
|
1496
|
-
* Properties with undefined values are deleted.
|
|
1497
|
-
* @return This DomElement instance for chaining.
|
|
1498
|
-
*/
|
|
1499
|
-
props(props: Record<string, any>): this;
|
|
1500
|
-
/**
|
|
1501
|
-
* Sets or removes the `id` of the element.
|
|
1502
|
-
* Passing `undefined` clears the ID by setting it to an empty string.
|
|
1503
|
-
*
|
|
1504
|
-
* @param value - The element's ID, or `undefined` to remove it.
|
|
1505
|
-
* @return This DomElement instance for chaining.
|
|
1506
|
-
*/
|
|
1507
|
-
id(value: string | undefined): this;
|
|
1508
1674
|
/**
|
|
1509
1675
|
* Sets or removes the `htmlFor` property on a <label> element.
|
|
1510
1676
|
* This links the label to a form control by its ID.
|
|
@@ -1526,9 +1692,10 @@ declare class DomElement<Tag extends keyof DomElementTagNameMap = keyof DomEleme
|
|
|
1526
1692
|
title(value: string | undefined): this;
|
|
1527
1693
|
/**
|
|
1528
1694
|
* Sets or removes the `disabled` attribute on the element.
|
|
1529
|
-
* Applicable to form controls like
|
|
1695
|
+
* Applicable to form controls like `<button>`, `<input>`, `<select>`, etc.
|
|
1696
|
+
* Passing `true` sets the attribute; `false` removes it.
|
|
1530
1697
|
*
|
|
1531
|
-
* @param value -
|
|
1698
|
+
* @param value - Whether the element should be disabled.
|
|
1532
1699
|
* @return This DomElement instance for chaining.
|
|
1533
1700
|
*/
|
|
1534
1701
|
disabled(value: boolean): this;
|
|
@@ -1545,17 +1712,41 @@ declare class DomElement<Tag extends keyof DomElementTagNameMap = keyof DomEleme
|
|
|
1545
1712
|
enable(): this;
|
|
1546
1713
|
/**
|
|
1547
1714
|
* Sets or removes the `popover` attribute on the element.
|
|
1548
|
-
* Applies to HTML elements that support the
|
|
1715
|
+
* Applies to HTML elements that support the Popover API (e.g., `<div popover>`).
|
|
1549
1716
|
* Passing `undefined` removes the attribute.
|
|
1550
1717
|
*
|
|
1551
|
-
*
|
|
1718
|
+
* Supported values:
|
|
1552
1719
|
* - `"auto"` → Automatically shows/hides based on user interaction.
|
|
1553
1720
|
* - `"manual"` → Requires explicit show/hide via JavaScript.
|
|
1721
|
+
* - `"hint"` → Lightweight tooltip-style popover (shown on hover/focus).
|
|
1722
|
+
*
|
|
1723
|
+
* @param value - The popover mode (`"auto"`, `"manual"`, or `"hint"`), or `undefined` to remove it.
|
|
1724
|
+
* @return This DomElement instance for chaining.
|
|
1725
|
+
*/
|
|
1726
|
+
popover(value: "auto" | "manual" | "hint" | undefined): this;
|
|
1727
|
+
/**
|
|
1728
|
+
* Sets or removes the `popovertarget` attribute on the element.
|
|
1729
|
+
* This links the element to a popover by ID, allowing it to trigger or control that popover.
|
|
1730
|
+
* Passing `undefined` removes the attribute.
|
|
1731
|
+
*
|
|
1732
|
+
* @param value - The ID of the target popover element, or `undefined` to remove the attribute.
|
|
1733
|
+
* @return This DomElement instance for chaining.
|
|
1734
|
+
*/
|
|
1735
|
+
popoverTarget(value: string | undefined): this;
|
|
1736
|
+
/**
|
|
1737
|
+
* Sets or removes the `popovertargetaction` attribute on the element.
|
|
1738
|
+
* This defines the action to perform on the target popover when the element is activated.
|
|
1739
|
+
* Pass `undefined` to remove the attribute.
|
|
1740
|
+
*
|
|
1741
|
+
* Valid values:
|
|
1742
|
+
* - `"show"` → Opens the target popover.
|
|
1743
|
+
* - `"hide"` → Closes the target popover.
|
|
1744
|
+
* - `"toggle"` → Toggles the target popover.
|
|
1554
1745
|
*
|
|
1555
|
-
* @param value - The
|
|
1746
|
+
* @param value - The action to apply, or `undefined` to remove the attribute.
|
|
1556
1747
|
* @return This DomElement instance for chaining.
|
|
1557
1748
|
*/
|
|
1558
|
-
|
|
1749
|
+
popoverTargetAction(value: "show" | "hide" | "toggle" | undefined): this;
|
|
1559
1750
|
/**
|
|
1560
1751
|
* Shows the popover on this element.
|
|
1561
1752
|
* Requires the element to have a `popover="manual"` attribute and be in the DOM.
|
|
@@ -1578,12 +1769,15 @@ declare class DomElement<Tag extends keyof DomElementTagNameMap = keyof DomEleme
|
|
|
1578
1769
|
*/
|
|
1579
1770
|
declare function $<T$1 extends keyof DomElementTagNameMap>(tag: T$1): DomElement<T$1>;
|
|
1580
1771
|
/**
|
|
1581
|
-
* Queries the DOM for a matching element and wraps it in a DomElement
|
|
1772
|
+
* Queries the DOM for a matching element and wraps it in a `DomElement`.
|
|
1773
|
+
* Returns `null` if no element matches the selector.
|
|
1774
|
+
*
|
|
1775
|
+
* This enables fluent manipulation using your custom DOM API.
|
|
1776
|
+
*
|
|
1582
1777
|
* @param selector - A CSS selector string to locate the element.
|
|
1583
|
-
* @return A DomElement wrapping the matched element.
|
|
1584
|
-
* @throws If no element matches the selector, this will throw due to non-null assertion.
|
|
1778
|
+
* @return A `DomElement` wrapping the matched element, or `null` if not found.
|
|
1585
1779
|
*/
|
|
1586
|
-
declare function $query<T$1 extends keyof DomElementTagNameMap>(selector: string): DomElement<T$1
|
|
1780
|
+
declare function $query<T$1 extends keyof DomElementTagNameMap>(selector: string): DomElement<T$1> | null;
|
|
1587
1781
|
//#endregion
|
|
1588
1782
|
//#region src/AnchorElement.d.ts
|
|
1589
1783
|
declare class AnchorElement extends DomElement<"a"> {
|
|
@@ -1592,6 +1786,144 @@ declare class AnchorElement extends DomElement<"a"> {
|
|
|
1592
1786
|
}
|
|
1593
1787
|
declare function $a(): AnchorElement;
|
|
1594
1788
|
//#endregion
|
|
1789
|
+
//#region src/BaseSvgElement.d.ts
|
|
1790
|
+
/**
|
|
1791
|
+
* Base class for SVG shape elements, providing fluent setters for common SVG attributes.
|
|
1792
|
+
*
|
|
1793
|
+
* Extends `DomElement<T>` with ergonomic methods for styling (`fill`, `stroke`, `opacity`)
|
|
1794
|
+
* and geometric transforms (`translate`, `rotate`, `scale`), ensuring consistency across
|
|
1795
|
+
* all SVG element wrappers (e.g. `<path>`, `<rect>`, `<circle>`, etc.).
|
|
1796
|
+
*
|
|
1797
|
+
* Intended to be subclassed by specific SVG element wrappers like `SvgPath`, `SvgRect`, etc.
|
|
1798
|
+
*
|
|
1799
|
+
* @typeParam T - The SVG tag name (e.g. "path", "rect", "circle") this element represents.
|
|
1800
|
+
*/
|
|
1801
|
+
declare class BaseSvgElement<T$1 extends keyof SvgElementTagNameMap> extends DomElement<T$1> {
|
|
1802
|
+
/**
|
|
1803
|
+
* Sets the `fill` color.
|
|
1804
|
+
* @param color - Fill color (e.g. "red", "#ff0000", "none").
|
|
1805
|
+
* @return This instance for chaining.
|
|
1806
|
+
*/
|
|
1807
|
+
svgFill(color: string): this;
|
|
1808
|
+
/**
|
|
1809
|
+
* Sets the `fill-rule` property.
|
|
1810
|
+
* Determines how the interior of a shape is determined when paths intersect.
|
|
1811
|
+
*
|
|
1812
|
+
* @param rule - One of "nonzero" or "evenodd".
|
|
1813
|
+
* @return This instance for chaining.
|
|
1814
|
+
*/
|
|
1815
|
+
fillRule(rule: "nonzero" | "evenodd"): this;
|
|
1816
|
+
/**
|
|
1817
|
+
* Sets the `stroke` color.
|
|
1818
|
+
* @param color - Stroke color (e.g. "black", "#000", "none").
|
|
1819
|
+
* @return This instance for chaining.
|
|
1820
|
+
*/
|
|
1821
|
+
svgStroke(color: string): this;
|
|
1822
|
+
/**
|
|
1823
|
+
* Sets the `stroke-width` value.
|
|
1824
|
+
* @param width - Stroke width in pixels or units.
|
|
1825
|
+
* @return This instance for chaining.
|
|
1826
|
+
*/
|
|
1827
|
+
svgStrokeWidth(width: number | string): this;
|
|
1828
|
+
/**
|
|
1829
|
+
* Sets the `stroke-linejoin` style.
|
|
1830
|
+
* Controls how two connected segments in a stroke join.
|
|
1831
|
+
*
|
|
1832
|
+
* @param value - One of "miter", "round", or "bevel".
|
|
1833
|
+
* @return This instance for chaining.
|
|
1834
|
+
*/
|
|
1835
|
+
strokeLinejoin(value: "miter" | "round" | "bevel"): this;
|
|
1836
|
+
/**
|
|
1837
|
+
* Sets the `stroke-linecap` style.
|
|
1838
|
+
* Controls how the end of an open stroke is rendered.
|
|
1839
|
+
*
|
|
1840
|
+
* @param value - One of "butt", "round", or "square".
|
|
1841
|
+
* @return This instance for chaining.
|
|
1842
|
+
*/
|
|
1843
|
+
strokeLinecap(value: "butt" | "round" | "square"): this;
|
|
1844
|
+
/**
|
|
1845
|
+
* Sets the `stroke-miterlimit` value.
|
|
1846
|
+
* Controls the maximum allowed ratio of miter length to stroke width for miter joins.
|
|
1847
|
+
*
|
|
1848
|
+
* @param value - Miter limit (typically ≥ 1).
|
|
1849
|
+
* @return This instance for chaining.
|
|
1850
|
+
*/
|
|
1851
|
+
strokeMiterlimit(value: number): this;
|
|
1852
|
+
/**
|
|
1853
|
+
* Sets the `opacity` value.
|
|
1854
|
+
* @param value - Opacity from 0 to 1.
|
|
1855
|
+
* @return This instance for chaining.
|
|
1856
|
+
*/
|
|
1857
|
+
svgOpacity(value: number): this;
|
|
1858
|
+
/**
|
|
1859
|
+
* Sets the `transform` attribute with a raw SVG transform string.
|
|
1860
|
+
* Accepts any valid transform function: translate, rotate, scale, skewX, skewY, matrix.
|
|
1861
|
+
*
|
|
1862
|
+
* @param value - SVG transform string (e.g. "translate(10, 20) rotate(45)").
|
|
1863
|
+
* @return This instance for chaining.
|
|
1864
|
+
*/
|
|
1865
|
+
svgTransform(value: string): this;
|
|
1866
|
+
/**
|
|
1867
|
+
* Applies a `translate(x, y)` transform to the element.
|
|
1868
|
+
* Sets the `transform` attribute, replacing any existing value.
|
|
1869
|
+
*
|
|
1870
|
+
* @param x - Horizontal translation in user units.
|
|
1871
|
+
* @param y - Vertical translation in user units.
|
|
1872
|
+
* @return This instance for chaining.
|
|
1873
|
+
*/
|
|
1874
|
+
svgTranslate(x: number, y: number): this;
|
|
1875
|
+
/**
|
|
1876
|
+
* Applies a horizontal `translate(x, 0)` transform to the element.
|
|
1877
|
+
* Sets the `transform` attribute, replacing any existing value.
|
|
1878
|
+
*
|
|
1879
|
+
* @param x - Horizontal translation in user units.
|
|
1880
|
+
* @return This instance for chaining.
|
|
1881
|
+
*/
|
|
1882
|
+
svgTranslateX(x: number): this;
|
|
1883
|
+
/**
|
|
1884
|
+
* Applies a vertical `translate(0, y)` transform to the element.
|
|
1885
|
+
* Sets the `transform` attribute, replacing any existing value.
|
|
1886
|
+
*
|
|
1887
|
+
* @param y - Vertical translation in user units.
|
|
1888
|
+
* @return This instance for chaining.
|
|
1889
|
+
*/
|
|
1890
|
+
svgTranslateY(y: number): this;
|
|
1891
|
+
/**
|
|
1892
|
+
* Applies a `rotate(angle)` or `rotate(angle, cx, cy)` transform to the element.
|
|
1893
|
+
* Sets the `transform` attribute, replacing any existing value.
|
|
1894
|
+
*
|
|
1895
|
+
* @param angle - Rotation angle in degrees.
|
|
1896
|
+
* @param cx - Optional x coordinate of the rotation center.
|
|
1897
|
+
* @param cy - Optional y coordinate of the rotation center.
|
|
1898
|
+
* @return This instance for chaining.
|
|
1899
|
+
*/
|
|
1900
|
+
svgRotate(angle: number, cx?: number, cy?: number): this;
|
|
1901
|
+
/**
|
|
1902
|
+
* Applies a uniform `scale(s)` transform to the element.
|
|
1903
|
+
* Sets the `transform` attribute, replacing any existing value.
|
|
1904
|
+
*
|
|
1905
|
+
* @param s - Uniform scale factor for both x and y axes.
|
|
1906
|
+
* @return This instance for chaining.
|
|
1907
|
+
*/
|
|
1908
|
+
svgScale(s: number): this;
|
|
1909
|
+
/**
|
|
1910
|
+
* Applies a horizontal `scale(sx, 1)` transform to the element.
|
|
1911
|
+
* Sets the `transform` attribute, replacing any existing value.
|
|
1912
|
+
*
|
|
1913
|
+
* @param sx - Horizontal scale factor.
|
|
1914
|
+
* @return This instance for chaining.
|
|
1915
|
+
*/
|
|
1916
|
+
svgScaleX(sx: number): this;
|
|
1917
|
+
/**
|
|
1918
|
+
* Applies a vertical `scale(1, sy)` transform to the element.
|
|
1919
|
+
* Sets the `transform` attribute, replacing any existing value.
|
|
1920
|
+
*
|
|
1921
|
+
* @param sy - Vertical scale factor.
|
|
1922
|
+
* @return This instance for chaining.
|
|
1923
|
+
*/
|
|
1924
|
+
svgScaleY(sy: number): this;
|
|
1925
|
+
}
|
|
1926
|
+
//#endregion
|
|
1595
1927
|
//#region src/Button.d.ts
|
|
1596
1928
|
declare class Button extends DomElement<"button"> {
|
|
1597
1929
|
constructor();
|
|
@@ -1878,10 +2210,18 @@ declare class CssRule extends BaseStyle {
|
|
|
1878
2210
|
//#endregion
|
|
1879
2211
|
//#region src/DomBody.d.ts
|
|
1880
2212
|
/**
|
|
1881
|
-
* Wrapper for
|
|
1882
|
-
*
|
|
2213
|
+
* Wrapper for a `<body>` element with style and DOM composition utilities.
|
|
2214
|
+
* Accepts any `HTMLBodyElement`, including from iframes or synthetic documents.
|
|
1883
2215
|
*/
|
|
1884
2216
|
declare class DomBody extends BaseDom<HTMLBodyElement> {
|
|
2217
|
+
constructor(body: HTMLBodyElement);
|
|
2218
|
+
protected _body: HTMLBodyElement;
|
|
2219
|
+
/**
|
|
2220
|
+
* Returns the underlying `<body>` element wrapped by this `DomBody` instance.
|
|
2221
|
+
* Enables direct DOM access for interoperability with native APIs or manual manipulation.
|
|
2222
|
+
*
|
|
2223
|
+
* @return The wrapped `HTMLBodyElement`.
|
|
2224
|
+
*/
|
|
1885
2225
|
get dom(): HTMLBodyElement;
|
|
1886
2226
|
}
|
|
1887
2227
|
/**
|
|
@@ -1892,20 +2232,157 @@ declare class DomBody extends BaseDom<HTMLBodyElement> {
|
|
|
1892
2232
|
*
|
|
1893
2233
|
* @return A DomBody instance wrapping `document.body`.
|
|
1894
2234
|
*/
|
|
1895
|
-
declare function $body(): DomBody;
|
|
2235
|
+
declare function $body(body?: HTMLBodyElement): DomBody;
|
|
1896
2236
|
//#endregion
|
|
1897
|
-
//#region src/
|
|
2237
|
+
//#region src/DomHead.d.ts
|
|
1898
2238
|
/**
|
|
1899
|
-
* Wrapper for
|
|
1900
|
-
*
|
|
2239
|
+
* Wrapper for a `<head>` element with style and DOM composition utilities.
|
|
2240
|
+
* Accepts any `HTMLHeadElement`, including from iframes or synthetic documents.
|
|
1901
2241
|
*/
|
|
1902
|
-
declare class
|
|
2242
|
+
declare class DomHead extends BaseDom<HTMLHeadElement> {
|
|
2243
|
+
constructor(head: HTMLHeadElement);
|
|
2244
|
+
protected _head: HTMLHeadElement;
|
|
1903
2245
|
/**
|
|
1904
|
-
*
|
|
1905
|
-
*
|
|
1906
|
-
*
|
|
1907
|
-
* @
|
|
1908
|
-
|
|
2246
|
+
* Returns the underlying `<head>` element wrapped by this `DomHead` instance.
|
|
2247
|
+
* Enables direct DOM access for interoperability with native APIs or manual manipulation.
|
|
2248
|
+
*
|
|
2249
|
+
* @return The wrapped `HTMLHeadElement`.
|
|
2250
|
+
*/
|
|
2251
|
+
get dom(): HTMLHeadElement;
|
|
2252
|
+
/**
|
|
2253
|
+
* Sets or updates the document's `<title>` element inside the `<head>`.
|
|
2254
|
+
* Ensures only one `<title>` exists — updates if found, creates if missing.
|
|
2255
|
+
*
|
|
2256
|
+
* @param text - The title text to apply.
|
|
2257
|
+
* @return This instance for chaining.
|
|
2258
|
+
*/
|
|
2259
|
+
title(text: string): this;
|
|
2260
|
+
/**
|
|
2261
|
+
* Sets or updates the `<meta charset="...">` tag in the `<head>`.
|
|
2262
|
+
* Ensures only one charset declaration exists — updates if found, creates if missing.
|
|
2263
|
+
*
|
|
2264
|
+
* @param encoding - The character encoding to set (e.g. "UTF-8").
|
|
2265
|
+
* @return This instance for chaining.
|
|
2266
|
+
*/
|
|
2267
|
+
charset(encoding: string): this;
|
|
2268
|
+
/**
|
|
2269
|
+
* Sets or updates the `<meta name="viewport">` tag in the `<head>`.
|
|
2270
|
+
* Ensures only one viewport declaration exists — updates if found, creates if missing.
|
|
2271
|
+
*
|
|
2272
|
+
* @param content - The viewport configuration string (e.g. "width=device-width, initial-scale=1").
|
|
2273
|
+
* @return This instance for chaining.
|
|
2274
|
+
*/
|
|
2275
|
+
viewport(content: string): this;
|
|
2276
|
+
/**
|
|
2277
|
+
* Sets or updates a `<meta http-equiv="...">` tag in the `<head>`.
|
|
2278
|
+
* Ensures only one tag per `http-equiv` value exists — updates if found, creates if missing.
|
|
2279
|
+
*
|
|
2280
|
+
* Common use cases include:
|
|
2281
|
+
* - `"refresh"` → auto-refresh or redirect
|
|
2282
|
+
* - `"content-type"` → MIME type and charset
|
|
2283
|
+
* - `"X-UA-Compatible"` → browser compatibility mode
|
|
2284
|
+
*
|
|
2285
|
+
* @param httpEquiv - The `http-equiv` directive (e.g. "refresh", "content-type").
|
|
2286
|
+
* @param content - The `content` value to apply.
|
|
2287
|
+
* @return This instance for chaining.
|
|
2288
|
+
*/
|
|
2289
|
+
httpEquiv(httpEquiv: string, content: string): this;
|
|
2290
|
+
/**
|
|
2291
|
+
* Sets or updates the `<meta http-equiv="Content-Security-Policy">` tag in the `<head>`.
|
|
2292
|
+
* Accepts a structured object to declaratively build the CSP string.
|
|
2293
|
+
*
|
|
2294
|
+
* @param policy - An object mapping CSP directives to space-separated values.
|
|
2295
|
+
* @return This instance for chaining.
|
|
2296
|
+
*
|
|
2297
|
+
* @example
|
|
2298
|
+
* head.csp({
|
|
2299
|
+
* "default-src": "'self'",
|
|
2300
|
+
* "script-src": "'self' https://cdn.example.com",
|
|
2301
|
+
* "style-src": "'self' 'unsafe-inline'",
|
|
2302
|
+
* "frame-src": "https://trusted.com"
|
|
2303
|
+
* });
|
|
2304
|
+
*/
|
|
2305
|
+
csp(policy: ContentSecurityPolicy): this;
|
|
2306
|
+
/**
|
|
2307
|
+
* Sets or updates the `<meta name="description">` tag in the `<head>`.
|
|
2308
|
+
* Ensures only one description tag exists — updates if found, creates if missing.
|
|
2309
|
+
*
|
|
2310
|
+
* Commonly used for SEO and social previews.
|
|
2311
|
+
*
|
|
2312
|
+
* @param text - The description content to apply.
|
|
2313
|
+
* @return This instance for chaining.
|
|
2314
|
+
*/
|
|
2315
|
+
description(text: string): this;
|
|
2316
|
+
/**
|
|
2317
|
+
* Sets or updates the `<meta name="keywords">` tag in the `<head>`.
|
|
2318
|
+
* Ensures only one keywords tag exists — updates if found, creates if missing.
|
|
2319
|
+
*
|
|
2320
|
+
* Keywords help search engines understand page relevance, though modern SEO relies more on content and structure.
|
|
2321
|
+
*
|
|
2322
|
+
* @param text - A comma-separated list of keywords.
|
|
2323
|
+
* @return This instance for chaining.
|
|
2324
|
+
*/
|
|
2325
|
+
keywords(text: string): this;
|
|
2326
|
+
/**
|
|
2327
|
+
* Sets or updates a `<link>` tag in the `<head>` by `rel`.
|
|
2328
|
+
* Ensures only one `<link rel="...">` exists — updates if found, creates if missing.
|
|
2329
|
+
*
|
|
2330
|
+
* Common use cases include:
|
|
2331
|
+
* - `"stylesheet"` → external CSS
|
|
2332
|
+
* - `"icon"` → favicon
|
|
2333
|
+
* - `"manifest"` → web app manifest
|
|
2334
|
+
*
|
|
2335
|
+
* @param rel - The `rel` attribute (e.g. "stylesheet", "icon").
|
|
2336
|
+
* @param href - The `href` value to apply (URL or path to the resource).
|
|
2337
|
+
* @param attributes - Optional additional attributes (e.g. type, media, sizes).
|
|
2338
|
+
* @return This instance for chaining.
|
|
2339
|
+
*/
|
|
2340
|
+
link(rel: string, href: string, attributes?: Record<string, string>): this;
|
|
2341
|
+
}
|
|
2342
|
+
/**
|
|
2343
|
+
* Creates a `DomHead` wrapper for the `<head>` element.
|
|
2344
|
+
* Defaults to the main document, but accepts an optional `HTMLHeadElement`.
|
|
2345
|
+
*
|
|
2346
|
+
* @param head - Optional `<head>` element to wrap (defaults to `document.head`).
|
|
2347
|
+
* @return A `DomHead` instance for fluent head manipulation.
|
|
2348
|
+
*/
|
|
2349
|
+
declare function $head(head?: HTMLHeadElement): DomHead;
|
|
2350
|
+
//#endregion
|
|
2351
|
+
//#region src/DomDocument.d.ts
|
|
2352
|
+
/**
|
|
2353
|
+
* Wrapper for the global `document` object with typed event listener utilities.
|
|
2354
|
+
* Useful for managing document-level events like visibility changes, selection, or clipboard interactions.
|
|
2355
|
+
*/
|
|
2356
|
+
declare class DomDocument {
|
|
2357
|
+
constructor(document?: Document);
|
|
2358
|
+
protected _document: Document;
|
|
2359
|
+
/**
|
|
2360
|
+
* Returns the underlying `Document` instance wrapped by this `DomDocument`.
|
|
2361
|
+
* Useful for direct DOM access or interoperability with native APIs.
|
|
2362
|
+
*
|
|
2363
|
+
* @return The wrapped `Document` instance.
|
|
2364
|
+
*/
|
|
2365
|
+
get dom(): Document;
|
|
2366
|
+
/**
|
|
2367
|
+
* Returns a `DomBody` wrapper for the document's `<body>` element.
|
|
2368
|
+
* Enables fluent DOM composition and styling for the document body.
|
|
2369
|
+
*
|
|
2370
|
+
* @return A `DomBody` instance wrapping the document's body.
|
|
2371
|
+
*/
|
|
2372
|
+
getBody(): DomBody;
|
|
2373
|
+
/**
|
|
2374
|
+
* Returns a `DomHead` wrapper for the document's `<head>` element.
|
|
2375
|
+
* Enables fluent DOM composition and styling for the document head.
|
|
2376
|
+
*
|
|
2377
|
+
* @return A `DomHead` instance wrapping the document's head.
|
|
2378
|
+
*/
|
|
2379
|
+
getHead(): DomHead;
|
|
2380
|
+
/**
|
|
2381
|
+
* Adds an event listener to the document.
|
|
2382
|
+
* @param type - The event type (e.g., "visibilitychange", "copy", "selectionchange").
|
|
2383
|
+
* @param handler - The event handler function.
|
|
2384
|
+
* @param options - Optional event listener options.
|
|
2385
|
+
* @return This instance for chaining.
|
|
1909
2386
|
*/
|
|
1910
2387
|
on<T extends keyof DocumentEventMap>(type: T, handler: (ev: DocumentEventMap[T] & {
|
|
1911
2388
|
currentTarget: Document;
|
|
@@ -1925,6 +2402,16 @@ declare class DomDocument {
|
|
|
1925
2402
|
* @return This instance for chaining.
|
|
1926
2403
|
*/
|
|
1927
2404
|
dispatch(event: Event): this;
|
|
2405
|
+
/**
|
|
2406
|
+
* Queries the document for a single matching element and wraps it in a `DomElement`.
|
|
2407
|
+
* Returns `null` if no match is found.
|
|
2408
|
+
*
|
|
2409
|
+
* This enables fluent DOM manipulation with ergonomic chaining and type safety.
|
|
2410
|
+
*
|
|
2411
|
+
* @param selector - A valid CSS selector string.
|
|
2412
|
+
* @return A `DomElement` wrapper for the matched element, or `null` if not found.
|
|
2413
|
+
*/
|
|
2414
|
+
query<T extends keyof DomElementTagNameMap>(selector: string): DomElement<T> | null;
|
|
1928
2415
|
}
|
|
1929
2416
|
/**
|
|
1930
2417
|
* Creates a new DomDocument instance bound to the global `document` object.
|
|
@@ -1938,13 +2425,23 @@ declare function $document(): DomDocument;
|
|
|
1938
2425
|
//#endregion
|
|
1939
2426
|
//#region src/DomWindow.d.ts
|
|
1940
2427
|
/**
|
|
1941
|
-
* Wrapper for
|
|
2428
|
+
* Wrapper for a `Window` object with typed event listener utilities.
|
|
1942
2429
|
* Useful for managing global events like resize, scroll, or keyboard shortcuts.
|
|
1943
2430
|
*/
|
|
1944
2431
|
declare class DomWindow {
|
|
2432
|
+
constructor(win?: Window);
|
|
2433
|
+
protected _window: Window;
|
|
2434
|
+
/**
|
|
2435
|
+
* Returns the wrapped `Window` instance.
|
|
2436
|
+
*/
|
|
2437
|
+
get dom(): Window;
|
|
2438
|
+
/**
|
|
2439
|
+
* Returns the associated `DomDocument` for this window.
|
|
2440
|
+
*/
|
|
2441
|
+
getDocument(): DomDocument;
|
|
1945
2442
|
/**
|
|
1946
2443
|
* Adds an event listener to the window.
|
|
1947
|
-
* @param type - The event type (e.g., "
|
|
2444
|
+
* @param type - The event type (e.g., "resize", "scroll", "keydown").
|
|
1948
2445
|
* @param handler - The event handler function.
|
|
1949
2446
|
* @param options - Optional event listener options.
|
|
1950
2447
|
* @return This instance for chaining.
|
|
@@ -1957,37 +2454,228 @@ declare class DomWindow {
|
|
|
1957
2454
|
* @param type - The event type to remove.
|
|
1958
2455
|
* @param handler - The original handler function.
|
|
1959
2456
|
* @param options - Optional event listener options.
|
|
1960
|
-
* @return This
|
|
2457
|
+
* @return This instance for chaining.
|
|
1961
2458
|
*/
|
|
1962
2459
|
off<T extends keyof WindowEventMap>(type: T, handler: (ev: WindowEventMap[T]) => void, options?: boolean | EventListenerOptions): this;
|
|
1963
2460
|
/**
|
|
1964
2461
|
* Dispatches a DOM event on the window object.
|
|
1965
2462
|
*
|
|
1966
|
-
* @param event - The corresponding event instance (e.g., `new Event("resize")
|
|
2463
|
+
* @param event - The corresponding event instance (e.g., `new Event("resize")`).
|
|
1967
2464
|
* @return This instance for chaining.
|
|
1968
2465
|
*/
|
|
1969
2466
|
dispatch(event: Event): this;
|
|
2467
|
+
/**
|
|
2468
|
+
* Sends a message to the wrapped `Window` using `postMessage`.
|
|
2469
|
+
* Useful for communicating with same-origin or cross-origin windows that are listening for messages.
|
|
2470
|
+
*
|
|
2471
|
+
* ⚠️ Ensure the target window is ready to receive messages.
|
|
2472
|
+
* ⚠️ For cross-origin messaging, the receiver must explicitly validate origins.
|
|
2473
|
+
*
|
|
2474
|
+
* @param data - The message payload to send (any serializable object).
|
|
2475
|
+
* @param targetOrigin - The expected origin of the receiver (e.g. "https://example.com" or "*").
|
|
2476
|
+
* @return This instance for chaining.
|
|
2477
|
+
*/
|
|
2478
|
+
postMessage(data: any, targetOrigin: string): this;
|
|
1970
2479
|
}
|
|
1971
2480
|
/**
|
|
1972
|
-
* Creates a
|
|
1973
|
-
*
|
|
2481
|
+
* Creates a `DomWindow` instance bound to the specified `Window` object.
|
|
2482
|
+
* Defaults to the global `window`, but can wrap any window (e.g., iframe's `contentWindow`).
|
|
1974
2483
|
*
|
|
1975
2484
|
* Useful for managing global interactions like resize, scroll, keyboard shortcuts, or visibility changes.
|
|
1976
2485
|
*
|
|
1977
|
-
* @
|
|
2486
|
+
* @param win - Optional `Window` instance to wrap (defaults to global `window`).
|
|
2487
|
+
* @return A `DomWindow` instance wrapping the given window.
|
|
1978
2488
|
*/
|
|
1979
|
-
declare function $window(): DomWindow;
|
|
2489
|
+
declare function $window(win?: Window): DomWindow;
|
|
1980
2490
|
//#endregion
|
|
1981
2491
|
//#region src/IFrame.d.ts
|
|
2492
|
+
/**
|
|
2493
|
+
* Fluent wrapper for the `<iframe>` element, extending `DomElement<"iframe">` with iframe-specific APIs.
|
|
2494
|
+
* Inherits styling and DOM manipulation capabilities from `BaseStyle → BaseDom → DomElement`.
|
|
2495
|
+
*
|
|
2496
|
+
* Provides ergonomic methods for setting `src`, sizing, fullscreen permissions, and reloading.
|
|
2497
|
+
* Designed for declarative composition, chaining, and integration with dynamic layout systems.
|
|
2498
|
+
*
|
|
2499
|
+
* Example:
|
|
2500
|
+
* ```ts
|
|
2501
|
+
* $iframe()
|
|
2502
|
+
* .src("https://example.com")
|
|
2503
|
+
* .width(800)
|
|
2504
|
+
* .height(600)
|
|
2505
|
+
* .allowFullscreen();
|
|
2506
|
+
* ```
|
|
2507
|
+
*
|
|
2508
|
+
* TODO:
|
|
2509
|
+
* - Add `.postMessage()` for messaging into iframe content
|
|
2510
|
+
* - Add `.getContentWindow()` for direct access to iframe's `contentWindow`
|
|
2511
|
+
*/
|
|
1982
2512
|
declare class IFrame extends DomElement<"iframe"> {
|
|
1983
2513
|
constructor();
|
|
2514
|
+
/**
|
|
2515
|
+
* Returns a `DomWindow` wrapper for the iframe's `contentWindow`.
|
|
2516
|
+
* Enables typed event handling and DOM access within the iframe's window context.
|
|
2517
|
+
*
|
|
2518
|
+
* ⚠️ Cross-origin iframes will restrict access to most properties for security reasons.
|
|
2519
|
+
*
|
|
2520
|
+
* @return A `DomWindow` instance wrapping the iframe's window, or `null` if inaccessible.
|
|
2521
|
+
*/
|
|
2522
|
+
getContentWindow(): DomWindow | null;
|
|
2523
|
+
/**
|
|
2524
|
+
* Returns a `DomDocument` wrapper for the iframe's `contentDocument`.
|
|
2525
|
+
* This enables typed event handling and DOM utilities inside the iframe.
|
|
2526
|
+
*
|
|
2527
|
+
* ⚠️ Returns `null` if the iframe is cross-origin or not yet loaded.
|
|
2528
|
+
*
|
|
2529
|
+
* @return A `DomDocument` instance wrapping the iframe's document, or `null` if inaccessible.
|
|
2530
|
+
*/
|
|
2531
|
+
getContentDocument(): DomDocument | null;
|
|
2532
|
+
/**
|
|
2533
|
+
* Returns a `DomBody` wrapper for the iframe's inner `<body>` element.
|
|
2534
|
+
* Only works for same-origin iframes. Returns `null` if the iframe is cross-origin,
|
|
2535
|
+
* not yet loaded, or has no accessible body element.
|
|
2536
|
+
*
|
|
2537
|
+
* This enables fluent DOM composition and styling inside the iframe when available.
|
|
2538
|
+
*
|
|
2539
|
+
* @return A `DomBody` instance wrapping the iframe's body, or `null` if inaccessible.
|
|
2540
|
+
*/
|
|
2541
|
+
getBody(): DomBody | null;
|
|
2542
|
+
/**
|
|
2543
|
+
* Returns a `DomHead` wrapper for the iframe's inner `<head>` element.
|
|
2544
|
+
* Only works for same-origin iframes. Returns `null` if the iframe is cross-origin or inaccessible.
|
|
2545
|
+
*
|
|
2546
|
+
* @return A `DomHead` instance wrapping the iframe's head, or `null` if inaccessible.
|
|
2547
|
+
*/
|
|
2548
|
+
getHead(): DomHead | null;
|
|
2549
|
+
/**
|
|
2550
|
+
* Checks whether the iframe is same-origin with the parent document.
|
|
2551
|
+
* Attempts to access `contentWindow.location.href` and catches any security error.
|
|
2552
|
+
*
|
|
2553
|
+
* @return `true` if same-origin, `false` if cross-origin or inaccessible.
|
|
2554
|
+
*/
|
|
2555
|
+
isSameOrigin(): boolean;
|
|
2556
|
+
/**
|
|
2557
|
+
* Sets the `src` attribute of the `<iframe>` element.
|
|
2558
|
+
* Defines the URL to load inside the iframe. Can be same-origin or cross-origin.
|
|
2559
|
+
* This triggers a navigation and replaces the iframe's current content.
|
|
2560
|
+
*
|
|
2561
|
+
* @param value - The URL to load in the iframe.
|
|
2562
|
+
* @return This instance for chaining.
|
|
2563
|
+
*/
|
|
1984
2564
|
src(value: string): this;
|
|
2565
|
+
/**
|
|
2566
|
+
* Enables or disables the `allowFullscreen` capability on the `<iframe>`.
|
|
2567
|
+
* When `true`, allows the iframe content to request fullscreen mode via the Fullscreen API.
|
|
2568
|
+
*
|
|
2569
|
+
* @param value - Whether to allow fullscreen requests (default is `true`).
|
|
2570
|
+
* @return This instance for chaining.
|
|
2571
|
+
*/
|
|
1985
2572
|
allowFullscreen(value?: boolean): this;
|
|
2573
|
+
/**
|
|
2574
|
+
* Sets the `width` attribute of the `<iframe>` element.
|
|
2575
|
+
* Accepts a numeric value in pixels and applies it via the `width` DOM property.
|
|
2576
|
+
* Uses `getStyleValue("width", value)` to normalize units or apply custom logic.
|
|
2577
|
+
*
|
|
2578
|
+
* @param value - The desired width in pixels.
|
|
2579
|
+
* @return This instance for chaining.
|
|
2580
|
+
*/
|
|
1986
2581
|
width(value: number): this;
|
|
2582
|
+
/**
|
|
2583
|
+
* Sets the `height` attribute of the `<iframe>` element.
|
|
2584
|
+
* Accepts a numeric value in pixels and applies it via the `height` DOM property.
|
|
2585
|
+
* Uses `getStyleValue("height", value)` to normalize units or apply custom logic.
|
|
2586
|
+
*
|
|
2587
|
+
* @param value - The desired height in pixels.
|
|
2588
|
+
* @return This instance for chaining.
|
|
2589
|
+
*/
|
|
1987
2590
|
height(value: number): this;
|
|
1988
|
-
|
|
1989
|
-
|
|
2591
|
+
/**
|
|
2592
|
+
* Sets both the `width` and `height` attributes of the `<iframe>` element.
|
|
2593
|
+
* Delegates to `.width()` and `.height()` internally for unit normalization and chaining.
|
|
2594
|
+
* Useful for concise, declarative sizing of the iframe in pixels.
|
|
2595
|
+
*
|
|
2596
|
+
* @param width - The desired width in pixels.
|
|
2597
|
+
* @param height - The desired height in pixels.
|
|
2598
|
+
* @return This instance for chaining.
|
|
2599
|
+
*/
|
|
2600
|
+
size(width: number, height: number): this;
|
|
2601
|
+
/**
|
|
2602
|
+
* Sets or removes the `sandbox` attribute to restrict iframe capabilities.
|
|
2603
|
+
* Accepts an array of sandbox flags (typed) or `undefined` to remove the attribute.
|
|
2604
|
+
*
|
|
2605
|
+
* @param flags - Array of allowed sandbox flags, or `undefined` to remove the attribute.
|
|
2606
|
+
* @return This instance for chaining.
|
|
2607
|
+
*/
|
|
2608
|
+
sandbox(flags: IFrameSandboxFlag[] | undefined): this;
|
|
2609
|
+
/**
|
|
2610
|
+
* Sets the `referrerPolicy` attribute to control referrer behavior for iframe requests.
|
|
2611
|
+
* Accepts values like "no-referrer", "origin", "strict-origin", etc.
|
|
2612
|
+
*
|
|
2613
|
+
* @param value - The referrer policy to apply.
|
|
2614
|
+
* @return This instance for chaining.
|
|
2615
|
+
*/
|
|
2616
|
+
referrerPolicy(value: ReferrerPolicy): this;
|
|
2617
|
+
/**
|
|
2618
|
+
* Sets the `loading` attribute to control iframe loading behavior.
|
|
2619
|
+
* Use `"lazy"` to defer loading until the iframe is near the viewport.
|
|
2620
|
+
*
|
|
2621
|
+
* @param value - `"lazy"` or `"eager"`.
|
|
2622
|
+
* @return This instance for chaining.
|
|
2623
|
+
*/
|
|
2624
|
+
loading(value: "lazy" | "eager"): this;
|
|
2625
|
+
/**
|
|
2626
|
+
* Reloads the iframe by reassigning its `src` attribute.
|
|
2627
|
+
* Works even for cross-origin iframes, as long as `src` is set.
|
|
2628
|
+
* This is the most broadly compatible reload strategy.
|
|
2629
|
+
* @return This instance for chaining.
|
|
2630
|
+
*/
|
|
2631
|
+
reloadViaSrc(): this;
|
|
2632
|
+
/**
|
|
2633
|
+
* Reloads the iframe using its `contentWindow.location.reload()` method.
|
|
2634
|
+
* Only works for same-origin iframes. Throws a security error if cross-origin.
|
|
2635
|
+
* @return This instance for chaining.
|
|
2636
|
+
*/
|
|
2637
|
+
reloadViaLocation(): this;
|
|
2638
|
+
/**
|
|
2639
|
+
* Reloads the iframe using the most appropriate strategy:
|
|
2640
|
+
*
|
|
2641
|
+
* - Attempts `contentWindow.location.reload()` for same-origin iframes, which preserves dynamic state and scroll position.
|
|
2642
|
+
* - Falls back to reassigning `src` for cross-origin iframes or when `contentWindow` is inaccessible.
|
|
2643
|
+
*
|
|
2644
|
+
* This ensures robust behavior across both same-origin and cross-origin scenarios.
|
|
2645
|
+
*
|
|
2646
|
+
* @return This instance for chaining.
|
|
2647
|
+
*/
|
|
2648
|
+
reload(): this;
|
|
2649
|
+
/**
|
|
2650
|
+
* Queries the iframe's `contentDocument` for a matching element and wraps it in a `DomElement`.
|
|
2651
|
+
* Only works for same-origin iframes. Returns `null` if the iframe is cross-origin, inaccessible, or the element is not found.
|
|
2652
|
+
*
|
|
2653
|
+
* This enables safe DOM querying inside iframes with fluent manipulation.
|
|
2654
|
+
*
|
|
2655
|
+
* @param selector - CSS selector to query inside the iframe.
|
|
2656
|
+
* @return A `DomElement` wrapping the matched element, or `null` if not found or inaccessible.
|
|
2657
|
+
*/
|
|
2658
|
+
queryInside<T extends keyof DomElementTagNameMap>(selector: string): DomElement<T> | null;
|
|
2659
|
+
/**
|
|
2660
|
+
* Sends a message to the iframe's `contentWindow` using `postMessage`.
|
|
2661
|
+
* Only works for same-origin iframes or cross-origin targets that accept messages.
|
|
2662
|
+
*
|
|
2663
|
+
* ⚠️ Ensure the iframe is loaded and the target window is ready to receive messages.
|
|
2664
|
+
* ⚠️ For cross-origin messaging, the receiver must explicitly validate origins.
|
|
2665
|
+
*
|
|
2666
|
+
* @param data - The message payload to send (any serializable object).
|
|
2667
|
+
* @param targetOrigin - The expected origin of the receiver (e.g. "https://example.com" or "*").
|
|
2668
|
+
* @return This instance for chaining.
|
|
2669
|
+
*/
|
|
2670
|
+
postMessage(data: any, targetOrigin: string): this;
|
|
1990
2671
|
}
|
|
2672
|
+
/**
|
|
2673
|
+
* Creates a new `IFrame` instance with a wrapped `<iframe>` element.
|
|
2674
|
+
* This provides access to the fluent iframe API, including sizing, messaging, reload strategies,
|
|
2675
|
+
* and DOM interaction helpers for same-origin content.
|
|
2676
|
+
*
|
|
2677
|
+
* @return A new `IFrame` instance.
|
|
2678
|
+
*/
|
|
1991
2679
|
declare function $iframe(): IFrame;
|
|
1992
2680
|
//#endregion
|
|
1993
2681
|
//#region src/ImageElement.d.ts
|
|
@@ -2093,6 +2781,367 @@ declare class OptionElement extends DomElement<"option"> {
|
|
|
2093
2781
|
}
|
|
2094
2782
|
declare function $option(): OptionElement;
|
|
2095
2783
|
//#endregion
|
|
2784
|
+
//#region src/PathData.d.ts
|
|
2785
|
+
/**
|
|
2786
|
+
* Fluent builder for constructing the `d` attribute of an SVG `<path>` element.
|
|
2787
|
+
* Supports common path commands with type-safe chaining and automatic formatting.
|
|
2788
|
+
*
|
|
2789
|
+
* Example:
|
|
2790
|
+
* new PathData()
|
|
2791
|
+
* .moveTo(10, 10)
|
|
2792
|
+
* .lineTo(100, 100)
|
|
2793
|
+
* .close()
|
|
2794
|
+
* .toString(); // "M10 10 L100 100 Z"
|
|
2795
|
+
*/
|
|
2796
|
+
declare class PathData {
|
|
2797
|
+
protected _segments: string[];
|
|
2798
|
+
/**
|
|
2799
|
+
* Moves the current drawing position to the absolute coordinate (x, y).
|
|
2800
|
+
* Starts a new subpath without drawing a line.
|
|
2801
|
+
*
|
|
2802
|
+
* Equivalent to the SVG `M` command.
|
|
2803
|
+
*
|
|
2804
|
+
* @param x - Absolute x coordinate.
|
|
2805
|
+
* @param y - Absolute y coordinate.
|
|
2806
|
+
* @return This instance for chaining.
|
|
2807
|
+
*/
|
|
2808
|
+
moveTo(x: number, y: number): this;
|
|
2809
|
+
/**
|
|
2810
|
+
* Moves the current drawing position by a relative offset (dx, dy).
|
|
2811
|
+
* Starts a new subpath without drawing a line.
|
|
2812
|
+
*
|
|
2813
|
+
* Equivalent to the SVG `m` command.
|
|
2814
|
+
*
|
|
2815
|
+
* @param dx - Relative x offset from the current position.
|
|
2816
|
+
* @param dy - Relative y offset from the current position.
|
|
2817
|
+
* @return This instance for chaining.
|
|
2818
|
+
*/
|
|
2819
|
+
moveToRel(dx: number, dy: number): this;
|
|
2820
|
+
/**
|
|
2821
|
+
* Draws a straight line from the current position to the absolute coordinate (x, y).
|
|
2822
|
+
* Adds a visible segment to the path.
|
|
2823
|
+
*
|
|
2824
|
+
* Equivalent to the SVG `L` command.
|
|
2825
|
+
*
|
|
2826
|
+
* @param x - Absolute x coordinate of the line endpoint.
|
|
2827
|
+
* @param y - Absolute y coordinate of the line endpoint.
|
|
2828
|
+
* @return This instance for chaining.
|
|
2829
|
+
*/
|
|
2830
|
+
lineTo(x: number, y: number): this;
|
|
2831
|
+
/**
|
|
2832
|
+
* Draws a straight line from the current position by a relative offset (dx, dy).
|
|
2833
|
+
* Adds a visible segment to the path.
|
|
2834
|
+
*
|
|
2835
|
+
* Equivalent to the SVG `l` command.
|
|
2836
|
+
*
|
|
2837
|
+
* @param dx - Relative x offset from the current position.
|
|
2838
|
+
* @param dy - Relative y offset from the current position.
|
|
2839
|
+
* @return This instance for chaining.
|
|
2840
|
+
*/
|
|
2841
|
+
lineToRel(dx: number, dy: number): this;
|
|
2842
|
+
/**
|
|
2843
|
+
* Draws a horizontal line from the current position to the absolute x coordinate.
|
|
2844
|
+
* Keeps the current y position unchanged.
|
|
2845
|
+
*
|
|
2846
|
+
* Equivalent to the SVG `H` command.
|
|
2847
|
+
*
|
|
2848
|
+
* @param x - Absolute x coordinate of the line endpoint.
|
|
2849
|
+
* @return This instance for chaining.
|
|
2850
|
+
*/
|
|
2851
|
+
horizontal(x: number): this;
|
|
2852
|
+
/**
|
|
2853
|
+
* Draws a horizontal line from the current position by a relative x offset.
|
|
2854
|
+
* Keeps the current y position unchanged.
|
|
2855
|
+
*
|
|
2856
|
+
* Equivalent to the SVG `h` command.
|
|
2857
|
+
*
|
|
2858
|
+
* @param dx - Relative x offset from the current position.
|
|
2859
|
+
* @return This instance for chaining.
|
|
2860
|
+
*/
|
|
2861
|
+
horizontalRel(dx: number): this;
|
|
2862
|
+
/**
|
|
2863
|
+
* Draws a vertical line from the current position to the absolute y coordinate.
|
|
2864
|
+
* Keeps the current x position unchanged.
|
|
2865
|
+
*
|
|
2866
|
+
* Equivalent to the SVG `V` command.
|
|
2867
|
+
*
|
|
2868
|
+
* @param y - Absolute y coordinate of the line endpoint.
|
|
2869
|
+
* @return This instance for chaining.
|
|
2870
|
+
*/
|
|
2871
|
+
vertical(y: number): this;
|
|
2872
|
+
/**
|
|
2873
|
+
* Draws a vertical line from the current position by a relative y offset.
|
|
2874
|
+
* Keeps the current x position unchanged.
|
|
2875
|
+
*
|
|
2876
|
+
* Equivalent to the SVG `v` command.
|
|
2877
|
+
*
|
|
2878
|
+
* @param dy - Relative y offset from the current position.
|
|
2879
|
+
* @return This instance for chaining.
|
|
2880
|
+
*/
|
|
2881
|
+
verticalRel(dy: number): this;
|
|
2882
|
+
/**
|
|
2883
|
+
* Draws a cubic Bézier curve from the current position to the absolute coordinate (x, y),
|
|
2884
|
+
* using two control points to shape the curve.
|
|
2885
|
+
*
|
|
2886
|
+
* Equivalent to the SVG `C` command.
|
|
2887
|
+
*
|
|
2888
|
+
* @param cx1 - Absolute x coordinate of the first control point.
|
|
2889
|
+
* @param cy1 - Absolute y coordinate of the first control point.
|
|
2890
|
+
* @param cx2 - Absolute x coordinate of the second control point.
|
|
2891
|
+
* @param cy2 - Absolute y coordinate of the second control point.
|
|
2892
|
+
* @param x - Absolute x coordinate of the curve endpoint.
|
|
2893
|
+
* @param y - Absolute y coordinate of the curve endpoint.
|
|
2894
|
+
* @return This instance for chaining.
|
|
2895
|
+
*/
|
|
2896
|
+
curveTo(cx1: number, cy1: number, cx2: number, cy2: number, x: number, y: number): this;
|
|
2897
|
+
/**
|
|
2898
|
+
* Draws a cubic Bézier curve from the current position by a relative offset (dx, dy),
|
|
2899
|
+
* using two relative control points to shape the curve.
|
|
2900
|
+
*
|
|
2901
|
+
* Equivalent to the SVG `c` command.
|
|
2902
|
+
*
|
|
2903
|
+
* @param dc1x - Relative x offset of the first control point.
|
|
2904
|
+
* @param dc1y - Relative y offset of the first control point.
|
|
2905
|
+
* @param dc2x - Relative x offset of the second control point.
|
|
2906
|
+
* @param dc2y - Relative y offset of the second control point.
|
|
2907
|
+
* @param dx - Relative x offset of the curve endpoint.
|
|
2908
|
+
* @param dy - Relative y offset of the curve endpoint.
|
|
2909
|
+
* @return This instance for chaining.
|
|
2910
|
+
*/
|
|
2911
|
+
curveToRel(dc1x: number, dc1y: number, dc2x: number, dc2y: number, dx: number, dy: number): this;
|
|
2912
|
+
/**
|
|
2913
|
+
* Draws a quadratic Bézier curve from the current position to the absolute coordinate (x, y),
|
|
2914
|
+
* using a single control point to shape the curve.
|
|
2915
|
+
*
|
|
2916
|
+
* Equivalent to the SVG `Q` command.
|
|
2917
|
+
*
|
|
2918
|
+
* @param cx - Absolute x coordinate of the control point.
|
|
2919
|
+
* @param cy - Absolute y coordinate of the control point.
|
|
2920
|
+
* @param x - Absolute x coordinate of the curve endpoint.
|
|
2921
|
+
* @param y - Absolute y coordinate of the curve endpoint.
|
|
2922
|
+
* @return This instance for chaining.
|
|
2923
|
+
*/
|
|
2924
|
+
quadraticTo(cx: number, cy: number, x: number, y: number): this;
|
|
2925
|
+
/**
|
|
2926
|
+
* Draws a quadratic Bézier curve from the current position by a relative offset (dx, dy),
|
|
2927
|
+
* using a single relative control point to shape the curve.
|
|
2928
|
+
*
|
|
2929
|
+
* Equivalent to the SVG `q` command.
|
|
2930
|
+
*
|
|
2931
|
+
* @param dcx - Relative x offset of the control point.
|
|
2932
|
+
* @param dcy - Relative y offset of the control point.
|
|
2933
|
+
* @param dx - Relative x offset of the curve endpoint.
|
|
2934
|
+
* @param dy - Relative y offset of the curve endpoint.
|
|
2935
|
+
* @return This instance for chaining.
|
|
2936
|
+
*/
|
|
2937
|
+
quadraticToRel(dcx: number, dcy: number, dx: number, dy: number): this;
|
|
2938
|
+
/**
|
|
2939
|
+
* Draws an elliptical arc from the current position to the absolute coordinate (x, y),
|
|
2940
|
+
* using the specified radii, rotation, and arc/sweep flags.
|
|
2941
|
+
*
|
|
2942
|
+
* Equivalent to the SVG `A` command.
|
|
2943
|
+
*
|
|
2944
|
+
* @param rx - Horizontal radius of the ellipse.
|
|
2945
|
+
* @param ry - Vertical radius of the ellipse.
|
|
2946
|
+
* @param xAxisRotation - Rotation (in degrees) of the ellipse's x-axis relative to the coordinate system.
|
|
2947
|
+
* @param largeArc - If true, draws the larger of the two possible arcs (sweep angle ≥ 180°).
|
|
2948
|
+
* @param sweep - If true, draws the arc in a "positive-angle" (clockwise) direction.
|
|
2949
|
+
* @param x - Absolute x coordinate of the arc endpoint.
|
|
2950
|
+
* @param y - Absolute y coordinate of the arc endpoint.
|
|
2951
|
+
* @return This instance for chaining.
|
|
2952
|
+
*/
|
|
2953
|
+
arcTo(rx: number, ry: number, xAxisRotation: number, largeArc: boolean, sweep: boolean, x: number, y: number): this;
|
|
2954
|
+
/**
|
|
2955
|
+
* Draws an elliptical arc from the current position by a relative offset (dx, dy),
|
|
2956
|
+
* using the specified radii, rotation, and arc/sweep flags.
|
|
2957
|
+
*
|
|
2958
|
+
* Equivalent to the SVG `a` command.
|
|
2959
|
+
*
|
|
2960
|
+
* @param rx - Horizontal radius of the ellipse.
|
|
2961
|
+
* @param ry - Vertical radius of the ellipse.
|
|
2962
|
+
* @param xAxisRotation - Rotation (in degrees) of the ellipse's x-axis relative to the coordinate system.
|
|
2963
|
+
* @param largeArc - If true, draws the larger of the two possible arcs (sweep angle ≥ 180°).
|
|
2964
|
+
* @param sweep - If true, draws the arc in a "positive-angle" (clockwise) direction.
|
|
2965
|
+
* @param dx - Relative x offset of the arc endpoint.
|
|
2966
|
+
* @param dy - Relative y offset of the arc endpoint.
|
|
2967
|
+
* @return This instance for chaining.
|
|
2968
|
+
*/
|
|
2969
|
+
arcToRel(rx: number, ry: number, xAxisRotation: number, largeArc: boolean, sweep: boolean, dx: number, dy: number): this;
|
|
2970
|
+
/**
|
|
2971
|
+
* Closes the current subpath by drawing a straight line back to its starting point.
|
|
2972
|
+
* Ensures the shape is fully enclosed, which is important for fill operations.
|
|
2973
|
+
*
|
|
2974
|
+
* Equivalent to the SVG `Z` command.
|
|
2975
|
+
*
|
|
2976
|
+
* @return This instance for chaining.
|
|
2977
|
+
*/
|
|
2978
|
+
close(): this;
|
|
2979
|
+
/**
|
|
2980
|
+
* Adds a rectangular path starting at (x, y) with the given width and height.
|
|
2981
|
+
* Uses `moveTo`, `horizontal`, `vertical`, and `close` for fluent composition.
|
|
2982
|
+
*
|
|
2983
|
+
* @param x - Top-left x coordinate.
|
|
2984
|
+
* @param y - Top-left y coordinate.
|
|
2985
|
+
* @param width - Width of the rectangle.
|
|
2986
|
+
* @param height - Height of the rectangle.
|
|
2987
|
+
* @return This instance for chaining.
|
|
2988
|
+
*/
|
|
2989
|
+
rect(x: number, y: number, width: number, height: number): this;
|
|
2990
|
+
/**
|
|
2991
|
+
* Adds a rectangular path using relative coordinates from the current position.
|
|
2992
|
+
* Uses `moveToRel`, `horizontalRel`, `verticalRel`, and `close` for fluent composition.
|
|
2993
|
+
*
|
|
2994
|
+
* @param dx - Relative x offset from the current position.
|
|
2995
|
+
* @param dy - Relative y offset from the current position.
|
|
2996
|
+
* @param width - Width of the rectangle.
|
|
2997
|
+
* @param height - Height of the rectangle.
|
|
2998
|
+
* @return This instance for chaining.
|
|
2999
|
+
*/
|
|
3000
|
+
rectRel(dx: number, dy: number, width: number, height: number): this;
|
|
3001
|
+
/**
|
|
3002
|
+
* Adds a rounded rectangle path starting at (x, y) with the given width, height, and corner radius.
|
|
3003
|
+
* Uses `moveTo`, `arcTo`, `horizontal`, `vertical`, and `close` for fluent composition.
|
|
3004
|
+
*
|
|
3005
|
+
* @param x - Top-left x coordinate.
|
|
3006
|
+
* @param y - Top-left y coordinate.
|
|
3007
|
+
* @param width - Width of the rectangle.
|
|
3008
|
+
* @param height - Height of the rectangle.
|
|
3009
|
+
* @param r - Radius of the corners.
|
|
3010
|
+
* @return This instance for chaining.
|
|
3011
|
+
*/
|
|
3012
|
+
roundedRect(x: number, y: number, width: number, height: number, r: number): this;
|
|
3013
|
+
/**
|
|
3014
|
+
* Adds a circular path centered at (cx, cy) with radius `r`.
|
|
3015
|
+
* Uses `moveTo` and two `arcTo` commands to complete the full circle.
|
|
3016
|
+
*
|
|
3017
|
+
* This creates a clockwise circle starting at the rightmost point.
|
|
3018
|
+
*
|
|
3019
|
+
* @param cx - Center x coordinate.
|
|
3020
|
+
* @param cy - Center y coordinate.
|
|
3021
|
+
* @param r - Radius of the circle.
|
|
3022
|
+
* @return This instance for chaining.
|
|
3023
|
+
*/
|
|
3024
|
+
circle(cx: number, cy: number, r: number): this;
|
|
3025
|
+
/**
|
|
3026
|
+
* Adds a circular path using relative coordinates from the current position.
|
|
3027
|
+
* Uses `moveToRel` and two `arcToRel` commands to complete the full circle.
|
|
3028
|
+
*
|
|
3029
|
+
* Starts at (r, 0) relative to the current position.
|
|
3030
|
+
*
|
|
3031
|
+
* @param dx - Relative x offset to the circle center.
|
|
3032
|
+
* @param dy - Relative y offset to the circle center.
|
|
3033
|
+
* @param r - Radius of the circle.
|
|
3034
|
+
* @return This instance for chaining.
|
|
3035
|
+
*/
|
|
3036
|
+
circleRel(dx: number, dy: number, r: number): this;
|
|
3037
|
+
/**
|
|
3038
|
+
* Adds an elliptical path centered at (cx, cy) with radii `rx` and `ry`.
|
|
3039
|
+
* Uses `moveTo` and two `arcTo` commands to complete the full ellipse.
|
|
3040
|
+
*
|
|
3041
|
+
* Starts at the rightmost point of the ellipse and draws two arcs to complete it.
|
|
3042
|
+
*
|
|
3043
|
+
* @param cx - Center x coordinate.
|
|
3044
|
+
* @param cy - Center y coordinate.
|
|
3045
|
+
* @param rx - Horizontal radius.
|
|
3046
|
+
* @param ry - Vertical radius.
|
|
3047
|
+
* @return This instance for chaining.
|
|
3048
|
+
*/
|
|
3049
|
+
ellipse(cx: number, cy: number, rx: number, ry: number): this;
|
|
3050
|
+
/**
|
|
3051
|
+
* Adds a regular star shape centered at (cx, cy) with the given number of points and outer radius.
|
|
3052
|
+
* Uses `moveTo` and `lineTo` to connect alternating outer and inner vertices.
|
|
3053
|
+
*
|
|
3054
|
+
* @param cx - Center x coordinate.
|
|
3055
|
+
* @param cy - Center y coordinate.
|
|
3056
|
+
* @param points - Number of star points (minimum 2).
|
|
3057
|
+
* @param radius - Outer radius of the star.
|
|
3058
|
+
* @param insetRatio - Ratio of inner radius to outer radius (default: 0.5).
|
|
3059
|
+
* @return This instance for chaining.
|
|
3060
|
+
*/
|
|
3061
|
+
star(cx: number, cy: number, points: number, radius: number, insetRatio?: number): this;
|
|
3062
|
+
/**
|
|
3063
|
+
* Adds a closed polygon path using the provided list of points.
|
|
3064
|
+
* Uses `moveTo` and `lineTo` to connect each vertex, then closes the shape.
|
|
3065
|
+
*
|
|
3066
|
+
* @param points - Array of [x, y] coordinate pairs.
|
|
3067
|
+
* @return This instance for chaining.
|
|
3068
|
+
*/
|
|
3069
|
+
polygon(points: [number, number][]): this;
|
|
3070
|
+
/**
|
|
3071
|
+
* Adds an open polyline path using the provided list of points.
|
|
3072
|
+
* Uses `moveTo` and `lineTo` to connect each vertex without closing the shape.
|
|
3073
|
+
*
|
|
3074
|
+
* @param points - Array of [x, y] coordinate pairs.
|
|
3075
|
+
* @return This instance for chaining.
|
|
3076
|
+
*/
|
|
3077
|
+
polyline(points: [number, number][]): this;
|
|
3078
|
+
/**
|
|
3079
|
+
* Adds a smooth spline through the given points using cubic Bézier segments.
|
|
3080
|
+
* Uses Catmull-Rom to Bézier conversion for natural curvature.
|
|
3081
|
+
*
|
|
3082
|
+
* @param points - Array of [x, y] coordinate pairs (minimum 2).
|
|
3083
|
+
* @param tension - Controls curve tightness (default: 0.5). Lower = looser, higher = tighter.
|
|
3084
|
+
* @return This instance for chaining.
|
|
3085
|
+
*/
|
|
3086
|
+
spline(points: [number, number][], tension?: number): this;
|
|
3087
|
+
/**
|
|
3088
|
+
* Adds a path from the given list of points.
|
|
3089
|
+
* Uses `moveTo` and `lineTo` to connect each vertex, optionally closing the shape.
|
|
3090
|
+
*
|
|
3091
|
+
* @param points - Array of [x, y] coordinate pairs.
|
|
3092
|
+
* @param close - Whether to close the path (default: false).
|
|
3093
|
+
* @return This instance for chaining.
|
|
3094
|
+
*/
|
|
3095
|
+
pathFrom(points: [number, number][], close?: boolean): this;
|
|
3096
|
+
/**
|
|
3097
|
+
* Adds a path using relative point offsets from the current position.
|
|
3098
|
+
* Uses `moveToRel` and `lineToRel` to connect each vertex, optionally closing the shape.
|
|
3099
|
+
*
|
|
3100
|
+
* @param deltas - Array of [dx, dy] relative coordinate pairs.
|
|
3101
|
+
* @param close - Whether to close the path (default: false).
|
|
3102
|
+
* @return This instance for chaining.
|
|
3103
|
+
*/
|
|
3104
|
+
pathFromRel(deltas: [number, number][], close?: boolean): this;
|
|
3105
|
+
/**
|
|
3106
|
+
* Adds a sequence of cubic Bézier segments using explicit control and end points.
|
|
3107
|
+
* Each segment is defined by two control points and one endpoint.
|
|
3108
|
+
*
|
|
3109
|
+
* The first point is used as the starting position (via `moveTo`),
|
|
3110
|
+
* and each subsequent triplet defines a `curveTo` segment.
|
|
3111
|
+
*
|
|
3112
|
+
* @param points - Array of [x, y] coordinate pairs: [start, c1, c2, end, c1, c2, end, ...].
|
|
3113
|
+
* Must contain 1 + 3×N points (N ≥ 1).
|
|
3114
|
+
* @return This instance for chaining.
|
|
3115
|
+
*/
|
|
3116
|
+
polyBezier(points: [number, number][]): this;
|
|
3117
|
+
/**
|
|
3118
|
+
* Adds a sequence of quadratic Bézier segments using explicit control and end points.
|
|
3119
|
+
* Each segment is defined by one control point and one endpoint.
|
|
3120
|
+
*
|
|
3121
|
+
* The first point is used as the starting position (via `moveTo`),
|
|
3122
|
+
* and each subsequent pair defines a `quadraticTo` segment.
|
|
3123
|
+
*
|
|
3124
|
+
* @param points - Array of [x, y] coordinate pairs: [start, c1, end, c1, end, ...].
|
|
3125
|
+
* Must contain 1 + 2×N points (N ≥ 1).
|
|
3126
|
+
* @return This instance for chaining.
|
|
3127
|
+
*/
|
|
3128
|
+
polyQuadratic(points: [number, number][]): this;
|
|
3129
|
+
/**
|
|
3130
|
+
* Adds a sequence of elliptical arc segments.
|
|
3131
|
+
* Each segment is defined by radii, rotation, arc/sweep flags, and an endpoint.
|
|
3132
|
+
*
|
|
3133
|
+
* The first point is used as the starting position (via `moveTo`),
|
|
3134
|
+
* and each subsequent arc segment is defined by a tuple of:
|
|
3135
|
+
* [rx, ry, xAxisRotation, largeArc, sweep, x, y]
|
|
3136
|
+
*
|
|
3137
|
+
* @param segments - Array of arc segments: [start, arc1, arc2, ...].
|
|
3138
|
+
* Must contain 1 + N×7 points (N ≥ 1).
|
|
3139
|
+
* @return This instance for chaining.
|
|
3140
|
+
*/
|
|
3141
|
+
polyArc(segments: (number | boolean)[][]): this;
|
|
3142
|
+
toString(): string;
|
|
3143
|
+
}
|
|
3144
|
+
//#endregion
|
|
2096
3145
|
//#region src/ProgressElement.d.ts
|
|
2097
3146
|
/**
|
|
2098
3147
|
* A typed wrapper around the native <progress> HTML element, extending the DomElement base class.
|
|
@@ -2143,9 +3192,273 @@ declare class SelectElement extends DomElement<"select"> {
|
|
|
2143
3192
|
}
|
|
2144
3193
|
declare function $select(): SelectElement;
|
|
2145
3194
|
//#endregion
|
|
3195
|
+
//#region src/SvgCircle.d.ts
|
|
3196
|
+
/**
|
|
3197
|
+
* Wrapper for the `<circle>` SVG element, extending `BaseSvgElement<"circle">` with circle-specific functionality.
|
|
3198
|
+
*
|
|
3199
|
+
* Provides a fluent API for setting circle geometry via `cx`, `cy`, and `r` attributes.
|
|
3200
|
+
* Inherits common styling and transform methods from `BaseSvgElement`, enabling consistent manipulation across SVG shape elements.
|
|
3201
|
+
*
|
|
3202
|
+
* Ideal for constructing circular shapes, markers, and radial primitives with ergonomic chaining.
|
|
3203
|
+
*/
|
|
3204
|
+
declare class SvgCircle extends BaseSvgElement<"circle"> {
|
|
3205
|
+
constructor();
|
|
3206
|
+
/**
|
|
3207
|
+
* Sets the `cx` (center x) coordinate.
|
|
3208
|
+
* @param cx - Horizontal center position.
|
|
3209
|
+
* @return This instance for chaining.
|
|
3210
|
+
*/
|
|
3211
|
+
cx(cx: number): this;
|
|
3212
|
+
/**
|
|
3213
|
+
* Sets the `cy` (center y) coordinate.
|
|
3214
|
+
* @param cy - Vertical center position.
|
|
3215
|
+
* @return This instance for chaining.
|
|
3216
|
+
*/
|
|
3217
|
+
cy(cy: number): this;
|
|
3218
|
+
/**
|
|
3219
|
+
* Sets the `r` (radius) of the circle.
|
|
3220
|
+
* @param r - Radius in user units.
|
|
3221
|
+
* @return This instance for chaining.
|
|
3222
|
+
*/
|
|
3223
|
+
r(r: number): this;
|
|
3224
|
+
}
|
|
3225
|
+
/**
|
|
3226
|
+
* Creates a new SvgCircle element.
|
|
3227
|
+
*
|
|
3228
|
+
* @return A new SvgCircle instance.
|
|
3229
|
+
*/
|
|
3230
|
+
declare function $circle(): SvgCircle;
|
|
3231
|
+
//#endregion
|
|
3232
|
+
//#region src/SvgElement.d.ts
|
|
3233
|
+
/**
|
|
3234
|
+
* Wrapper for the `<svg>` root element, extending `BaseSvgElement<"svg">` with viewport and layout configuration.
|
|
3235
|
+
*
|
|
3236
|
+
* Provides a fluent API for setting width, height, viewBox, and namespace attributes.
|
|
3237
|
+
* Inherits common styling and transform methods from `BaseSvgElement`, enabling consistent manipulation across the entire SVG tree.
|
|
3238
|
+
*
|
|
3239
|
+
* Ideal for constructing standalone SVG documents or embedding scalable vector graphics in UI components.
|
|
3240
|
+
*/
|
|
3241
|
+
declare class SvgElement extends BaseSvgElement<"svg"> {
|
|
3242
|
+
constructor();
|
|
3243
|
+
/**
|
|
3244
|
+
* Sets the `width` of the SVG viewport.
|
|
3245
|
+
* @param w - Width in pixels or units.
|
|
3246
|
+
* @return This instance for chaining.
|
|
3247
|
+
*/
|
|
3248
|
+
width(w: number | string): this;
|
|
3249
|
+
/**
|
|
3250
|
+
* Sets the `height` of the SVG viewport.
|
|
3251
|
+
* @param h - Height in pixels or units.
|
|
3252
|
+
* @return This instance for chaining.
|
|
3253
|
+
*/
|
|
3254
|
+
height(h: number | string): this;
|
|
3255
|
+
/**
|
|
3256
|
+
* Sets the `viewBox` attribute for scalable layout.
|
|
3257
|
+
* @param x - Minimum x coordinate.
|
|
3258
|
+
* @param y - Minimum y coordinate.
|
|
3259
|
+
* @param w - ViewBox width.
|
|
3260
|
+
* @param h - ViewBox height.
|
|
3261
|
+
* @return This instance for chaining.
|
|
3262
|
+
*/
|
|
3263
|
+
viewBox(x: number, y: number, w: number, h: number): this;
|
|
3264
|
+
}
|
|
3265
|
+
/**
|
|
3266
|
+
* Creates a new SvgElement root.
|
|
3267
|
+
*
|
|
3268
|
+
* @return A new SvgElement instance.
|
|
3269
|
+
*/
|
|
3270
|
+
declare function $svg(): SvgElement;
|
|
3271
|
+
//#endregion
|
|
3272
|
+
//#region src/SvgGroup.d.ts
|
|
3273
|
+
/**
|
|
3274
|
+
* Wrapper for the `<g>` SVG element, extending `BaseSvgElement<"g">` with group-specific functionality.
|
|
3275
|
+
*
|
|
3276
|
+
* Provides a fluent API for grouping multiple SVG elements under a shared transform or style context.
|
|
3277
|
+
* Inherits common styling and transform methods from `BaseSvgElement`, enabling consistent manipulation across grouped shapes.
|
|
3278
|
+
*
|
|
3279
|
+
* Ideal for structuring reusable components, applying collective transforms, or organizing layered SVG content.
|
|
3280
|
+
*/
|
|
3281
|
+
declare class SvgGroup extends BaseSvgElement<"g"> {
|
|
3282
|
+
constructor();
|
|
3283
|
+
}
|
|
3284
|
+
/**
|
|
3285
|
+
* Creates a new SvgGroup element.
|
|
3286
|
+
*
|
|
3287
|
+
* @return A new SvgGroup instance.
|
|
3288
|
+
*/
|
|
3289
|
+
declare function $group(): SvgGroup;
|
|
3290
|
+
//#endregion
|
|
3291
|
+
//#region src/SvgPath.d.ts
|
|
3292
|
+
/**
|
|
3293
|
+
* Wrapper for the `<path>` SVG element, extending `BaseSvgElement<"path">` with path-specific functionality.
|
|
3294
|
+
*
|
|
3295
|
+
* Provides a fluent API for setting the `d` attribute using either raw path strings or structured `PathData` builders.
|
|
3296
|
+
* Inherits common styling and transform methods from `BaseSvgElement`, enabling consistent manipulation across SVG shape elements.
|
|
3297
|
+
*
|
|
3298
|
+
* Ideal for constructing complex vector shapes, curves, and outlines with ergonomic chaining.
|
|
3299
|
+
*/
|
|
3300
|
+
declare class SvgPath extends BaseSvgElement<"path"> {
|
|
3301
|
+
constructor();
|
|
3302
|
+
/**
|
|
3303
|
+
* Sets the `d` attribute using a raw string or PathData instance.
|
|
3304
|
+
* @param path - Path data string or builder.
|
|
3305
|
+
* @return This instance for chaining.
|
|
3306
|
+
*/
|
|
3307
|
+
d(path: string | PathData): this;
|
|
3308
|
+
}
|
|
3309
|
+
/**
|
|
3310
|
+
* Creates a new SvgPath element.
|
|
3311
|
+
*
|
|
3312
|
+
* @return A new SvgPath instance.
|
|
3313
|
+
*/
|
|
3314
|
+
declare function $path(): SvgPath;
|
|
3315
|
+
//#endregion
|
|
3316
|
+
//#region src/SvgRect.d.ts
|
|
3317
|
+
/**
|
|
3318
|
+
* Wrapper for the `<rect>` SVG element, extending `BaseSvgElement<"rect">` with rect-specific functionality.
|
|
3319
|
+
*
|
|
3320
|
+
* Provides a fluent API for setting rectangle geometry via `x`, `y`, `width`, `height`, and optional corner radii.
|
|
3321
|
+
* Inherits common styling and transform methods from `BaseSvgElement`, enabling consistent manipulation across SVG shape elements.
|
|
3322
|
+
*
|
|
3323
|
+
* Ideal for constructing positioned rectangles, UI blocks, and layout primitives with ergonomic chaining.
|
|
3324
|
+
*/
|
|
3325
|
+
declare class SvgRect extends BaseSvgElement<"rect"> {
|
|
3326
|
+
constructor();
|
|
3327
|
+
/**
|
|
3328
|
+
* Sets the `x` position of the rectangle.
|
|
3329
|
+
* @param x - Horizontal coordinate.
|
|
3330
|
+
* @return This instance for chaining.
|
|
3331
|
+
*/
|
|
3332
|
+
x(x: number): this;
|
|
3333
|
+
/**
|
|
3334
|
+
* Sets the `y` position of the rectangle.
|
|
3335
|
+
* @param y - Vertical coordinate.
|
|
3336
|
+
* @return This instance for chaining.
|
|
3337
|
+
*/
|
|
3338
|
+
y(y: number): this;
|
|
3339
|
+
/**
|
|
3340
|
+
* Sets the `width` of the rectangle.
|
|
3341
|
+
* @param w - Width in user units.
|
|
3342
|
+
* @return This instance for chaining.
|
|
3343
|
+
*/
|
|
3344
|
+
width(w: number): this;
|
|
3345
|
+
/**
|
|
3346
|
+
* Sets the `height` of the rectangle.
|
|
3347
|
+
* @param h - Height in user units.
|
|
3348
|
+
* @return This instance for chaining.
|
|
3349
|
+
*/
|
|
3350
|
+
height(h: number): this;
|
|
3351
|
+
/**
|
|
3352
|
+
* Sets the horizontal corner radius (`rx`).
|
|
3353
|
+
* @param rx - Horizontal radius.
|
|
3354
|
+
* @return This instance for chaining.
|
|
3355
|
+
*/
|
|
3356
|
+
rx(rx: number): this;
|
|
3357
|
+
/**
|
|
3358
|
+
* Sets the vertical corner radius (`ry`).
|
|
3359
|
+
* @param ry - Vertical radius.
|
|
3360
|
+
* @return This instance for chaining.
|
|
3361
|
+
*/
|
|
3362
|
+
ry(ry: number): this;
|
|
3363
|
+
}
|
|
3364
|
+
/**
|
|
3365
|
+
* Creates a new SvgRect element.
|
|
3366
|
+
*
|
|
3367
|
+
* @return A new SvgRect instance.
|
|
3368
|
+
*/
|
|
3369
|
+
declare function $rect(): SvgRect;
|
|
3370
|
+
//#endregion
|
|
3371
|
+
//#region src/TextArea.d.ts
|
|
3372
|
+
/**
|
|
3373
|
+
* Fluent wrapper for the native `<textarea>` element.
|
|
3374
|
+
* Provides ergonomic access to common attributes like `name`, `value`, `placeholder`, `rows`, `cols`, and `wrap`.
|
|
3375
|
+
* Enables type-safe, chainable configuration for form inputs, comment boxes, and multi-line editors.
|
|
3376
|
+
*
|
|
3377
|
+
* This class extends `DomElement<"textarea">`, preserving full DOM access while offering a declarative API.
|
|
3378
|
+
* Ideal for dynamic UI composition, form scaffolding, and reusable component abstractions.
|
|
3379
|
+
*/
|
|
3380
|
+
declare class TextArea extends DomElement<"textarea"> {
|
|
3381
|
+
constructor();
|
|
3382
|
+
/**
|
|
3383
|
+
* Sets the `name` attribute of the element.
|
|
3384
|
+
* Useful for form serialization and identifying the field in submissions.
|
|
3385
|
+
*
|
|
3386
|
+
* @param value - The name to assign to the element.
|
|
3387
|
+
* @return This instance for chaining.
|
|
3388
|
+
*/
|
|
3389
|
+
name(value: string): this;
|
|
3390
|
+
/**
|
|
3391
|
+
* Sets the current value of the element.
|
|
3392
|
+
* Applies to `<input>` and `<textarea>` elements.
|
|
3393
|
+
*
|
|
3394
|
+
* @param value - The string value to assign.
|
|
3395
|
+
* @return This instance for chaining.
|
|
3396
|
+
*/
|
|
3397
|
+
value(value: string): this;
|
|
3398
|
+
/**
|
|
3399
|
+
* Retrieves the current value of the element.
|
|
3400
|
+
* Useful for reading user input or programmatic state.
|
|
3401
|
+
*
|
|
3402
|
+
* @return The string value of the element.
|
|
3403
|
+
*/
|
|
3404
|
+
getValue(): string;
|
|
3405
|
+
/**
|
|
3406
|
+
* Sets the `placeholder` text shown when the element is empty.
|
|
3407
|
+
* Useful for guiding user input with contextual hints or expected formatting.
|
|
3408
|
+
*
|
|
3409
|
+
* Applies to `<input>` and `<textarea>` elements.
|
|
3410
|
+
*
|
|
3411
|
+
* @param value - The placeholder string to display.
|
|
3412
|
+
* @return This instance for chaining.
|
|
3413
|
+
*/
|
|
3414
|
+
placeholder(value: string): this;
|
|
3415
|
+
/**
|
|
3416
|
+
* Sets the number of visible text rows in the `<textarea>`.
|
|
3417
|
+
* Useful for controlling vertical size and layout in forms or editors.
|
|
3418
|
+
*
|
|
3419
|
+
* @param count - The number of rows to display.
|
|
3420
|
+
* @return This instance for chaining.
|
|
3421
|
+
*/
|
|
3422
|
+
rows(count: number): this;
|
|
3423
|
+
/**
|
|
3424
|
+
* Sets the number of visible character columns in the `<textarea>`.
|
|
3425
|
+
* Useful for controlling horizontal size and layout in forms or editors.
|
|
3426
|
+
*
|
|
3427
|
+
* @param count - The number of columns to display.
|
|
3428
|
+
* @return This instance for chaining.
|
|
3429
|
+
*/
|
|
3430
|
+
cols(count: number): this;
|
|
3431
|
+
/**
|
|
3432
|
+
* Sets the `wrap` behavior for text input in the `<textarea>`.
|
|
3433
|
+
* Controls how text is wrapped when submitted or displayed.
|
|
3434
|
+
*
|
|
3435
|
+
* - `"soft"`: No automatic line breaks; text wraps visually but not in form submission.
|
|
3436
|
+
* - `"hard"`: Text wraps and includes line breaks in submitted value.
|
|
3437
|
+
* - `"off"`: Disables wrapping entirely (non-standard but supported in some browsers).
|
|
3438
|
+
*
|
|
3439
|
+
* @param mode - The desired wrap mode.
|
|
3440
|
+
* @return This instance for chaining.
|
|
3441
|
+
*/
|
|
3442
|
+
wrap(mode: TextAreaWrapMode): this;
|
|
3443
|
+
/**
|
|
3444
|
+
* Sets the maximum number of characters allowed in the `<textarea>`.
|
|
3445
|
+
* Useful for input validation, limiting user responses, or enforcing content constraints.
|
|
3446
|
+
*
|
|
3447
|
+
* @param limit - The maximum number of characters allowed.
|
|
3448
|
+
* @return This instance for chaining.
|
|
3449
|
+
*/
|
|
3450
|
+
maxLength(limit: number): this;
|
|
3451
|
+
}
|
|
3452
|
+
/**
|
|
3453
|
+
* Creates a new TextArea element.
|
|
3454
|
+
*
|
|
3455
|
+
* @return A new TextArea instance.
|
|
3456
|
+
*/
|
|
3457
|
+
declare function $textarea(): TextArea;
|
|
3458
|
+
//#endregion
|
|
2146
3459
|
//#region src/utils.d.ts
|
|
2147
3460
|
declare function uniqueId(): string;
|
|
2148
3461
|
declare function camelToKebab(prop: string): string;
|
|
2149
3462
|
declare function getStyleValue(name: Autocomplete<keyof CssProperties>, value: string | number): string;
|
|
2150
3463
|
//#endregion
|
|
2151
|
-
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, LinearGradientDirection, MediaRule, OptionElement, ProgressElement, SVG_TAGS, SelectElement, StyleSheet, TAG_ALIAS, TagAlias, UNITLESS_CSS_PROPS, VENDOR_CSS_PROPS, camelToKebab, getStyleValue, uniqueId };
|
|
3464
|
+
export { $, $a, $body, $btn, $canvas, $circle, $document, $group, $head, $iframe, $img, $input, $option, $path, $progress, $query, $rect, $select, $svg, $textarea, $window, AnchorElement, Autocomplete, BaseDom, BaseStyle, BaseSvgElement, Button, Canvas, ContentSecurityPolicy, CssProperties, type CssProperty, CssRule, DomBody, DomDocument, DomElement, DomElementChild, DomElementEventMap, DomElementTagNameMap, DomHead, DomWindow, IFrame, IFrameSandboxFlag, ImageElement, InputCheckbox, InputColor, InputElementMap, InputNumber, InputRange, InputText, LinearGradientDirection, MediaRule, OptionElement, PathData, ProgressElement, SVG_TAGS, SelectElement, StyleSheet, SvgCircle, SvgElement, SvgElementTagNameMap, SvgGroup, SvgPath, SvgRect, TAG_ALIAS, TagAlias, TextArea, TextAreaWrapMode, UNITLESS_CSS_PROPS, VENDOR_CSS_PROPS, camelToKebab, getStyleValue, uniqueId };
|