@skirbi/sugar 0.0.20 → 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 CHANGED
@@ -1,5 +1,20 @@
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
+
3
18
  0.0.20 2026-04-24 18:34:26Z
4
19
 
5
20
  * And do not disable it
@@ -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
@@ -2,7 +2,7 @@
2
2
  //
3
3
  // SPDX-License-Identifier: MIT
4
4
 
5
- const VERSION = "0.0.20";
5
+ const VERSION = "0.0.21";
6
6
 
7
7
  export { HTMLElementSugar } from './htmlelement.mjs';
8
8
  export { HTMLElementSugarInput } from './htmlelement-input.mjs';
package/package.json CHANGED
@@ -52,5 +52,5 @@
52
52
  },
53
53
  "sideEffects": false,
54
54
  "type": "module",
55
- "version": "0.0.20"
55
+ "version": "0.0.21"
56
56
  }