@wildwinter/app-shell 0.37.0 → 0.38.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/README.md CHANGED
@@ -118,6 +118,19 @@ needing and never had.
118
118
  toast(`Save refused: ${err}`, "error");
119
119
  ```
120
120
 
121
+ - **`revealRow`** - land on one row of a settings list. `expandableRow` takes a
122
+ `name` and stamps it on the row; `revealRow(within, name)` opens that row's
123
+ details, brings it to the middle of its scroller and lights it for a moment.
124
+ "Go to definition" in both apps opened the page a property is declared on and
125
+ stopped there, with the row off screen. It returns false when no row carries
126
+ the name, so a host whose page fills in late asks again on a later frame.
127
+ Brings nothing new: the light is in `settings.css`.
128
+
129
+ ```ts
130
+ list.append(expandableRow({ line, details, name: decl.name }));
131
+ revealRow(document, "mood");
132
+ ```
133
+
121
134
  - **`--ok`** joins `--danger` and `--warn` in `tokens.css`, with a `light-dark()`
122
135
  default every palette should override in its own `theme.css`. It is the only
123
136
  colour in the grammar layer, and it is there because it kept not being
package/dist/index.cjs CHANGED
@@ -486,6 +486,7 @@ var PANE_MENU = {
486
486
  // src/settings.ts
487
487
  function expandableRow(opts) {
488
488
  const row = el("div", "set-row");
489
+ if (opts.name !== void 0) row.dataset.name = opts.name;
489
490
  const line = el("div", "set-rowline");
490
491
  if (opts.details && opts.details.length) {
491
492
  const details = el("div", "set-details");
@@ -511,6 +512,19 @@ function expandableRow(opts) {
511
512
  }
512
513
  return row;
513
514
  }
515
+ function revealRow(within, name) {
516
+ const row = [...within.querySelectorAll(".set-row")].find((r) => r.dataset.name === name);
517
+ if (!row) return false;
518
+ const toggle = row.querySelector(".set-rowline > .set-expand");
519
+ if (toggle && toggle.getAttribute("aria-expanded") !== "true") toggle.click();
520
+ const still = typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
521
+ row.scrollIntoView({ block: "center", behavior: still ? "auto" : "smooth" });
522
+ row.classList.remove("landed");
523
+ void row.offsetWidth;
524
+ row.classList.add("landed");
525
+ row.addEventListener("animationend", () => row.classList.remove("landed"), { once: true });
526
+ return true;
527
+ }
514
528
  function focusNewRow(listEl) {
515
529
  const last = listEl?.lastElementChild;
516
530
  if (!(last instanceof HTMLElement)) return;
@@ -1862,6 +1876,7 @@ exports.propertyNameify = propertyNameify;
1862
1876
  exports.propertyRefProblem = propertyRefProblem;
1863
1877
  exports.renderStepperBar = renderStepperBar;
1864
1878
  exports.revalidatePropertyRefs = revalidatePropertyRefs;
1879
+ exports.revealRow = revealRow;
1865
1880
  exports.saveIndicator = saveIndicator;
1866
1881
  exports.showAbout = showAbout;
1867
1882
  exports.staleBar = staleBar;