@kiosko/sdk 0.2.7 → 0.2.9

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.
@@ -34,3 +34,11 @@ export declare const LANGUAGES: readonly Language[];
34
34
  export declare const LANGUAGE_IDS: readonly string[];
35
35
  /** The language with this id (`zh-Hant`), if Kiosko speaks it. */
36
36
  export declare function languageById(id: string): Language | undefined;
37
+ /** A region's name (`TW`, `ES`) in a language Kiosko speaks (`zh-Hans`). */
38
+ export declare function regionName(code: string, lang: string): string;
39
+ /**
40
+ * `a, b and c` in `lang`. Chinese lists with 、 throughout, the way prose and
41
+ * labels do (`Intl.ListFormat` gives `Linux、macOS和Windows`, glued to the
42
+ * Latin names).
43
+ */
44
+ export declare function listIn(items: readonly string[], lang: string): string;
package/dist/languages.js CHANGED
@@ -1,12 +1,15 @@
1
1
  /**
2
2
  * Simplified Chinese is read in mainland China, where Claude (and Gemini) are
3
- * not offered: no AI-agent, cats-room nor Claude-usage plugins there, and local
4
- * models (Qwen, DeepSeek… on your own GPU) in their place.
3
+ * not offered. The AI-agent plugins read the agents used there (agents 0.3:
4
+ * Qwen Code, Kimi CLI, iFlow, Codex, OpenCode, with the cats room on top) and
5
+ * `usage` the providers' balances (usage 0.3: DeepSeek, Kimi), so all are
6
+ * offered; local models lead, and the Claude-only usage widgets give way to
7
+ * the ones that read those providers.
5
8
  */
6
9
  const MAINLAND_CHINA = {
7
- without: ['agents', 'cats', 'usage'],
8
- first: ['llm', 'gpu'],
9
- instead: { 'agents/summary': 'llm/status', 'agents/sessions': 'llm/models', 'usage/rail': 'gpu/cards', 'cats/room': 'gpu/history' },
10
+ without: [],
11
+ first: ['llm', 'gpu', 'usage'],
12
+ instead: { 'usage/rail': 'usage/balance', 'usage/blocks': 'usage/agents' },
10
13
  };
11
14
  export const LANGUAGES = [
12
15
  { id: 'en', name: 'English', panel: 'en', ogLocale: 'en_US', hreflang: ['en', 'x-default'], dir: 'ltr' },
@@ -20,3 +23,40 @@ export const LANGUAGE_IDS = LANGUAGES.map((l) => l.id);
20
23
  export function languageById(id) {
21
24
  return LANGUAGES.find((l) => l.id === id);
22
25
  }
26
+ /**
27
+ * Region names as their readers write them, where `Intl.DisplayNames` says
28
+ * otherwise: mainland usage names Taiwan, Hong Kong and Macau as part of China
29
+ * (and a site that lists it among countries reads as foreign there); in
30
+ * Taiwan, Hong Kong is plain 香港, not the long official name.
31
+ */
32
+ const REGION_NAMES = {
33
+ 'zh-Hans': { TW: '中国台湾', HK: '中国香港', MO: '中国澳门' },
34
+ 'zh-Hant': { HK: '香港', MO: '澳門' },
35
+ };
36
+ /** A region's name (`TW`, `ES`) in a language Kiosko speaks (`zh-Hans`). */
37
+ export function regionName(code, lang) {
38
+ const own = REGION_NAMES[lang]?.[code.toUpperCase()];
39
+ if (own)
40
+ return own;
41
+ try {
42
+ return new Intl.DisplayNames([lang], { type: 'region' }).of(code) ?? code;
43
+ }
44
+ catch {
45
+ return code;
46
+ }
47
+ }
48
+ /**
49
+ * `a, b and c` in `lang`. Chinese lists with 、 throughout, the way prose and
50
+ * labels do (`Intl.ListFormat` gives `Linux、macOS和Windows`, glued to the
51
+ * Latin names).
52
+ */
53
+ export function listIn(items, lang) {
54
+ if (/^zh\b/.test(lang))
55
+ return items.join('、');
56
+ try {
57
+ return new Intl.ListFormat(lang, { type: 'conjunction' }).format(items);
58
+ }
59
+ catch {
60
+ return items.join(', ');
61
+ }
62
+ }
package/dist/plugin.d.ts CHANGED
@@ -571,7 +571,7 @@ export interface InterludeDefinition<OF extends ObjectField<any> = ObjectField<a
571
571
  * package.json, `"kiosko": { "sdk": "^0.2.0" }`, so it can be refused before
572
572
  * it runs); the registry compares them with `satisfies`.
573
573
  */
574
- export declare const SDK_VERSION = "0.2.7";
574
+ export declare const SDK_VERSION = "0.2.9";
575
575
  /**
576
576
  * What a plugin does on the machine, declared for the person who installs
577
577
  * it: the Plugins page and the plugin store show it next to the plugin. It
package/dist/plugin.js CHANGED
@@ -4,7 +4,7 @@ export const CATEGORIES = [
4
4
  { id: 'time', label: { en: 'Time & calendar', es: 'Tiempo y agenda', de: 'Zeit & Kalender', 'zh-Hant': '時間與行事曆', 'zh-Hans': '时间与日历' } },
5
5
  { id: 'productivity', label: { en: 'Productivity', es: 'Productividad', de: 'Produktivität', 'zh-Hant': '生產力', 'zh-Hans': '效率' } },
6
6
  { id: 'dev', label: { en: 'Development', es: 'Desarrollo', de: 'Entwicklung', 'zh-Hant': '開發', 'zh-Hans': '开发' } },
7
- { id: 'info', label: { en: 'News & world', es: 'Noticias y mundo', de: 'Nachrichten & Welt', 'zh-Hant': '新聞與世界', 'zh-Hans': '新闻与世界' } },
7
+ { id: 'info', label: { en: 'News & world', es: 'Noticias y mundo', de: 'Nachrichten & Welt', 'zh-Hant': '資訊與生活', 'zh-Hans': '资讯与生活' } },
8
8
  { id: 'media', label: { en: 'Media', es: 'Multimedia', de: 'Medien', 'zh-Hant': '多媒體', 'zh-Hans': '多媒体' } },
9
9
  { id: 'scene', label: { en: 'Scenes', es: 'Escenas', de: 'Szenen', 'zh-Hant': '場景', 'zh-Hans': '场景' } },
10
10
  { id: 'fun', label: { en: 'Fun', es: 'Diversión', de: 'Spaß', 'zh-Hant': '趣味', 'zh-Hans': '趣味' } },
@@ -18,7 +18,7 @@ export const PAD_KEYS = ['up', 'down', 'left', 'right', 'a', 'b', 'x', 'y', 'l',
18
18
  * package.json, `"kiosko": { "sdk": "^0.2.0" }`, so it can be refused before
19
19
  * it runs); the registry compares them with `satisfies`.
20
20
  */
21
- export const SDK_VERSION = '0.2.7';
21
+ export const SDK_VERSION = '0.2.9';
22
22
  /* Identity helpers: they only exist so TypeScript infers option and data types. */
23
23
  export function defineWidget(w) {
24
24
  return w;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiosko/sdk",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "Plugin SDK for Kiosko: define widgets, data sources and interludes for small always-on LCD panels.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -65,5 +65,5 @@
65
65
  "url": "git+https://github.com/kiosko-lcd/kiosko.git",
66
66
  "directory": "packages/sdk"
67
67
  },
68
- "author": "Loksly"
68
+ "author": "Loksly <info@kioskolcd.dev> (https://kioskolcd.dev)"
69
69
  }
package/src/languages.ts CHANGED
@@ -29,13 +29,16 @@ export interface Language {
29
29
 
30
30
  /**
31
31
  * Simplified Chinese is read in mainland China, where Claude (and Gemini) are
32
- * not offered: no AI-agent, cats-room nor Claude-usage plugins there, and local
33
- * models (Qwen, DeepSeek… on your own GPU) in their place.
32
+ * not offered. The AI-agent plugins read the agents used there (agents 0.3:
33
+ * Qwen Code, Kimi CLI, iFlow, Codex, OpenCode, with the cats room on top) and
34
+ * `usage` the providers' balances (usage 0.3: DeepSeek, Kimi), so all are
35
+ * offered; local models lead, and the Claude-only usage widgets give way to
36
+ * the ones that read those providers.
34
37
  */
35
38
  const MAINLAND_CHINA: NonNullable<Language['plugins']> = {
36
- without: ['agents', 'cats', 'usage'],
37
- first: ['llm', 'gpu'],
38
- instead: { 'agents/summary': 'llm/status', 'agents/sessions': 'llm/models', 'usage/rail': 'gpu/cards', 'cats/room': 'gpu/history' },
39
+ without: [],
40
+ first: ['llm', 'gpu', 'usage'],
41
+ instead: { 'usage/rail': 'usage/balance', 'usage/blocks': 'usage/agents' },
39
42
  };
40
43
 
41
44
  export const LANGUAGES: readonly Language[] = [
@@ -52,3 +55,39 @@ export const LANGUAGE_IDS: readonly string[] = LANGUAGES.map((l) => l.id);
52
55
  export function languageById(id: string): Language | undefined {
53
56
  return LANGUAGES.find((l) => l.id === id);
54
57
  }
58
+
59
+ /**
60
+ * Region names as their readers write them, where `Intl.DisplayNames` says
61
+ * otherwise: mainland usage names Taiwan, Hong Kong and Macau as part of China
62
+ * (and a site that lists it among countries reads as foreign there); in
63
+ * Taiwan, Hong Kong is plain 香港, not the long official name.
64
+ */
65
+ const REGION_NAMES: Record<string, Readonly<Record<string, string>>> = {
66
+ 'zh-Hans': { TW: '中国台湾', HK: '中国香港', MO: '中国澳门' },
67
+ 'zh-Hant': { HK: '香港', MO: '澳門' },
68
+ };
69
+
70
+ /** A region's name (`TW`, `ES`) in a language Kiosko speaks (`zh-Hans`). */
71
+ export function regionName(code: string, lang: string): string {
72
+ const own = REGION_NAMES[lang]?.[code.toUpperCase()];
73
+ if (own) return own;
74
+ try {
75
+ return new Intl.DisplayNames([lang], { type: 'region' }).of(code) ?? code;
76
+ } catch {
77
+ return code;
78
+ }
79
+ }
80
+
81
+ /**
82
+ * `a, b and c` in `lang`. Chinese lists with 、 throughout, the way prose and
83
+ * labels do (`Intl.ListFormat` gives `Linux、macOS和Windows`, glued to the
84
+ * Latin names).
85
+ */
86
+ export function listIn(items: readonly string[], lang: string): string {
87
+ if (/^zh\b/.test(lang)) return items.join('、');
88
+ try {
89
+ return new Intl.ListFormat(lang, { type: 'conjunction' }).format(items);
90
+ } catch {
91
+ return items.join(', ');
92
+ }
93
+ }
package/src/plugin.ts CHANGED
@@ -67,7 +67,7 @@ export const CATEGORIES: { id: Category; label: Localized }[] = [
67
67
  { id: 'time', label: { en: 'Time & calendar', es: 'Tiempo y agenda', de: 'Zeit & Kalender', 'zh-Hant': '時間與行事曆', 'zh-Hans': '时间与日历' } },
68
68
  { id: 'productivity', label: { en: 'Productivity', es: 'Productividad', de: 'Produktivität', 'zh-Hant': '生產力', 'zh-Hans': '效率' } },
69
69
  { id: 'dev', label: { en: 'Development', es: 'Desarrollo', de: 'Entwicklung', 'zh-Hant': '開發', 'zh-Hans': '开发' } },
70
- { id: 'info', label: { en: 'News & world', es: 'Noticias y mundo', de: 'Nachrichten & Welt', 'zh-Hant': '新聞與世界', 'zh-Hans': '新闻与世界' } },
70
+ { id: 'info', label: { en: 'News & world', es: 'Noticias y mundo', de: 'Nachrichten & Welt', 'zh-Hant': '資訊與生活', 'zh-Hans': '资讯与生活' } },
71
71
  { id: 'media', label: { en: 'Media', es: 'Multimedia', de: 'Medien', 'zh-Hant': '多媒體', 'zh-Hans': '多媒体' } },
72
72
  { id: 'scene', label: { en: 'Scenes', es: 'Escenas', de: 'Szenen', 'zh-Hant': '場景', 'zh-Hans': '场景' } },
73
73
  { id: 'fun', label: { en: 'Fun', es: 'Diversión', de: 'Spaß', 'zh-Hant': '趣味', 'zh-Hans': '趣味' } },
@@ -566,7 +566,7 @@ export interface InterludeDefinition<OF extends ObjectField<any> = ObjectField<a
566
566
  * package.json, `"kiosko": { "sdk": "^0.2.0" }`, so it can be refused before
567
567
  * it runs); the registry compares them with `satisfies`.
568
568
  */
569
- export const SDK_VERSION = '0.2.7';
569
+ export const SDK_VERSION = '0.2.9';
570
570
 
571
571
  /**
572
572
  * What a plugin does on the machine, declared for the person who installs