@wildwinter/app-shell 0.31.0 → 0.32.0

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.cjs CHANGED
@@ -180,8 +180,13 @@ function iconBtn(glyph, title, onClick, disabled = false, danger = false) {
180
180
  return b;
181
181
  }
182
182
  function labelled(label2, control) {
183
- const w = el("label", "shell-labelled");
183
+ const target = control.matches("input, select, textarea") ? control : control.querySelector("input:not([type=button]):not([type=submit]), select, textarea");
184
+ const w = el(target ? "label" : "div", "shell-labelled");
184
185
  w.append(el("span", "shell-fieldcap", label2), control);
186
+ if (target) {
187
+ if (!target.id) target.id = `shell-f-${Math.random().toString(36).slice(2, 9)}`;
188
+ w.htmlFor = target.id;
189
+ }
185
190
  return w;
186
191
  }
187
192
  function moveItem(arr, i, delta) {
@@ -988,8 +993,11 @@ function bindPropertyRef(input, onCommit, opts) {
988
993
  const list = document.createElement("datalist");
989
994
  list.id = `shell-propref-${Math.random().toString(36).slice(2, 9)}`;
990
995
  input.setAttribute("list", list.id);
991
- input.after(list);
996
+ const attach = () => {
997
+ if (!list.isConnected && input.parentNode) input.after(list);
998
+ };
992
999
  const sync = () => {
1000
+ attach();
993
1001
  const known = opts.known();
994
1002
  list.replaceChildren(...known.map((k) => {
995
1003
  const o = document.createElement("option");