@skirbi/sugar 0.0.20 → 0.0.22
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 +12 -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.22 2026-05-28 03:45:56Z
|
|
4
|
+
|
|
5
|
+
* Fix htmlelementsugar-select for using native options
|
|
6
|
+
|
|
7
|
+
0.0.21 2026-05-10 02:05:46Z
|
|
8
|
+
|
|
9
|
+
* Add `$()` and `$$()` selector helpers to HTMLElementSugar.
|
|
10
|
+
Components were increasingly using repetitive
|
|
11
|
+
`querySelector()` and `querySelectorAll()` calls, especially in
|
|
12
|
+
templated custom elements.
|
|
13
|
+
|
|
14
|
+
The new helpers provide small ergonomic wrappers:
|
|
15
|
+
|
|
16
|
+
* `$()` returns the first matching descendant
|
|
17
|
+
* `$$()` returns all matching descendants as an array
|
|
18
|
+
|
|
19
|
+
This keeps component render logic significantly cleaner while
|
|
20
|
+
remaining fully standards-based internally.
|
|
21
|
+
|
|
3
22
|
0.0.20 2026-04-24 18:34:26Z
|
|
4
23
|
|
|
5
24
|
* And do not disable it
|
|
@@ -115,9 +115,20 @@ export class HTMLElementSugarSelect extends HTMLElementSugarInput {
|
|
|
115
115
|
if (hasStatic) {
|
|
116
116
|
this._setOptionsFromOptions(select, rawOptions, cfg);
|
|
117
117
|
if (searchEl) this._setupLocalSearch(select, searchEl);
|
|
118
|
-
}
|
|
118
|
+
}
|
|
119
|
+
else if (hasEndpoint) {
|
|
119
120
|
this._setupRemote(select, searchEl, cfg);
|
|
120
121
|
}
|
|
122
|
+
else {
|
|
123
|
+
const authoredOptions = Array.from(this.children)
|
|
124
|
+
.filter((node) => node.matches?.('option,optgroup'));
|
|
125
|
+
|
|
126
|
+
for (const option of authoredOptions) {
|
|
127
|
+
select.appendChild(option);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
|
|
121
132
|
|
|
122
133
|
// Apply initial value after options exist.
|
|
123
134
|
if (cfg.value != null && cfg.value !== '') select.value = String(cfg.value);
|
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