@wildwinter/app-shell 0.51.0 → 0.53.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.
@@ -1,5 +1,5 @@
1
- export { PROPERTY_TYPES, defaultControl, mountPropertyList } from './chunk-B56FWJ5Y.js';
2
- import './chunk-ELEDQRZ7.js';
1
+ export { PROPERTY_TYPES, defaultControl, mountPropertyList } from './chunk-5BKGDTYD.js';
2
+ import './chunk-XJM733E6.js';
3
3
  import './chunk-W4WC4FO5.js';
4
4
  //# sourceMappingURL=property-list.js.map
5
5
  //# sourceMappingURL=property-list.js.map
@@ -452,6 +452,23 @@ function rungStrip(opts) {
452
452
  }
453
453
  return strip;
454
454
  }
455
+ function valueHelpText(decl, value) {
456
+ const help = decl.valueHelp;
457
+ if (help === void 0) return "";
458
+ const said = (v) => Object.prototype.hasOwnProperty.call(help, v) ? help[v] : void 0;
459
+ if (decl.type === "enum" || decl.type === "quality") {
460
+ const held = typeof value === "string" && value !== "" ? value : typeof decl.default === "string" && decl.default !== "" ? decl.default : decl.type === "enum" ? decl.values?.[0] : decl.stages?.[0];
461
+ return held === void 0 ? "" : said(held) ?? "";
462
+ }
463
+ if (decl.type === "flags") {
464
+ const held = Array.isArray(value) ? value.map(String) : Array.isArray(decl.default) ? decl.default.map(String) : [];
465
+ return held.flatMap((v) => {
466
+ const h = said(v);
467
+ return h === void 0 ? [] : [`${v}: ${h}`];
468
+ }).join("\n");
469
+ }
470
+ return "";
471
+ }
455
472
  var fallbackFlags = (decl) => Array.isArray(decl.default) ? decl.default.filter((v) => typeof v === "string") : [];
456
473
  function fieldValueProblem(decl, value) {
457
474
  if (value === void 0 || value === null || value === "") return "";
@@ -492,6 +509,7 @@ function fieldRow(initial) {
492
509
  caption.id = `shell-fr-${Math.random().toString(36).slice(2, 9)}`;
493
510
  const body = el("div", "shell-fieldrow-body");
494
511
  const purpose = el("p", "shell-fieldrow-purpose");
512
+ const valueHelp = el("p", "shell-fieldrow-purpose shell-fieldrow-valuehelp");
495
513
  const problem = el("p", "shell-fieldrow-problem");
496
514
  problem.setAttribute("role", "status");
497
515
  row.append(caption, body);
@@ -512,7 +530,10 @@ function fieldRow(initial) {
512
530
  purpose.id = `${caption.id}-p`;
513
531
  problem.id = `${caption.id}-m`;
514
532
  const sayProblem = () => {
515
- const words = [typing || fieldValueProblem(opts.decl, opts.value), opts.problem ?? ""].filter((w) => w !== "");
533
+ const help = valueHelpText(opts.decl, opts.value);
534
+ valueHelp.textContent = help;
535
+ valueHelp.hidden = help === "";
536
+ const words = opts.replaceProblem !== void 0 ? [opts.replaceProblem].filter((w) => w !== "") : [typing || fieldValueProblem(opts.decl, opts.value), opts.problem ?? ""].filter((w) => w !== "");
516
537
  problem.textContent = words.join(" ");
517
538
  problem.hidden = words.length === 0;
518
539
  row.classList.toggle("has-problem", words.length > 0);
@@ -701,7 +722,7 @@ function fieldRow(initial) {
701
722
  purpose.textContent = decl.purpose ?? "";
702
723
  if (decl.purpose) body.append(purpose);
703
724
  else purpose.remove();
704
- body.append(problem);
725
+ body.append(valueHelp, problem);
705
726
  sayProblem();
706
727
  };
707
728
  draw(initial);
@@ -812,5 +833,6 @@ exports.fieldRows = fieldRows;
812
833
  exports.fieldValueProblem = fieldValueProblem;
813
834
  exports.rungStrip = rungStrip;
814
835
  exports.stageGateNote = stageGateNote;
836
+ exports.valueHelpText = valueHelpText;
815
837
  //# sourceMappingURL=value-control.cjs.map
816
838
  //# sourceMappingURL=value-control.cjs.map