@celestia-island/hikari 0.50.4 → 0.51.1
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/styles/index.scss +1 -0
- package/src/styles/reset.scss +60 -0
- package/src/styles/resetSheet.test.ts +43 -0
package/package.json
CHANGED
package/src/styles/index.scss
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
// import them granularly only for legacy compositions. The previous
|
|
22
22
|
// version of this file re-exported packages/theme + packages/components
|
|
23
23
|
// through paths that escape the npm package and did not compile.
|
|
24
|
+
@use "./reset.scss";
|
|
24
25
|
@use "./theme/channels.scss";
|
|
25
26
|
@use "./theme/scale.scss";
|
|
26
27
|
@use "./admin-tokens.scss";
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* ── Host reset (L2) ────────────────────────────────────────────────────
|
|
2
|
+
* The base normalization every hikari host needs and none of them should
|
|
3
|
+
* have to hand-roll. Component sheets self-declare their critical box
|
|
4
|
+
* geometry (`.hk-input-element`'s border-box, borders, appearance), but
|
|
5
|
+
* the wrappers and the native controls they contain still inherit the
|
|
6
|
+
* UA's default typography chain — measured 2026-09-14 in the flasher on
|
|
7
|
+
* hikari 0.49: without a host reset the sign-in fields render ~100px
|
|
8
|
+
* (min-height 2.5rem plus UA line-height/font inflation of the in-flow
|
|
9
|
+
* content), with one exactly ~40px. The chest webui historically rode
|
|
10
|
+
* UnoCSS with preflight planned around it; hosts without a utility
|
|
11
|
+
* layer had nothing. This sheet is that nothing: preflight-equivalent,
|
|
12
|
+
* token-aware, and part of the canonical composition (index.scss).
|
|
13
|
+
*
|
|
14
|
+
* Order: FIRST in the composition. It only ever lowers UA defaults;
|
|
15
|
+
* component sheets and host styles override it by specificity/order. */
|
|
16
|
+
|
|
17
|
+
*,
|
|
18
|
+
*::before,
|
|
19
|
+
*::after {
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
border-width: 0;
|
|
22
|
+
border-style: solid;
|
|
23
|
+
border-color: rgb(var(--color-border, 120 120 120) / 40%);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
html {
|
|
27
|
+
line-height: 1.5;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
body {
|
|
31
|
+
margin: 0;
|
|
32
|
+
font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
button,
|
|
36
|
+
input,
|
|
37
|
+
optgroup,
|
|
38
|
+
select,
|
|
39
|
+
textarea {
|
|
40
|
+
margin: 0;
|
|
41
|
+
padding: 0;
|
|
42
|
+
font: inherit;
|
|
43
|
+
line-height: inherit;
|
|
44
|
+
color: inherit;
|
|
45
|
+
background: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
button,
|
|
49
|
+
[type='button'],
|
|
50
|
+
[type='reset'],
|
|
51
|
+
[type='submit'] {
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
img,
|
|
56
|
+
svg,
|
|
57
|
+
canvas {
|
|
58
|
+
display: block;
|
|
59
|
+
max-width: 100%;
|
|
60
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
import { describe, expect, it } from "vitest";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Host-reset composition guard.
|
|
9
|
+
*
|
|
10
|
+
* reset.scss is the base normalization every hikari host needs (measured
|
|
11
|
+
* 2026-09-14 in the flasher: without it the UA typography chain inflates
|
|
12
|
+
* the component wrappers — sign-in fields ~100px vs ~40px with it). Hosts
|
|
13
|
+
* that historically rode a utility-layer preflight (chest: UnoCSS, with
|
|
14
|
+
* preflight later disabled) no longer need a hand-rolled equivalent.
|
|
15
|
+
*
|
|
16
|
+
* The contract under test: the canonical composition (index.scss) loads
|
|
17
|
+
* the reset FIRST, and the reset actually normalizes the native control
|
|
18
|
+
* typography chain — the exact rules the flasher regression hinged on.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const stylesDir = resolve(dirname(fileURLToPath(import.meta.url)));
|
|
22
|
+
|
|
23
|
+
function read(path: string): string {
|
|
24
|
+
return readFileSync(resolve(stylesDir, path), "utf8").replace(/\r\n/g, "\n");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
describe("host reset sheet", () => {
|
|
28
|
+
it("loads first in the canonical composition", () => {
|
|
29
|
+
const index = read("index.scss");
|
|
30
|
+
const first = index.match(/^@use "([^"]+)";/m)?.[1];
|
|
31
|
+
expect(first).toBe("./reset.scss");
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("normalizes the native control typography chain", () => {
|
|
35
|
+
const reset = read("reset.scss");
|
|
36
|
+
for (const selector of ["button,", "input,", "textarea"]) {
|
|
37
|
+
expect(reset).toContain(selector);
|
|
38
|
+
}
|
|
39
|
+
expect(reset).toContain("font: inherit");
|
|
40
|
+
expect(reset).toContain("line-height: inherit");
|
|
41
|
+
expect(reset).toContain("box-sizing: border-box");
|
|
42
|
+
});
|
|
43
|
+
});
|