@skirbi/sugar 0.0.19 → 0.0.21
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/Changes +19 -0
- package/lib/htmlelement-select.mjs +0 -1
- package/lib/htmlelement.mjs +14 -0
- package/lib/index.mjs +1 -1
- package/package.json +1 -1
package/Changes
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
Revision history for @skirbi/sugar
|
|
2
2
|
|
|
3
|
+
0.0.21 2026-05-10 02:05:46Z
|
|
4
|
+
|
|
5
|
+
* Add `$()` and `$$()` selector helpers to HTMLElementSugar.
|
|
6
|
+
Components were increasingly using repetitive
|
|
7
|
+
`querySelector()` and `querySelectorAll()` calls, especially in
|
|
8
|
+
templated custom elements.
|
|
9
|
+
|
|
10
|
+
The new helpers provide small ergonomic wrappers:
|
|
11
|
+
|
|
12
|
+
* `$()` returns the first matching descendant
|
|
13
|
+
* `$$()` returns all matching descendants as an array
|
|
14
|
+
|
|
15
|
+
This keeps component render logic significantly cleaner while
|
|
16
|
+
remaining fully standards-based internally.
|
|
17
|
+
|
|
18
|
+
0.0.20 2026-04-24 18:34:26Z
|
|
19
|
+
|
|
20
|
+
* And do not disable it
|
|
21
|
+
|
|
3
22
|
0.0.19 2026-04-24 18:31:29Z
|
|
4
23
|
|
|
5
24
|
* Fix nuking placeholder for select
|
package/lib/htmlelement.mjs
CHANGED
|
@@ -343,5 +343,19 @@ export class HTMLElementSugar extends HTMLElement {
|
|
|
343
343
|
assertQuerySelector(haystack, needle, msg) {
|
|
344
344
|
return this.constructor.assertQuerySelector(haystack, needle, msg);
|
|
345
345
|
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Query inside current component root.
|
|
349
|
+
*/
|
|
350
|
+
$(selector) {
|
|
351
|
+
return this.querySelector(selector)
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Query all inside current component root.
|
|
356
|
+
*/
|
|
357
|
+
$$(selector) {
|
|
358
|
+
return [...this.querySelectorAll(selector)]
|
|
359
|
+
}
|
|
346
360
|
}
|
|
347
361
|
|
package/lib/index.mjs
CHANGED
package/package.json
CHANGED