@revenexx/cover 0.2.21 → 0.2.23

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.
@@ -3,22 +3,20 @@ import SearchFacets from "../search/filter/SearchFacets.vue";
3
3
  import type { ProductListing } from "../../composables/useProductListing";
4
4
 
5
5
  /**
6
- * Desktop-only sticky facet rail wrapping the shared SearchFacets panel.
6
+ * Desktop facet rail wrapping the shared SearchFacets panel.
7
7
  *
8
- * The rail STICKS on purpose — the filters stay reachable while the results
9
- * scroll past them. What it also needs, and did not have, is a ceiling and a
10
- * scrollbar of its own: a `position: sticky` box does not scroll its content,
11
- * so once the facet list grew taller than the viewport everything below the
12
- * fold became UNREACHABLE. The page scrolled, the rail stayed pinned, and the
13
- * lower groups could not be seen at all — on a catalogue with a couple of long
14
- * attribute facets that is most of the sidebar.
8
+ * IT SCROLLS WITH THE PAGE. It used to stick under the header, which sounds
9
+ * helpful and is not: a `position: sticky` box does not scroll its own content,
10
+ * so every filter below the fold became unreachable on a catalogue with more
11
+ * than a screenful of facets. Bounding the rail and giving it `overflow-y-auto`
12
+ * fixed the reachability and bought a second, nested scrollbar next to the
13
+ * page's own — two bars racing each other on one screen, and a column that
14
+ * refuses to move while everything beside it does.
15
15
  *
16
- * The mobile drawer had this right from the start (`h-full overflow-y-auto` in
17
- * SearchFacetsDrawer); only the desktop rail was missing it.
18
- *
19
- * `100dvh` rather than `100vh` so a mobile browser's collapsing toolbar does
20
- * not leave the last filter under the chrome, and `overscroll-contain` so
21
- * reaching the end of the list does not hand the scroll to the page mid-swipe.
16
+ * A filter column that simply scrolls away with the results is the plain
17
+ * behaviour people expect, and it needs no height maths, no inner scroller and
18
+ * no dvh guard. The mobile drawer is a different story and keeps its own
19
+ * scroll: it is a full-height overlay, not a column on a page.
22
20
  */
23
21
  const props = defineProps<{
24
22
  listing: ProductListing;
@@ -28,10 +26,7 @@ const listing = props.listing;
28
26
  </script>
29
27
 
30
28
  <template>
31
- <div
32
- class="hidden lg:block w-60 shrink-0 sticky top-(--ui-header-height) pt-1 pb-6
33
- max-h-[calc(100dvh-var(--ui-header-height))] overflow-y-auto overscroll-contain"
34
- >
29
+ <div class="hidden lg:block w-60 shrink-0 pt-1">
35
30
  <SearchFacets
36
31
  v-model="listing.activeFilters.value"
37
32
  v-model:price-range="listing.priceRange.value"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revenexx/cover",
3
- "version": "0.2.21",
3
+ "version": "0.2.23",
4
4
  "description": "Cover \u2014 revenexx design system for Nuxt. Distributed as a Nuxt layer: generic UI components, theming tokens and stores shared by the demo shop, custom storefronts and the Blokkli theme.",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
@@ -372,17 +372,32 @@ async function buildSpecRows(attrs: Record<string, unknown>, locale: Locale): Pr
372
372
  const pick = (labels: Record<string, string> | null | undefined, fallback: string): string =>
373
373
  labels?.[locale] ?? labels?.de ?? labels?.en ?? fallback;
374
374
 
375
+ // One value of an attribute, as a person should read it: an option code
376
+ // resolved to its label, a declared unit appended.
377
+ const render = (m: LiveAttributeMeta | undefined, value: unknown): string => {
378
+ const raw = String(value);
379
+ const label = m?.options?.[raw] ? pick(m.options[raw], raw) : raw;
380
+ return m?.unit && !raw.includes(m.unit) ? `${label} ${m.unit}` : label;
381
+ };
382
+
375
383
  const rows = Object.entries(attrs)
376
384
  .filter(([key, value]) => {
377
385
  if (value === null || value === undefined || value === "") return false;
386
+ // A multiselect with nothing chosen is an empty array, which is not
387
+ // `""` and would otherwise render as a row with no value at all.
388
+ if (Array.isArray(value) && value.length === 0) return false;
378
389
  if (key === "image") return false;
379
390
  return !meta[key]?.hidden;
380
391
  })
381
392
  .map(([key, value]) => {
382
393
  const m = meta[key];
383
- const raw = String(value);
384
- let display = m?.options?.[raw] ? pick(m.options[raw], raw) : raw;
385
- if (m?.unit && !raw.includes(m.unit)) display = `${display} ${m.unit}`;
394
+ // A MULTISELECT HOLDS AN ARRAY, and `String(["a","b"])` is "a,b" —
395
+ // which then matches no option and printed the raw codes, e.g.
396
+ // `ok-10,oks-1,fks-1` where the page should read `OK 10, OKS 1,
397
+ // FKS 1`. Resolve each value on its own and join them for reading.
398
+ const display = Array.isArray(value)
399
+ ? value.map(v => render(m, v)).join(", ")
400
+ : render(m, value);
386
401
  const rank = m?.groupCode && SPEC_GROUP_RANK[m.groupCode] !== undefined ? SPEC_GROUP_RANK[m.groupCode] : 5;
387
402
  return { label: pick(m?.labels, prettifyAttrKey(key)), value: display, sort: rank * 1000 + (m?.position ?? 999) };
388
403
  })