@celestia-island/hikari 0.55.529 → 0.55.530
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
CHANGED
|
@@ -290,13 +290,17 @@
|
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
/* Autofill overrides */
|
|
293
|
-
/* The
|
|
293
|
+
/* The frozen autofill transition lives ONLY inside the autofill states.
|
|
294
|
+
An earlier revision hung it on every field (the "fidelity" port moved it
|
|
295
|
+
out of this block): a 100000000s step-end transition never completes, so
|
|
296
|
+
the field's painted `color` stayed at the PREVIOUS theme's value after a
|
|
297
|
+
theme switch — black text on the freshly dark surface, for the typed
|
|
298
|
+
value and the native placeholder alike (::placeholder inherits this
|
|
299
|
+
color). Scoped to the autofill states it still pins Chrome's own
|
|
300
|
+
autofill/preview paint for exactly as long as that paint exists, while
|
|
301
|
+
an ordinary field follows the theme instantly.
|
|
302
|
+
The finite duration (instead of `calc(infinity * 1s)`) keeps this sheet
|
|
294
303
|
compilable by the grass compiler the Rust form shares it with. */
|
|
295
|
-
.hk-input-box input,
|
|
296
|
-
.hk-input-box textarea {
|
|
297
|
-
transition: color 100000000s step-end, background-color 100000000s step-end;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
304
|
.hk-input-box input:-webkit-autofill,
|
|
301
305
|
.hk-input-box input:-webkit-autofill:hover,
|
|
302
306
|
.hk-input-box input:-webkit-autofill:focus,
|
|
@@ -307,6 +311,7 @@
|
|
|
307
311
|
-webkit-text-fill-color: rgb(var(--color-text)) !important;
|
|
308
312
|
-webkit-box-shadow: 0 0 0 1000px rgb(var(--color-surface)) inset !important;
|
|
309
313
|
caret-color: rgb(var(--color-text));
|
|
314
|
+
transition: color 100000000s step-end, background-color 100000000s step-end;
|
|
310
315
|
}
|
|
311
316
|
|
|
312
317
|
.hk-input-box input:-webkit-autofill::first-line,
|
|
@@ -317,10 +322,13 @@
|
|
|
317
322
|
}
|
|
318
323
|
|
|
319
324
|
.hk-input-box input:-internal-autofill-previewed,
|
|
320
|
-
.hk-input-box input:-internal-autofill-selected
|
|
325
|
+
.hk-input-box input:-internal-autofill-selected,
|
|
326
|
+
.hk-input-box textarea:-internal-autofill-previewed,
|
|
327
|
+
.hk-input-box textarea:-internal-autofill-selected {
|
|
321
328
|
-webkit-text-fill-color: rgb(var(--color-text)) !important;
|
|
322
329
|
-webkit-box-shadow: 0 0 0 1000px rgb(var(--color-surface)) inset !important;
|
|
323
330
|
caret-color: rgb(var(--color-text));
|
|
331
|
+
transition: color 100000000s step-end, background-color 100000000s step-end;
|
|
324
332
|
}
|
|
325
333
|
|
|
326
334
|
/* The password variant's right-edge affordance (hold-to-reveal eye /
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
|
-
<meta name="hk-error-landing" content="v1 0.55.
|
|
4
|
+
<meta name="hk-error-landing" content="v1 0.55.530 <dev>">
|
|
5
5
|
<meta charset="utf-8" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
7
|
<meta name="robots" content="noindex" />
|
|
@@ -1274,7 +1274,6 @@
|
|
|
1274
1274
|
}
|
|
1275
1275
|
|
|
1276
1276
|
.s-auth-card input:not(.hk-otp-cell) {
|
|
1277
|
-
transition: color 100000000s step-end, background-color 100000000s step-end;
|
|
1278
1277
|
appearance: none;
|
|
1279
1278
|
-webkit-appearance: none;
|
|
1280
1279
|
/* 0 radius here was always a visual no-op: the auth card's inputs are
|
|
@@ -1285,13 +1284,20 @@
|
|
|
1285
1284
|
border-radius: 0;
|
|
1286
1285
|
}
|
|
1287
1286
|
|
|
1287
|
+
/* The frozen autofill transition lives ONLY inside the autofill states
|
|
1288
|
+
(same contract as HkInput.scss): hung on every field it pins the
|
|
1289
|
+
painted color at the previous theme's value forever — black text on a
|
|
1290
|
+
freshly dark surface after one theme switch. */
|
|
1288
1291
|
.s-auth-card input:-webkit-autofill,
|
|
1289
1292
|
.s-auth-card input:-webkit-autofill:hover,
|
|
1290
1293
|
.s-auth-card input:-webkit-autofill:focus,
|
|
1291
|
-
.s-auth-card input:-webkit-autofill:active
|
|
1294
|
+
.s-auth-card input:-webkit-autofill:active,
|
|
1295
|
+
.s-auth-card input:-internal-autofill-previewed,
|
|
1296
|
+
.s-auth-card input:-internal-autofill-selected {
|
|
1292
1297
|
-webkit-text-fill-color: var(--hi-color-text-primary, #333) !important;
|
|
1293
1298
|
-webkit-box-shadow: 0 0 0 1000px var(--hi-color-surface, #fff) inset !important;
|
|
1294
1299
|
caret-color: var(--hi-color-text-primary, #333);
|
|
1300
|
+
transition: color 100000000s step-end, background-color 100000000s step-end;
|
|
1295
1301
|
}
|
|
1296
1302
|
|
|
1297
1303
|
.s-auth-card input:-webkit-autofill::first-line {
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { readdirSync } from "node:fs";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
import { compile, compileString } from "sass";
|
|
6
|
+
import { describe, expect, it } from "vitest";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Autofill-freeze containment contract (family-wide input readability).
|
|
10
|
+
*
|
|
11
|
+
* Chrome's autofill paint is pinned back with a frozen transition
|
|
12
|
+
* (`color`/`background-color` at 100000000s step-end — the transition
|
|
13
|
+
* never completes, so the painted value stays wherever it was). That trick
|
|
14
|
+
* is ONLY sound inside an autofill state: hung on a field's base state it
|
|
15
|
+
* also freezes every THEME-driven color change, so one light→dark switch
|
|
16
|
+
* left every input painting black text (typed value and native placeholder
|
|
17
|
+
* alike — ::placeholder inherits `color`) on the freshly dark surface.
|
|
18
|
+
* That regression shipped once (the "fidelity" port moved the freeze out
|
|
19
|
+
* of the autofill block) and blackened every login field in the family.
|
|
20
|
+
*
|
|
21
|
+
* Mutation anchors for the two claims above:
|
|
22
|
+
* MUT:freeze-leak — re-hanging the freeze on a base-state selector flips
|
|
23
|
+
* the sweep and the HkInput/admin-tokens/mixin pins red (verified: the
|
|
24
|
+
* historical shape turns `2 failed | 4 passed`);
|
|
25
|
+
* MUT:autofill-anchor-lost — dropping the freeze from an autofill block
|
|
26
|
+
* turns the positive anchors red (`1 failed | 5 passed`);
|
|
27
|
+
* MUT:mixin-base-leak — the emitted mixin growing an unscoped base rule
|
|
28
|
+
* turns the wrapper pin red (`1 failed | 5 passed`).
|
|
29
|
+
*
|
|
30
|
+
* This pin walks the leaf rules of every sheet that carries the freeze and
|
|
31
|
+
* fails the build if any freeze appears outside an autofill selector —
|
|
32
|
+
* and, positively, that the autofill blocks still carry it (the anti-flash
|
|
33
|
+
* behavior must survive alongside the containment).
|
|
34
|
+
*/
|
|
35
|
+
const stylesDir = dirname(fileURLToPath(import.meta.url));
|
|
36
|
+
const srcDir = resolve(stylesDir, "..");
|
|
37
|
+
|
|
38
|
+
/** Every spelling the freeze has ever shipped as (the `1e8s` form is the
|
|
39
|
+
* same duration minified — guard both). */
|
|
40
|
+
const FREEZE_SPELLINGS = ["100000000s", "1e8s"];
|
|
41
|
+
|
|
42
|
+
/** A rule body counts as "frozen" when it carries the freeze duration on a
|
|
43
|
+
* color/background transition. */
|
|
44
|
+
function isFrozen(body: string): boolean {
|
|
45
|
+
return FREEZE_SPELLINGS.some((spelling) => body.includes(spelling));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** The autofill STATES the freeze is allowed to live in — pseudo-class
|
|
49
|
+
* forms, not a bare substring (a class that merely contains the word
|
|
50
|
+
* "autofill", like `.promo-autofill-note`, must NOT pass). */
|
|
51
|
+
const AUTOFILL_STATE = /:(-webkit-autofill|-internal-autofill-previewed|-internal-autofill-selected)/i;
|
|
52
|
+
|
|
53
|
+
interface LeafRule {
|
|
54
|
+
selector: string;
|
|
55
|
+
body: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Flatten compiled CSS into leaf rules (bodies without braces). */
|
|
59
|
+
function leafRules(css: string): LeafRule[] {
|
|
60
|
+
const withoutComments = css.replace(/\/\*[\s\S]*?\*\//g, "");
|
|
61
|
+
const leaves: LeafRule[] = [];
|
|
62
|
+
const selectors: string[] = [];
|
|
63
|
+
let buf = "";
|
|
64
|
+
for (const ch of withoutComments) {
|
|
65
|
+
if (ch === "{") {
|
|
66
|
+
selectors.push(buf.trim());
|
|
67
|
+
buf = "";
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (ch === "}") {
|
|
71
|
+
const selector = selectors.pop() ?? "";
|
|
72
|
+
if (!selector.startsWith("@") && !buf.includes("{") && buf.trim().length > 0) {
|
|
73
|
+
leaves.push({ selector, body: buf.trim() });
|
|
74
|
+
}
|
|
75
|
+
buf = "";
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
buf += ch;
|
|
79
|
+
}
|
|
80
|
+
return leaves;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function sheetRules(relativePath: string): LeafRule[] {
|
|
84
|
+
const file = resolve(srcDir, relativePath);
|
|
85
|
+
return leafRules(compile(file, { style: "expanded" }).css);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** The containment sweep: a freeze may only ride an autofill-state selector. */
|
|
89
|
+
function expectFreezeContained(rules: LeafRule[], label: string, requireFreeze = true): void {
|
|
90
|
+
const frozen = rules.filter((rule) => isFrozen(rule.body));
|
|
91
|
+
if (requireFreeze) {
|
|
92
|
+
expect(frozen.length, `${label}: the autofill freeze rules exist`).toBeGreaterThan(0);
|
|
93
|
+
}
|
|
94
|
+
for (const rule of frozen) {
|
|
95
|
+
expect(
|
|
96
|
+
rule.selector,
|
|
97
|
+
`${label}: freeze outside an autofill state leaks into ${JSON.stringify(rule.selector)}`,
|
|
98
|
+
).toMatch(AUTOFILL_STATE);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** The positive anchor: an autofill block still carries the freeze. */
|
|
103
|
+
function expectAutofillFreeze(rules: LeafRule[], selectorFragment: string, label: string): void {
|
|
104
|
+
const hit = rules.find(
|
|
105
|
+
(rule) => rule.selector.toLowerCase().includes(selectorFragment) && isFrozen(rule.body),
|
|
106
|
+
);
|
|
107
|
+
expect(hit, `${label}: no autofill rule ${selectorFragment} carries the freeze`).toBeDefined();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Every component + style sheet that could carry an input — the sweep is a
|
|
111
|
+
* directory cursor, not a hand list, so a NEW sheet with the freeze is
|
|
112
|
+
* scanned too (mirrors of these sheets are byte-guarded separately by
|
|
113
|
+
* vue_mirror_drift_tests.rs). */
|
|
114
|
+
function sweptSheets(): string[] {
|
|
115
|
+
const sheets: string[] = [];
|
|
116
|
+
for (const dir of ["components", "styles"]) {
|
|
117
|
+
for (const entry of readdirSync(resolve(srcDir, dir))) {
|
|
118
|
+
if (entry.endsWith(".scss") && !entry.startsWith("_")) {
|
|
119
|
+
sheets.push(`${dir}/${entry}`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return sheets;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
describe("input autofill freeze containment", () => {
|
|
127
|
+
// The sweep compiles ~40 small sheets; keep the shared parse one-shot.
|
|
128
|
+
const swept = new Map(sweptSheets().map((sheet) => [sheet, sheetRules(sheet)]));
|
|
129
|
+
|
|
130
|
+
it("no sheet carries the freeze outside an autofill state", () => {
|
|
131
|
+
for (const [sheet, rules] of swept) {
|
|
132
|
+
expectFreezeContained(rules, sheet, false);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it("HkInput.scss keeps the freeze inside the autofill states", () => {
|
|
137
|
+
const rules = swept.get("components/HkInput.scss")!;
|
|
138
|
+
expectFreezeContained(rules, "HkInput");
|
|
139
|
+
expectAutofillFreeze(rules, "hk-input-box input:-webkit-autofill", "HkInput");
|
|
140
|
+
// The historical bug shape: the BASE field selector must not exist
|
|
141
|
+
// carrying a transition at all.
|
|
142
|
+
const base = rules.find((rule) => rule.selector.replace(/\s+/g, " ") === ".hk-input-box input, .hk-input-box textarea");
|
|
143
|
+
expect(base, "the unscoped base-field rule must stay deleted").toBeUndefined();
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it("admin-tokens.scss keeps the auth-card freeze inside the autofill states", () => {
|
|
147
|
+
const rules = swept.get("styles/admin-tokens.scss")!;
|
|
148
|
+
expectFreezeContained(rules, "admin-tokens");
|
|
149
|
+
expectAutofillFreeze(rules, "s-auth-card input:-webkit-autofill", "admin-tokens");
|
|
150
|
+
const base = rules.find((rule) => rule.selector.replace(/\s+/g, " ") === ".s-auth-card input:not(.hk-otp-cell)");
|
|
151
|
+
expect(base, "the auth-card base input rule exists").toBeDefined();
|
|
152
|
+
expect(isFrozen(base!.body), "the auth-card base input rule must not freeze").toBe(false);
|
|
153
|
+
expect(base!.body).not.toContain("transition:");
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it("HkPasswordSurface.scss keeps the freeze scoped (already-correct shape, pinned)", () => {
|
|
157
|
+
expectFreezeContained(swept.get("components/HkPasswordSurface.scss")!, "HkPasswordSurface");
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it("HkOtpInput.scss keeps the freeze scoped", () => {
|
|
161
|
+
// The OTP sheet pins autofill with a plain background override and
|
|
162
|
+
// carries no frozen transition today; the sweep only guards against
|
|
163
|
+
// one being introduced outside an autofill state.
|
|
164
|
+
expectFreezeContained(swept.get("components/HkOtpInput.scss")!, "HkOtpInput", false);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it("field-autofill-overrides mixin emits the freeze only in autofill states", () => {
|
|
168
|
+
const wrapper = `@use "theme/field" as field;\n@include field.field-autofill-overrides("fx-box");\n`;
|
|
169
|
+
const css = compileString(wrapper, { loadPaths: [srcDir] }).css;
|
|
170
|
+
const rules = leafRules(css);
|
|
171
|
+
expectFreezeContained(rules, "field mixin");
|
|
172
|
+
expectAutofillFreeze(rules, "fx-box input:-webkit-autofill", "field mixin");
|
|
173
|
+
const base = rules.find((rule) => rule.selector.replace(/\s+/g, " ") === ".fx-box input, .fx-box textarea");
|
|
174
|
+
expect(base, "the mixin must not emit an unscoped base-field rule").toBeUndefined();
|
|
175
|
+
});
|
|
176
|
+
});
|
package/src/theme/_field.scss
CHANGED
|
@@ -85,11 +85,10 @@
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
@mixin field-autofill-overrides($box-class) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
/* The frozen autofill transition lives ONLY inside the autofill states
|
|
89
|
+
(same contract as HkInput.scss): an unscoped copy pins the field's
|
|
90
|
+
painted color at the previous theme's value forever, so one theme
|
|
91
|
+
switch paints black text on the new dark surface. */
|
|
93
92
|
.#{$box-class} input:-webkit-autofill,
|
|
94
93
|
.#{$box-class} input:-webkit-autofill:hover,
|
|
95
94
|
.#{$box-class} input:-webkit-autofill:focus,
|
|
@@ -100,6 +99,7 @@
|
|
|
100
99
|
-webkit-text-fill-color: rgb(var(--color-text)) !important;
|
|
101
100
|
-webkit-box-shadow: 0 0 0 1000px rgb(var(--color-surface)) inset !important;
|
|
102
101
|
caret-color: rgb(var(--color-text));
|
|
102
|
+
transition: color 100000000s step-end, background-color 100000000s step-end;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
.#{$box-class} input:-webkit-autofill::first-line,
|
|
@@ -110,9 +110,12 @@
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
.#{$box-class} input:-internal-autofill-previewed,
|
|
113
|
-
.#{$box-class} input:-internal-autofill-selected
|
|
113
|
+
.#{$box-class} input:-internal-autofill-selected,
|
|
114
|
+
.#{$box-class} textarea:-internal-autofill-previewed,
|
|
115
|
+
.#{$box-class} textarea:-internal-autofill-selected {
|
|
114
116
|
-webkit-text-fill-color: rgb(var(--color-text)) !important;
|
|
115
117
|
-webkit-box-shadow: 0 0 0 1000px rgb(var(--color-surface)) inset !important;
|
|
116
118
|
caret-color: rgb(var(--color-text));
|
|
119
|
+
transition: color 100000000s step-end, background-color 100000000s step-end;
|
|
117
120
|
}
|
|
118
121
|
}
|