@jjlmoya/utils-games-development 1.66.0 → 1.67.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 +67 -67
- package/scripts/postinstall.mjs +27 -27
- package/src/category/GamesCategorySEO.astro +19 -19
- package/src/category/i18n/de.ts +15 -15
- package/src/category/i18n/en.ts +15 -15
- package/src/category/i18n/es.ts +15 -15
- package/src/category/i18n/fr.ts +15 -15
- package/src/category/i18n/id.ts +10 -10
- package/src/category/i18n/it.ts +10 -10
- package/src/category/i18n/ja.ts +10 -10
- package/src/category/i18n/ko.ts +10 -10
- package/src/category/i18n/nl.ts +10 -10
- package/src/category/i18n/pl.ts +10 -10
- package/src/category/i18n/pt.ts +10 -10
- package/src/category/i18n/ru.ts +10 -10
- package/src/category/i18n/sv.ts +10 -10
- package/src/category/i18n/tr.ts +10 -10
- package/src/category/i18n/zh.ts +10 -10
- package/src/category/seo.astro +15 -15
- package/src/components/PreviewNavSidebar.astro +116 -116
- package/src/components/PreviewToolbar.astro +143 -143
- package/src/data.ts +11 -11
- package/src/env.d.ts +5 -5
- package/src/index.ts +20 -20
- package/src/layouts/PreviewLayout.astro +122 -122
- package/src/pages/[locale]/[slug].astro +165 -165
- package/src/pages/[locale].astro +250 -250
- package/src/pages/index.astro +4 -4
- package/src/tests/category_seo_quality.test.ts +74 -0
- package/src/tests/diacritics_density.test.ts +118 -118
- package/src/tests/faq_count.test.ts +19 -19
- package/src/tests/i18n_coverage.test.ts +36 -36
- package/src/tests/inverted_punctuation.test.ts +84 -84
- package/src/tests/mocks/astro_mock.js +2 -2
- package/src/tests/no_en_dash.test.ts +70 -70
- package/src/tests/no_h1_in_components.test.ts +48 -48
- package/src/tests/pagespeed_best_practices.test.ts +198 -198
- package/src/tests/qa-test-helpers.ts +32 -32
- package/src/tests/qa_bibliography_links.test.ts +41 -41
- package/src/tests/qa_claim_evidence.test.ts +69 -69
- package/src/tests/qa_logic_reference_coverage.test.ts +46 -46
- package/src/tests/qa_runtime_i18n.test.ts +100 -100
- package/src/tests/schemas_fulfillment.test.ts +23 -23
- package/src/tests/script_density.test.ts +94 -94
- package/src/tests/seo_length.test.ts +23 -23
- package/src/tests/slug_language_code_format.test.ts +23 -23
- package/src/tests/slug_uniqueness.test.ts +80 -80
- package/src/tests/title_quality.test.ts +56 -56
- package/src/tool/audioLoopPointFinder/audio-loop-point-finder.css +322 -322
- package/src/tool/audioLoopPointFinder/client.ts +262 -262
- package/src/tool/hitboxHurtboxAnimator/hitbox-hurtbox-animator.css +614 -614
- package/src/tool/saveFileEditor/component.astro +351 -351
- package/src/tool/saveFileEditor/game-save-file-editor.css +250 -250
- package/src/tool/spriteSheetPacker/app-client.ts +248 -248
- package/src/tool/spriteSheetPacker/bibliography.ts +12 -12
- package/src/tool/spriteSheetPacker/component.astro +229 -229
- package/src/tool/spriteSheetPacker/dropzone-client.ts +55 -55
- package/src/tool/spriteSheetPacker/entry.ts +28 -28
- package/src/tool/spriteSheetPacker/exporter.ts +116 -116
- package/src/tool/spriteSheetPacker/extractor-client.ts +127 -127
- package/src/tool/spriteSheetPacker/flipbook-client.ts +60 -60
- package/src/tool/spriteSheetPacker/logic.test.ts +155 -155
- package/src/tool/spriteSheetPacker/logic.ts +32 -32
- package/src/tool/spriteSheetPacker/packer-core.ts +121 -121
- package/src/tool/spriteSheetPacker/packer-ui.ts +86 -86
- package/src/tool/spriteSheetPacker/sprite-sheet-packer.css +578 -578
- package/src/tool/spriteSheetPacker/types.ts +89 -89
- package/src/tool/spriteSheetPacker/ui.ts +42 -42
- package/src/tool/steamCapsuleGenerator/index.ts +9 -9
- package/src/tool/steamCapsuleGenerator/validation.ts +14 -14
- package/src/types.ts +72 -72
package/src/pages/[locale].astro
CHANGED
|
@@ -1,251 +1,251 @@
|
|
|
1
|
-
---
|
|
2
|
-
import PreviewLayout from '../layouts/PreviewLayout.astro';
|
|
3
|
-
import PreviewNavSidebar from '../components/PreviewNavSidebar.astro';
|
|
4
|
-
import { gamesCategory, ALL_TOOLS } from '../index';
|
|
5
|
-
import { Icon } from 'astro-icon/components';
|
|
6
|
-
import type { KnownLocale, ToolLocaleContent } from '../types';
|
|
7
|
-
|
|
8
|
-
export async function getStaticPaths() {
|
|
9
|
-
const locales = ['de', 'en', 'es', 'fr', 'id', 'it', 'ja', 'ko', 'nl', 'pl', 'pt', 'ru', 'sv', 'tr', 'zh'] as KnownLocale[];
|
|
10
|
-
return locales.map(locale => ({ params: { locale } }));
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const { locale: currentLocale } = Astro.params as { locale: KnownLocale };
|
|
14
|
-
|
|
15
|
-
const categoryContent = await gamesCategory.i18n[currentLocale]!();
|
|
16
|
-
|
|
17
|
-
const tools = ALL_TOOLS || [];
|
|
18
|
-
|
|
19
|
-
const toolsWithContent = tools.length > 0
|
|
20
|
-
? await Promise.all(
|
|
21
|
-
tools.map(async ({ entry, Component }) => {
|
|
22
|
-
const languages = Object.keys(entry.i18n);
|
|
23
|
-
const localeEntries = await Promise.all(
|
|
24
|
-
languages.map(async (l) => {
|
|
25
|
-
const content = await entry.i18n[l as KnownLocale]!();
|
|
26
|
-
return [l, content];
|
|
27
|
-
})
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
const localeContents = Object.fromEntries(localeEntries) as Record<string, ToolLocaleContent<Record<string, string>>>;
|
|
31
|
-
|
|
32
|
-
const currentLocaleContent = localeContents[currentLocale] || localeContents['en'] || localeContents['es'];
|
|
33
|
-
const availableLocales: Record<string, string> = {};
|
|
34
|
-
|
|
35
|
-
for (const l of languages) {
|
|
36
|
-
const lCont = localeContents[l];
|
|
37
|
-
if (lCont) {
|
|
38
|
-
availableLocales[l] = `/${l}/${lCont.slug}`;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return { entry, Component, locale: currentLocaleContent, availableLocales };
|
|
43
|
-
})
|
|
44
|
-
)
|
|
45
|
-
: [];
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
<PreviewLayout
|
|
49
|
-
title={categoryContent.title}
|
|
50
|
-
currentLocale={currentLocale}
|
|
51
|
-
hasSidebar={true}
|
|
52
|
-
>
|
|
53
|
-
<PreviewNavSidebar
|
|
54
|
-
slot="sidebar"
|
|
55
|
-
categoryTitle={categoryContent.title}
|
|
56
|
-
tools={toolsWithContent.map(({ entry, locale, availableLocales }) => {
|
|
57
|
-
const href = availableLocales[currentLocale] || (locale ? `/${currentLocale}/${locale.slug}` : '#');
|
|
58
|
-
return {
|
|
59
|
-
id: entry.id,
|
|
60
|
-
title: locale?.title || entry.id,
|
|
61
|
-
href: href,
|
|
62
|
-
};
|
|
63
|
-
})}
|
|
64
|
-
/>
|
|
65
|
-
<div class="dashboard">
|
|
66
|
-
<header class="preview-header">
|
|
1
|
+
---
|
|
2
|
+
import PreviewLayout from '../layouts/PreviewLayout.astro';
|
|
3
|
+
import PreviewNavSidebar from '../components/PreviewNavSidebar.astro';
|
|
4
|
+
import { gamesCategory, ALL_TOOLS } from '../index';
|
|
5
|
+
import { Icon } from 'astro-icon/components';
|
|
6
|
+
import type { KnownLocale, ToolLocaleContent } from '../types';
|
|
7
|
+
|
|
8
|
+
export async function getStaticPaths() {
|
|
9
|
+
const locales = ['de', 'en', 'es', 'fr', 'id', 'it', 'ja', 'ko', 'nl', 'pl', 'pt', 'ru', 'sv', 'tr', 'zh'] as KnownLocale[];
|
|
10
|
+
return locales.map(locale => ({ params: { locale } }));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const { locale: currentLocale } = Astro.params as { locale: KnownLocale };
|
|
14
|
+
|
|
15
|
+
const categoryContent = await gamesCategory.i18n[currentLocale]!();
|
|
16
|
+
|
|
17
|
+
const tools = ALL_TOOLS || [];
|
|
18
|
+
|
|
19
|
+
const toolsWithContent = tools.length > 0
|
|
20
|
+
? await Promise.all(
|
|
21
|
+
tools.map(async ({ entry, Component }) => {
|
|
22
|
+
const languages = Object.keys(entry.i18n);
|
|
23
|
+
const localeEntries = await Promise.all(
|
|
24
|
+
languages.map(async (l) => {
|
|
25
|
+
const content = await entry.i18n[l as KnownLocale]!();
|
|
26
|
+
return [l, content];
|
|
27
|
+
})
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const localeContents = Object.fromEntries(localeEntries) as Record<string, ToolLocaleContent<Record<string, string>>>;
|
|
31
|
+
|
|
32
|
+
const currentLocaleContent = localeContents[currentLocale] || localeContents['en'] || localeContents['es'];
|
|
33
|
+
const availableLocales: Record<string, string> = {};
|
|
34
|
+
|
|
35
|
+
for (const l of languages) {
|
|
36
|
+
const lCont = localeContents[l];
|
|
37
|
+
if (lCont) {
|
|
38
|
+
availableLocales[l] = `/${l}/${lCont.slug}`;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return { entry, Component, locale: currentLocaleContent, availableLocales };
|
|
43
|
+
})
|
|
44
|
+
)
|
|
45
|
+
: [];
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
<PreviewLayout
|
|
49
|
+
title={categoryContent.title}
|
|
50
|
+
currentLocale={currentLocale}
|
|
51
|
+
hasSidebar={true}
|
|
52
|
+
>
|
|
53
|
+
<PreviewNavSidebar
|
|
54
|
+
slot="sidebar"
|
|
55
|
+
categoryTitle={categoryContent.title}
|
|
56
|
+
tools={toolsWithContent.map(({ entry, locale, availableLocales }) => {
|
|
57
|
+
const href = availableLocales[currentLocale] || (locale ? `/${currentLocale}/${locale.slug}` : '#');
|
|
58
|
+
return {
|
|
59
|
+
id: entry.id,
|
|
60
|
+
title: locale?.title || entry.id,
|
|
61
|
+
href: href,
|
|
62
|
+
};
|
|
63
|
+
})}
|
|
64
|
+
/>
|
|
65
|
+
<div class="dashboard">
|
|
66
|
+
<header class="preview-header">
|
|
67
67
|
<span class="badge">preview · @jjlmoya/utils-games-development</span>
|
|
68
|
-
<h1>{categoryContent.title}</h1>
|
|
69
|
-
<p>{categoryContent.description}</p>
|
|
70
|
-
</header>
|
|
71
|
-
|
|
72
|
-
<div class="tool-list">
|
|
73
|
-
{toolsWithContent?.map(({ entry, locale, availableLocales }) => (
|
|
74
|
-
<article class="tool-card">
|
|
75
|
-
<a href={availableLocales?.[currentLocale] || (locale ? `/${currentLocale}/${locale.slug}` : '#')} class="tool-card-link">
|
|
76
|
-
<div class="tool-icons">
|
|
77
|
-
<div class="icon-wrapper bg">
|
|
78
|
-
<Icon name={entry.icons.bg} />
|
|
79
|
-
</div>
|
|
80
|
-
<div class="icon-wrapper fg">
|
|
81
|
-
<Icon name={entry.icons.fg} />
|
|
82
|
-
</div>
|
|
83
|
-
</div>
|
|
84
|
-
<div class="tool-card-content">
|
|
85
|
-
<h2 class="tool-title">{locale?.title}</h2>
|
|
86
|
-
<p class="tool-description">{locale?.description}</p>
|
|
87
|
-
</div>
|
|
88
|
-
<div class="tool-card-meta">
|
|
89
|
-
<span class="tool-id">{entry.id}</span>
|
|
90
|
-
</div>
|
|
91
|
-
</a>
|
|
92
|
-
|
|
93
|
-
{availableLocales && Object.keys(availableLocales).length > 1 && (
|
|
94
|
-
<div class="tool-locales">
|
|
95
|
-
{Object.entries(availableLocales).map(([l, url]) => (
|
|
96
|
-
<a href={url} class="locale-badge" title={`Ver en ${l.toUpperCase()}`} class:list={{ active: l === currentLocale }}>
|
|
97
|
-
{l.toUpperCase()}
|
|
98
|
-
</a>
|
|
99
|
-
))}
|
|
100
|
-
</div>
|
|
101
|
-
)}
|
|
102
|
-
</article>
|
|
103
|
-
))}
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
</PreviewLayout>
|
|
107
|
-
|
|
108
|
-
<style>
|
|
109
|
-
.dashboard {
|
|
110
|
-
display: flex;
|
|
111
|
-
flex-direction: column;
|
|
112
|
-
gap: 5rem;
|
|
113
|
-
}
|
|
114
|
-
.preview-header {
|
|
115
|
-
text-align: center;
|
|
116
|
-
padding-bottom: 3rem;
|
|
117
|
-
border-bottom: 1px solid var(--border-color);
|
|
118
|
-
}
|
|
119
|
-
.badge {
|
|
120
|
-
display: inline-block;
|
|
121
|
-
padding: 0.25rem 0.75rem;
|
|
122
|
-
background: var(--accent);
|
|
123
|
-
border-radius: 99px;
|
|
124
|
-
font-size: 0.7rem;
|
|
125
|
-
font-weight: 800;
|
|
126
|
-
margin-bottom: 1.5rem;
|
|
127
|
-
color: var(--text-base);
|
|
128
|
-
letter-spacing: 0.05em;
|
|
129
|
-
}
|
|
130
|
-
h1 {
|
|
131
|
-
font-size: clamp(2rem, 6vw, 3.5rem);
|
|
132
|
-
font-weight: 900;
|
|
133
|
-
margin: 0 0 1rem;
|
|
134
|
-
background: linear-gradient(to bottom, var(--text-base), var(--text-muted));
|
|
135
|
-
-webkit-background-clip: text;
|
|
136
|
-
-webkit-text-fill-color: transparent;
|
|
137
|
-
background-clip: text;
|
|
138
|
-
}
|
|
139
|
-
.preview-header p {
|
|
140
|
-
color: var(--text-muted);
|
|
141
|
-
font-size: 1.1rem;
|
|
142
|
-
margin: 0;
|
|
143
|
-
}
|
|
144
|
-
.tool-list {
|
|
145
|
-
display: grid;
|
|
146
|
-
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
|
|
147
|
-
gap: 2rem;
|
|
148
|
-
}
|
|
149
|
-
.tool-card {
|
|
150
|
-
display: flex;
|
|
151
|
-
flex-direction: column;
|
|
152
|
-
gap: 1rem;
|
|
153
|
-
}
|
|
154
|
-
.tool-card-link {
|
|
155
|
-
flex: 1;
|
|
156
|
-
display: flex;
|
|
157
|
-
flex-direction: column;
|
|
158
|
-
padding: 1.5rem;
|
|
159
|
-
background: var(--bg-surface);
|
|
160
|
-
border: 1px solid var(--border-color);
|
|
161
|
-
border-radius: 0.75rem;
|
|
162
|
-
text-decoration: none;
|
|
163
|
-
transition: all 0.2s ease;
|
|
164
|
-
}
|
|
165
|
-
.tool-card-link:hover {
|
|
166
|
-
border-color: var(--accent);
|
|
167
|
-
background: rgba(244, 63, 94, 0.05);
|
|
168
|
-
transform: translateY(-2px);
|
|
169
|
-
}
|
|
170
|
-
.tool-icons {
|
|
171
|
-
display: flex;
|
|
172
|
-
align-items: center;
|
|
173
|
-
gap: 1rem;
|
|
174
|
-
margin-bottom: 1.25rem;
|
|
175
|
-
}
|
|
176
|
-
.icon-wrapper {
|
|
177
|
-
display: flex;
|
|
178
|
-
align-items: center;
|
|
179
|
-
justify-content: center;
|
|
180
|
-
width: 3rem;
|
|
181
|
-
height: 3rem;
|
|
182
|
-
border-radius: 0.5rem;
|
|
183
|
-
font-size: 1.5rem;
|
|
184
|
-
}
|
|
185
|
-
.icon-wrapper.bg {
|
|
186
|
-
background: var(--accent);
|
|
187
|
-
color: var(--text-base);
|
|
188
|
-
}
|
|
189
|
-
.icon-wrapper.fg {
|
|
190
|
-
background: var(--bg-page);
|
|
191
|
-
border: 1px solid var(--border-color);
|
|
192
|
-
color: var(--accent);
|
|
193
|
-
}
|
|
194
|
-
.tool-card-content {
|
|
195
|
-
flex: 1;
|
|
196
|
-
display: flex;
|
|
197
|
-
flex-direction: column;
|
|
198
|
-
}
|
|
199
|
-
.tool-title {
|
|
200
|
-
font-size: 1.25rem;
|
|
201
|
-
font-weight: 700;
|
|
202
|
-
margin: 0 0 0.5rem;
|
|
203
|
-
color: var(--text-base);
|
|
204
|
-
}
|
|
205
|
-
.tool-description {
|
|
206
|
-
font-size: 0.9375rem;
|
|
207
|
-
color: var(--text-muted);
|
|
208
|
-
line-height: 1.5;
|
|
209
|
-
margin: 0;
|
|
210
|
-
}
|
|
211
|
-
.tool-card-meta {
|
|
212
|
-
padding-top: 1rem;
|
|
213
|
-
border-top: 1px solid var(--border-color);
|
|
214
|
-
margin-top: 1.5rem;
|
|
215
|
-
}
|
|
216
|
-
.tool-id {
|
|
217
|
-
display: inline-block;
|
|
218
|
-
font-size: 0.7rem;
|
|
219
|
-
background: var(--bg-page);
|
|
220
|
-
border: 1px solid var(--border-color);
|
|
221
|
-
padding: 0.35rem 0.75rem;
|
|
222
|
-
border-radius: 0.4rem;
|
|
223
|
-
color: var(--accent);
|
|
224
|
-
font-weight: 600;
|
|
225
|
-
}
|
|
226
|
-
.tool-locales {
|
|
227
|
-
display: flex;
|
|
228
|
-
gap: 0.5rem;
|
|
229
|
-
flex-wrap: wrap;
|
|
230
|
-
}
|
|
231
|
-
.locale-badge {
|
|
232
|
-
display: inline-block;
|
|
233
|
-
padding: 0.4rem 0.85rem;
|
|
234
|
-
background: var(--bg-page);
|
|
235
|
-
border: 1px solid var(--border-color);
|
|
236
|
-
border-radius: 0.4rem;
|
|
237
|
-
color: var(--text-muted);
|
|
238
|
-
text-decoration: none;
|
|
239
|
-
font-size: 0.75rem;
|
|
240
|
-
font-weight: 600;
|
|
241
|
-
text-transform: uppercase;
|
|
242
|
-
letter-spacing: 0.05em;
|
|
243
|
-
transition: all 0.15s ease;
|
|
244
|
-
}
|
|
245
|
-
.locale-badge:hover,
|
|
246
|
-
.locale-badge.active {
|
|
247
|
-
color: var(--accent);
|
|
248
|
-
border-color: var(--accent);
|
|
249
|
-
background: rgba(244, 63, 94, 0.1);
|
|
250
|
-
}
|
|
251
|
-
</style>
|
|
68
|
+
<h1>{categoryContent.title}</h1>
|
|
69
|
+
<p>{categoryContent.description}</p>
|
|
70
|
+
</header>
|
|
71
|
+
|
|
72
|
+
<div class="tool-list">
|
|
73
|
+
{toolsWithContent?.map(({ entry, locale, availableLocales }) => (
|
|
74
|
+
<article class="tool-card">
|
|
75
|
+
<a href={availableLocales?.[currentLocale] || (locale ? `/${currentLocale}/${locale.slug}` : '#')} class="tool-card-link">
|
|
76
|
+
<div class="tool-icons">
|
|
77
|
+
<div class="icon-wrapper bg">
|
|
78
|
+
<Icon name={entry.icons.bg} />
|
|
79
|
+
</div>
|
|
80
|
+
<div class="icon-wrapper fg">
|
|
81
|
+
<Icon name={entry.icons.fg} />
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
<div class="tool-card-content">
|
|
85
|
+
<h2 class="tool-title">{locale?.title}</h2>
|
|
86
|
+
<p class="tool-description">{locale?.description}</p>
|
|
87
|
+
</div>
|
|
88
|
+
<div class="tool-card-meta">
|
|
89
|
+
<span class="tool-id">{entry.id}</span>
|
|
90
|
+
</div>
|
|
91
|
+
</a>
|
|
92
|
+
|
|
93
|
+
{availableLocales && Object.keys(availableLocales).length > 1 && (
|
|
94
|
+
<div class="tool-locales">
|
|
95
|
+
{Object.entries(availableLocales).map(([l, url]) => (
|
|
96
|
+
<a href={url} class="locale-badge" title={`Ver en ${l.toUpperCase()}`} class:list={{ active: l === currentLocale }}>
|
|
97
|
+
{l.toUpperCase()}
|
|
98
|
+
</a>
|
|
99
|
+
))}
|
|
100
|
+
</div>
|
|
101
|
+
)}
|
|
102
|
+
</article>
|
|
103
|
+
))}
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
</PreviewLayout>
|
|
107
|
+
|
|
108
|
+
<style>
|
|
109
|
+
.dashboard {
|
|
110
|
+
display: flex;
|
|
111
|
+
flex-direction: column;
|
|
112
|
+
gap: 5rem;
|
|
113
|
+
}
|
|
114
|
+
.preview-header {
|
|
115
|
+
text-align: center;
|
|
116
|
+
padding-bottom: 3rem;
|
|
117
|
+
border-bottom: 1px solid var(--border-color);
|
|
118
|
+
}
|
|
119
|
+
.badge {
|
|
120
|
+
display: inline-block;
|
|
121
|
+
padding: 0.25rem 0.75rem;
|
|
122
|
+
background: var(--accent);
|
|
123
|
+
border-radius: 99px;
|
|
124
|
+
font-size: 0.7rem;
|
|
125
|
+
font-weight: 800;
|
|
126
|
+
margin-bottom: 1.5rem;
|
|
127
|
+
color: var(--text-base);
|
|
128
|
+
letter-spacing: 0.05em;
|
|
129
|
+
}
|
|
130
|
+
h1 {
|
|
131
|
+
font-size: clamp(2rem, 6vw, 3.5rem);
|
|
132
|
+
font-weight: 900;
|
|
133
|
+
margin: 0 0 1rem;
|
|
134
|
+
background: linear-gradient(to bottom, var(--text-base), var(--text-muted));
|
|
135
|
+
-webkit-background-clip: text;
|
|
136
|
+
-webkit-text-fill-color: transparent;
|
|
137
|
+
background-clip: text;
|
|
138
|
+
}
|
|
139
|
+
.preview-header p {
|
|
140
|
+
color: var(--text-muted);
|
|
141
|
+
font-size: 1.1rem;
|
|
142
|
+
margin: 0;
|
|
143
|
+
}
|
|
144
|
+
.tool-list {
|
|
145
|
+
display: grid;
|
|
146
|
+
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
|
|
147
|
+
gap: 2rem;
|
|
148
|
+
}
|
|
149
|
+
.tool-card {
|
|
150
|
+
display: flex;
|
|
151
|
+
flex-direction: column;
|
|
152
|
+
gap: 1rem;
|
|
153
|
+
}
|
|
154
|
+
.tool-card-link {
|
|
155
|
+
flex: 1;
|
|
156
|
+
display: flex;
|
|
157
|
+
flex-direction: column;
|
|
158
|
+
padding: 1.5rem;
|
|
159
|
+
background: var(--bg-surface);
|
|
160
|
+
border: 1px solid var(--border-color);
|
|
161
|
+
border-radius: 0.75rem;
|
|
162
|
+
text-decoration: none;
|
|
163
|
+
transition: all 0.2s ease;
|
|
164
|
+
}
|
|
165
|
+
.tool-card-link:hover {
|
|
166
|
+
border-color: var(--accent);
|
|
167
|
+
background: rgba(244, 63, 94, 0.05);
|
|
168
|
+
transform: translateY(-2px);
|
|
169
|
+
}
|
|
170
|
+
.tool-icons {
|
|
171
|
+
display: flex;
|
|
172
|
+
align-items: center;
|
|
173
|
+
gap: 1rem;
|
|
174
|
+
margin-bottom: 1.25rem;
|
|
175
|
+
}
|
|
176
|
+
.icon-wrapper {
|
|
177
|
+
display: flex;
|
|
178
|
+
align-items: center;
|
|
179
|
+
justify-content: center;
|
|
180
|
+
width: 3rem;
|
|
181
|
+
height: 3rem;
|
|
182
|
+
border-radius: 0.5rem;
|
|
183
|
+
font-size: 1.5rem;
|
|
184
|
+
}
|
|
185
|
+
.icon-wrapper.bg {
|
|
186
|
+
background: var(--accent);
|
|
187
|
+
color: var(--text-base);
|
|
188
|
+
}
|
|
189
|
+
.icon-wrapper.fg {
|
|
190
|
+
background: var(--bg-page);
|
|
191
|
+
border: 1px solid var(--border-color);
|
|
192
|
+
color: var(--accent);
|
|
193
|
+
}
|
|
194
|
+
.tool-card-content {
|
|
195
|
+
flex: 1;
|
|
196
|
+
display: flex;
|
|
197
|
+
flex-direction: column;
|
|
198
|
+
}
|
|
199
|
+
.tool-title {
|
|
200
|
+
font-size: 1.25rem;
|
|
201
|
+
font-weight: 700;
|
|
202
|
+
margin: 0 0 0.5rem;
|
|
203
|
+
color: var(--text-base);
|
|
204
|
+
}
|
|
205
|
+
.tool-description {
|
|
206
|
+
font-size: 0.9375rem;
|
|
207
|
+
color: var(--text-muted);
|
|
208
|
+
line-height: 1.5;
|
|
209
|
+
margin: 0;
|
|
210
|
+
}
|
|
211
|
+
.tool-card-meta {
|
|
212
|
+
padding-top: 1rem;
|
|
213
|
+
border-top: 1px solid var(--border-color);
|
|
214
|
+
margin-top: 1.5rem;
|
|
215
|
+
}
|
|
216
|
+
.tool-id {
|
|
217
|
+
display: inline-block;
|
|
218
|
+
font-size: 0.7rem;
|
|
219
|
+
background: var(--bg-page);
|
|
220
|
+
border: 1px solid var(--border-color);
|
|
221
|
+
padding: 0.35rem 0.75rem;
|
|
222
|
+
border-radius: 0.4rem;
|
|
223
|
+
color: var(--accent);
|
|
224
|
+
font-weight: 600;
|
|
225
|
+
}
|
|
226
|
+
.tool-locales {
|
|
227
|
+
display: flex;
|
|
228
|
+
gap: 0.5rem;
|
|
229
|
+
flex-wrap: wrap;
|
|
230
|
+
}
|
|
231
|
+
.locale-badge {
|
|
232
|
+
display: inline-block;
|
|
233
|
+
padding: 0.4rem 0.85rem;
|
|
234
|
+
background: var(--bg-page);
|
|
235
|
+
border: 1px solid var(--border-color);
|
|
236
|
+
border-radius: 0.4rem;
|
|
237
|
+
color: var(--text-muted);
|
|
238
|
+
text-decoration: none;
|
|
239
|
+
font-size: 0.75rem;
|
|
240
|
+
font-weight: 600;
|
|
241
|
+
text-transform: uppercase;
|
|
242
|
+
letter-spacing: 0.05em;
|
|
243
|
+
transition: all 0.15s ease;
|
|
244
|
+
}
|
|
245
|
+
.locale-badge:hover,
|
|
246
|
+
.locale-badge.active {
|
|
247
|
+
color: var(--accent);
|
|
248
|
+
border-color: var(--accent);
|
|
249
|
+
background: rgba(244, 63, 94, 0.1);
|
|
250
|
+
}
|
|
251
|
+
</style>
|
package/src/pages/index.astro
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
---
|
|
2
|
-
---
|
|
3
|
-
<meta http-equiv="refresh" content="0;url=/es" />
|
|
4
|
-
|
|
1
|
+
---
|
|
2
|
+
---
|
|
3
|
+
<meta http-equiv="refresh" content="0;url=/es" />
|
|
4
|
+
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import type { CategoryLocaleContent } from '../types';
|
|
3
|
+
|
|
4
|
+
const EXPECTED_LOCALES = [
|
|
5
|
+
'de', 'en', 'es', 'fr', 'id', 'it', 'ja', 'ko', 'nl', 'pl', 'pt', 'ru', 'sv', 'tr', 'zh',
|
|
6
|
+
] as const;
|
|
7
|
+
const COMPACT_LOCALES = new Set(['ja', 'ko', 'zh']);
|
|
8
|
+
|
|
9
|
+
const localeModules = import.meta.glob('../category/i18n/*.ts', { eager: true }) as Record<
|
|
10
|
+
string,
|
|
11
|
+
{ content: CategoryLocaleContent }
|
|
12
|
+
>;
|
|
13
|
+
|
|
14
|
+
function textFrom(value: unknown): string {
|
|
15
|
+
if (typeof value === 'string') return value.replace(/<[^>]*>/g, ' ');
|
|
16
|
+
if (Array.isArray(value)) return value.map(textFrom).join(' ');
|
|
17
|
+
if (value && typeof value === 'object') return Object.values(value).map(textFrom).join(' ');
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const STRONG_CLAIM = /\b(?:garantiz\w*|guarante\w*|validat(?:ed)|valid(?:ated|ado|ada|ados|adas|ée|ées)|actualizad\w*)\b/iu;
|
|
22
|
+
|
|
23
|
+
function getContents(): Map<string, CategoryLocaleContent> {
|
|
24
|
+
return new Map(
|
|
25
|
+
Object.entries(localeModules).map(([file, module]) => [file.match(/\/([a-z]{2})\.ts$/u)?.[1] ?? file, module.content]),
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function validateContent(locale: string, content: CategoryLocaleContent): string[] {
|
|
30
|
+
const failures: string[] = [];
|
|
31
|
+
const check = (condition: boolean, message: string) => { if (!condition) failures.push(`${locale}: ${message}`); };
|
|
32
|
+
const minimumTitleLength = COMPACT_LOCALES.has(locale) ? 4 : 12;
|
|
33
|
+
const minimumDescriptionLength = COMPACT_LOCALES.has(locale) ? 20 : 60;
|
|
34
|
+
check(content.title.trim().length >= minimumTitleLength && content.title.trim().length <= 70, 'title must use a useful 4/12–70 character length');
|
|
35
|
+
check(content.description.trim().length >= minimumDescriptionLength && content.description.trim().length <= 180, 'description must use a useful 20/60–180 character length');
|
|
36
|
+
check(content.seo.length >= 2, 'SEO needs at least two sections');
|
|
37
|
+
check(content.seo.some((section) => section.type === 'paragraph'), 'SEO needs visible explanatory copy');
|
|
38
|
+
|
|
39
|
+
const seoText = textFrom(content.seo).replace(/\s+/g, ' ').trim();
|
|
40
|
+
const minimumSeoLength = COMPACT_LOCALES.has(locale) ? 120 : 240;
|
|
41
|
+
check(seoText.length >= minimumSeoLength, 'SEO copy must contain the minimum visible copy for its script');
|
|
42
|
+
check(content.seo.filter((section) => section.type === 'title').length >= 1, 'SEO needs a section heading');
|
|
43
|
+
check(!/[�]/u.test(seoText), 'SEO contains replacement characters');
|
|
44
|
+
check(!/ {2,}/u.test(seoText), 'SEO contains duplicated whitespace');
|
|
45
|
+
check(!STRONG_CLAIM.test(seoText), 'SEO contains an unsupported strong claim');
|
|
46
|
+
|
|
47
|
+
check(content.slug.trim().length > 0 && /^[a-z0-9-]+$/u.test(content.slug), 'slug must be a non-empty URL-safe value');
|
|
48
|
+
return failures;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
describe('Category SEO quality contract', () => {
|
|
52
|
+
it('has one content file for every configured locale', () => {
|
|
53
|
+
const contents = getContents();
|
|
54
|
+
expect([...contents.keys()].sort()).toEqual([...EXPECTED_LOCALES].sort());
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('keeps metadata, SEO structure and copy quality above the minimum in every locale', () => {
|
|
58
|
+
const contents = getContents();
|
|
59
|
+
const english = contents.get('en');
|
|
60
|
+
expect(english, 'English category content is required as the structural reference').toBeDefined();
|
|
61
|
+
|
|
62
|
+
const failures = EXPECTED_LOCALES.flatMap((locale) => {
|
|
63
|
+
const content = contents.get(locale);
|
|
64
|
+
return content ? validateContent(locale, content) : [];
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
for (const locale of EXPECTED_LOCALES) {
|
|
68
|
+
const content = contents.get(locale);
|
|
69
|
+
if (!content) failures.push(`${locale}: category content is missing`);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
expect(failures, 'category SEO quality failures').toEqual([]);
|
|
73
|
+
}, 30000);
|
|
74
|
+
});
|