@uniweb/kit 0.13.2 → 0.13.3

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 (2) hide show
  1. package/package.json +4 -4
  2. package/src/utils/index.js +15 -50
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/kit",
3
- "version": "0.13.2",
3
+ "version": "0.13.3",
4
4
  "description": "Standard component library for Uniweb foundations",
5
5
  "type": "module",
6
6
  "exports": {
@@ -44,9 +44,9 @@
44
44
  "shiki": "^3.0.0",
45
45
  "tailwind-merge": "^3.6.0",
46
46
  "temml": "^0.13.2",
47
- "@uniweb/core": "^0.11.1",
48
- "@uniweb/semantic-parser": "^1.3.0",
49
- "@uniweb/scene": "^0.1.3"
47
+ "@uniweb/core": "^0.11.2",
48
+ "@uniweb/scene": "^0.1.3",
49
+ "@uniweb/semantic-parser": "^1.3.0"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "react": "^19.0.0",
@@ -15,47 +15,23 @@ export { twMerge, twJoin }
15
15
  // ─────────────────────────────────────────────────────────────────
16
16
 
17
17
  /**
18
- * Common locale display names (native language names)
19
- * Used as fallback when site.yml doesn't specify labels.
20
- * Tree-shakeable: only included if foundation uses getLocaleLabel().
18
+ * Locale display names and label resolution now live in `@uniweb/core`, because
19
+ * core is what BUILDS the locale objects a foundation reads (`getLocales()`,
20
+ * `website.langs`) and could not resolve a label from over here. Re-exported so
21
+ * `import { LOCALE_DISPLAY_NAMES } from '@uniweb/kit'` keeps working.
22
+ *
23
+ * Imported by leaf subpath, not bare `@uniweb/core`, to keep the graph kit drags
24
+ * into every foundation bundle small — the same reason `@uniweb/projections`
25
+ * reaches for `@uniweb/core/locale-config`.
21
26
  */
22
- export const LOCALE_DISPLAY_NAMES = {
23
- en: 'English',
24
- es: 'Español',
25
- fr: 'Français',
26
- de: 'Deutsch',
27
- it: 'Italiano',
28
- pt: 'Português',
29
- nl: 'Nederlands',
30
- pl: 'Polski',
31
- ru: 'Русский',
32
- ja: '日本語',
33
- ko: '한국어',
34
- zh: '中文',
35
- 'zh-CN': '简体中文',
36
- 'zh-TW': '繁體中文',
37
- ar: 'العربية',
38
- he: 'עברית',
39
- hi: 'हिन्दी',
40
- th: 'ไทย',
41
- vi: 'Tiếng Việt',
42
- tr: 'Türkçe',
43
- uk: 'Українська',
44
- cs: 'Čeština',
45
- el: 'Ελληνικά',
46
- hu: 'Magyar',
47
- ro: 'Română',
48
- sv: 'Svenska',
49
- da: 'Dansk',
50
- fi: 'Suomi',
51
- no: 'Norsk',
52
- id: 'Bahasa Indonesia',
53
- ms: 'Bahasa Melayu'
54
- }
27
+ export { LOCALE_DISPLAY_NAMES } from '@uniweb/core/locale-config'
55
28
 
56
29
  /**
57
- * Get display label for a locale
58
- * Priority: locale.label (from site config) LOCALE_DISPLAY_NAMES code.toUpperCase()
30
+ * Get display label for a locale.
31
+ * Priority: locale.label (from site config) -> LOCALE_DISPLAY_NAMES -> code.toUpperCase()
32
+ *
33
+ * Thin alias for core's `localeLabel` — kept so the kit-facing name and the
34
+ * existing foundation call sites do not move.
59
35
  *
60
36
  * @param {Object|string} locale - Locale object {code, label?} or locale code string
61
37
  * @returns {string} Display label for the locale
@@ -66,18 +42,7 @@ export const LOCALE_DISPLAY_NAMES = {
66
42
  * getLocaleLabel('es') // 'Español'
67
43
  * getLocaleLabel({ code: 'xx' }) // 'XX'
68
44
  */
69
- export function getLocaleLabel(locale) {
70
- // Handle string input (just a code)
71
- if (typeof locale === 'string') {
72
- return LOCALE_DISPLAY_NAMES[locale] || locale.toUpperCase()
73
- }
74
-
75
- // Handle object input
76
- if (!locale || !locale.code) return ''
77
-
78
- // Priority: explicit label → known display name → uppercase code
79
- return locale.label || LOCALE_DISPLAY_NAMES[locale.code] || locale.code.toUpperCase()
80
- }
45
+ export { localeLabel as getLocaleLabel } from '@uniweb/core/locale-config'
81
46
 
82
47
  // ─────────────────────────────────────────────────────────────────
83
48
  // Icon Utilities