@celestia-island/hikari 0.55.415 → 0.55.417
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/HkAffixPicker.scss +2 -2
- package/src/components/HkAlert.scss +12 -12
- package/src/components/HkAuthSubmitButton.scss +1 -1
- package/src/components/HkBlockingToast.scss +7 -7
- package/src/components/HkBreadcrumb.scss +3 -3
- package/src/components/HkCardList.scss +3 -3
- package/src/components/HkColorSchemeEditor.test.ts +179 -0
- package/src/components/HkColorSchemeEditor.tsx +57 -2
- package/src/components/HkCookieConsent.scss +1 -1
- package/src/components/HkCurrencySelect.scss +2 -2
- package/src/components/HkDiffViewer.scss +5 -5
- package/src/components/HkEditableTable.scss +1 -1
- package/src/components/HkEmergencySnoozeTray.scss +2 -2
- package/src/components/HkFileBrowserDialog.scss +2 -2
- package/src/components/HkFileField.scss +3 -3
- package/src/components/HkFilePickerField.scss +2 -2
- package/src/components/HkFilterPanel.scss +1 -1
- package/src/components/HkIcon.scss +3 -3
- package/src/components/HkIconButtonGroup.scss +1 -1
- package/src/components/HkIconChip.scss +4 -4
- package/src/components/HkInput.scss +3 -3
- package/src/components/HkLogWindow.scss +2 -2
- package/src/components/HkMenu.scss +1 -1
- package/src/components/HkMessageBox.scss +2 -2
- package/src/components/HkMoneyInput.scss +2 -2
- package/src/components/HkNotificationBell.scss +3 -3
- package/src/components/HkOtpInput.scss +2 -2
- package/src/components/HkPasswordSurface.scss +12 -12
- package/src/components/HkPersistentToast.scss +3 -3
- package/src/components/HkPillToggleGroup.scss +6 -6
- package/src/components/HkPillToggleGroup.test.tsx +12 -7
- package/src/components/HkPopupSelect.scss +3 -3
- package/src/components/HkProgressBar.scss +1 -1
- package/src/components/HkProgressBar.styles.test.ts +1 -1
- package/src/components/HkProgressRing.scss +2 -2
- package/src/components/HkQuote.scss +3 -3
- package/src/components/HkRangeRibbon.scss +1 -1
- package/src/components/HkSecretRevealModal.scss +1 -1
- package/src/components/HkSelect.scss +3 -3
- package/src/components/HkSelectionGrid.scss +4 -4
- package/src/components/HkSelectionGrid.test.tsx +183 -54
- package/src/components/HkSelectionWaterfall.scss +4 -4
- package/src/components/HkStatCard.scss +4 -4
- package/src/components/HkStatusBar.tsx +9 -9
- package/src/components/HkStatusRow.scss +3 -3
- package/src/components/HkStepGuide.scss +2 -2
- package/src/components/HkSwitch.scss +1 -1
- package/src/components/HkTag.scss +12 -12
- package/src/components/HkTemplateField.scss +1 -1
- package/src/components/HkTextarea.scss +1 -1
- package/src/components/HkToast.scss +5 -5
- package/src/components/HkTree.scss +2 -2
- package/src/components/_menu-item.scss +4 -4
- package/src/plugins/boot-recovery.details.test.ts +1 -1
- package/src/plugins/boot-recovery.diagnostics.test.ts +1 -1
- package/src/plugins/boot-recovery.error-context.test.ts +1 -1
- package/src/plugins/boot-recovery.locales.test.ts +1 -1
- package/src/plugins/bootLandingCss.js +1 -1
- package/src/plugins/bootLandingDetailsCss.js +1 -1
- package/src/styles/admin-tokens.scss +16 -16
- package/src/styles/channelFallbacks.test.ts +15 -0
- package/src/styles/theme/channels.scss +23 -13
- package/src/styles/theme/scrollbar.scss +3 -3
- package/src/styles/tokenInventory.test.ts +19 -0
- package/src/theme/_field.scss +3 -3
- package/src/theme/index.ts +1 -1
- package/src/theme/presets.ts +73 -14
- package/src/theme/solidInk.contract.test.ts +77 -6
- package/src/tokens.scss +23 -13
|
@@ -19,6 +19,7 @@ import { fileURLToPath } from "node:url";
|
|
|
19
19
|
import { describe, expect, it } from "vitest";
|
|
20
20
|
|
|
21
21
|
import { solidInk, themePresets, tokensToCSSVars } from "./presets";
|
|
22
|
+
import type { ThemeTokenRGB } from "./presets";
|
|
22
23
|
|
|
23
24
|
const WHITE = "255 255 255";
|
|
24
25
|
const BLACK = "0 0 0";
|
|
@@ -28,19 +29,22 @@ const scss = readFileSync(join(here, "..", "components", "HkToast.scss"), "utf-8
|
|
|
28
29
|
/**
|
|
29
30
|
* The shipped fills and the ink the rule picks for each, asserted explicitly:
|
|
30
31
|
* a rule that silently flipped its judgement is exactly what this guards.
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
32
|
+
* Since the canonical-family move the shipped fills are identical in both
|
|
33
|
+
* schemes and dark enough to take white everywhere — the table asserts that
|
|
34
|
+
* uniformity.
|
|
34
35
|
*/
|
|
36
|
+
// The shipped semantic quartet is the SHARED canonical family (solid fills
|
|
37
|
+
// ignore the mode, user direction) — dark enough (gamma-lum 0.27-0.32) that
|
|
38
|
+
// every slot takes the house WHITE ink in BOTH schemes.
|
|
35
39
|
const EXPECTED_INK: Array<{ mode: "light" | "dark"; tone: "danger" | "success" | "warning" | "info"; ink: string }> = [
|
|
36
40
|
{ mode: "light", tone: "danger", ink: WHITE },
|
|
37
41
|
{ mode: "light", tone: "success", ink: WHITE },
|
|
38
|
-
{ mode: "light", tone: "warning", ink:
|
|
42
|
+
{ mode: "light", tone: "warning", ink: WHITE },
|
|
39
43
|
{ mode: "light", tone: "info", ink: WHITE },
|
|
40
44
|
{ mode: "dark", tone: "danger", ink: WHITE },
|
|
41
|
-
{ mode: "dark", tone: "success", ink:
|
|
45
|
+
{ mode: "dark", tone: "success", ink: WHITE },
|
|
42
46
|
{ mode: "dark", tone: "warning", ink: WHITE },
|
|
43
|
-
{ mode: "dark", tone: "info", ink:
|
|
47
|
+
{ mode: "dark", tone: "info", ink: WHITE },
|
|
44
48
|
];
|
|
45
49
|
|
|
46
50
|
/**
|
|
@@ -53,11 +57,25 @@ const MUST_STAY_WHITE: Array<["light" | "dark", "danger" | "success" | "warning"
|
|
|
53
57
|
["light", "danger"],
|
|
54
58
|
["light", "success"],
|
|
55
59
|
["light", "info"],
|
|
60
|
+
["light", "warning"],
|
|
56
61
|
["dark", "danger"],
|
|
62
|
+
["dark", "success"],
|
|
57
63
|
["dark", "warning"],
|
|
64
|
+
["dark", "info"],
|
|
58
65
|
];
|
|
59
66
|
|
|
60
67
|
describe("solid-fill ink rule", () => {
|
|
68
|
+
it("uses the house 0.65 threshold (not the legacy 0.55)", () => {
|
|
69
|
+
// #A3A3A3 γlum = 0.6400: the 0.65 house rule says WHITE (≤0.65), while
|
|
70
|
+
// the rejected 0.55 rule would say BLACK (>0.55).
|
|
71
|
+
const fill: ThemeTokenRGB = { r: 0xa3, g: 0xa3, b: 0xa3 };
|
|
72
|
+
const ink = solidInk(fill);
|
|
73
|
+
expect(ink).toEqual({ r: 255, g: 255, b: 255 });
|
|
74
|
+
// #A6A6A6 γlum = 0.6587 > 0.65 → black.
|
|
75
|
+
const above: ThemeTokenRGB = { r: 0xa6, g: 0xa6, b: 0xa6 };
|
|
76
|
+
expect(solidInk(above)).toEqual({ r: 0, g: 0, b: 0 });
|
|
77
|
+
});
|
|
78
|
+
|
|
61
79
|
it("inks each shipped fill by its own lightness", () => {
|
|
62
80
|
const light = tokensToCSSVars(themePresets.default.light);
|
|
63
81
|
const dark = tokensToCSSVars(themePresets.default.dark);
|
|
@@ -178,6 +196,59 @@ describe("static seed matches the solidInk rule", () => {
|
|
|
178
196
|
return [Number(m![1]), Number(m![2]), Number(m![3])];
|
|
179
197
|
};
|
|
180
198
|
|
|
199
|
+
// The tag/link components paint the semantic slots as TEXT on a 10% tint
|
|
200
|
+
// of the fill over the page — NOT on the solid fill. The runtime must
|
|
201
|
+
// therefore expose a page/tint-readable fg variant per tone, and the tag
|
|
202
|
+
// sheet must use it (never the raw fill: a fill used as text on a dark
|
|
203
|
+
// page measures ~1.1:1). Computed here against the actual composite so the
|
|
204
|
+
// pin is a readability guarantee, not an existence check.
|
|
205
|
+
it("tag text reads on its 10% tint (the fg variant is real)", () => {
|
|
206
|
+
// The canonical family is now the shipped default (light mode; the dark
|
|
207
|
+
// preset carries the same solid fills per the mode-independence rule).
|
|
208
|
+
const tokens = tokensToCSSVars(themePresets.default.light);
|
|
209
|
+
const parse = (name: string): [number, number, number] => {
|
|
210
|
+
const m = tokens[name]?.match(/(\d+) (\d+) (\d+)/);
|
|
211
|
+
expect(m, `${name} emitted`).not.toBeNull();
|
|
212
|
+
return [Number(m![1]), Number(m![2]), Number(m![3])];
|
|
213
|
+
};
|
|
214
|
+
const ratio = (a: [number, number, number], b: [number, number, number]) => {
|
|
215
|
+
const lum = (c: [number, number, number]) => {
|
|
216
|
+
const f = (v: number) => {
|
|
217
|
+
const x = v / 255;
|
|
218
|
+
return x <= 0.04045 ? x / 12.92 : ((x + 0.055) / 1.055) ** 2.4;
|
|
219
|
+
};
|
|
220
|
+
return 0.2126 * f(c[0]) + 0.7152 * f(c[1]) + 0.0722 * f(c[2]);
|
|
221
|
+
};
|
|
222
|
+
const [hi, lo] = [lum(a), lum(b)].sort((x, y) => y - x);
|
|
223
|
+
return (hi + 0.05) / (lo + 0.05);
|
|
224
|
+
};
|
|
225
|
+
const bg = parse("--color-background");
|
|
226
|
+
for (const tone of ["success", "danger", "warning", "info"] as const) {
|
|
227
|
+
const fill = parse(`--color-${TONE_FILL[tone]}`);
|
|
228
|
+
const fg = parse(`--hi-color-${tone}-fg`);
|
|
229
|
+
// The chip background is a 10% tint of the fill over the page.
|
|
230
|
+
const tint = fill.map((v, i) => Math.round(v * 0.1 + bg[i] * 0.9)) as [number, number, number];
|
|
231
|
+
expect(
|
|
232
|
+
ratio(fg, tint),
|
|
233
|
+
`--hi-color-${tone}-fg must read on the ${tone} tint`,
|
|
234
|
+
).toBeGreaterThanOrEqual(4.5);
|
|
235
|
+
}
|
|
236
|
+
// And the sheet must use the fg var, not the raw fill as text.
|
|
237
|
+
const hkTag = readFileSync(join(here, "..", "components", "HkTag.scss"), "utf-8");
|
|
238
|
+
for (const tone of ["success", "danger", "warning"] as const) {
|
|
239
|
+
expect(
|
|
240
|
+
hkTag.includes(`--hi-color-${tone}-fg`),
|
|
241
|
+
`HkTag.scss .hk-tag-${tone} paints --hi-color-${tone}-fg`,
|
|
242
|
+
).toBe(true);
|
|
243
|
+
// The negative pin needs a runtime RegExp: a template literal inside
|
|
244
|
+
// regex delimiters compiles the un-interpolated "+ tone +" text.
|
|
245
|
+
const rawFill = new RegExp(
|
|
246
|
+
`\\.hk-tag-${tone}\\s*\\{[^}]*color:\\s*var\\(--hi-color-${tone}[,)]`,
|
|
247
|
+
);
|
|
248
|
+
expect(rawFill.test(hkTag), `.hk-tag-${tone} must not paint the raw fill`).toBe(false);
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
|
|
181
252
|
for (const path of ["tokens.scss", join("styles", "theme", "channels.scss")]) {
|
|
182
253
|
it(`seeds each on-tone ink to what solidInk derives from the ${path} fills`, () => {
|
|
183
254
|
const file = readFileSync(join(here, "..", ...path.split("/")), "utf-8");
|
package/src/tokens.scss
CHANGED
|
@@ -30,15 +30,15 @@
|
|
|
30
30
|
--c-primary-medium: rgb(var(--color-primary, 122 162 247) / 25%);
|
|
31
31
|
--c-primary-strong: rgb(var(--color-primary, 122 162 247) / 40%);
|
|
32
32
|
--c-primary-intense: rgb(var(--color-primary, 122 162 247) / 40%);
|
|
33
|
-
--c-error-dim: rgb(var(--color-error,
|
|
34
|
-
--c-error-overlay: rgb(var(--color-error,
|
|
35
|
-
--c-error-strong: rgb(var(--color-error,
|
|
33
|
+
--c-error-dim: rgb(var(--color-error, 166 41 55) / 10%);
|
|
34
|
+
--c-error-overlay: rgb(var(--color-error, 166 41 55) / 20%);
|
|
35
|
+
--c-error-strong: rgb(var(--color-error, 166 41 55) / 50%);
|
|
36
36
|
--shadow-elevated: 0 8px 32px rgb(0 0 0 / 15%);
|
|
37
37
|
--shadow-dropdown: 0 4px 24px rgb(0 0 0 / 12%), 0 0 0 1px rgb(255 255 255 / 4%);
|
|
38
38
|
--shadow-button: 0 4px 14px rgb(var(--color-primary, 122 162 247) / 35%);
|
|
39
|
-
--shadow-button-danger: 0 4px 14px rgb(var(--color-error,
|
|
39
|
+
--shadow-button-danger: 0 4px 14px rgb(var(--color-error, 166 41 55) / 35%);
|
|
40
40
|
--shadow-focus: 0 0 0 3px rgb(var(--color-primary, 122 162 247) / 12%);
|
|
41
|
-
--shadow-focus-error: 0 0 0 3px rgb(var(--color-error,
|
|
41
|
+
--shadow-focus-error: 0 0 0 3px rgb(var(--color-error, 166 41 55) / 12%);
|
|
42
42
|
--border-input: rgb(var(--color-border, 100 100 100) / 15%);
|
|
43
43
|
--border-faint: rgb(var(--color-border, 100 100 100) / 10%);
|
|
44
44
|
--border-subtle: rgb(var(--color-border, 100 100 100) / 12%);
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
--hi-bg-surface-dark: rgb(var(--color-muted, 108 108 108) / 12%);
|
|
63
63
|
--hi-color-primary-dark: color-mix(in srgb, rgb(var(--color-primary, 122 162 247)) 82%, #000);
|
|
64
64
|
--hi-color-secondary-dark: color-mix(in srgb, rgb(var(--color-secondary, 81 154 115)) 82%, #000);
|
|
65
|
-
--hi-color-danger-dark: color-mix(in srgb, rgb(var(--color-error,
|
|
66
|
-
--hi-color-success-dark: color-mix(in srgb, rgb(var(--color-success,
|
|
65
|
+
--hi-color-danger-dark: color-mix(in srgb, rgb(var(--color-error, 166 41 55)) 82%, #000);
|
|
66
|
+
--hi-color-success-dark: color-mix(in srgb, rgb(var(--color-success, 31 101 48)) 82%, #000);
|
|
67
67
|
--hi-color-text-on-secondary: rgb(var(--color-on-solid, 255 255 255));
|
|
68
68
|
--hi-color-text-on-danger: rgb(var(--color-on-solid, 255 255 255));
|
|
69
69
|
--hi-color-text-on-success: rgb(var(--color-on-solid, 255 255 255));
|
|
@@ -85,8 +85,14 @@
|
|
|
85
85
|
* re-derives these per tone from its own fills (see tokensToCSSVars). */
|
|
86
86
|
--color-on-danger: 255 255 255;
|
|
87
87
|
--color-on-success: 255 255 255;
|
|
88
|
-
--color-on-warning:
|
|
89
|
-
--color-on-info:
|
|
88
|
+
--color-on-warning: 255 255 255;
|
|
89
|
+
--color-on-info: 255 255 255;
|
|
90
|
+
/* Per-tone page-readable fills (readable_on vs the page): the canonical
|
|
91
|
+
* fills themselves — they read on the light page as-is. */
|
|
92
|
+
--color-success-fg: 31 101 48;
|
|
93
|
+
--color-error-fg: 166 41 55;
|
|
94
|
+
--color-warning-fg: 137 72 0;
|
|
95
|
+
--color-info-fg: 0 98 116;
|
|
90
96
|
--color-secondary: 81 154 115;
|
|
91
97
|
--color-accent: 247 181 0;
|
|
92
98
|
--color-text: 30 30 30;
|
|
@@ -109,10 +115,10 @@
|
|
|
109
115
|
--color-selected-bg: 191 218 242;
|
|
110
116
|
--color-selected-text: 30 30 30;
|
|
111
117
|
--color-status-bar-bg: 240 244 248;
|
|
112
|
-
--color-success:
|
|
113
|
-
--color-error:
|
|
114
|
-
--color-warning:
|
|
115
|
-
--color-info:
|
|
118
|
+
--color-success: 31 101 48;
|
|
119
|
+
--color-error: 166 41 55;
|
|
120
|
+
--color-warning: 137 72 0;
|
|
121
|
+
--color-info: 0 98 116;
|
|
116
122
|
|
|
117
123
|
--hi-color-primary: rgb(var(--color-primary));
|
|
118
124
|
--hi-color-secondary: rgb(var(--color-secondary));
|
|
@@ -139,6 +145,10 @@
|
|
|
139
145
|
--hi-color-text-on-success: rgb(var(--color-on-success));
|
|
140
146
|
--hi-color-text-on-warning: rgb(var(--color-on-warning));
|
|
141
147
|
--hi-color-text-on-info: rgb(var(--color-on-info));
|
|
148
|
+
--hi-color-success-fg: rgb(var(--color-success-fg));
|
|
149
|
+
--hi-color-danger-fg: rgb(var(--color-error-fg));
|
|
150
|
+
--hi-color-warning-fg: rgb(var(--color-warning-fg));
|
|
151
|
+
--hi-color-info-fg: rgb(var(--color-info-fg));
|
|
142
152
|
/* Surface-layer aliases the runtime writes on every apply — seeded so
|
|
143
153
|
* no-JS consumers resolve them instead of invalid var(). */
|
|
144
154
|
--hi-color-bg-subtle: rgb(var(--color-surface) / 0.5);
|