@rimelight/ui 0.0.2 → 0.0.4

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.
Files changed (105) hide show
  1. package/package.json +6 -3
  2. package/src/components/carousel/carousel-script.ts +188 -188
  3. package/src/components/carousel/index.ts +1 -1
  4. package/src/components/input-otp/InputOtpTypes.ts +6 -6
  5. package/src/components/radio-group/RadioGroupTypes.ts +6 -6
  6. package/src/components/select/SelectTypes.ts +13 -13
  7. package/src/components/switch/SwitchTypes.ts +6 -6
  8. package/src/components/toast/index.ts +1 -1
  9. package/src/components/toast/toast-manager.ts +234 -234
  10. package/src/components/toggle/ToggleTypes.ts +14 -14
  11. package/src/config/cookies.ts +5 -5
  12. package/src/config/index.ts +3 -3
  13. package/src/config/links.ts +4 -4
  14. package/src/config/site.config.ts +27 -45
  15. package/src/domain/cms/index.ts +1 -1
  16. package/src/domain/cms/types.ts +20 -20
  17. package/src/domain/i18n/constants.ts +21 -21
  18. package/src/domain/i18n/cookie-storage.ts +13 -13
  19. package/src/domain/i18n/country-to-locale-map.ts +67 -67
  20. package/src/domain/i18n/fetcher.ts +278 -268
  21. package/src/domain/i18n/flags.ts +16 -16
  22. package/src/domain/i18n/format.ts +90 -90
  23. package/src/domain/i18n/index.ts +10 -10
  24. package/src/domain/i18n/middleware/i18n.ts +161 -160
  25. package/src/domain/i18n/resolve-locale.ts +55 -55
  26. package/src/domain/i18n/schema.ts +29 -29
  27. package/src/domain/index.ts +4 -4
  28. package/src/domain/seo/constants.ts +6 -20
  29. package/src/domain/seo/index.ts +3 -3
  30. package/src/domain/seo/services/index.ts +3 -3
  31. package/src/domain/seo/services/llms.ts +56 -53
  32. package/src/domain/seo/services/robots.ts +12 -12
  33. package/src/domain/seo/services/sitemap.ts +56 -56
  34. package/src/domain/seo/utils.ts +36 -37
  35. package/src/domain/theme/constants.ts +6 -6
  36. package/src/domain/theme/index.ts +2 -2
  37. package/src/domain/theme/schema.ts +10 -10
  38. package/src/env.d.ts +49 -49
  39. package/src/integrations/index.ts +1 -0
  40. package/src/integrations/sri.ts +92 -0
  41. package/src/lib/component-preview.ts +73 -73
  42. package/src/lib/index.ts +6 -6
  43. package/src/lib/remark/remark-modified-time.ts +13 -13
  44. package/src/lib/showcase-preview-elements.ts +408 -408
  45. package/src/lib/showcase-renderer.ts +218 -218
  46. package/src/lib/showcase-utils.ts +189 -189
  47. package/src/lib/turnstile.ts +35 -35
  48. package/src/lib/utils/starwind/positioning.ts +318 -318
  49. package/src/locales/de/blog.json +9 -9
  50. package/src/locales/de/common.json +19 -19
  51. package/src/locales/de/errors.json +6 -6
  52. package/src/locales/de/home.json +20 -20
  53. package/src/locales/de/messages.json +8 -8
  54. package/src/locales/de/nav.json +13 -13
  55. package/src/locales/de/projects.json +9 -9
  56. package/src/locales/de/services.json +43 -43
  57. package/src/locales/en/blog.json +9 -9
  58. package/src/locales/en/chat.json +29 -29
  59. package/src/locales/en/common.json +19 -19
  60. package/src/locales/en/cookie_notice.json +11 -11
  61. package/src/locales/en/editor.json +24 -24
  62. package/src/locales/en/errors.json +6 -6
  63. package/src/locales/en/home.json +20 -20
  64. package/src/locales/en/messages.json +8 -8
  65. package/src/locales/en/nav.json +13 -13
  66. package/src/locales/en/projects.json +9 -9
  67. package/src/locales/en/services.json +43 -43
  68. package/src/locales/es/blog.json +9 -9
  69. package/src/locales/es/common.json +19 -19
  70. package/src/locales/es/errors.json +6 -6
  71. package/src/locales/es/home.json +20 -20
  72. package/src/locales/es/messages.json +8 -8
  73. package/src/locales/es/nav.json +13 -13
  74. package/src/locales/es/projects.json +9 -9
  75. package/src/locales/es/services.json +43 -43
  76. package/src/locales/ja/blog.json +9 -9
  77. package/src/locales/ja/common.json +19 -19
  78. package/src/locales/ja/errors.json +6 -6
  79. package/src/locales/ja/home.json +20 -20
  80. package/src/locales/ja/messages.json +8 -8
  81. package/src/locales/ja/nav.json +13 -13
  82. package/src/locales/ja/projects.json +9 -9
  83. package/src/locales/ja/services.json +43 -43
  84. package/src/locales/pt/blog.json +9 -9
  85. package/src/locales/pt/chat.json +29 -29
  86. package/src/locales/pt/common.json +19 -19
  87. package/src/locales/pt/cookie_notice.json +11 -11
  88. package/src/locales/pt/editor.json +24 -24
  89. package/src/locales/pt/errors.json +6 -6
  90. package/src/locales/pt/home.json +20 -20
  91. package/src/locales/pt/messages.json +8 -8
  92. package/src/locales/pt/nav.json +13 -13
  93. package/src/locales/pt/projects.json +9 -9
  94. package/src/locales/pt/services.json +43 -43
  95. package/src/middleware/index.ts +2 -0
  96. package/src/middleware/security.ts +15 -0
  97. package/src/middleware/sri.ts +78 -0
  98. package/src/utils/index.ts +2 -2
  99. package/src/utils/server/cookies.ts +98 -98
  100. package/src/utils/server/index.ts +1 -1
  101. package/src/utils/shared/deep-merge.ts +36 -36
  102. package/src/utils/shared/embed.ts +105 -105
  103. package/src/utils/shared/index.ts +3 -3
  104. package/src/utils/shared/parse-boolean.ts +14 -14
  105. package/worker-configuration.d.ts +0 -14791
@@ -1,21 +1,21 @@
1
- // Locales Configuration
2
- export const SUPPORTED_LOCALES = ["en", "pt", "ja", "de", "es"] as const
3
- export type SupportedLocales = (typeof SUPPORTED_LOCALES)[number]
4
-
5
- // Default locale
6
- export const DEFAULT_LOCALE: SupportedLocales = "en"
7
-
8
- // Missing translation banner flag
9
- export const ENABLE_MISSING_TRANSLATION_BANNER = true
10
-
11
- // UI Labels
12
- export const LANGUAGES: Record<SupportedLocales, string> = {
13
- en: "English",
14
- pt: "Português",
15
- ja: "日本語",
16
- de: "Deutsch",
17
- es: "Español"
18
- }
19
-
20
- // Cookie name
21
- export const LANG_COOKIE_NAME = "lang"
1
+ // Locales Configuration
2
+ export const SUPPORTED_LOCALES = ["en", "pt", "ja", "de", "es"] as const
3
+ export type SupportedLocales = (typeof SUPPORTED_LOCALES)[number]
4
+
5
+ // Default locale
6
+ export const DEFAULT_LOCALE: SupportedLocales = "en"
7
+
8
+ // Missing translation banner flag
9
+ export const ENABLE_MISSING_TRANSLATION_BANNER = true
10
+
11
+ // UI Labels
12
+ export const LANGUAGES: Record<SupportedLocales, string> = {
13
+ en: "English",
14
+ pt: "Português",
15
+ ja: "日本語",
16
+ de: "Deutsch",
17
+ es: "Español"
18
+ }
19
+
20
+ // Cookie name
21
+ export const LANG_COOKIE_NAME = "lang"
@@ -1,13 +1,13 @@
1
- import { type AstroCookies } from "astro"
2
-
3
- import { type Locale, LocaleSchema } from "./schema"
4
- import { setCookie, getCookieWithSchema } from "../../utils/server/cookies"
5
- import { LANG_COOKIE_NAME } from "./constants"
6
-
7
- export function setCookieLang(cookies: AstroCookies, locale: Locale) {
8
- setCookie(cookies, LANG_COOKIE_NAME, locale)
9
- }
10
-
11
- export function getCookieLang(cookies: AstroCookies): Locale | null {
12
- return getCookieWithSchema(cookies, LANG_COOKIE_NAME, LocaleSchema)
13
- }
1
+ import { type AstroCookies } from "astro"
2
+
3
+ import { type Locale, LocaleSchema } from "./schema"
4
+ import { setCookie, getCookieWithSchema } from "../../utils/server/cookies"
5
+ import { LANG_COOKIE_NAME } from "./constants"
6
+
7
+ export function setCookieLang(cookies: AstroCookies, locale: Locale) {
8
+ setCookie(cookies, LANG_COOKIE_NAME, locale)
9
+ }
10
+
11
+ export function getCookieLang(cookies: AstroCookies): Locale | null {
12
+ return getCookieWithSchema(cookies, LANG_COOKIE_NAME, LocaleSchema)
13
+ }
@@ -1,67 +1,67 @@
1
- import type { Locale } from "./schema.ts"
2
-
3
- // Key: ISO 3166-1 Alpha-2 Country Code (from request.cf.country)
4
- // Value: The optimal language to serve
5
- const GEO_MAP: Record<string, Locale> = {
6
- // --- ANGLOSPHERE (Explicitly set to EN) ---
7
- US: "en", // United States
8
- GB: "en", // United Kingdom
9
- AU: "en", // Australia
10
- NZ: "en", // New Zealand
11
- IE: "en", // Ireland
12
- CA: "en", // Canada (Majority EN, fallbacks handle FR better via Accept-Language headers)
13
-
14
- // --- DACH (German) ---
15
- DE: "de",
16
- AT: "de",
17
- CH: "de",
18
- LI: "de",
19
-
20
- // --- LATAM + SPAIN ---
21
- ES: "es",
22
- MX: "es",
23
- AR: "es",
24
- CO: "es",
25
- CL: "es",
26
- PE: "es",
27
- VE: "es",
28
- GT: "es",
29
- EC: "es",
30
-
31
- // Asia
32
- JP: "ja",
33
-
34
- // --- LUSOPHONE (Portuguese) ---
35
- PT: "pt",
36
- BR: "pt",
37
- AO: "pt",
38
- MZ: "pt"
39
-
40
- // --- FRANCOPHONE ---
41
- // FR: 'fr',
42
- // BE: 'fr',
43
- // MC: 'fr',
44
- // SN: 'fr',
45
-
46
- // --- SLAVIC / POST-SOVIET ---
47
- // UA: 'uk',
48
- // RU: 'ru',
49
- // KZ: 'ru',
50
- // BY: 'ru',
51
-
52
- // Add other mappings as needed...
53
- }
54
-
55
- /**
56
- * Maps a Cloudflare Country Code to a supported App Locale. Returns undefined if no direct mapping
57
- * exists (falling back to default strategy).
58
- */
59
- export function mapCountryToLocale(country: unknown): string | undefined {
60
- // Safety: In dev mode (localhost), 'country' might be null or undefined.
61
- if (typeof country !== "string") return undefined
62
-
63
- // Cloudflare always sends uppercase (e.g., 'US', 'DE'), but safety first.
64
- const code = country.toUpperCase()
65
-
66
- return GEO_MAP[code]
67
- }
1
+ import type { Locale } from "./schema.ts"
2
+
3
+ // Key: ISO 3166-1 Alpha-2 Country Code (from request.cf.country)
4
+ // Value: The optimal language to serve
5
+ const GEO_MAP: Record<string, Locale> = {
6
+ // --- ANGLOSPHERE (Explicitly set to EN) ---
7
+ US: "en", // United States
8
+ GB: "en", // United Kingdom
9
+ AU: "en", // Australia
10
+ NZ: "en", // New Zealand
11
+ IE: "en", // Ireland
12
+ CA: "en", // Canada (Majority EN, fallbacks handle FR better via Accept-Language headers)
13
+
14
+ // --- DACH (German) ---
15
+ DE: "de",
16
+ AT: "de",
17
+ CH: "de",
18
+ LI: "de",
19
+
20
+ // --- LATAM + SPAIN ---
21
+ ES: "es",
22
+ MX: "es",
23
+ AR: "es",
24
+ CO: "es",
25
+ CL: "es",
26
+ PE: "es",
27
+ VE: "es",
28
+ GT: "es",
29
+ EC: "es",
30
+
31
+ // Asia
32
+ JP: "ja",
33
+
34
+ // --- LUSOPHONE (Portuguese) ---
35
+ PT: "pt",
36
+ BR: "pt",
37
+ AO: "pt",
38
+ MZ: "pt"
39
+
40
+ // --- FRANCOPHONE ---
41
+ // FR: 'fr',
42
+ // BE: 'fr',
43
+ // MC: 'fr',
44
+ // SN: 'fr',
45
+
46
+ // --- SLAVIC / POST-SOVIET ---
47
+ // UA: 'uk',
48
+ // RU: 'ru',
49
+ // KZ: 'ru',
50
+ // BY: 'ru',
51
+
52
+ // Add other mappings as needed...
53
+ }
54
+
55
+ /**
56
+ * Maps a Cloudflare Country Code to a supported App Locale. Returns undefined if no direct mapping
57
+ * exists (falling back to default strategy).
58
+ */
59
+ export function mapCountryToLocale(country: unknown): string | undefined {
60
+ // Safety: In dev mode (localhost), 'country' might be null or undefined.
61
+ if (typeof country !== "string") return undefined
62
+
63
+ // Cloudflare always sends uppercase (e.g., 'US', 'DE'), but safety first.
64
+ const code = country.toUpperCase()
65
+
66
+ return GEO_MAP[code]
67
+ }