@jjlmoya/utils-tabletop 1.38.0 → 1.39.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jjlmoya/utils-tabletop",
3
- "version": "1.38.0",
3
+ "version": "1.39.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  import { Icon } from "astro-icon/components";
3
3
  import type { KnownLocale } from "../types";
4
+ import { getCategoryUi } from "../mfe/category-ui";
4
5
  import { getUtilitiesPath } from "@jjlmoya/utils-shared/routing";
5
6
 
6
7
  interface Props {
@@ -30,9 +31,10 @@ const LABELS: Record<KnownLocale, string> = {
30
31
 
31
32
  const { locale, categoryTitle, categoryHref, currentTitle } = Astro.props;
32
33
  const homeLabel = LABELS[locale];
34
+ const breadcrumbLabel = getCategoryUi(locale).breadcrumb;
33
35
  ---
34
36
 
35
- <nav class="production-breadcrumb" aria-label="Breadcrumb">
37
+ <nav class="production-breadcrumb" aria-label={breadcrumbLabel}>
36
38
  <ol class="production-breadcrumb-list">
37
39
  <li class="production-breadcrumb-item">
38
40
  <a href={getUtilitiesPath(locale)}>{homeLabel}</a>
@@ -12,6 +12,7 @@ import { HEADER_UI } from "../i18n/header-ui";
12
12
  import { LANGUAGE_LOCALES, LANGUAGE_NAMES, type Language } from "../i18n/languages";
13
13
  import { LANGUAGE_UI } from "../i18n/language-ui";
14
14
  import { getBrand } from "../identity/brands";
15
+ import { getBrandAssetPath } from "../mfe/assets";
15
16
 
16
17
  interface AlternateLink { language: Language; url: string; }
17
18
  interface Props {
@@ -26,6 +27,9 @@ interface Props {
26
27
 
27
28
  const { title, description, locale, image, toolCss, publicPath, alternates } = Astro.props;
28
29
  const brand = getBrand(locale);
30
+ const brandFavicon = getBrandAssetPath(brand, "favicon");
31
+ const brandSizedFavicon = getBrandAssetPath(brand, "faviconSized");
32
+ const brandAppleTouchIcon = getBrandAssetPath(brand, "appleTouchIcon");
29
33
  const origin = brand === "jjlmoya" ? "https://www.jjlmoya.es" : "https://www.gamebob.dev";
30
34
  const canonical = new URL(publicPath, origin).href;
31
35
  const socialImage = image ? new URL(image, canonical).href : undefined;
@@ -60,6 +64,9 @@ const xDefaultUrl = alternates.find(({ language }) => language === "en")?.url ??
60
64
  <meta name="author" content="jjlmoya" />
61
65
  <meta name="robots" content="index, follow, max-image-preview:large" />
62
66
  <meta name="referrer" content="strict-origin-when-cross-origin" />
67
+ <link rel="icon" type="image/x-icon" href={brandFavicon} />
68
+ <link rel="icon" type="image/webp" sizes={brand === "jjlmoya" ? "32x32" : "48x48"} href={brandSizedFavicon} />
69
+ <link rel="apple-touch-icon" href={brandAppleTouchIcon} />
63
70
  <link rel="canonical" href={canonical} />
64
71
  {alternates.map(({ language, url }) => <link rel="alternate" hreflang={language} href={absoluteUrl(language, url)} />)}
65
72
  <link rel="alternate" hreflang="x-default" href={absoluteUrl("en", xDefaultUrl)} />
@@ -27,9 +27,9 @@ const ui = getCategoryUi(locale);
27
27
  <ProductionBreadcrumb locale={locale} categoryTitle={categoryTitle} categoryHref={categoryHref || publicCategoryPath} currentTitle={content.title} />
28
28
  <UtilityHeader titleHighlight={titleHighlight} titleBase={titleBase} description={content.description} gradientFrom="#10b981" gradientTo="#0d9488" />
29
29
  <section class="utility-tool-production"><Component ui={content.ui} locale={locale} /></section>
30
- <div class="utility-zoom-production" aria-label="Zoom controls">
31
- <span class="utility-zoom-label">Zoom</span>
32
- <div class="utility-zoom-controls"><button type="button" data-zoom="out" aria-label="Zoom out">−</button><button type="button" data-zoom="reset" aria-label="Reset zoom">100%</button><button type="button" data-zoom="in" aria-label="Zoom in">+</button></div>
30
+ <div class="utility-zoom-production" aria-label={ui.zoomControls}>
31
+ <span class="utility-zoom-label">{ui.zoom}</span>
32
+ <div class="utility-zoom-controls"><button type="button" data-zoom="out" aria-label={ui.zoomOut}>−</button><button type="button" data-zoom="reset" aria-label={ui.resetZoom}>100%</button><button type="button" data-zoom="in" aria-label={ui.zoomIn}>+</button></div>
33
33
  </div>
34
34
  <ProductionWidget locale={locale} slug={content.slug} />
35
35
  {content.faq.length > 0 && <section class="utility-section-production"><FAQSection items={content.faq} /></section>}
@@ -38,7 +38,7 @@ const ui = getCategoryUi(locale);
38
38
  </Fragment>
39
39
  <section class="utility-section-production"><SEOComponent locale={locale} /></section>
40
40
  {content.bibliography.length > 0 && <section class="utility-section-production"><BibliographyComponent locale={locale} /></section>}
41
- {relatedTools.length > 0 && <section class="utility-related-production" aria-labelledby="related-tools-title"><div class="utility-related-heading"><span class="utility-related-eyebrow">Keep exploring</span><h2 id="related-tools-title">More tools in {categoryTitle}</h2></div><div class="utility-related-grid">{relatedTools.map((tool, index) => <a href={tool.href} class="utility-related-card"><span class="utility-related-index">{String(index + 1).padStart(2, "0")}</span><span class="utility-related-icon"><Icon name={tool.icon} /></span><h3>{tool.title}</h3><p>{tool.description}</p><span class="utility-related-cta">{ui.openTool} <Icon name="mdi:arrow-top-right" /></span></a>)}</div></section>}
41
+ {relatedTools.length > 0 && <section class="utility-related-production" aria-labelledby="related-tools-title"><div class="utility-related-heading"><span class="utility-related-eyebrow">{ui.relatedEyebrow}</span><h2 id="related-tools-title">{ui.moreToolsIn} {categoryTitle}</h2></div><div class="utility-related-grid">{relatedTools.map((tool, index) => <a href={tool.href} class="utility-related-card"><span class="utility-related-index">{String(index + 1).padStart(2, "0")}</span><span class="utility-related-icon"><Icon name={tool.icon} /></span><h3>{tool.title}</h3><p>{tool.description}</p><span class="utility-related-cta">{ui.openTool} <Icon name="mdi:arrow-top-right" /></span></a>)}</div></section>}
42
42
  </div>
43
43
  </div>
44
44
  </ProductionPage>
package/src/mfe/assets.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  import packageMetadata from "../../package.json";
2
+ import type { Brand } from "../identity/brands";
3
+
4
+ const UTILITY_ASSET_ROOT = "/_utilities/tabletop";
2
5
 
3
6
  export const TABLETOP_ASSET_VERSION = encodeURIComponent(
4
7
  import.meta.env.PUBLIC_APP_VERSION ?? packageMetadata.version,
@@ -6,6 +9,27 @@ export const TABLETOP_ASSET_VERSION = encodeURIComponent(
6
9
 
7
10
  const withAssetVersion = (path: string): string => `${path}?version=${TABLETOP_ASSET_VERSION}`;
8
11
 
12
+ export const getUtilityAssetPath = (assetName: string): string =>
13
+ withAssetVersion(`${UTILITY_ASSET_ROOT}/${assetName}`);
14
+
15
+ const BRAND_ASSETS = {
16
+ gamebob: {
17
+ favicon: "favicon.ico",
18
+ faviconSized: "favicon-48.webp",
19
+ appleTouchIcon: "apple-touch-icon-brand.webp",
20
+ },
21
+ jjlmoya: {
22
+ favicon: "favicon-jjlmoya.ico",
23
+ faviconSized: "favicon-jjlmoya-32.webp",
24
+ appleTouchIcon: "apple-touch-icon-jjlmoya.webp",
25
+ },
26
+ } as const satisfies Record<Brand, Record<"favicon" | "faviconSized" | "appleTouchIcon", string>>;
27
+
28
+ export const getBrandAssetPath = (
29
+ brand: Brand,
30
+ asset: keyof (typeof BRAND_ASSETS)[Brand],
31
+ ): string => getUtilityAssetPath(BRAND_ASSETS[brand][asset]);
32
+
9
33
  export const getUtilityOgImage = (englishSlug: string): string =>
10
34
  withAssetVersion(`/_utilities/tabletop/images/${englishSlug}.webp`);
11
35
 
@@ -3,24 +3,32 @@ import type { KnownLocale } from '../types';
3
3
  export interface CategoryUi {
4
4
  useTool: string;
5
5
  openTool: string;
6
+ relatedEyebrow: string;
7
+ moreToolsIn: string;
8
+ zoom: string;
9
+ zoomControls: string;
10
+ zoomOut: string;
11
+ resetZoom: string;
12
+ zoomIn: string;
13
+ breadcrumb: string;
6
14
  }
7
15
 
8
16
  export const CATEGORY_UI: Record<KnownLocale, CategoryUi> = {
9
- es: { useTool: 'Usar herramienta', openTool: 'Abrir herramienta' },
10
- en: { useTool: 'Use tool', openTool: 'Open tool' },
11
- fr: { useTool: "Utiliser l'outil", openTool: "Ouvrir l'outil" },
12
- de: { useTool: 'Werkzeug verwenden', openTool: 'Werkzeug öffnen' },
13
- it: { useTool: 'Usa lo strumento', openTool: 'Apri lo strumento' },
14
- pt: { useTool: 'Usar ferramenta', openTool: 'Abrir ferramenta' },
15
- nl: { useTool: 'Tool gebruiken', openTool: 'Tool openen' },
16
- sv: { useTool: 'Använd verktyget', openTool: 'Öppna verktyget' },
17
- pl: { useTool: 'Użyj narzędzia', openTool: 'Otwórz narzędzie' },
18
- id: { useTool: 'Gunakan alat', openTool: 'Buka alat' },
19
- tr: { useTool: 'Aracı kullan', openTool: 'Aracı aç' },
20
- ru: { useTool: 'Использовать инструмент', openTool: 'Открыть инструмент' },
21
- ja: { useTool: 'ツールを使う', openTool: 'ツールを開く' },
22
- ko: { useTool: '도구 사용', openTool: '도구 열기' },
23
- zh: { useTool: '使用工具', openTool: '打开工具' },
17
+ es: { useTool: 'Usar herramienta', openTool: 'Abrir herramienta', relatedEyebrow: 'Sigue explorando', moreToolsIn: 'Más herramientas en', zoom: 'Zoom', zoomControls: 'Controles de zoom', zoomOut: 'Reducir zoom', resetZoom: 'Restablecer zoom', zoomIn: 'Aumentar zoom', breadcrumb: 'Migas de pan' },
18
+ en: { useTool: 'Use tool', openTool: 'Open tool', relatedEyebrow: 'Keep exploring', moreToolsIn: 'More tools in', zoom: 'Zoom', zoomControls: 'Zoom controls', zoomOut: 'Zoom out', resetZoom: 'Reset zoom', zoomIn: 'Zoom in', breadcrumb: 'Breadcrumb' },
19
+ fr: { useTool: "Utiliser l'outil", openTool: "Ouvrir l'outil", relatedEyebrow: 'Continuez à explorer', moreToolsIn: "Plus d'outils dans", zoom: 'Zoom', zoomControls: 'Commandes de zoom', zoomOut: 'Réduire le zoom', resetZoom: 'Réinitialiser le zoom', zoomIn: 'Augmenter le zoom', breadcrumb: 'Fil d’Ariane' },
20
+ de: { useTool: 'Werkzeug verwenden', openTool: 'Werkzeug öffnen', relatedEyebrow: 'Mehr entdecken', moreToolsIn: 'Weitere Werkzeuge in', zoom: 'Zoom', zoomControls: 'Zoom-Steuerung', zoomOut: 'Verkleinern', resetZoom: 'Zoom zurücksetzen', zoomIn: 'Vergrößern', breadcrumb: 'Brotkrümelnavigation' },
21
+ it: { useTool: 'Usa lo strumento', openTool: 'Apri lo strumento', relatedEyebrow: 'Continua a esplorare', moreToolsIn: 'Altri strumenti in', zoom: 'Zoom', zoomControls: 'Controlli zoom', zoomOut: 'Riduci zoom', resetZoom: 'Reimposta zoom', zoomIn: 'Aumenta zoom', breadcrumb: 'Breadcrumb' },
22
+ pt: { useTool: 'Usar ferramenta', openTool: 'Abrir ferramenta', relatedEyebrow: 'Continue a explorar', moreToolsIn: 'Mais ferramentas em', zoom: 'Zoom', zoomControls: 'Controlos de zoom', zoomOut: 'Reduzir zoom', resetZoom: 'Repor zoom', zoomIn: 'Aumentar zoom', breadcrumb: 'Trilho de navegação' },
23
+ nl: { useTool: 'Tool gebruiken', openTool: 'Tool openen', relatedEyebrow: 'Blijf ontdekken', moreToolsIn: 'Meer tools in', zoom: 'Zoom', zoomControls: 'Zoomknoppen', zoomOut: 'Uitzoomen', resetZoom: 'Zoom herstellen', zoomIn: 'Inzoomen', breadcrumb: 'Broodkruimelnavigatie' },
24
+ sv: { useTool: 'Använd verktyget', openTool: 'Öppna verktyget', relatedEyebrow: 'Utforska mer', moreToolsIn: 'Fler verktyg i', zoom: 'Zoom', zoomControls: 'Zoomkontroller', zoomOut: 'Zooma ut', resetZoom: 'Återställ zoom', zoomIn: 'Zooma in', breadcrumb: 'Brödsmulenavigering' },
25
+ pl: { useTool: 'Użyj narzędzia', openTool: 'Otwórz narzędzie', relatedEyebrow: 'Odkrywaj dalej', moreToolsIn: 'Więcej narzędzi w', zoom: 'Powiększenie', zoomControls: 'Sterowanie powiększeniem', zoomOut: 'Pomniejsz', resetZoom: 'Resetuj powiększenie', zoomIn: 'Powiększ', breadcrumb: 'Okruszki nawigacji' },
26
+ id: { useTool: 'Gunakan alat', openTool: 'Buka alat', relatedEyebrow: 'Jelajahi lebih lanjut', moreToolsIn: 'Alat lainnya di', zoom: 'Zoom', zoomControls: 'Kontrol zoom', zoomOut: 'Perkecil', resetZoom: 'Atur ulang zoom', zoomIn: 'Perbesar', breadcrumb: 'Breadcrumb' },
27
+ tr: { useTool: 'Aracı kullan', openTool: 'Aracı aç', relatedEyebrow: 'Keşfetmeye devam edin', moreToolsIn: 'Diğer araçlar:', zoom: 'Yakınlaştırma', zoomControls: 'Yakınlaştırma denetimleri', zoomOut: 'Uzaklaştır', resetZoom: 'Yakınlaştırmayı sıfırla', zoomIn: 'Yakınlaştır', breadcrumb: 'İçerik haritası' },
28
+ ru: { useTool: 'Использовать инструмент', openTool: 'Открыть инструмент', relatedEyebrow: 'Продолжить изучение', moreToolsIn: 'Другие инструменты в', zoom: 'Масштаб', zoomControls: 'Управление масштабом', zoomOut: 'Уменьшить', resetZoom: 'Сбросить масштаб', zoomIn: 'Увеличить', breadcrumb: 'Навигационная цепочка' },
29
+ ja: { useTool: 'ツールを使う', openTool: 'ツールを開く', relatedEyebrow: 'さらに探索', moreToolsIn: 'その他のツール:', zoom: 'ズーム', zoomControls: 'ズーム操作', zoomOut: '縮小', resetZoom: 'ズームをリセット', zoomIn: '拡大', breadcrumb: 'パンくずリスト' },
30
+ ko: { useTool: '도구 사용', openTool: '도구 열기', relatedEyebrow: '더 탐색하기', moreToolsIn: '카테고리의 다른 도구:', zoom: '확대/축소', zoomControls: '확대/축소 컨트롤', zoomOut: '축소', resetZoom: '확대/축소 초기화', zoomIn: '확대', breadcrumb: '탐색 경로' },
31
+ zh: { useTool: '使用工具', openTool: '打开工具', relatedEyebrow: '继续探索', moreToolsIn: '更多工具:', zoom: '缩放', zoomControls: '缩放控件', zoomOut: '缩小', resetZoom: '重置缩放', zoomIn: '放大', breadcrumb: '面包屑导航' },
24
32
  };
25
33
 
26
34
  export const getCategoryUi = (locale: KnownLocale): CategoryUi => CATEGORY_UI[locale];
@@ -7,10 +7,16 @@ describe('category UI translations', () => {
7
7
  for (const locale of UTILITY_LOCALES) {
8
8
  expect(getCategoryUi(locale).useTool.trim()).not.toBe('');
9
9
  expect(getCategoryUi(locale).openTool.trim()).not.toBe('');
10
+ expect(getCategoryUi(locale).relatedEyebrow.trim()).not.toBe('');
11
+ expect(getCategoryUi(locale).moreToolsIn.trim()).not.toBe('');
12
+ expect(getCategoryUi(locale).zoomControls.trim()).not.toBe('');
13
+ expect(getCategoryUi(locale).breadcrumb.trim()).not.toBe('');
10
14
  }
11
15
 
12
16
  expect(Object.keys(CATEGORY_UI).sort()).toEqual([...UTILITY_LOCALES].sort());
13
17
  expect(UTILITY_LOCALES.filter((locale) => locale !== 'en').every((locale) => getCategoryUi(locale).useTool !== 'Use tool')).toBe(true);
14
18
  expect(UTILITY_LOCALES.filter((locale) => locale !== 'en').every((locale) => getCategoryUi(locale).openTool !== 'Open tool')).toBe(true);
19
+ expect(UTILITY_LOCALES.filter((locale) => locale !== 'en').every((locale) => getCategoryUi(locale).relatedEyebrow !== 'Keep exploring')).toBe(true);
20
+ expect(UTILITY_LOCALES.filter((locale) => locale !== 'en').every((locale) => getCategoryUi(locale).moreToolsIn !== 'More tools in')).toBe(true);
15
21
  });
16
22
  });