@hagicode/hagilight 0.1.2-dev.8.1.a91b4b9 → 0.2.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.
@@ -115,7 +115,7 @@ const { fallback, locale = Astro.currentLocale ?? 'en' } = Astro.props;
115
115
  display: -webkit-box;
116
116
  overflow: hidden;
117
117
  margin: 0;
118
- color: var(--sl-color-text-high, #111827);
118
+ color: var(--sl-color-text-high, var(--sl-color-gray-1, #111827));
119
119
  font-size: var(--sl-text-sm);
120
120
  font-weight: 600;
121
121
  line-height: 1.35;
@@ -127,11 +127,23 @@ const { fallback, locale = Astro.currentLocale ?? 'en' } = Astro.props;
127
127
  color: var(--sl-color-text, #1f2937);
128
128
  }
129
129
 
130
- .hagilight-promoto__image {
131
- display: block;
130
+ .hagilight-promoto__media {
131
+ display: inline-flex;
132
+ align-items: center;
133
+ justify-content: center;
132
134
  width: clamp(4.5rem, 8vw, 6.25rem);
135
+ min-width: clamp(4.5rem, 8vw, 6.25rem);
133
136
  aspect-ratio: 1;
137
+ overflow: hidden;
138
+ border: 1px solid color-mix(in srgb, var(--sl-color-accent-high, #1d4ed8) 18%, var(--sl-color-gray-5, #cbd5e1));
134
139
  border-radius: 0.8rem;
140
+ background: color-mix(in srgb, var(--sl-color-bg-sidebar, #f8fafc) 82%, transparent);
141
+ }
142
+
143
+ .hagilight-promoto__image {
144
+ display: block;
145
+ width: 100%;
146
+ height: 100%;
135
147
  object-fit: cover;
136
148
  }
137
149
 
@@ -216,83 +228,112 @@ const { fallback, locale = Astro.currentLocale ?? 'en' } = Astro.props;
216
228
 
217
229
  @media (max-width: 960px) {
218
230
  .hagilight-promoto__slide {
219
- grid-template-columns: minmax(0, 1fr) auto;
231
+ grid-template-columns: 1fr;
220
232
  gap: 0.75rem;
233
+ padding-inline-end: 3.7rem;
234
+ }
235
+
236
+ .hagilight-promoto__slide[data-has-image='true'] {
237
+ grid-template-columns: 1fr;
221
238
  }
222
239
 
223
240
  .hagilight-promoto__copy {
224
241
  grid-template-columns: 1fr;
225
242
  gap: 0.45rem;
226
243
  }
244
+
245
+ .hagilight-promoto__media {
246
+ width: min(100%, 8rem);
247
+ min-width: 0;
248
+ }
249
+
250
+ .hagilight-promoto__cta {
251
+ justify-self: start;
252
+ white-space: normal;
253
+ }
254
+
255
+ .hagilight-promoto__controls {
256
+ justify-content: flex-start;
257
+ padding-top: 0;
258
+ }
227
259
  }
228
260
 
229
261
  @media (max-width: 720px) {
230
262
  .hagilight-promoto__shell {
231
263
  bottom: calc(env(safe-area-inset-bottom) + 0.5rem);
232
- width: min(calc(100vw - 1rem), 28rem);
264
+ width: min(calc(100vw - 1rem), 24rem);
233
265
  border-radius: 1rem;
234
266
  }
235
267
 
236
268
  .hagilight-promoto__slide {
237
- grid-template-columns: minmax(0, 1fr) auto;
238
- gap: 0.5rem;
239
- padding: 0.65rem 3.25rem 0.65rem 0.75rem;
269
+ grid-template-columns: 1fr;
270
+ gap: 0.7rem;
271
+ padding: 0.85rem 4.8rem 0.85rem 0.85rem;
272
+ }
273
+
274
+ .hagilight-promoto__slide[data-has-image='true'] {
275
+ grid-template-columns: minmax(0, 1fr) 4.5rem;
276
+ align-items: start;
240
277
  }
241
278
 
242
279
  .hagilight-promoto__copy {
243
280
  grid-column: 1;
244
- grid-row: 1 / 3;
281
+ grid-row: 1;
282
+ gap: 0.45rem;
245
283
  }
246
284
 
247
285
  .hagilight-promoto__title {
248
- font-size: var(--sl-text-xs);
286
+ font-size: 0.92rem;
249
287
  }
250
288
 
251
289
  .hagilight-promoto__description {
252
- font-size: var(--sl-text-xs);
290
+ font-size: 0.84rem;
253
291
  font-weight: 500;
292
+ line-height: 1.3;
254
293
  }
255
294
 
256
- .hagilight-promoto__image {
295
+ .hagilight-promoto__media {
296
+ width: 4.5rem;
297
+ min-width: 4.5rem;
298
+ align-self: start;
257
299
  grid-column: 2;
258
300
  grid-row: 1;
259
- width: 3rem;
260
301
  }
261
302
 
262
303
  .hagilight-promoto__cta {
263
- grid-column: 2;
264
- grid-row: 2;
265
- min-width: 4rem;
266
- min-height: 1.9rem;
267
- padding-inline: 0.5rem;
268
- font-size: var(--sl-text-xs);
269
- overflow-wrap: anywhere;
304
+ grid-column: 1 / -1;
305
+ justify-self: stretch;
306
+ min-width: 0;
307
+ min-height: 2.35rem;
308
+ width: 100%;
309
+ font-size: 0.82rem;
310
+ white-space: normal;
270
311
  }
271
312
 
272
- .hagilight-promoto__slide[data-has-image='false'] {
273
- grid-template-rows: auto;
313
+ .hagilight-promoto__control {
314
+ min-width: 2.2rem;
315
+ min-height: 2.2rem;
274
316
  }
275
317
 
276
- .hagilight-promoto__slide[data-has-image='false'] .hagilight-promoto__copy,
277
- .hagilight-promoto__slide[data-has-image='false'] .hagilight-promoto__cta {
278
- grid-row: 1;
318
+ .hagilight-promoto__count {
319
+ min-width: 2.75rem;
320
+ font-size: 0.75rem;
279
321
  }
280
322
 
281
- .hagilight-promoto__slide[data-has-image='false'] .hagilight-promoto__cta {
282
- min-width: 4.5rem;
323
+ .hagilight-promoto__dismiss {
324
+ inset-block-start: 0.55rem;
325
+ inset-inline-end: 0.55rem;
326
+ width: auto;
327
+ min-width: 2rem;
328
+ height: 2rem;
329
+ gap: 0.25rem;
330
+ padding-inline: 0.55rem;
283
331
  }
284
332
 
285
333
  .hagilight-promoto__controls {
286
- justify-content: flex-start;
287
334
  flex-wrap: wrap;
288
335
  gap: 0.35rem;
289
- padding: 0 0.75rem 0.6rem;
290
- }
291
-
292
- .hagilight-promoto__control {
293
- min-width: 2rem;
294
- min-height: 2rem;
295
- padding-inline: 0.5rem;
336
+ padding: 0 0.85rem 0.9rem;
296
337
  }
297
338
  }
298
339
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hagicode/hagilight",
3
- "version": "0.1.2-dev.8.1.a91b4b9",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "description": "Shared Astro components for HagiCode sites",
6
6
  "repository": {
package/promoto-banner.ts CHANGED
@@ -239,6 +239,8 @@ export function definePromotoBannerElement(): void {
239
239
  slide.append(copy);
240
240
 
241
241
  if (card.image) {
242
+ const media = document.createElement('span');
243
+ media.className = 'hagilight-promoto__media';
242
244
  const image = document.createElement('img');
243
245
  image.className = 'hagilight-promoto__image';
244
246
  image.src = card.image.src;
@@ -247,7 +249,8 @@ export function definePromotoBannerElement(): void {
247
249
  image.decoding = 'async';
248
250
  if (card.image.width) image.width = card.image.width;
249
251
  if (card.image.height) image.height = card.image.height;
250
- slide.append(image);
252
+ media.append(image);
253
+ slide.append(media);
251
254
  }
252
255
  slide.append(link);
253
256
  fragment.append(slide);
@@ -25,7 +25,8 @@
25
25
  "pt-BR": "Entrada principal do produto.",
26
26
  "ru-RU": "Основной вход в продукт."
27
27
  },
28
- "url": "https://www.hagicode.com/"
28
+ "url": "https://www.hagicode.com/",
29
+ "supportsLocalePath": true
29
30
  },
30
31
  {
31
32
  "id": "newbe-blog",
@@ -165,7 +166,8 @@
165
166
  "pt-BR": "Galeria com designs web de IA de destaque.",
166
167
  "ru-RU": "Галерея выразительных AI web-дизайнов."
167
168
  },
168
- "url": "https://design.hagicode.com/"
169
+ "url": "https://design.hagicode.com/",
170
+ "supportsLocalePath": true
169
171
  },
170
172
  {
171
173
  "id": "soul-builder",
@@ -222,5 +224,39 @@
222
224
  "ru-RU": "Соберите способности агента."
223
225
  },
224
226
  "url": "https://trait.hagicode.com/"
227
+ },
228
+ {
229
+ "id": "openspec-docs",
230
+ "name": {
231
+ "zh-CN": "OpenSpec 文档",
232
+ "zh-Hant": "OpenSpec 文件",
233
+ "en-US": "OpenSpec Docs",
234
+ "ja-JP": "OpenSpec ドキュメント",
235
+ "ko-KR": "OpenSpec 문서",
236
+ "de-DE": "OpenSpec-Dokumentation",
237
+ "fr-FR": "Documentation OpenSpec",
238
+ "es-ES": "Documentación de OpenSpec",
239
+ "pt-BR": "Documentação do OpenSpec",
240
+ "ru-RU": "Документация OpenSpec"
241
+ },
242
+ "url": "https://openspec.hagicode.com/",
243
+ "supportsLocalePath": true
244
+ },
245
+ {
246
+ "id": "omniroute-docs",
247
+ "name": {
248
+ "zh-CN": "OmniRoute 文档",
249
+ "zh-Hant": "OmniRoute 文件",
250
+ "en-US": "OmniRoute Docs",
251
+ "ja-JP": "OmniRoute ドキュメント",
252
+ "ko-KR": "OmniRoute 문서",
253
+ "de-DE": "OmniRoute-Dokumentation",
254
+ "fr-FR": "Documentation OmniRoute",
255
+ "es-ES": "Documentación de OmniRoute",
256
+ "pt-BR": "Documentação do OmniRoute",
257
+ "ru-RU": "Документация OmniRoute"
258
+ },
259
+ "url": "https://omniroute.hagicode.com/",
260
+ "supportsLocalePath": true
225
261
  }
226
262
  ]
package/site-links.ts CHANGED
@@ -16,7 +16,7 @@ export type SiteLinkKey =
16
16
  | 'issueFeedback'
17
17
  | 'contactEmail'
18
18
  | 'qqGroup'
19
- | 'steam'
19
+ | 'microsoftStore'
20
20
  | 'icpFiling'
21
21
  | 'publicSecurityFiling';
22
22
 
@@ -48,6 +48,7 @@ export interface RelatedSite {
48
48
  name: LocalizedText;
49
49
  url: string;
50
50
  description?: LocalizedText;
51
+ supportsLocalePath?: boolean;
51
52
  }
52
53
 
53
54
  export interface SiteLinksOptions {
@@ -153,10 +154,11 @@ const translations = {
153
154
  'fr-FR': 'Groupe QQ 610394020', 'es-ES': 'Grupo QQ 610394020',
154
155
  'pt-BR': 'Grupo QQ 610394020', 'ru-RU': 'Группа QQ 610394020',
155
156
  },
156
- steam: {
157
- 'zh-CN': 'Steam', 'zh-Hant': 'Steam', 'en-US': 'Steam', 'ja-JP': 'Steam',
158
- 'ko-KR': 'Steam', 'de-DE': 'Steam', 'fr-FR': 'Steam', 'es-ES': 'Steam',
159
- 'pt-BR': 'Steam', 'ru-RU': 'Steam',
157
+ microsoftStore: {
158
+ 'zh-CN': 'Microsoft Store', 'zh-Hant': 'Microsoft Store', 'en-US': 'Microsoft Store',
159
+ 'ja-JP': 'Microsoft Store', 'ko-KR': 'Microsoft Store', 'de-DE': 'Microsoft Store',
160
+ 'fr-FR': 'Microsoft Store', 'es-ES': 'Microsoft Store', 'pt-BR': 'Microsoft Store',
161
+ 'ru-RU': 'Microsoft Store',
160
162
  },
161
163
  icpFiling: '闽ICP备2026004153号-1',
162
164
  publicSecurityFiling: '闽公网安备35011102351148号',
@@ -178,7 +180,11 @@ const defaultLinks: Record<SiteLinkKey, LinkDefinition> = {
178
180
  issueFeedback: { label: translations.issueFeedback, href: 'https://github.com/HagiCode-org/site/issues', external: true },
179
181
  contactEmail: { label: translations.contactEmail, href: 'mailto:support@hagicode.com' },
180
182
  qqGroup: { label: translations.qqGroup, href: 'https://qm.qq.com/q/Fwb0o094kw', external: true },
181
- steam: { label: translations.steam, href: 'https://store.steampowered.com/app/4625540/Hagicode/', external: true },
183
+ microsoftStore: {
184
+ label: translations.microsoftStore,
185
+ href: 'https://apps.microsoft.com/detail/9N3PM0N3SVDW',
186
+ external: true,
187
+ },
182
188
  icpFiling: {
183
189
  label: translations.icpFiling,
184
190
  href: 'https://beian.miit.gov.cn/',
@@ -209,8 +215,8 @@ const defaultLinks: Record<SiteLinkKey, LinkDefinition> = {
209
215
 
210
216
  const groups: Record<LinkGroup, readonly SiteLinkKey[]> = {
211
217
  header: ['home', 'blog', 'support'],
212
- quick: ['downloadClient', 'about', 'dockerCompose', 'productDocs', 'blogPosts', 'rss'],
213
- community: ['github', 'discord', 'issueFeedback', 'contactEmail', 'qqGroup', 'costCalculator', 'steam'],
218
+ quick: ['downloadClient', 'microsoftStore', 'about', 'dockerCompose', 'productDocs', 'blogPosts', 'rss'],
219
+ community: ['github', 'discord', 'issueFeedback', 'contactEmail', 'qqGroup', 'costCalculator'],
214
220
  filings: ['icpFiling', 'publicSecurityFiling'],
215
221
  };
216
222
 
@@ -317,8 +323,8 @@ export function resolveSiteLinks(localeInput?: string | null, options: SiteLinks
317
323
  const relatedIds = new Set<string>();
318
324
  const relatedUrls = new Set<string>();
319
325
  const relatedSites = (options.relatedSites ?? docsRelatedSites).flatMap((site) => {
320
- const href = site.id === 'hagicode-main' && !options.relatedSites
321
- ? marketingPath(locale, '/')
326
+ const href = site.supportsLocalePath
327
+ ? new URL(`${locale}/`, site.url.endsWith('/') ? site.url : `${site.url}/`).toString()
322
328
  : site.url;
323
329
  const normalizedUrl = normalizeUrl(href);
324
330
  if (site.id === options.siteId || renderedUrls.has(normalizedUrl)