@celestia-island/hikari 0.55.482 → 0.55.484
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/dist/types/theme/themeVarsCss.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/HkAdminHeader.test.tsx +36 -0
- package/src/components/HkAdminHeader.tsx +34 -7
- package/src/components/adminHeaderBrand.contract.test.ts +26 -13
- package/src/i18n/locales/ar/components.json +1 -0
- package/src/i18n/locales/ar/components.toml +1 -0
- package/src/i18n/locales/de/components.json +1 -0
- package/src/i18n/locales/de/components.toml +1 -0
- package/src/i18n/locales/en/components.json +1 -0
- package/src/i18n/locales/en/components.toml +1 -0
- package/src/i18n/locales/es/components.json +1 -0
- package/src/i18n/locales/es/components.toml +1 -0
- package/src/i18n/locales/fr/components.json +1 -0
- package/src/i18n/locales/fr/components.toml +1 -0
- package/src/i18n/locales/ja/components.json +1 -0
- package/src/i18n/locales/ja/components.toml +1 -0
- package/src/i18n/locales/ko/components.json +1 -0
- package/src/i18n/locales/ko/components.toml +1 -0
- package/src/i18n/locales/pt/components.json +1 -0
- package/src/i18n/locales/pt/components.toml +1 -0
- package/src/i18n/locales/ru/components.json +1 -0
- package/src/i18n/locales/ru/components.toml +1 -0
- package/src/i18n/locales/zh-Hans/components.json +1 -0
- package/src/i18n/locales/zh-Hans/components.toml +1 -0
- package/src/i18n/locales/zh-Hant/components.json +1 -0
- package/src/i18n/locales/zh-Hant/components.toml +1 -0
- package/src/styles/admin-tokens.scss +15 -0
- package/src/styles/theme-vars.css +117 -0
- package/src/theme/themeVarsCss.contract.test.ts +65 -0
- package/src/theme/themeVarsCss.ts +56 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function buildThemeVarsCss(): string;
|
package/package.json
CHANGED
|
@@ -589,4 +589,40 @@ describe("HkAdminHeader host slots (L39 ruling-a revival)", () => {
|
|
|
589
589
|
expect(c.querySelector(".locale-popup")).toBeNull();
|
|
590
590
|
expect(c.textContent).not.toContain("Account center");
|
|
591
591
|
});
|
|
592
|
+
|
|
593
|
+
it("makes the brand the drawer trigger on mobile and drops the standalone hamburger", async () => {
|
|
594
|
+
// Brand-as-trigger (2026-11-25 user direction): with a brand on the
|
|
595
|
+
// menu face, the hamburger is redundant chrome and — worse — mounts
|
|
596
|
+
// only after JS, leaving pre-hydration phones with no nav affordance.
|
|
597
|
+
// The brand renders in SSR, so IT carries the trigger.
|
|
598
|
+
let fired = 0;
|
|
599
|
+
const c = mount(headerNode({
|
|
600
|
+
showHamburger: true,
|
|
601
|
+
brandSrc: "/logo.webp",
|
|
602
|
+
avatarAction: "menu",
|
|
603
|
+
title: "Docs",
|
|
604
|
+
onHamburger: () => { fired += 1; },
|
|
605
|
+
}));
|
|
606
|
+
expect(c.querySelector(".s-admin-header-hamburger-icon"), "standalone hamburger is gone").toBeNull();
|
|
607
|
+
const trigger = c.querySelector("button.s-admin-header-brand--trigger");
|
|
608
|
+
expect(trigger, "the brand is a real button").toBeTruthy();
|
|
609
|
+
expect(trigger?.querySelector("img"), "carrying the mark").toBeTruthy();
|
|
610
|
+
await click(trigger);
|
|
611
|
+
expect(fired, "clicking the brand opens the drawer").toBe(1);
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
it("keeps the standalone hamburger on faces without a brand", () => {
|
|
615
|
+
// The fallback: no brand → nothing else to tap → the hamburger stays.
|
|
616
|
+
const c = mount(headerNode({ showHamburger: true, avatarAction: "menu", title: "Docs" }));
|
|
617
|
+
expect(c.querySelector(".s-admin-header-hamburger-icon")).toBeTruthy();
|
|
618
|
+
expect(c.querySelector(".s-admin-header-brand--trigger")).toBeNull();
|
|
619
|
+
});
|
|
620
|
+
|
|
621
|
+
it("keeps the desktop brand a non-control span", () => {
|
|
622
|
+
// Desktop (showHamburger=false): the brand stays identity-not-control.
|
|
623
|
+
const c = mount(headerNode({ brandSrc: "/logo.webp", avatarAction: "menu", title: "Docs" }));
|
|
624
|
+
expect(c.querySelector("span.s-admin-header-brand")).toBeTruthy();
|
|
625
|
+
expect(c.querySelector("button.s-admin-header-brand--trigger")).toBeNull();
|
|
626
|
+
expect(c.querySelector(".s-admin-header-hamburger-icon")).toBeNull();
|
|
627
|
+
});
|
|
592
628
|
});
|
|
@@ -374,8 +374,18 @@ export const HkAdminHeader = defineComponent({
|
|
|
374
374
|
* above owns the header's columns, and a fourth in-flow child
|
|
375
375
|
* would fall into the left wing's track and skew every column
|
|
376
376
|
* after it. Inside the wing it keeps its place (leftmost, ahead
|
|
377
|
-
* of the avatar) at the wing's own 16px rhythm.
|
|
378
|
-
|
|
377
|
+
* of the avatar) at the wing's own 16px rhythm.
|
|
378
|
+
*
|
|
379
|
+
* BRAND-AS-TRIGGER (2026-11-25 user direction): when the face
|
|
380
|
+
* carries a brand mark, the mark ITSELF is the drawer trigger —
|
|
381
|
+
* the standalone hamburger is redundant chrome (多此一举) and,
|
|
382
|
+
* worse, it only mounts after JS (the shell's mounted gate),
|
|
383
|
+
* leaving a pre-hydration phone with NO visible nav affordance.
|
|
384
|
+
* The brand renders in SSR, so making it the trigger gives the
|
|
385
|
+
* phone a visible menu affordance from first paint. The standalone
|
|
386
|
+
* hamburger stays only for faces WITHOUT a brand (there is
|
|
387
|
+
* nothing else to tap). */}
|
|
388
|
+
{props.showHamburger && !brandedMenuFace.value && (
|
|
379
389
|
<HButton
|
|
380
390
|
variant="ghost"
|
|
381
391
|
size="sm"
|
|
@@ -405,11 +415,28 @@ export const HkAdminHeader = defineComponent({
|
|
|
405
415
|
* dropdown and its carrier slots) does not mount at all —
|
|
406
416
|
* the ZERO ACCOUNT SURFACE clause of the brand contract. */}
|
|
407
417
|
{brandedMenuFace.value && (
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
418
|
+
props.showHamburger ? (
|
|
419
|
+
/* Mobile drawer face: the brand IS the menu trigger (see the
|
|
420
|
+
* brand-as-trigger note at the hamburger above). A real button
|
|
421
|
+
* so the affordance is honest; the static-brand styling stays
|
|
422
|
+
* via the shared class, the trigger chrome is pinned off. */
|
|
423
|
+
<button
|
|
424
|
+
type="button"
|
|
425
|
+
class="s-admin-header-brand s-admin-header-brand--trigger"
|
|
426
|
+
aria-label={t("hikari::adminHeader.openNav", "Open navigation")}
|
|
427
|
+
onClick={() => emit("hamburger")}
|
|
428
|
+
>
|
|
429
|
+
{slots.brand ? slots.brand() : (
|
|
430
|
+
<HkLogo src={props.brandSrc} alt={props.brandAlt} size="sm" />
|
|
431
|
+
)}
|
|
432
|
+
</button>
|
|
433
|
+
) : (
|
|
434
|
+
<span class="s-admin-header-brand">
|
|
435
|
+
{slots.brand ? slots.brand() : (
|
|
436
|
+
<HkLogo src={props.brandSrc} alt={props.brandAlt} size="sm" />
|
|
437
|
+
)}
|
|
438
|
+
</span>
|
|
439
|
+
)
|
|
413
440
|
)}
|
|
414
441
|
{/* The reserved workspace-switcher slot (drawer face only).
|
|
415
442
|
The chat header's left wing is avatar + ws-trigger button,
|
|
@@ -16,16 +16,23 @@ import { fileURLToPath } from "node:url";
|
|
|
16
16
|
* entry of HkAdminHeaderSlots):
|
|
17
17
|
* 1. the slot is declared in the SlotsType aggregate (zero-param —
|
|
18
18
|
* a static mark has no state to hand down);
|
|
19
|
-
* 2. the
|
|
20
|
-
* .s-admin-header-brand,
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
19
|
+
* 2. the face renders the mark through the ONE base class,
|
|
20
|
+
* .s-admin-header-brand, only while avatarAction is "menu";
|
|
21
|
+
* DESKTOP keeps it a non-control span; MOBILE (showHamburger)
|
|
22
|
+
* promotes the same mark to the drawer trigger through the
|
|
23
|
+
* --trigger variant (brand-as-trigger, 2026-11-25 user direction:
|
|
24
|
+
* the standalone hamburger was redundant chrome and mounted only
|
|
25
|
+
* after JS, leaving pre-hydration phones with no nav affordance —
|
|
26
|
+
* the brand renders in SSR, so IT always carries the trigger).
|
|
27
|
+
* MUT:mut-brand-trigger — forcing the trigger branch off REDS the
|
|
28
|
+
* HkAdminHeader suite's mobile test (verified this PR).
|
|
29
|
+
* 3. the DESKTOP mark is NON-INTERACTIVE: div-variant HkLogo (no
|
|
30
|
+
* href ever passed), no button semantics; the MOBILE trigger is a
|
|
31
|
+
* real <button> with the --trigger variant stripping the
|
|
32
|
+
* user-agent chrome;
|
|
33
|
+
* 4. the face pins the pointer cursor OFF on the desktop mark and
|
|
34
|
+
* drops the container rounding (site marks ship their own shape);
|
|
35
|
+
* the mobile trigger restores the pointer (it promises a click);
|
|
29
36
|
* 5. the mark rides the "sm" HkLogo step — the closest visual weight
|
|
30
37
|
* to the 28px identity trigger it replaces inside the 48px band.
|
|
31
38
|
*/
|
|
@@ -42,10 +49,13 @@ describe("admin header brand slot contract", () => {
|
|
|
42
49
|
);
|
|
43
50
|
});
|
|
44
51
|
|
|
45
|
-
it("renders the mark
|
|
46
|
-
expect(adminHeader, "the render site must carry the brand class").toContain(
|
|
52
|
+
it("renders the mark through the one base class, desktop span + mobile trigger", () => {
|
|
53
|
+
expect(adminHeader, "the render site must carry the brand base class").toContain(
|
|
47
54
|
'class="s-admin-header-brand"',
|
|
48
55
|
);
|
|
56
|
+
expect(adminHeader, "the mobile trigger variant exists").toContain(
|
|
57
|
+
'"s-admin-header-brand s-admin-header-brand--trigger"',
|
|
58
|
+
);
|
|
49
59
|
// Drawer-face invariance: the face condition lives in ONE computed
|
|
50
60
|
// (brand mounted AND avatarAction "menu") that BOTH the mark render
|
|
51
61
|
// and the trigger suppression read — dropping the computed, or
|
|
@@ -56,11 +66,14 @@ describe("admin header brand slot contract", () => {
|
|
|
56
66
|
/brandedMenuFace = computed\(\s*\(\) => brandMounted\.value && props\.avatarAction === "menu",?\s*\)/,
|
|
57
67
|
);
|
|
58
68
|
expect(adminHeader).toMatch(
|
|
59
|
-
/brandedMenuFace\.value && \(\s
|
|
69
|
+
/brandedMenuFace\.value && \(\s*props\.showHamburger \? \([\s\S]*?<button\s+type="button"\s+class="s-admin-header-brand s-admin-header-brand--trigger"/,
|
|
60
70
|
);
|
|
61
71
|
expect(adminHeader).toMatch(
|
|
62
72
|
/identityMounted\.value && !brandedMenuFace\.value && \(\s*<HkAvatarButton/,
|
|
63
73
|
);
|
|
74
|
+
expect(adminHeader, "the standalone hamburger is suppressed whenever the brand carries the trigger").toMatch(
|
|
75
|
+
/props\.showHamburger && !brandedMenuFace\.value && \(\s*<HButton/,
|
|
76
|
+
);
|
|
64
77
|
});
|
|
65
78
|
|
|
66
79
|
it("renders the mark non-interactively (div-variant HkLogo, no href)", () => {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"hikari::adminHeader.adminGroup": "المسؤولون",
|
|
4
4
|
"hikari::adminHeader.avatar": "الصورة الرمزية",
|
|
5
5
|
"hikari::adminHeader.avatarTrigger": "قائمة الحساب",
|
|
6
|
+
"hikari::adminHeader.openNav": "افتح التنقل",
|
|
6
7
|
"hikari::adminHeader.forceSignOut": "تسجيل الخروج",
|
|
7
8
|
"hikari::adminHeader.language": "اللغة",
|
|
8
9
|
"hikari::adminHeader.login": "تسجيل الدخول",
|
|
@@ -98,5 +98,6 @@ hk.adminHeader.signingIn = "جارٍ تسجيل الدخول…"
|
|
|
98
98
|
hk.adminHeader.forceSignOut = "تسجيل الخروج"
|
|
99
99
|
hk.adminHeader.avatar = "الصورة الرمزية"
|
|
100
100
|
hk.adminHeader.avatarTrigger = "قائمة الحساب"
|
|
101
|
+
hk.adminHeader.openNav = "افتح التنقل"
|
|
101
102
|
hk.adminHeader.language = "اللغة"
|
|
102
103
|
hk.adminHeader.adminGroup = "المسؤولون"
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"hikari::adminHeader.adminGroup": "Administratoren",
|
|
4
4
|
"hikari::adminHeader.avatar": "Avatar",
|
|
5
5
|
"hikari::adminHeader.avatarTrigger": "Kontomenü",
|
|
6
|
+
"hikari::adminHeader.openNav": "Navigation öffnen",
|
|
6
7
|
"hikari::adminHeader.forceSignOut": "Abmelden",
|
|
7
8
|
"hikari::adminHeader.language": "Sprache",
|
|
8
9
|
"hikari::adminHeader.login": "Anmelden",
|
|
@@ -98,5 +98,6 @@ hk.adminHeader.signingIn = "Anmeldung läuft…"
|
|
|
98
98
|
hk.adminHeader.forceSignOut = "Abmelden"
|
|
99
99
|
hk.adminHeader.avatar = "Avatar"
|
|
100
100
|
hk.adminHeader.avatarTrigger = "Kontomenü"
|
|
101
|
+
hk.adminHeader.openNav = "Navigation öffnen"
|
|
101
102
|
hk.adminHeader.language = "Sprache"
|
|
102
103
|
hk.adminHeader.adminGroup = "Administratoren"
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"hikari::adminHeader.adminGroup": "Administrators",
|
|
4
4
|
"hikari::adminHeader.avatar": "Avatar",
|
|
5
5
|
"hikari::adminHeader.avatarTrigger": "Account menu",
|
|
6
|
+
"hikari::adminHeader.openNav": "Open navigation",
|
|
6
7
|
"hikari::adminHeader.forceSignOut": "Sign out",
|
|
7
8
|
"hikari::adminHeader.language": "Language",
|
|
8
9
|
"hikari::adminHeader.login": "Login",
|
|
@@ -98,5 +98,6 @@ hk.adminHeader.signingIn = "Signing in…"
|
|
|
98
98
|
hk.adminHeader.forceSignOut = "Sign out"
|
|
99
99
|
hk.adminHeader.avatar = "Avatar"
|
|
100
100
|
hk.adminHeader.avatarTrigger = "Account menu"
|
|
101
|
+
hk.adminHeader.openNav = "Open navigation"
|
|
101
102
|
hk.adminHeader.language = "Language"
|
|
102
103
|
hk.adminHeader.adminGroup = "Administrators"
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"hikari::adminHeader.adminGroup": "Administradores",
|
|
4
4
|
"hikari::adminHeader.avatar": "Avatar",
|
|
5
5
|
"hikari::adminHeader.avatarTrigger": "Menú de cuenta",
|
|
6
|
+
"hikari::adminHeader.openNav": "Abrir navegación",
|
|
6
7
|
"hikari::adminHeader.forceSignOut": "Cerrar sesión",
|
|
7
8
|
"hikari::adminHeader.language": "Idioma",
|
|
8
9
|
"hikari::adminHeader.login": "Iniciar sesión",
|
|
@@ -98,5 +98,6 @@ hk.adminHeader.signingIn = "Iniciando sesión…"
|
|
|
98
98
|
hk.adminHeader.forceSignOut = "Cerrar sesión"
|
|
99
99
|
hk.adminHeader.avatar = "Avatar"
|
|
100
100
|
hk.adminHeader.avatarTrigger = "Menú de cuenta"
|
|
101
|
+
hk.adminHeader.openNav = "Abrir navegación"
|
|
101
102
|
hk.adminHeader.language = "Idioma"
|
|
102
103
|
hk.adminHeader.adminGroup = "Administradores"
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"hikari::adminHeader.adminGroup": "Administrateurs",
|
|
4
4
|
"hikari::adminHeader.avatar": "Avatar",
|
|
5
5
|
"hikari::adminHeader.avatarTrigger": "Menu du compte",
|
|
6
|
+
"hikari::adminHeader.openNav": "Ouvrir la navigation",
|
|
6
7
|
"hikari::adminHeader.forceSignOut": "Se déconnecter",
|
|
7
8
|
"hikari::adminHeader.language": "Langue",
|
|
8
9
|
"hikari::adminHeader.login": "Se connecter",
|
|
@@ -98,5 +98,6 @@ hk.adminHeader.signingIn = "Connexion en cours…"
|
|
|
98
98
|
hk.adminHeader.forceSignOut = "Se déconnecter"
|
|
99
99
|
hk.adminHeader.avatar = "Avatar"
|
|
100
100
|
hk.adminHeader.avatarTrigger = "Menu du compte"
|
|
101
|
+
hk.adminHeader.openNav = "Ouvrir la navigation"
|
|
101
102
|
hk.adminHeader.language = "Langue"
|
|
102
103
|
hk.adminHeader.adminGroup = "Administrateurs"
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"hikari::adminHeader.adminGroup": "管理者",
|
|
4
4
|
"hikari::adminHeader.avatar": "アバター",
|
|
5
5
|
"hikari::adminHeader.avatarTrigger": "アカウントメニュー",
|
|
6
|
+
"hikari::adminHeader.openNav": "ナビゲーションを開く",
|
|
6
7
|
"hikari::adminHeader.forceSignOut": "サインアウト",
|
|
7
8
|
"hikari::adminHeader.language": "言語",
|
|
8
9
|
"hikari::adminHeader.login": "ログイン",
|
|
@@ -98,5 +98,6 @@ hk.adminHeader.signingIn = "サインイン中…"
|
|
|
98
98
|
hk.adminHeader.forceSignOut = "サインアウト"
|
|
99
99
|
hk.adminHeader.avatar = "アバター"
|
|
100
100
|
hk.adminHeader.avatarTrigger = "アカウントメニュー"
|
|
101
|
+
hk.adminHeader.openNav = "ナビゲーションを開く"
|
|
101
102
|
hk.adminHeader.language = "言語"
|
|
102
103
|
hk.adminHeader.adminGroup = "管理者"
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"hikari::adminHeader.adminGroup": "관리자",
|
|
4
4
|
"hikari::adminHeader.avatar": "아바타",
|
|
5
5
|
"hikari::adminHeader.avatarTrigger": "계정 메뉴",
|
|
6
|
+
"hikari::adminHeader.openNav": "내비게이션 열기",
|
|
6
7
|
"hikari::adminHeader.forceSignOut": "로그아웃",
|
|
7
8
|
"hikari::adminHeader.language": "언어",
|
|
8
9
|
"hikari::adminHeader.login": "로그인",
|
|
@@ -98,5 +98,6 @@ hk.adminHeader.signingIn = "로그인 중…"
|
|
|
98
98
|
hk.adminHeader.forceSignOut = "로그아웃"
|
|
99
99
|
hk.adminHeader.avatar = "아바타"
|
|
100
100
|
hk.adminHeader.avatarTrigger = "계정 메뉴"
|
|
101
|
+
hk.adminHeader.openNav = "내비게이션 열기"
|
|
101
102
|
hk.adminHeader.language = "언어"
|
|
102
103
|
hk.adminHeader.adminGroup = "관리자"
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"hikari::adminHeader.adminGroup": "Administradores",
|
|
4
4
|
"hikari::adminHeader.avatar": "Avatar",
|
|
5
5
|
"hikari::adminHeader.avatarTrigger": "Menu da conta",
|
|
6
|
+
"hikari::adminHeader.openNav": "Abrir navegação",
|
|
6
7
|
"hikari::adminHeader.forceSignOut": "Sair",
|
|
7
8
|
"hikari::adminHeader.language": "Idioma",
|
|
8
9
|
"hikari::adminHeader.login": "Entrar",
|
|
@@ -98,5 +98,6 @@ hk.adminHeader.signingIn = "Entrando…"
|
|
|
98
98
|
hk.adminHeader.forceSignOut = "Sair"
|
|
99
99
|
hk.adminHeader.avatar = "Avatar"
|
|
100
100
|
hk.adminHeader.avatarTrigger = "Menu da conta"
|
|
101
|
+
hk.adminHeader.openNav = "Abrir navegação"
|
|
101
102
|
hk.adminHeader.language = "Idioma"
|
|
102
103
|
hk.adminHeader.adminGroup = "Administradores"
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"hikari::adminHeader.adminGroup": "Администраторы",
|
|
4
4
|
"hikari::adminHeader.avatar": "Аватар",
|
|
5
5
|
"hikari::adminHeader.avatarTrigger": "Меню учётной записи",
|
|
6
|
+
"hikari::adminHeader.openNav": "Открыть навигацию",
|
|
6
7
|
"hikari::adminHeader.forceSignOut": "Выйти",
|
|
7
8
|
"hikari::adminHeader.language": "Язык",
|
|
8
9
|
"hikari::adminHeader.login": "Войти",
|
|
@@ -98,5 +98,6 @@ hk.adminHeader.signingIn = "Вход…"
|
|
|
98
98
|
hk.adminHeader.forceSignOut = "Выйти"
|
|
99
99
|
hk.adminHeader.avatar = "Аватар"
|
|
100
100
|
hk.adminHeader.avatarTrigger = "Меню учётной записи"
|
|
101
|
+
hk.adminHeader.openNav = "Открыть навигацию"
|
|
101
102
|
hk.adminHeader.language = "Язык"
|
|
102
103
|
hk.adminHeader.adminGroup = "Администраторы"
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"hikari::adminHeader.adminGroup": "管理员",
|
|
4
4
|
"hikari::adminHeader.avatar": "头像",
|
|
5
5
|
"hikari::adminHeader.avatarTrigger": "账户菜单",
|
|
6
|
+
"hikari::adminHeader.openNav": "打开导航",
|
|
6
7
|
"hikari::adminHeader.forceSignOut": "退出登录",
|
|
7
8
|
"hikari::adminHeader.language": "语言",
|
|
8
9
|
"hikari::adminHeader.login": "登录",
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"hikari::adminHeader.adminGroup": "管理員",
|
|
4
4
|
"hikari::adminHeader.avatar": "頭像",
|
|
5
5
|
"hikari::adminHeader.avatarTrigger": "帳戶選單",
|
|
6
|
+
"hikari::adminHeader.openNav": "開啟導覽",
|
|
6
7
|
"hikari::adminHeader.forceSignOut": "登出",
|
|
7
8
|
"hikari::adminHeader.language": "語言",
|
|
8
9
|
"hikari::adminHeader.login": "登入",
|
|
@@ -693,6 +693,21 @@
|
|
|
693
693
|
border-radius: 0;
|
|
694
694
|
}
|
|
695
695
|
|
|
696
|
+
/* The mobile drawer face renders the brand AS the menu trigger (a real
|
|
697
|
+
* <button> — see the brand-as-trigger note in HkAdminHeader). A button's
|
|
698
|
+
* user-agent chrome (background, border, font) would distort the mark, so
|
|
699
|
+
* the trigger variant strips it and restores the pointer cursor the
|
|
700
|
+
* identity contract pins off. */
|
|
701
|
+
.s-admin-header-brand--trigger,
|
|
702
|
+
.s-admin-header-brand--trigger .hk-logo {
|
|
703
|
+
background: none;
|
|
704
|
+
border: 0;
|
|
705
|
+
padding: 0;
|
|
706
|
+
font: inherit;
|
|
707
|
+
color: inherit;
|
|
708
|
+
cursor: pointer;
|
|
709
|
+
}
|
|
710
|
+
|
|
696
711
|
/* The old hover camera veil ("change avatar" affordance) is gone: the
|
|
697
712
|
* avatar trigger opens the account MENU — the avatar edit is the Camera
|
|
698
713
|
* item inside it — so the veil promised an action the click never
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/* GENERATED by themeVarsCss.contract.test.ts (REGEN_THEME_VARS=1) —
|
|
2
|
+
* do not edit by hand. Source: the stock `default` preset in
|
|
3
|
+
* presets.ts; the regen command is in the contract test doc block. */
|
|
4
|
+
html[data-mode="dark"] {
|
|
5
|
+
--color-primary: 136 192 208;
|
|
6
|
+
--color-on-primary: 0 0 0;
|
|
7
|
+
--color-on-solid-text: 46 52 64;
|
|
8
|
+
--color-on-solid-icon: 46 52 64;
|
|
9
|
+
--color-on-solid: 46 52 64;
|
|
10
|
+
--color-on-danger: 255 255 255;
|
|
11
|
+
--color-on-success: 255 255 255;
|
|
12
|
+
--color-on-warning: 255 255 255;
|
|
13
|
+
--color-on-info: 255 255 255;
|
|
14
|
+
--color-secondary: 143 188 187;
|
|
15
|
+
--color-accent: 94 129 172;
|
|
16
|
+
--color-text: 247 249 252;
|
|
17
|
+
--color-text-secondary: 230 232 234;
|
|
18
|
+
--color-text-tertiary: 214 215 216;
|
|
19
|
+
--color-muted: 180 180 180;
|
|
20
|
+
--color-border: 128 128 128;
|
|
21
|
+
--color-focused-border: 136 192 208;
|
|
22
|
+
--color-background: 22 27 38;
|
|
23
|
+
--color-surface: 34 40 54;
|
|
24
|
+
--color-selected-bg: 70 70 85;
|
|
25
|
+
--color-selected-text: 248 248 250;
|
|
26
|
+
--color-status-bar-bg: 34 40 54;
|
|
27
|
+
--color-success: 31 101 48;
|
|
28
|
+
--color-error: 166 41 55;
|
|
29
|
+
--color-warning: 137 72 0;
|
|
30
|
+
--color-info: 0 98 116;
|
|
31
|
+
--hi-color-primary: rgb(var(--color-primary));
|
|
32
|
+
--hi-color-secondary: rgb(var(--color-secondary));
|
|
33
|
+
--hi-color-surface: rgb(var(--color-surface));
|
|
34
|
+
--hi-color-background: rgb(var(--color-background));
|
|
35
|
+
--hi-color-border: rgb(var(--color-border) / 15%);
|
|
36
|
+
--hi-color-text-primary: rgb(var(--color-text));
|
|
37
|
+
--hi-color-text-secondary: rgb(var(--color-text-secondary));
|
|
38
|
+
--hi-color-muted: rgb(var(--color-muted));
|
|
39
|
+
--hi-color-on-primary: rgb(var(--color-on-primary));
|
|
40
|
+
--hi-color-text-on-primary: rgb(var(--color-on-primary));
|
|
41
|
+
--hi-color-text-on-solid: rgb(var(--color-on-solid-text, 255 255 255));
|
|
42
|
+
--hi-color-icon-on-solid: rgb(var(--color-on-solid-icon, 255 255 255));
|
|
43
|
+
--hi-color-success: rgb(var(--color-success));
|
|
44
|
+
--hi-color-error: rgb(var(--color-error));
|
|
45
|
+
--hi-color-warning: rgb(var(--color-warning));
|
|
46
|
+
--hi-color-info: rgb(var(--color-info));
|
|
47
|
+
--hi-color-text-on-danger: rgb(var(--color-on-danger));
|
|
48
|
+
--hi-color-text-on-success: rgb(var(--color-on-success));
|
|
49
|
+
--hi-color-text-on-warning: rgb(var(--color-on-warning));
|
|
50
|
+
--hi-color-text-on-info: rgb(var(--color-on-info));
|
|
51
|
+
--hi-color-success-fg: rgb(94 162 105);
|
|
52
|
+
--hi-color-danger-fg: rgb(233 104 109);
|
|
53
|
+
--hi-color-warning-fg: rgb(200 130 73);
|
|
54
|
+
--hi-color-info-fg: rgb(81 158 177);
|
|
55
|
+
--hi-color-bg-subtle: rgb(var(--color-surface) / 0.5);
|
|
56
|
+
--hi-color-bg-elevated: rgb(var(--color-surface));
|
|
57
|
+
--hi-color-bg-container: rgb(var(--color-surface));
|
|
58
|
+
--hi-color-bg-canvas: rgb(var(--color-background));
|
|
59
|
+
--hi-secondary-bg: rgb(var(--color-surface) / 0.5);
|
|
60
|
+
}
|
|
61
|
+
html[data-mode="light"] {
|
|
62
|
+
--color-primary: 214 51 132;
|
|
63
|
+
--color-on-primary: 255 255 255;
|
|
64
|
+
--color-on-solid-text: 255 255 255;
|
|
65
|
+
--color-on-solid-icon: 255 255 255;
|
|
66
|
+
--color-on-solid: 255 255 255;
|
|
67
|
+
--color-on-danger: 255 255 255;
|
|
68
|
+
--color-on-success: 255 255 255;
|
|
69
|
+
--color-on-warning: 255 255 255;
|
|
70
|
+
--color-on-info: 255 255 255;
|
|
71
|
+
--color-secondary: 156 106 222;
|
|
72
|
+
--color-accent: 230 167 0;
|
|
73
|
+
--color-text: 30 30 30;
|
|
74
|
+
--color-text-secondary: 43 43 43;
|
|
75
|
+
--color-text-tertiary: 55 55 55;
|
|
76
|
+
--color-muted: 80 80 80;
|
|
77
|
+
--color-border: 128 128 128;
|
|
78
|
+
--color-focused-border: 214 51 132;
|
|
79
|
+
--color-background: 245 245 240;
|
|
80
|
+
--color-surface: 255 255 255;
|
|
81
|
+
--color-selected-bg: 200 200 205;
|
|
82
|
+
--color-selected-text: 40 40 45;
|
|
83
|
+
--color-status-bar-bg: 230 230 225;
|
|
84
|
+
--color-success: 31 101 48;
|
|
85
|
+
--color-error: 166 41 55;
|
|
86
|
+
--color-warning: 137 72 0;
|
|
87
|
+
--color-info: 0 98 116;
|
|
88
|
+
--hi-color-primary: rgb(var(--color-primary));
|
|
89
|
+
--hi-color-secondary: rgb(var(--color-secondary));
|
|
90
|
+
--hi-color-surface: rgb(var(--color-surface));
|
|
91
|
+
--hi-color-background: rgb(var(--color-background));
|
|
92
|
+
--hi-color-border: rgb(var(--color-border) / 15%);
|
|
93
|
+
--hi-color-text-primary: rgb(var(--color-text));
|
|
94
|
+
--hi-color-text-secondary: rgb(var(--color-text-secondary));
|
|
95
|
+
--hi-color-muted: rgb(var(--color-muted));
|
|
96
|
+
--hi-color-on-primary: rgb(var(--color-on-primary));
|
|
97
|
+
--hi-color-text-on-primary: rgb(var(--color-on-primary));
|
|
98
|
+
--hi-color-text-on-solid: rgb(var(--color-on-solid-text, 255 255 255));
|
|
99
|
+
--hi-color-icon-on-solid: rgb(var(--color-on-solid-icon, 255 255 255));
|
|
100
|
+
--hi-color-success: rgb(var(--color-success));
|
|
101
|
+
--hi-color-error: rgb(var(--color-error));
|
|
102
|
+
--hi-color-warning: rgb(var(--color-warning));
|
|
103
|
+
--hi-color-info: rgb(var(--color-info));
|
|
104
|
+
--hi-color-text-on-danger: rgb(var(--color-on-danger));
|
|
105
|
+
--hi-color-text-on-success: rgb(var(--color-on-success));
|
|
106
|
+
--hi-color-text-on-warning: rgb(var(--color-on-warning));
|
|
107
|
+
--hi-color-text-on-info: rgb(var(--color-on-info));
|
|
108
|
+
--hi-color-success-fg: rgb(31 101 48);
|
|
109
|
+
--hi-color-danger-fg: rgb(166 41 55);
|
|
110
|
+
--hi-color-warning-fg: rgb(137 72 0);
|
|
111
|
+
--hi-color-info-fg: rgb(0 98 116);
|
|
112
|
+
--hi-color-bg-subtle: rgb(var(--color-surface) / 0.5);
|
|
113
|
+
--hi-color-bg-elevated: rgb(var(--color-surface));
|
|
114
|
+
--hi-color-bg-container: rgb(var(--color-surface));
|
|
115
|
+
--hi-color-bg-canvas: rgb(var(--color-background));
|
|
116
|
+
--hi-secondary-bg: rgb(var(--color-surface) / 0.5);
|
|
117
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { describe, expect, it } from "vitest";
|
|
5
|
+
|
|
6
|
+
import { buildThemeVarsCss } from "./themeVarsCss";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Drift contract for the PRE-RENDERED theme CSS (hikari#1546): the checked
|
|
10
|
+
* -in `src/styles/theme-vars.css` must be byte-identical to what
|
|
11
|
+
* `buildThemeVarsCss()` composes from the live preset table. When the
|
|
12
|
+
* table changes (new slot, adjusted color), the CSS MUST be regenerated in
|
|
13
|
+
* the same PR — otherwise a returning visitor's pre-hydration paint uses
|
|
14
|
+
* stale colors and the runtime injection visibly snaps them on mount.
|
|
15
|
+
*
|
|
16
|
+
* Regeneration (the preset table is TS, so the toolchain that can execute
|
|
17
|
+
* it IS this runner — the vue-mirror discipline):
|
|
18
|
+
*
|
|
19
|
+
* REGEN_THEME_VARS=1 \
|
|
20
|
+
* node_modules/.bin/vitest run src/theme/themeVarsCss.contract.test.ts
|
|
21
|
+
*
|
|
22
|
+
* The test executes the same composition any future generator would, so
|
|
23
|
+
* the writer and the checker cannot disagree.
|
|
24
|
+
*/
|
|
25
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
26
|
+
const cssPath = join(here, "..", "styles", "theme-vars.css");
|
|
27
|
+
|
|
28
|
+
describe("pre-rendered theme vars CSS (hikari#1546)", () => {
|
|
29
|
+
const css = buildThemeVarsCss();
|
|
30
|
+
|
|
31
|
+
it("matches the composition of the live preset table", () => {
|
|
32
|
+
const checkedIn = readFileSync(cssPath, "utf8");
|
|
33
|
+
if (checkedIn === css) return;
|
|
34
|
+
// Drift: the preset table moved without a regen. Rewrite ONLY under the
|
|
35
|
+
// explicit env (a stray REGEN_THEME_VARS in a normal run must not touch
|
|
36
|
+
// the worktree silently), then re-read for a real assertion — the write
|
|
37
|
+
// happens AFTER the drift is established, never before the compare.
|
|
38
|
+
// MUT:mut-regen-write-order — reverting to write-before-compare silences
|
|
39
|
+
// this test entirely (the round-1 review footgun).
|
|
40
|
+
if (process.env.REGEN_THEME_VARS === "1") {
|
|
41
|
+
writeFileSync(cssPath, css);
|
|
42
|
+
expect(readFileSync(cssPath, "utf8"), "regen wrote the composition").toBe(css);
|
|
43
|
+
console.log(`REGEN: rewrote drifted ${cssPath} (${css.length} bytes)`);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
expect(checkedIn).toBe(css);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("covers both modes with the core color tokens", () => {
|
|
50
|
+
expect(css).toContain('html[data-mode="dark"]');
|
|
51
|
+
expect(css).toContain('html[data-mode="light"]');
|
|
52
|
+
// The slots with no per-component CSS fallback — a missing one leaves
|
|
53
|
+
// the unthemed flash hikari#1546 describes, so each is load-bearing.
|
|
54
|
+
for (const slot of [
|
|
55
|
+
"--color-primary",
|
|
56
|
+
"--color-text",
|
|
57
|
+
"--color-background",
|
|
58
|
+
"--color-surface",
|
|
59
|
+
"--color-muted",
|
|
60
|
+
"--color-border",
|
|
61
|
+
]) {
|
|
62
|
+
expect(css, `${slot} must be pre-rendered`).toContain(`${slot}:`);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { themePresets, tokensToCSSVars, getThemeTokens } from "./presets";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The PRE-RENDERED static form of the stock theme table (hikari#1546).
|
|
5
|
+
*
|
|
6
|
+
* `applyTheme()` injects the whole cssvar set from JS, which is why a
|
|
7
|
+
* phone's first paint used to flash the unthemed default: no JS, no vars.
|
|
8
|
+
* This module composes the SAME `tokensToCSSVars` output the runtime uses
|
|
9
|
+
* into plain CSS blocks keyed on the `data-mode` attribute — the SSR
|
|
10
|
+
* template ships it in `<head>`, and a tiny inline bootstrap only sets
|
|
11
|
+
* `data-theme`/`data-mode` (attribute writes, no computation) before body
|
|
12
|
+
* paint. The cascade picks the block instantly.
|
|
13
|
+
*
|
|
14
|
+
* Selectors are mode-keyed and deliberately NOT theme-keyed: a stored
|
|
15
|
+
* CUSTOM theme id cannot be pre-rendered (user-authored, lives in
|
|
16
|
+
* localStorage), so pre-hydration those users see the stock colors in the
|
|
17
|
+
* right MODE — strictly better than the previous unthemed flash — and
|
|
18
|
+
* `applyTheme()` replaces them the moment the bundle lands. Override
|
|
19
|
+
* mechanics: the runtime writes a managed `<style data-hikari-theme-vars>`
|
|
20
|
+
* block whose selector (`html:root`, 0-1-1) TIES with these `html[data-mode]`
|
|
21
|
+
* blocks — the runtime wins by head ORDER (its block is appended after the
|
|
22
|
+
* SSR sheet), so the static sheet must stay in the SSR head; a late/async
|
|
23
|
+
* -loaded copy would re-tie and could snap the theme back.
|
|
24
|
+
*
|
|
25
|
+
* Phase 2 (de-Vue): the table itself moves to the Rust palette crate
|
|
26
|
+
* (tairitsu lane) and this module consumes generated JSON — the CSS form
|
|
27
|
+
* and the bootstrap contract stay exactly as they are here.
|
|
28
|
+
*
|
|
29
|
+
* Group tokens (shape/radius) are intentionally NOT included: every
|
|
30
|
+
* component reads them with its own CSS fallback (e.g.
|
|
31
|
+
* `var(--hk-radius-sm, 4px)` in HkSkeleton, `var(--hk-z-*)`,
|
|
32
|
+
* `var(--hk-picker-*)`), so the pre-hydration window degrades to identical
|
|
33
|
+
* geometry, and the runtime emission covers them anyway.
|
|
34
|
+
*/
|
|
35
|
+
const MODES = ["dark", "light"] as const;
|
|
36
|
+
|
|
37
|
+
export function buildThemeVarsCss(): string {
|
|
38
|
+
const preset = themePresets.default;
|
|
39
|
+
if (!preset) return "/* stock preset table is empty — nothing to pre-render */\n";
|
|
40
|
+
const chunks: string[] = [
|
|
41
|
+
"/* GENERATED by themeVarsCss.contract.test.ts (REGEN_THEME_VARS=1) —",
|
|
42
|
+
" * do not edit by hand. Source: the stock `default` preset in",
|
|
43
|
+
" * presets.ts; the regen command is in the contract test doc block. */",
|
|
44
|
+
];
|
|
45
|
+
for (const mode of MODES) {
|
|
46
|
+
const tokens = getThemeTokens("default", mode);
|
|
47
|
+
if (!tokens) continue;
|
|
48
|
+
const vars = tokensToCSSVars(tokens);
|
|
49
|
+
chunks.push(`html[data-mode="${mode}"] {`);
|
|
50
|
+
for (const name of Object.keys(vars)) {
|
|
51
|
+
chunks.push(` ${name}: ${vars[name]};`);
|
|
52
|
+
}
|
|
53
|
+
chunks.push("}");
|
|
54
|
+
}
|
|
55
|
+
return chunks.join("\n") + "\n";
|
|
56
|
+
}
|