@celestia-island/hikari 0.55.247 → 0.55.248
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
|
@@ -21,11 +21,19 @@
|
|
|
21
21
|
.hk-waterfall-columns {
|
|
22
22
|
display: flex;
|
|
23
23
|
align-items: flex-start;
|
|
24
|
-
gap: var(--space-12);
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
/* Independent columns (not CSS columns): each keeps its own transition
|
|
28
|
-
group, so a card arriving in one column never reflows the other.
|
|
27
|
+
group, so a card arriving in one column never reflows the other.
|
|
28
|
+
Column spacing rides SIBLING MARGINS, never a container `gap`: a gap is
|
|
29
|
+
spent between every adjacent pair of rendered flex items — including the
|
|
30
|
+
pair (live column, collapsed column) — so with a collapsed trailing
|
|
31
|
+
column the surviving card rendered one `--space-12` narrower than the
|
|
32
|
+
bucket while the bucket's other children (a full-width bucketHeader
|
|
33
|
+
caption row) kept the true right edge. Every single-card section drew a
|
|
34
|
+
ragged right edge against its own header (chest reports view, user
|
|
35
|
+
screenshot 2026-10-31). A sibling margin is only spent where two
|
|
36
|
+
width-carrying columns actually sit, and an empty column cancels it. */
|
|
29
37
|
.hk-waterfall-column {
|
|
30
38
|
flex: 1 1 0;
|
|
31
39
|
min-width: 0;
|
|
@@ -34,10 +42,23 @@
|
|
|
34
42
|
gap: var(--space-12);
|
|
35
43
|
}
|
|
36
44
|
|
|
45
|
+
.hk-waterfall-column + .hk-waterfall-column {
|
|
46
|
+
margin-inline-start: var(--space-12);
|
|
47
|
+
}
|
|
48
|
+
|
|
37
49
|
/* A bucket with fewer cards than columns leaves an empty column behind.
|
|
38
50
|
Without this it keeps its `flex: 1 1 0` share of the row and the
|
|
39
51
|
surviving card renders at half width beside a ghost; collapsed, the card
|
|
40
|
-
takes the full width until the bucket grows a card for that column
|
|
52
|
+
takes the full width until the bucket grows a card for that column —
|
|
53
|
+
and with the margin-based spacing above it costs no gap either, so the
|
|
54
|
+
surviving column spans the bucket edge to edge. */
|
|
41
55
|
.hk-waterfall-column[data-empty] {
|
|
42
56
|
flex: 0 0 0;
|
|
57
|
+
margin-inline-start: 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* Same no-ghost-cost rule on the leading edge: an empty column ahead of a
|
|
61
|
+
live one must not indent it off the bucket's start edge either. */
|
|
62
|
+
.hk-waterfall-column[data-empty] + .hk-waterfall-column {
|
|
63
|
+
margin-inline-start: 0;
|
|
43
64
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
import { compile } from "sass";
|
|
6
|
+
import { describe, expect, it } from "vitest";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Compiled-stylesheet guard for HkWaterfall's column geometry — the axis a
|
|
10
|
+
* runtime jsdom suite cannot see (it does no layout): how the two masonry
|
|
11
|
+
* columns share the bucket row.
|
|
12
|
+
*
|
|
13
|
+
* 1. column spacing is SIBLING MARGIN, not a container `gap`;
|
|
14
|
+
* 2. a collapsed (`[data-empty]`) column costs no width AND no spacing —
|
|
15
|
+
* a container gap would be spent on the (live, collapsed) pair, so the
|
|
16
|
+
* surviving card rendered one `--space-12` narrower than the bucket
|
|
17
|
+
* while full-width bucketHeader caption rows kept the true edge: a
|
|
18
|
+
* ragged right edge on every single-card section (chest reports view,
|
|
19
|
+
* user screenshot 2026-10-31);
|
|
20
|
+
* 3. a live column AFTER a collapsed one is not indented off the bucket's
|
|
21
|
+
* start edge either.
|
|
22
|
+
*
|
|
23
|
+
* Vitest stubs CSS, so the runtime suite can never catch a lost rule —
|
|
24
|
+
* this compiles the sheet directly and asserts the contract.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
const componentDir = resolve(dirname(fileURLToPath(import.meta.url)));
|
|
28
|
+
|
|
29
|
+
const css = compile(resolve(componentDir, "HkWaterfall.scss"), {
|
|
30
|
+
style: "expanded",
|
|
31
|
+
}).css;
|
|
32
|
+
|
|
33
|
+
function ruleFor(selector: string): string {
|
|
34
|
+
const start = css.indexOf(selector);
|
|
35
|
+
expect(start, `${selector} present in the compiled sheet`).toBeGreaterThanOrEqual(0);
|
|
36
|
+
const open = css.indexOf("{", start);
|
|
37
|
+
const close = css.indexOf("}", open);
|
|
38
|
+
return css.slice(start, close + 1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
describe("HkWaterfall column spacing contract", () => {
|
|
42
|
+
it("compiles without warnings", () => {
|
|
43
|
+
expect(css).toContain(".hk-waterfall-columns");
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it("the columns row carries no container gap (a gap would be spent on collapsed columns too)", () => {
|
|
47
|
+
const rule = ruleFor(".hk-waterfall-columns {");
|
|
48
|
+
expect(rule).not.toContain("gap");
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("adjacent live columns are spaced by a sibling margin", () => {
|
|
52
|
+
const rule = ruleFor(".hk-waterfall-column + .hk-waterfall-column {");
|
|
53
|
+
expect(rule).toContain("margin-inline-start: var(--space-12)");
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("a collapsed column costs no width and no spacing", () => {
|
|
57
|
+
const rule = ruleFor(".hk-waterfall-column[data-empty] {");
|
|
58
|
+
expect(rule).toContain("flex: 0 0 0");
|
|
59
|
+
expect(rule).toContain("margin-inline-start: 0");
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("a live column after a collapsed one starts flush at the bucket edge", () => {
|
|
63
|
+
const rule = ruleFor(".hk-waterfall-column[data-empty] + .hk-waterfall-column {");
|
|
64
|
+
expect(rule).toContain("margin-inline-start: 0");
|
|
65
|
+
});
|
|
66
|
+
});
|