@devslab/site-kit 0.8.1 → 0.9.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.
@@ -460,6 +460,15 @@ var _tmpl$2$2 = [
460
460
  "</a></li>"
461
461
  ];
462
462
  var _tmpl$3$2 = [
463
+ "<nav",
464
+ " class=\"site-footer__langs\"",
465
+ "><details class=\"site-footer__langs-menu\"><summary class=\"site-footer__langs-trigger\" aria-label=\"",
466
+ "\"><span",
467
+ ">",
468
+ "</span></summary><ul class=\"site-footer__langs-list\" role=\"list\">",
469
+ "</ul></details></nav>"
470
+ ];
471
+ var _tmpl$4$2 = [
463
472
  "<footer",
464
473
  " class=\"site-footer\"",
465
474
  "><div class=\"site-footer__inner\"><!--$-->",
@@ -470,18 +479,12 @@ var _tmpl$3$2 = [
470
479
  "<!--/--><li>",
471
480
  "</li></ul></div></div></footer>"
472
481
  ];
473
- var _tmpl$4$2 = [
474
- "<nav",
475
- " class=\"site-footer__langs\"",
476
- ">",
477
- "</nav>"
478
- ];
479
- var _tmpl$5$2 = [
482
+ var _tmpl$5$2 = ["<span", " aria-hidden=\"true\">·</span>"];
483
+ var _tmpl$6$2 = [
480
484
  "<a",
481
485
  ">",
482
486
  "</a>"
483
487
  ];
484
- var _tmpl$6$2 = ["<span", " aria-hidden=\"true\">·</span>"];
485
488
  var _tmpl$7$2 = [
486
489
  "<bdi",
487
490
  ">",
@@ -573,6 +576,30 @@ function SiteHeader(props) {
573
576
  } }))), escape(props.actions));
574
577
  }
575
578
  /**
579
+ * The footer's language row, collapsed.
580
+ *
581
+ * It used to be every language laid out flat, which is a different length in
582
+ * every product — ten for one, twenty for another — so the same footer carried
583
+ * a different visual weight depending on how many languages the product sells
584
+ * in. A `<details>` keeps all of them: the anchors are in the document whether
585
+ * it is open or not, so a crawler still follows every locale, and it works with
586
+ * no JavaScript. Same mechanism as the header's flag menu, including Escape
587
+ * returning focus to the trigger.
588
+ *
589
+ * The trigger is the current language's own name rather than a translated word
590
+ * for "language": it is the one label already meaningful to a reader who cannot
591
+ * read the page, and it is what the flat row marked with `aria-current`.
592
+ */
593
+ function FooterLocaleMenu(props) {
594
+ const current = () => props.registry.LOCALES.find((entry) => entry.code === props.state.locale);
595
+ return ssr(_tmpl$3$2, ssrHydrationKey(), ssrAttribute("aria-label", escape(props.label, true), false), `${escape(props.label, true)}: ${escape(current()?.nativeName ?? props.state.locale, true)}`, ssrAttribute("lang", escape(current()?.code, true), false) + ssrAttribute("dir", escape(current()?.dir, true), false), escape(current()?.nativeName ?? props.state.locale), escape(createComponent(For, {
596
+ get each() {
597
+ return props.registry.LOCALES;
598
+ },
599
+ children: (entry) => ssr(_tmpl$2$2, ssrHydrationKey(), ssrAttribute("href", escape(props.state.hrefForLocale(entry.code), true), false) + ssrAttribute("hreflang", escape(entry.code, true), false) + ssrAttribute("lang", escape(entry.code, true), false) + ssrAttribute("dir", escape(entry.dir, true), false) + ssrAttribute("aria-current", entry.code === props.state.locale ? "page" : escape(void 0, true), false), escape(entry.nativeName))
600
+ })));
601
+ }
602
+ /**
576
603
  * The family footer: a language row, then the brand beside its family links,
577
604
  * then the page's links and the copyright.
578
605
  *
@@ -587,21 +614,29 @@ function SiteHeader(props) {
587
614
  */
588
615
  function SiteFooter(props) {
589
616
  const registry = () => props.localeRegistry ?? FAMILY_LOCALES;
590
- return ssr(_tmpl$3$2, ssrHydrationKey(), ssrAttribute("aria-label", escape(props.messages.footerLabel, true), false), escape(createComponent(Show, {
617
+ return ssr(_tmpl$4$2, ssrHydrationKey(), ssrAttribute("aria-label", escape(props.messages.footerLabel, true), false), escape(createComponent(Show, {
591
618
  get when() {
592
619
  return props.locale;
593
620
  },
594
- children: (locale) => ssr(_tmpl$4$2, ssrHydrationKey(), ssrAttribute("aria-label", escape(props.messages.localeLabel, true), false), escape(createComponent(For, {
595
- get each() {
596
- return registry().LOCALES;
621
+ children: (locale) => createComponent(FooterLocaleMenu, {
622
+ get state() {
623
+ return locale();
597
624
  },
598
- children: (entry) => ssr(_tmpl$5$2, ssrHydrationKey() + ssrAttribute("href", escape(locale().hrefForLocale(entry.code), true), false) + ssrAttribute("hreflang", escape(entry.code, true), false) + ssrAttribute("lang", escape(entry.code, true), false) + ssrAttribute("dir", escape(entry.dir, true), false) + ssrAttribute("aria-current", entry.code === locale().locale ? "page" : escape(void 0, true), false), escape(entry.nativeName))
599
- })))
625
+ get registry() {
626
+ return registry();
627
+ },
628
+ get label() {
629
+ return props.messages.localeLabel;
630
+ },
631
+ get onSelect() {
632
+ return props.onLocaleSelect;
633
+ }
634
+ })
600
635
  })), escape(props.brand.logo), escape(props.brand.name), escape(createComponent(For, {
601
636
  get each() {
602
637
  return props.family ?? [];
603
638
  },
604
- children: (item) => [ssr(_tmpl$6$2, ssrHydrationKey()), ssr(_tmpl$5$2, ssrHydrationKey() + ssrAttribute("href", escape(item.href, true), false), escape(item.label))]
639
+ children: (item) => [ssr(_tmpl$5$2, ssrHydrationKey()), ssr(_tmpl$6$2, ssrHydrationKey() + ssrAttribute("href", escape(item.href, true), false), escape(item.label))]
605
640
  })), escape(createComponent(For, {
606
641
  get each() {
607
642
  return props.links;