jj 2.5.0 → 2.7.2
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 +29 -2
- package/SKILL.md +667 -0
- package/lib/bundle.cjs +2031 -0
- package/lib/bundle.cjs.map +1 -0
- package/lib/bundle.d.cts +1782 -0
- package/lib/bundle.d.ts +1782 -1
- package/lib/bundle.global.js +1953 -0
- package/lib/bundle.global.js.map +1 -0
- package/lib/bundle.js +232 -230
- package/lib/bundle.js.map +1 -7
- package/lib/bundle.min.cjs +2 -0
- package/lib/bundle.min.cjs.map +1 -0
- package/lib/bundle.min.d.cts +1782 -0
- package/lib/bundle.min.d.ts +1782 -1
- package/lib/bundle.min.global.js +2 -0
- package/lib/bundle.min.global.js.map +1 -0
- package/lib/bundle.min.js +2 -1
- package/lib/bundle.min.js.map +1 -0
- package/package.json +8 -17
- package/lib/JJD.d.ts +0 -87
- package/lib/JJD.js +0 -119
- package/lib/JJD.js.map +0 -1
- package/lib/JJDF.d.ts +0 -74
- package/lib/JJDF.js +0 -98
- package/lib/JJDF.js.map +0 -1
- package/lib/JJE.d.ts +0 -299
- package/lib/JJE.js +0 -401
- package/lib/JJE.js.map +0 -1
- package/lib/JJET.d.ts +0 -79
- package/lib/JJET.js +0 -114
- package/lib/JJET.js.map +0 -1
- package/lib/JJEx.d.ts +0 -63
- package/lib/JJEx.js +0 -83
- package/lib/JJEx.js.map +0 -1
- package/lib/JJHE.d.ts +0 -109
- package/lib/JJHE.js +0 -136
- package/lib/JJHE.js.map +0 -1
- package/lib/JJN-wrap.d.ts +0 -1
- package/lib/JJN-wrap.js +0 -46
- package/lib/JJN-wrap.js.map +0 -1
- package/lib/JJN.d.ts +0 -126
- package/lib/JJN.js +0 -166
- package/lib/JJN.js.map +0 -1
- package/lib/JJNx.d.ts +0 -126
- package/lib/JJNx.js +0 -157
- package/lib/JJNx.js.map +0 -1
- package/lib/JJSE.d.ts +0 -170
- package/lib/JJSE.js +0 -217
- package/lib/JJSE.js.map +0 -1
- package/lib/JJSR.d.ts +0 -71
- package/lib/JJSR.js +0 -90
- package/lib/JJSR.js.map +0 -1
- package/lib/JJT.d.ts +0 -92
- package/lib/JJT.js +0 -116
- package/lib/JJT.js.map +0 -1
- package/lib/case.d.ts +0 -60
- package/lib/case.js +0 -92
- package/lib/case.js.map +0 -1
- package/lib/components.d.ts +0 -147
- package/lib/components.js +0 -287
- package/lib/components.js.map +0 -1
- package/lib/helpers.d.ts +0 -159
- package/lib/helpers.js +0 -233
- package/lib/helpers.js.map +0 -1
- package/lib/index.d.ts +0 -33
- package/lib/index.js +0 -35
- package/lib/index.js.map +0 -1
- package/lib/internal.d.ts +0 -30
- package/lib/internal.js +0 -35
- package/lib/internal.js.map +0 -1
- package/lib/types.d.ts +0 -65
- package/lib/types.js +0 -2
- package/lib/types.js.map +0 -1
- package/lib/util.d.ts +0 -68
- package/lib/util.js +0 -90
- package/lib/util.js.map +0 -1
- package/llms.txt +0 -214
package/lib/JJDF.d.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { Wrapped } from './types.js';
|
|
2
|
-
import { JJNx } from './JJNx.js';
|
|
3
|
-
/**
|
|
4
|
-
* Wraps a DocumentFragment (which is a descendant of Node).
|
|
5
|
-
*
|
|
6
|
-
* @remarks
|
|
7
|
-
* DocumentFragments are lightweight versions of Document that store a segment of a document structure
|
|
8
|
-
* comprised of nodes just like a standard document. The key difference is that because the document fragment
|
|
9
|
-
* isn't part of the active document tree structure, changes made to the fragment don't affect the document,
|
|
10
|
-
* cause reflow, or incur any performance impact that can occur when changes are made.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* const frag = JJDF.create()
|
|
15
|
-
* frag.append(
|
|
16
|
-
* h('div', null, 'Item 1'),
|
|
17
|
-
* h('div', null, 'Item 2'),
|
|
18
|
-
* )
|
|
19
|
-
* document.body.appendChild(frag.ref)
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment | DocumentFragment}
|
|
23
|
-
*/
|
|
24
|
-
export declare class JJDF<T extends DocumentFragment = DocumentFragment> extends JJNx<T> {
|
|
25
|
-
/**
|
|
26
|
-
* Creates a JJDF instance from a DocumentFragment reference.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```ts
|
|
30
|
-
* const frag = JJDF.from(myFrag)
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* @param ref - The DocumentFragment instance.
|
|
35
|
-
* @returns A new JJDF instance.
|
|
36
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment | DocumentFragment}
|
|
37
|
-
*/
|
|
38
|
-
static from(ref: DocumentFragment): JJDF;
|
|
39
|
-
/**
|
|
40
|
-
* Creates a new empty JJDF instance (wraps a new DocumentFragment).
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* ```ts
|
|
44
|
-
* const frag = JJDF.create()
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* @returns A new JJDF instance.
|
|
48
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/createDocumentFragment | document.createDocumentFragment}
|
|
49
|
-
*/
|
|
50
|
-
static create(): JJDF<DocumentFragment>;
|
|
51
|
-
/**
|
|
52
|
-
* Creates an instance of JJDF.
|
|
53
|
-
*
|
|
54
|
-
* @param ref - The DocumentFragment instance to wrap.
|
|
55
|
-
* @throws {TypeError} If `ref` is not a DocumentFragment.
|
|
56
|
-
*/
|
|
57
|
-
constructor(ref: T);
|
|
58
|
-
/**
|
|
59
|
-
* Finds an element by ID within this DocumentFragment.
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* ```ts
|
|
63
|
-
* const el = frag.byId('header') // Returns null if not found
|
|
64
|
-
* const el = frag.byId('header', true) // Throws if not found
|
|
65
|
-
* ```
|
|
66
|
-
*
|
|
67
|
-
* @param id - The ID to search for.
|
|
68
|
-
* @param required - Whether to throw an error if not found. Defaults to false.
|
|
69
|
-
* @returns The wrapped element, or null if not found and required is false.
|
|
70
|
-
* @throws {TypeError} If id is not a string or element not found and required is true.
|
|
71
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/getElementById | DocumentFragment.getElementById}
|
|
72
|
-
*/
|
|
73
|
-
byId(id: string, required?: boolean): Wrapped | null;
|
|
74
|
-
}
|
package/lib/JJDF.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { isA, isStr } from 'jty';
|
|
2
|
-
import { JJN } from './JJN.js';
|
|
3
|
-
import { JJNx } from './JJNx.js';
|
|
4
|
-
import { typeErr } from './internal.js';
|
|
5
|
-
/**
|
|
6
|
-
* Wraps a DocumentFragment (which is a descendant of Node).
|
|
7
|
-
*
|
|
8
|
-
* @remarks
|
|
9
|
-
* DocumentFragments are lightweight versions of Document that store a segment of a document structure
|
|
10
|
-
* comprised of nodes just like a standard document. The key difference is that because the document fragment
|
|
11
|
-
* isn't part of the active document tree structure, changes made to the fragment don't affect the document,
|
|
12
|
-
* cause reflow, or incur any performance impact that can occur when changes are made.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```ts
|
|
16
|
-
* const frag = JJDF.create()
|
|
17
|
-
* frag.append(
|
|
18
|
-
* h('div', null, 'Item 1'),
|
|
19
|
-
* h('div', null, 'Item 2'),
|
|
20
|
-
* )
|
|
21
|
-
* document.body.appendChild(frag.ref)
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment | DocumentFragment}
|
|
25
|
-
*/
|
|
26
|
-
export class JJDF extends JJNx {
|
|
27
|
-
/**
|
|
28
|
-
* Creates a JJDF instance from a DocumentFragment reference.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```ts
|
|
32
|
-
* const frag = JJDF.from(myFrag)
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* @param ref - The DocumentFragment instance.
|
|
37
|
-
* @returns A new JJDF instance.
|
|
38
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment | DocumentFragment}
|
|
39
|
-
*/
|
|
40
|
-
static from(ref) {
|
|
41
|
-
return new JJDF(ref);
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Creates a new empty JJDF instance (wraps a new DocumentFragment).
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```ts
|
|
48
|
-
* const frag = JJDF.create()
|
|
49
|
-
* ```
|
|
50
|
-
*
|
|
51
|
-
* @returns A new JJDF instance.
|
|
52
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/createDocumentFragment | document.createDocumentFragment}
|
|
53
|
-
*/
|
|
54
|
-
static create() {
|
|
55
|
-
return new JJDF(document.createDocumentFragment());
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Creates an instance of JJDF.
|
|
59
|
-
*
|
|
60
|
-
* @param ref - The DocumentFragment instance to wrap.
|
|
61
|
-
* @throws {TypeError} If `ref` is not a DocumentFragment.
|
|
62
|
-
*/
|
|
63
|
-
constructor(ref) {
|
|
64
|
-
if (!isA(ref, DocumentFragment)) {
|
|
65
|
-
throw new TypeError(`Expected a DocumentFragment. Got ${ref} (${typeof ref})`);
|
|
66
|
-
}
|
|
67
|
-
super(ref);
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Finds an element by ID within this DocumentFragment.
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
73
|
-
* ```ts
|
|
74
|
-
* const el = frag.byId('header') // Returns null if not found
|
|
75
|
-
* const el = frag.byId('header', true) // Throws if not found
|
|
76
|
-
* ```
|
|
77
|
-
*
|
|
78
|
-
* @param id - The ID to search for.
|
|
79
|
-
* @param required - Whether to throw an error if not found. Defaults to false.
|
|
80
|
-
* @returns The wrapped element, or null if not found and required is false.
|
|
81
|
-
* @throws {TypeError} If id is not a string or element not found and required is true.
|
|
82
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/getElementById | DocumentFragment.getElementById}
|
|
83
|
-
*/
|
|
84
|
-
byId(id, required = false) {
|
|
85
|
-
if (!isStr(id)) {
|
|
86
|
-
throw typeErr('id', 'a string', id);
|
|
87
|
-
}
|
|
88
|
-
const el = this.ref.getElementById(id);
|
|
89
|
-
if (el) {
|
|
90
|
-
return JJN.wrap(el);
|
|
91
|
-
}
|
|
92
|
-
if (required) {
|
|
93
|
-
throw new TypeError(`Element with id ${id} not found`);
|
|
94
|
-
}
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
//# sourceMappingURL=JJDF.js.map
|
package/lib/JJDF.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JJDF.js","sourceRoot":"","sources":["../src/JJDF.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,KAAK,CAAA;AAChC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAE9B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,IAAoD,SAAQ,IAAO;IAC5E;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,IAAI,CAAC,GAAqB;QAC7B,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,CAAA;IACxB,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAC,MAAM;QACT,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,sBAAsB,EAAE,CAAC,CAAA;IACtD,CAAC;IAED;;;;;OAKG;IACH,YAAY,GAAM;QACd,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,gBAAgB,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,SAAS,CAAC,oCAAoC,GAAG,KAAK,OAAO,GAAG,GAAG,CAAC,CAAA;QAClF,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,CAAA;IACd,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,IAAI,CAAC,EAAU,EAAE,QAAQ,GAAG,KAAK;QAC7B,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;YACb,MAAM,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,CAAC,CAAA;QACvC,CAAC;QACD,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC,CAAA;QACtC,IAAI,EAAE,EAAE,CAAC;YACL,OAAO,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QACvB,CAAC;QACD,IAAI,QAAQ,EAAE,CAAC;YACX,MAAM,IAAI,SAAS,CAAC,mBAAmB,EAAE,YAAY,CAAC,CAAA;QAC1D,CAAC;QACD,OAAO,IAAI,CAAA;IACf,CAAC;CACJ"}
|
package/lib/JJE.d.ts
DELETED
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
import { JJSR } from './JJSR.js';
|
|
2
|
-
import { ShadowConfig } from './types.js';
|
|
3
|
-
import { JJNx } from './JJNx.js';
|
|
4
|
-
/**
|
|
5
|
-
* Wraps a DOM Element (which is a descendant of Node).
|
|
6
|
-
*
|
|
7
|
-
* @remarks
|
|
8
|
-
* This class provides a wrapper around the native `Element` interface, adding fluent API methods
|
|
9
|
-
* for attribute manipulation, class handling, and event binding.
|
|
10
|
-
*
|
|
11
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element | Element}
|
|
12
|
-
*/
|
|
13
|
-
export declare class JJE<T extends Element = Element> extends JJNx<T> {
|
|
14
|
-
/**
|
|
15
|
-
* Creates a JJE instance from an Element reference.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```ts
|
|
19
|
-
* const el = JJE.from(document.querySelector('.my-class'))
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* @param ref - The Element instance.
|
|
23
|
-
* @returns A new JJE instance.
|
|
24
|
-
*/
|
|
25
|
-
static from(ref: Element): JJE;
|
|
26
|
-
/**
|
|
27
|
-
* Creates an instance of JJE.
|
|
28
|
-
*
|
|
29
|
-
* @param ref - The Element to wrap.
|
|
30
|
-
* @throws {TypeError} If `ref` is not an Element.
|
|
31
|
-
*/
|
|
32
|
-
constructor(ref: T);
|
|
33
|
-
/**
|
|
34
|
-
* Gets the value of an attribute.
|
|
35
|
-
*
|
|
36
|
-
* @param name - The name of the attribute.
|
|
37
|
-
* @returns The attribute value, or null if not present.
|
|
38
|
-
* @throws {TypeError} If `name` is not a string.
|
|
39
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute | Element.getAttribute}
|
|
40
|
-
*/
|
|
41
|
-
getAttr(name: string): string | null;
|
|
42
|
-
/**
|
|
43
|
-
* Checks if an attribute exists.
|
|
44
|
-
*
|
|
45
|
-
* @param name - The name of the attribute.
|
|
46
|
-
* @returns `true` if the attribute exists, otherwise `false`.
|
|
47
|
-
* @throws {TypeError} If `name` is not a string.
|
|
48
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute | Element.hasAttribute}
|
|
49
|
-
*/
|
|
50
|
-
hasAttr(name: string): boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Sets one or more attributes on the Element.
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* ```ts
|
|
56
|
-
* el.setAttr('id', 'my-id') // Single attribute
|
|
57
|
-
* el.setAttr({ id: 'my-id', class: 'my-class' }) // Multiple attributes
|
|
58
|
-
* el.setAttr('x', 50) // Numbers are automatically converted
|
|
59
|
-
* ```
|
|
60
|
-
*
|
|
61
|
-
* @throws {TypeError} If arguments are invalid types.
|
|
62
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute | Element.setAttribute}
|
|
63
|
-
*/
|
|
64
|
-
setAttr(name: string, value: any): this;
|
|
65
|
-
setAttr(obj: Record<string, any>): this;
|
|
66
|
-
/**
|
|
67
|
-
* Removes one or more attributes from the Element.
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* ```ts
|
|
71
|
-
* el.rmAttr('disabled') // Remove single
|
|
72
|
-
* el.rmAttr('hidden', 'aria-hidden') // Remove multiple
|
|
73
|
-
* ```
|
|
74
|
-
*
|
|
75
|
-
* @param names - The name(s) of the attribute(s) to remove.
|
|
76
|
-
* @returns This instance for chaining.
|
|
77
|
-
* @throws {TypeError} If any name is not a string.
|
|
78
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute | Element.removeAttribute}
|
|
79
|
-
*/
|
|
80
|
-
rmAttr(...names: string[]): this;
|
|
81
|
-
/**
|
|
82
|
-
* Gets the value of an ARIA attribute.
|
|
83
|
-
*
|
|
84
|
-
* @remarks
|
|
85
|
-
* Automatically prepends `aria-` to the name.
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* ```ts
|
|
89
|
-
* el.getAria('label') // gets 'aria-label'
|
|
90
|
-
* ```
|
|
91
|
-
*
|
|
92
|
-
* @param name - The ARIA attribute suffix (e.g., 'label' for 'aria-label').
|
|
93
|
-
* @returns The attribute value, or null if not present.
|
|
94
|
-
* @throws {TypeError} If `name` is not a string.
|
|
95
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes | ARIA Attributes}
|
|
96
|
-
*/
|
|
97
|
-
getAria(name: string): string | null;
|
|
98
|
-
/**
|
|
99
|
-
* Checks if an ARIA attribute exists.
|
|
100
|
-
*
|
|
101
|
-
* @param name - The ARIA attribute suffix.
|
|
102
|
-
* @returns `true` if the attribute exists.
|
|
103
|
-
* @throws {TypeError} If `name` is not a string.
|
|
104
|
-
*/
|
|
105
|
-
hasAria(name: string): boolean;
|
|
106
|
-
/**
|
|
107
|
-
* Sets one or more ARIA attributes on the Element.
|
|
108
|
-
*
|
|
109
|
-
* @example
|
|
110
|
-
* ```ts
|
|
111
|
-
* el.setAria('hidden', 'true') // Single: sets aria-hidden="true"
|
|
112
|
-
* el.setAria({ label: 'Close', hidden: 'false' }) // Multiple
|
|
113
|
-
* el.setAria('level', 2) // Numbers are automatically converted
|
|
114
|
-
* ```
|
|
115
|
-
*
|
|
116
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes | ARIA Attributes}
|
|
117
|
-
*/
|
|
118
|
-
setAria(name: string, value: any): this;
|
|
119
|
-
setAria(obj: Record<string, any>): this;
|
|
120
|
-
/**
|
|
121
|
-
* Removes one or more ARIA attributes from the Element.
|
|
122
|
-
*
|
|
123
|
-
* @example
|
|
124
|
-
* ```ts
|
|
125
|
-
* el.rmAria('hidden') // Remove single
|
|
126
|
-
* el.rmAria('label', 'hidden') // Remove multiple
|
|
127
|
-
* ```
|
|
128
|
-
*
|
|
129
|
-
* @param names - The ARIA attribute suffix(es) to remove.
|
|
130
|
-
* @returns This instance for chaining.
|
|
131
|
-
* @throws {TypeError} If any name is not a string.
|
|
132
|
-
*/
|
|
133
|
-
rmAria(...names: string[]): this;
|
|
134
|
-
/**
|
|
135
|
-
* Gets the class attribute.
|
|
136
|
-
*
|
|
137
|
-
* @returns The class attribute value, or null if not present.
|
|
138
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/className | Element.className}
|
|
139
|
-
*/
|
|
140
|
-
getClass(): string | null;
|
|
141
|
-
/**
|
|
142
|
-
* Sets the class attribute or conditionally adds/removes classes.
|
|
143
|
-
*
|
|
144
|
-
* @remarks
|
|
145
|
-
* - Pass a string to replace the entire class attribute
|
|
146
|
-
* - Pass an object with class names as keys and boolean values to conditionally add/remove classes
|
|
147
|
-
* - To remove all classes, pass an empty string: `setClass('')`
|
|
148
|
-
*
|
|
149
|
-
* @example
|
|
150
|
-
* ```ts
|
|
151
|
-
* el.setClass('btn btn-primary') // Set classes as string
|
|
152
|
-
* el.setClass({ // Conditional classes (Vue.js style)
|
|
153
|
-
* 'active': true, // adds 'active'
|
|
154
|
-
* 'disabled': false, // removes 'disabled'
|
|
155
|
-
* 'highlight': isHighlighted // adds/removes based on condition
|
|
156
|
-
* })
|
|
157
|
-
* ```
|
|
158
|
-
*
|
|
159
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/className | Element.className}
|
|
160
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/classList | Element.classList}
|
|
161
|
-
*/
|
|
162
|
-
setClass(className: string): this;
|
|
163
|
-
setClass(classMap: Record<string, boolean | unknown>): this;
|
|
164
|
-
/**
|
|
165
|
-
* Adds one or more classes to the Element.
|
|
166
|
-
*
|
|
167
|
-
* @example
|
|
168
|
-
* ```ts
|
|
169
|
-
* el.addClass('btn', 'btn-primary')
|
|
170
|
-
* ```
|
|
171
|
-
*
|
|
172
|
-
* @param classNames - The classes to add.
|
|
173
|
-
* @returns This instance for chaining.
|
|
174
|
-
* @throws {TypeError} If any class name is not a string.
|
|
175
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/classList | Element.classList}
|
|
176
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/add | DOMTokenList.add}
|
|
177
|
-
*/
|
|
178
|
-
addClass(...classNames: string[]): this;
|
|
179
|
-
/**
|
|
180
|
-
* Removes one or more classes from the Element.
|
|
181
|
-
*
|
|
182
|
-
* @example
|
|
183
|
-
* ```ts
|
|
184
|
-
* el.rmClass('active') // Remove single
|
|
185
|
-
* el.rmClass('btn', 'btn-primary') // Remove multiple
|
|
186
|
-
* ```
|
|
187
|
-
*
|
|
188
|
-
* @param classNames - The classes to remove.
|
|
189
|
-
* @returns This instance for chaining.
|
|
190
|
-
* @throws {TypeError} If any class name is not a string.
|
|
191
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/classList | Element.classList}
|
|
192
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/remove | DOMTokenList.remove}
|
|
193
|
-
*/
|
|
194
|
-
rmClass(...classNames: string[]): this;
|
|
195
|
-
/**
|
|
196
|
-
* Checks if the Element has a specific class.
|
|
197
|
-
*
|
|
198
|
-
* @param className - The class to check for.
|
|
199
|
-
* @returns `true` if the element has the class.
|
|
200
|
-
* @throws {TypeError} If `className` is not a string.
|
|
201
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/classList | Element.classList}
|
|
202
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/contains | DOMTokenList.contains}
|
|
203
|
-
*/
|
|
204
|
-
hasClass(className: string): boolean;
|
|
205
|
-
/**
|
|
206
|
-
* Toggles a class on the Element.
|
|
207
|
-
*
|
|
208
|
-
* @param className - The class to toggle.
|
|
209
|
-
* @returns This instance for chaining.
|
|
210
|
-
* @throws {TypeError} If `className` is not a string.
|
|
211
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/classList | Element.classList}
|
|
212
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/toggle | DOMTokenList.toggle}
|
|
213
|
-
*/
|
|
214
|
-
toggleClass(className: string): this;
|
|
215
|
-
/**
|
|
216
|
-
* Replaces a class with another one
|
|
217
|
-
*
|
|
218
|
-
* @remarks
|
|
219
|
-
* If the `oldClassName` doesn't exist, the `newClassName` isn't added
|
|
220
|
-
*
|
|
221
|
-
* @param oldClassName - The class name to remove
|
|
222
|
-
* @param newClassName - The class name to add
|
|
223
|
-
* @throws {TypeError} If either className is not a string.
|
|
224
|
-
*/
|
|
225
|
-
replaceClass(oldClassName: string, newClassName: string): this;
|
|
226
|
-
/**
|
|
227
|
-
|
|
228
|
-
* Hides the Element by setting the `hidden` attribute and `aria-hidden="true"`.
|
|
229
|
-
*
|
|
230
|
-
* @returns This instance for chaining.
|
|
231
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden | hidden attribute}
|
|
232
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-hidden | aria-hidden}
|
|
233
|
-
*/
|
|
234
|
-
hide(): this;
|
|
235
|
-
/**
|
|
236
|
-
* Shows the Element by removing the `hidden` and `aria-hidden` attributes.
|
|
237
|
-
*
|
|
238
|
-
* @returns This instance for chaining.
|
|
239
|
-
*/
|
|
240
|
-
show(): this;
|
|
241
|
-
/**
|
|
242
|
-
* Disables the Element by setting the `disabled` attribute and `aria-disabled="true"`.
|
|
243
|
-
*
|
|
244
|
-
* @returns This instance for chaining.
|
|
245
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled | disabled attribute}
|
|
246
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-disabled | aria-disabled}
|
|
247
|
-
*/
|
|
248
|
-
disable(): this;
|
|
249
|
-
/**
|
|
250
|
-
* Enables the Element by removing the `disabled` and `aria-disabled` attributes.
|
|
251
|
-
*
|
|
252
|
-
* @returns This instance for chaining.
|
|
253
|
-
*/
|
|
254
|
-
enable(): this;
|
|
255
|
-
/**
|
|
256
|
-
* Gets the inner HTML of the Element.
|
|
257
|
-
*
|
|
258
|
-
* @remarks
|
|
259
|
-
* This method operates on `innerHTML`. The method name is kept short for convenience.
|
|
260
|
-
*
|
|
261
|
-
* @returns The inner HTML string.
|
|
262
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML | Element.innerHTML}
|
|
263
|
-
*/
|
|
264
|
-
getHTML(): string;
|
|
265
|
-
/**
|
|
266
|
-
* Sets the inner HTML of the Element.
|
|
267
|
-
*
|
|
268
|
-
* @remarks
|
|
269
|
-
* This method operates on `innerHTML`. The method name is kept short for convenience.
|
|
270
|
-
* Pass an empty string, `null`, or `undefined` to clear the content.
|
|
271
|
-
*
|
|
272
|
-
* @param html - The HTML string to set, or null/undefined to clear.
|
|
273
|
-
* @returns This instance for chaining.
|
|
274
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML | Element.innerHTML}
|
|
275
|
-
*/
|
|
276
|
-
setHTML(html?: string | null): this;
|
|
277
|
-
/**
|
|
278
|
-
* Attaches a Shadow DOM to the Element and optionally sets its content and styles.
|
|
279
|
-
*
|
|
280
|
-
* @remarks
|
|
281
|
-
* We prevent FOUC by assigning the template and CSS in one go.
|
|
282
|
-
* **Note:** You can't attach a shadow root to every type of element. There are some that can't have a
|
|
283
|
-
* shadow DOM for security reasons (for example `<a>`).
|
|
284
|
-
*
|
|
285
|
-
* @param mode - The encapsulation mode ('open' or 'closed'). Defaults to 'open'.
|
|
286
|
-
* @param config - Optional configuration object containing `template` (HTML string) and `styles` (array of CSSStyleSheet).
|
|
287
|
-
* @returns This instance for chaining.
|
|
288
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/attachShadow | Element.attachShadow}
|
|
289
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/adoptedStyleSheets | ShadowRoot.adoptedStyleSheets}
|
|
290
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/adoptedStyleSheets | Document.adoptedStyleSheets}
|
|
291
|
-
*/
|
|
292
|
-
initShadow(mode?: ShadowRootMode, config?: ShadowConfig): this;
|
|
293
|
-
/**
|
|
294
|
-
* Gets a wrapper around the Element's Shadow Root, if it exists.
|
|
295
|
-
*
|
|
296
|
-
* @returns A JJSR instance wrapping the shadow root, or null if no shadow root exists.
|
|
297
|
-
*/
|
|
298
|
-
get shadow(): JJSR<ShadowRoot> | null;
|
|
299
|
-
}
|