@celestia-island/hikari 0.55.76 → 0.55.77
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 +1 -1
- package/src/components/HkThemeToggle.test.ts +23 -0
- package/src/components/HkThemeToggle.tsx +11 -2
- package/src/i18n/locales/ar/components.json +1 -0
- package/src/i18n/locales/de/components.json +1 -0
- package/src/i18n/locales/en/components.json +1 -0
- package/src/i18n/locales/es/components.json +1 -0
- package/src/i18n/locales/fr/components.json +1 -0
- package/src/i18n/locales/ja/components.json +1 -0
- package/src/i18n/locales/ko/components.json +1 -0
- package/src/i18n/locales/pt/components.json +1 -0
- package/src/i18n/locales/ru/components.json +1 -0
- package/src/i18n/locales/zh-Hans/components.json +1 -0
- package/src/i18n/locales/zh-Hant/components.json +1 -0
- package/src/theme/presets.ts +7 -0
package/package.json
CHANGED
|
@@ -427,3 +427,26 @@ describe("HkThemeToggle exposed closeMenu", () => {
|
|
|
427
427
|
expect(document.body.querySelector(".s-theme-menu")).toBeTruthy();
|
|
428
428
|
});
|
|
429
429
|
});
|
|
430
|
+
|
|
431
|
+
describe("HkThemeToggle theme names", () => {
|
|
432
|
+
it("localizes a name that is a message key and passes literal names through", async () => {
|
|
433
|
+
// The ThemePreset.name convention: a resolvable catalog key renders its
|
|
434
|
+
// message (hosts ship localized built-ins); anything else — user-named
|
|
435
|
+
// customs, strings that merely LOOK like dotted keys — renders raw,
|
|
436
|
+
// because t() falls back to the input when the key is unknown.
|
|
437
|
+
useTheme().addCustomTheme({ ...anyPresetTokens(), id: "test-keyed", name: "hikari::theme.defaultThemeName" });
|
|
438
|
+
useTheme().addCustomTheme({ ...anyPresetTokens(), id: "test-literal", name: "Not A Catalog Key.At All" });
|
|
439
|
+
const { container } = mountToggle(true);
|
|
440
|
+
await settle();
|
|
441
|
+
|
|
442
|
+
openMenu(container);
|
|
443
|
+
await settle();
|
|
444
|
+
|
|
445
|
+
const names = [...document.body.querySelectorAll<HTMLElement>(".s-theme-menu .s-theme-item-row .s-theme-item-name")]
|
|
446
|
+
.map((el) => el.textContent?.trim());
|
|
447
|
+
// en bundle value of the key (the test locale is hikari's default).
|
|
448
|
+
expect(names).toContain("Default");
|
|
449
|
+
expect(names).toContain("Not A Catalog Key.At All");
|
|
450
|
+
expect(names).not.toContain("hikari::theme.defaultThemeName");
|
|
451
|
+
});
|
|
452
|
+
});
|
|
@@ -24,7 +24,9 @@ const AUTO_MERGE_KEYS = ["light", "dark"];
|
|
|
24
24
|
|
|
25
25
|
/** Scoped payload handed to the `item-leading` / `item-trailing` slots:
|
|
26
26
|
* one object per theme row, carrying enough identity for the host to
|
|
27
|
-
* render swatches or affordances without re-deriving the preset.
|
|
27
|
+
* render swatches or affordances without re-deriving the preset.
|
|
28
|
+
* `name` is the RAW stored string — it may be a message key (see
|
|
29
|
+
* `ThemePreset.name`); the row cell resolves it through the catalog. */
|
|
28
30
|
export interface ThemeItemScope {
|
|
29
31
|
id: ThemeId;
|
|
30
32
|
name: string;
|
|
@@ -314,6 +316,13 @@ export const HkThemeToggle = defineComponent({
|
|
|
314
316
|
};
|
|
315
317
|
const leadingSlot = slots["item-leading"];
|
|
316
318
|
const trailingSlot = slots["item-trailing"];
|
|
319
|
+
// A preset/custom name may be a message key into hikari's own
|
|
320
|
+
// catalog (the documented ThemePreset.name convention — hosts
|
|
321
|
+
// ship localized built-ins like "hikari::theme.defaultThemeName").
|
|
322
|
+
// `t()` falls back to the raw string for anything that is not a
|
|
323
|
+
// key, so literal display names pass through unchanged, and the
|
|
324
|
+
// reactive message lookup re-renders rows on locale switches.
|
|
325
|
+
const displayName = t(th.name);
|
|
317
326
|
return (
|
|
318
327
|
<div
|
|
319
328
|
key={th.id}
|
|
@@ -334,7 +343,7 @@ export const HkThemeToggle = defineComponent({
|
|
|
334
343
|
) : currentTheme.value === th.id ? (
|
|
335
344
|
<span class="hk-menu-item-icon s-theme-item-check"><Check size={14} /></span>
|
|
336
345
|
) : null}
|
|
337
|
-
<span class="s-theme-item-name">{
|
|
346
|
+
<span class="s-theme-item-name">{displayName}</span>
|
|
338
347
|
</button>
|
|
339
348
|
{trailingSlot ? (
|
|
340
349
|
<span class="s-theme-item-trailing">{trailingSlot(scope)}</span>
|
|
@@ -220,6 +220,7 @@
|
|
|
220
220
|
"hikari::tagInput.reorder": "إعادة الترتيب — {label}",
|
|
221
221
|
"hikari::modal.hiddenLayers": "الطبقات المخفية",
|
|
222
222
|
"hikari::theme.modeTabHint": "هذه التبويبات تختار لوحة الألوان التي تحرّرها؛ لتبديل الوضع الفاتح/الداكن للتطبيق كله استخدم شريط الأوضاع أعلى نافذة السمة.",
|
|
223
|
+
"hikari::theme.defaultThemeName": "افتراضي",
|
|
223
224
|
"hikari::emptyState.loading": "جارٍ التحميل",
|
|
224
225
|
"hikari::mfaVerify.title": "التحقق من الحساب",
|
|
225
226
|
"hikari::mfaVerify.verifySubtitle": "جارٍ التحقق من {name} — أكمل طريقة تسجيل الدخول للمتابعة",
|
|
@@ -220,6 +220,7 @@
|
|
|
220
220
|
"hikari::tagInput.reorder": "Neu anordnen — {label}",
|
|
221
221
|
"hikari::modal.hiddenLayers": "Verdeckte Ebenen",
|
|
222
222
|
"hikari::theme.modeTabHint": "Diese Reiter wählen die zu bearbeitende Palette; die appweite Hell/Dunkel-Umschaltung liegt im Modusstreifen des Themen-Popups.",
|
|
223
|
+
"hikari::theme.defaultThemeName": "Standard",
|
|
223
224
|
"hikari::emptyState.loading": "Wird geladen",
|
|
224
225
|
"hikari::mfaVerify.title": "Konto verifizieren",
|
|
225
226
|
"hikari::mfaVerify.verifySubtitle": "{name} wird verifiziert — Anmeldung abschließen, um fortzufahren",
|
|
@@ -220,6 +220,7 @@
|
|
|
220
220
|
"hikari::tagInput.reorder": "Reorder {label}",
|
|
221
221
|
"hikari::modal.hiddenLayers": "Hidden layers",
|
|
222
222
|
"hikari::theme.modeTabHint": "These tabs pick which palette you are EDITING; to switch the app-wide light/dark, use the mode strip at the top of the theme popup.",
|
|
223
|
+
"hikari::theme.defaultThemeName": "Default",
|
|
223
224
|
"hikari::emptyState.loading": "Loading",
|
|
224
225
|
"hikari::mfaVerify.title": "Verify account",
|
|
225
226
|
"hikari::mfaVerify.verifySubtitle": "Verifying {name} — complete a sign-in method to continue",
|
|
@@ -220,6 +220,7 @@
|
|
|
220
220
|
"hikari::tagInput.reorder": "Reordenar — {label}",
|
|
221
221
|
"hikari::modal.hiddenLayers": "Capas ocultas",
|
|
222
222
|
"hikari::theme.modeTabHint": "Estas pestañas eligen la paleta que estás EDITANDO; para cambiar el modo claro/oscuro de toda la app, usa la franja de modos de la parte superior del panel de temas.",
|
|
223
|
+
"hikari::theme.defaultThemeName": "Predeterminado",
|
|
223
224
|
"hikari::emptyState.loading": "Cargando",
|
|
224
225
|
"hikari::mfaVerify.title": "Verificar cuenta",
|
|
225
226
|
"hikari::mfaVerify.verifySubtitle": "Verificando {name}: completa un método de acceso para continuar",
|
|
@@ -220,6 +220,7 @@
|
|
|
220
220
|
"hikari::tagInput.reorder": "Réorganiser — {label}",
|
|
221
221
|
"hikari::modal.hiddenLayers": "Couches masquées",
|
|
222
222
|
"hikari::theme.modeTabHint": "Ces onglets choisissent la palette éditée ; pour basculer clair/sombre dans toute l’app, utilisez la barre de mode du menu de thème.",
|
|
223
|
+
"hikari::theme.defaultThemeName": "Par défaut",
|
|
223
224
|
"hikari::emptyState.loading": "Chargement",
|
|
224
225
|
"hikari::mfaVerify.title": "Vérifier le compte",
|
|
225
226
|
"hikari::mfaVerify.verifySubtitle": "Vérification de {name} — terminez une méthode de connexion pour continuer",
|
|
@@ -220,6 +220,7 @@
|
|
|
220
220
|
"hikari::tagInput.reorder": "並べ替え — {label}",
|
|
221
221
|
"hikari::modal.hiddenLayers": "非表示の階層",
|
|
222
222
|
"hikari::theme.modeTabHint": "このタブは編集対象のパレットを選ぶだけです。アプリ全体の明/暗はテーマポップアップ上部のモードストリップで切り替えてください。",
|
|
223
|
+
"hikari::theme.defaultThemeName": "デフォルト",
|
|
223
224
|
"hikari::emptyState.loading": "読み込み中",
|
|
224
225
|
"hikari::mfaVerify.title": "アカウントの確認",
|
|
225
226
|
"hikari::mfaVerify.verifySubtitle": "{name} の本人確認を続行します",
|
|
@@ -220,6 +220,7 @@
|
|
|
220
220
|
"hikari::tagInput.reorder": "순서 변경 — {label}",
|
|
221
221
|
"hikari::modal.hiddenLayers": "숨겨진 레이어",
|
|
222
222
|
"hikari::theme.modeTabHint": "이 탭은 편집할 팔레트를 고를 뿐입니다. 앱 전체 밝기/어둠은 테마 팝업 상단의 모드 스트립에서 바꾸세요.",
|
|
223
|
+
"hikari::theme.defaultThemeName": "기본값",
|
|
223
224
|
"hikari::emptyState.loading": "불러오는 중",
|
|
224
225
|
"hikari::mfaVerify.title": "계정 확인",
|
|
225
226
|
"hikari::mfaVerify.verifySubtitle": "{name} 님의 신원을 확인하여 로그인을 계속하세요",
|
|
@@ -220,6 +220,7 @@
|
|
|
220
220
|
"hikari::tagInput.reorder": "Reordenar — {label}",
|
|
221
221
|
"hikari::modal.hiddenLayers": "Camadas ocultas",
|
|
222
222
|
"hikari::theme.modeTabHint": "Estas abas escolhem a paleta que você está EDITANDO; para alternar o claro/escuro do app inteiro, use a faixa de modos no topo do painel de temas.",
|
|
223
|
+
"hikari::theme.defaultThemeName": "Padrão",
|
|
223
224
|
"hikari::emptyState.loading": "Carregando",
|
|
224
225
|
"hikari::mfaVerify.title": "Verificar conta",
|
|
225
226
|
"hikari::mfaVerify.verifySubtitle": "Verificando {name} — conclua um método de acesso para continuar",
|
|
@@ -220,6 +220,7 @@
|
|
|
220
220
|
"hikari::tagInput.reorder": "Изменить порядок — {label}",
|
|
221
221
|
"hikari::modal.hiddenLayers": "Скрытые слои",
|
|
222
222
|
"hikari::theme.modeTabHint": "Вкладки выбирают редактируемую палитру; общесистемное переключение светлой/тёмной — в полосе режимов вверху меню темы.",
|
|
223
|
+
"hikari::theme.defaultThemeName": "По умолчанию",
|
|
223
224
|
"hikari::emptyState.loading": "Загрузка",
|
|
224
225
|
"hikari::mfaVerify.title": "Подтверждение аккаунта",
|
|
225
226
|
"hikari::mfaVerify.verifySubtitle": "Проверка {name} — завершите вход, чтобы продолжить",
|
|
@@ -224,6 +224,7 @@
|
|
|
224
224
|
"hikari::tagInput.reorder": "拖动排序 — {label}",
|
|
225
225
|
"hikari::modal.hiddenLayers": "隐藏层级",
|
|
226
226
|
"hikari::theme.modeTabHint": "切换这里编辑的是对应模式的调色板;要切换应用整体深/浅,请用主题弹窗顶部的模式条。",
|
|
227
|
+
"hikari::theme.defaultThemeName": "默认",
|
|
227
228
|
"hikari::emptyState.loading": "加载中",
|
|
228
229
|
"hikari::mfaVerify.title": "验证账户",
|
|
229
230
|
"hikari::mfaVerify.verifySubtitle": "正在验证 {name} 的身份,请完成验证以继续登录",
|
|
@@ -224,6 +224,7 @@
|
|
|
224
224
|
"hikari::tagInput.reorder": "拖曳排序 — {label}",
|
|
225
225
|
"hikari::modal.hiddenLayers": "隱藏層級",
|
|
226
226
|
"hikari::theme.modeTabHint": "切換這裡編輯的是對應模式的調色盤;要切換應用整體深/淺,請用主題彈窗頂部的模式條。",
|
|
227
|
+
"hikari::theme.defaultThemeName": "預設",
|
|
227
228
|
"hikari::emptyState.loading": "載入中",
|
|
228
229
|
"hikari::mfaVerify.title": "驗證帳戶",
|
|
229
230
|
"hikari::mfaVerify.verifySubtitle": "正在驗證 {name} 的身分,請完成驗證以繼續登入",
|
package/src/theme/presets.ts
CHANGED
|
@@ -60,6 +60,13 @@ export interface ThemeTokenGroupModes {
|
|
|
60
60
|
|
|
61
61
|
export interface ThemePreset {
|
|
62
62
|
id: string;
|
|
63
|
+
/**
|
|
64
|
+
* Display name: either a literal string or a message key resolvable in
|
|
65
|
+
* hikari's own i18n catalog (e.g. "hikari::theme.defaultThemeName").
|
|
66
|
+
* Theme rows resolve names through `t()`, which falls back to the raw
|
|
67
|
+
* string for anything that is not a key, so user-named customs and
|
|
68
|
+
* literal preset names render unchanged while keyed built-ins localize.
|
|
69
|
+
*/
|
|
63
70
|
name: string;
|
|
64
71
|
dark: ThemeSchemeTokens;
|
|
65
72
|
light: ThemeSchemeTokens;
|