@celestia-island/hikari 0.55.455 → 0.55.456
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/HkExpansionPanel.scss +14 -5
- package/src/components/HkExpansionPanel.test.tsx +34 -3
- package/src/components/HkExpansionPanel.tsx +9 -1
- package/src/components/HkSerpentineUnlock.scss +17 -0
- package/src/components/HkSerpentineUnlock.test.ts +49 -2
- package/src/components/HkSerpentineUnlock.tsx +9 -1
- package/src/components/HkTabs.scss +11 -0
- package/src/components/HkTabs.test.ts +75 -0
package/package.json
CHANGED
|
@@ -125,17 +125,26 @@
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
.hk-expansion-panel-content {
|
|
128
|
+
/* The clipped grid item must stay PADDING-FREE: vertical padding on it
|
|
129
|
+
cannot collapse with the 0fr track — the track goes to zero but the
|
|
130
|
+
padding block survives as a residual band under the header of every
|
|
131
|
+
closed panel (the "weird padding below the collapsed DPI card"
|
|
132
|
+
report). The body inset therefore lives on the inner wrapper, which
|
|
133
|
+
the clip takes away wholesale when the track collapses. */
|
|
134
|
+
min-height: 0;
|
|
135
|
+
overflow: hidden;
|
|
136
|
+
visibility: hidden;
|
|
137
|
+
// Stays visible while the closing animation runs, then hides.
|
|
138
|
+
transition: visibility 0s linear var(--duration-normal);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.hk-expansion-panel-content-inner {
|
|
128
142
|
/* The BODY padding belongs to the panel, not to each host: inline
|
|
129
143
|
padding matches the header's own (var(--space-12)), so body content
|
|
130
144
|
aligns with the title, and the bottom pad gives the content breathing
|
|
131
145
|
room before the panel edge. Without this every consumer hand-pads
|
|
132
146
|
(and forgets — the flush body was exactly that report). */
|
|
133
147
|
padding: var(--space-8) var(--space-12) var(--space-12);
|
|
134
|
-
min-height: 0;
|
|
135
|
-
overflow: hidden;
|
|
136
|
-
visibility: hidden;
|
|
137
|
-
// Stays visible while the closing animation runs, then hides.
|
|
138
|
-
transition: visibility 0s linear var(--duration-normal);
|
|
139
148
|
}
|
|
140
149
|
|
|
141
150
|
.hk-expansion-panel[data-open] .hk-expansion-panel-content {
|
|
@@ -111,15 +111,46 @@ describe("HkExpansionPanel", () => {
|
|
|
111
111
|
});
|
|
112
112
|
});
|
|
113
113
|
|
|
114
|
-
describe("HkExpansionPanel body padding contract (2026-11-19)", () => {
|
|
114
|
+
describe("HkExpansionPanel body padding contract (2026-11-19, relocated 2026-11-21)", () => {
|
|
115
115
|
// The BODY padding belongs to the panel (user direction 2026-11-19: a
|
|
116
116
|
// flush expanded body read as a host bug, and hosts that hand-padded
|
|
117
117
|
// doubled once the panel grew its own). The stylesheet contract keeps
|
|
118
118
|
// the inset from being dropped again.
|
|
119
|
-
|
|
119
|
+
//
|
|
120
|
+
// 2026-11-21 (user report: a residual band below the collapsed DPI
|
|
121
|
+
// card): the padding MOVED from the clipped grid item to an inner
|
|
122
|
+
// wrapper. Vertical padding on the clipped item cannot collapse with
|
|
123
|
+
// the 0fr track — the track goes to zero but the padding block
|
|
124
|
+
// survives as a ~20px dead band under the header of every closed
|
|
125
|
+
// panel. Both halves are pinned: the inset still exists (inner), and
|
|
126
|
+
// the clip itself carries none.
|
|
127
|
+
it("owns the body inset on the inner wrapper (header-aligned inline + bottom)", () => {
|
|
120
128
|
const scss = readFileSync(join(dirname(fileURLToPath(import.meta.url)), "HkExpansionPanel.scss"), "utf8");
|
|
121
129
|
expect(scss).toMatch(
|
|
122
|
-
/\.hk-expansion-panel-content\s*{[^}]*padding:\s*var\(--space-8\)\s+var\(--space-12\)\s+var\(--space-12\)/,
|
|
130
|
+
/\.hk-expansion-panel-content-inner\s*{[^}]*padding:\s*var\(--space-8\)\s+var\(--space-12\)\s+var\(--space-12\)/,
|
|
123
131
|
);
|
|
124
132
|
});
|
|
133
|
+
|
|
134
|
+
it("keeps the clipped grid item padding-free so a closed panel collapses to zero", () => {
|
|
135
|
+
const scss = readFileSync(join(dirname(fileURLToPath(import.meta.url)), "HkExpansionPanel.scss"), "utf8");
|
|
136
|
+
const content = scss.match(/\.hk-expansion-panel-content\s*{([^}]*)}/)?.[1] ?? "";
|
|
137
|
+
// Strip comments first — the prose explains the rule and mentions the
|
|
138
|
+
// word; only the declarations count.
|
|
139
|
+
const declarations = content.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\/\/[^\n]*/g, "");
|
|
140
|
+
expect(declarations).not.toMatch(/padding/);
|
|
141
|
+
// The collapse machinery stays on the clip: the 0fr track + the
|
|
142
|
+
// min-height/overflow pair are what make the closed body actually
|
|
143
|
+
// disappear rather than shrink to its padding.
|
|
144
|
+
expect(declarations).toContain("min-height: 0");
|
|
145
|
+
expect(declarations).toContain("overflow: hidden");
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it("renders the inner wrapper between the clip and the slot content", () => {
|
|
149
|
+
const container = mountPanel({ title: "T" }, { default: () => h("p", "body") });
|
|
150
|
+
const content = panelOf(container).querySelector<HTMLElement>(".hk-expansion-panel-content")!;
|
|
151
|
+
expect(content).toBeTruthy();
|
|
152
|
+
const inner = content.querySelector<HTMLElement>(":scope > .hk-expansion-panel-content-inner");
|
|
153
|
+
expect(inner).toBeTruthy();
|
|
154
|
+
expect(inner!.textContent).toBe("body");
|
|
155
|
+
});
|
|
125
156
|
});
|
|
@@ -93,7 +93,15 @@ export default defineComponent({
|
|
|
93
93
|
</span>
|
|
94
94
|
</button>
|
|
95
95
|
<div class="hk-expansion-panel-body">
|
|
96
|
-
<div class="hk-expansion-panel-content">
|
|
96
|
+
<div class="hk-expansion-panel-content">
|
|
97
|
+
{/* The PADDING lives on this inner wrapper, not on the clipped
|
|
98
|
+
grid item: a padded grid item cannot collapse to zero (the
|
|
99
|
+
padding block survives the 0fr track as a residual band under
|
|
100
|
+
the header — the "weird padding below the collapsed DPI card"
|
|
101
|
+
report). The clip stays padding-free; the wrapper is what
|
|
102
|
+
gets clipped away. */}
|
|
103
|
+
<div class="hk-expansion-panel-content-inner">{slots.default?.()}</div>
|
|
104
|
+
</div>
|
|
97
105
|
</div>
|
|
98
106
|
</div>
|
|
99
107
|
);
|
|
@@ -104,10 +104,27 @@
|
|
|
104
104
|
// The generous top padding keeps the copy clear of the lane stroke —
|
|
105
105
|
// a second device pass showed 8px reading as part of the graphic.
|
|
106
106
|
display: block;
|
|
107
|
+
// One text line's box, kept across states: the confirmed spinner (12px)
|
|
108
|
+
// is shorter than the text line box it replaces, and without this floor
|
|
109
|
+
// the hint (and everything below it) jumps up ~6px at the moment of
|
|
110
|
+
// confirm.
|
|
111
|
+
min-height: calc(var(--text-xs, 0.75rem) * 1.5);
|
|
107
112
|
padding: var(--space-8, 8px) var(--space-12, 12px) var(--space-4, 4px);
|
|
108
113
|
text-align: center;
|
|
109
114
|
font-size: var(--text-xs, 0.75rem);
|
|
110
115
|
color: rgb(var(--color-muted));
|
|
111
116
|
}
|
|
112
117
|
|
|
118
|
+
// The retired ✓ glyph is a busy spinner now (2026-11-21 user ruling):
|
|
119
|
+
// a walk completion hands off to the parent, so the hint line shows the
|
|
120
|
+
// standard spinner. The wrapper is a BLOCK-level flex box, so
|
|
121
|
+
// text-align cannot centre it — this confirmed override must stay AFTER
|
|
122
|
+
// the base rule above (same specificity (0,2,0); source order decides)
|
|
123
|
+
// or the centring silently dies (R5-caught S2).
|
|
124
|
+
.hk-serpentine--confirmed .hk-serpentine-hint {
|
|
125
|
+
display: flex;
|
|
126
|
+
align-items: center;
|
|
127
|
+
justify-content: center;
|
|
128
|
+
}
|
|
129
|
+
|
|
113
130
|
|
|
@@ -126,6 +126,33 @@ describe("HkSerpentineUnlock (mounted)", () => {
|
|
|
126
126
|
expect(cancelSpy).not.toHaveBeenCalled();
|
|
127
127
|
});
|
|
128
128
|
|
|
129
|
+
it("shows the busy spinner after a confirm — never a ✓ success stamp", async () => {
|
|
130
|
+
// 2026-11-21 user ruling: a walk completion hands off to the parent,
|
|
131
|
+
// so the hint line renders the standard spinner (the retired "✓"
|
|
132
|
+
// read as a success stamp on a deletion still in flight — and the
|
|
133
|
+
// #1468 revert had brought it back). DOM assertions ride nextTick:
|
|
134
|
+
// the confirm emit is synchronous, the render is not.
|
|
135
|
+
const el = mountGate();
|
|
136
|
+
expect(el.querySelector(".hk-serpentine-hint .hk-spinner")).toBeNull();
|
|
137
|
+
const path = generateSerpentinePath(600, 96, 42);
|
|
138
|
+
const start = path.points[0]!;
|
|
139
|
+
pointer(el, "pointerdown", start.x, start.y);
|
|
140
|
+
for (let d = 6; d <= path.totalLength + 4; d += 6) {
|
|
141
|
+
const at = projectOntoPath(path.points, d);
|
|
142
|
+
pointer(el, "pointermove", at.x, at.y);
|
|
143
|
+
}
|
|
144
|
+
pointer(el, "pointerup", 600, 48);
|
|
145
|
+
await nextTick();
|
|
146
|
+
// Mutation-ordering contract (R3 S1): the two semantic pins come FIRST,
|
|
147
|
+
// so each dies on its own line — a mutation back to the text "✓" trips
|
|
148
|
+
// the glyph-absence pin (and drops aria-busy), not just the spinner
|
|
149
|
+
// existence query.
|
|
150
|
+
const hint = el.querySelector(".hk-serpentine-hint")!;
|
|
151
|
+
expect(hint.textContent).not.toContain("✓");
|
|
152
|
+
expect(el.getAttribute("aria-busy")).toBe("true");
|
|
153
|
+
expect(hint.querySelector(".hk-spinner")).toBeTruthy();
|
|
154
|
+
});
|
|
155
|
+
|
|
129
156
|
it("holds position when the pointer drifts off-lane (no reset)", () => {
|
|
130
157
|
// Device feedback: an 18px corridor reset the walk on every wobble.
|
|
131
158
|
// Now a drifting pointer HOLDS the knob (no fail, no spring); the walk
|
|
@@ -299,7 +326,26 @@ describe("HkSerpentineUnlock styles contract", () => {
|
|
|
299
326
|
});
|
|
300
327
|
|
|
301
328
|
it("keeps no displacement animation at all (the shake retired with the off-path fail)", () => {
|
|
302
|
-
|
|
329
|
+
// The busy spinner is the standard HkSpinner component — its rotation
|
|
330
|
+
// keyframe lives in HkSpinner.scss, not here (0 here is the healthy
|
|
331
|
+
// state; the ≤1 slack exists only so a future local keyframe does not
|
|
332
|
+
// read as a regression of the retired shake).
|
|
333
|
+
expect(scss.split("@keyframes").length - 1).toBeLessThanOrEqual(1);
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
it("authors the confirmed flex override AFTER the base hint rule (cascade pin)", () => {
|
|
337
|
+
// R5-caught S2: both selectors are (0,2,0), so source order decides.
|
|
338
|
+
// The confirmed rule (flex centring for the block-level spinner
|
|
339
|
+
// wrapper) sat ABOVE the base `display: block` and never applied —
|
|
340
|
+
// the spinner hugged the hint line's left edge. Pin the order.
|
|
341
|
+
const base = scss.indexOf(".hk-serpentine-hint {");
|
|
342
|
+
const confirmed = scss.indexOf(".hk-serpentine--confirmed .hk-serpentine-hint {");
|
|
343
|
+
expect(base).toBeGreaterThan(-1);
|
|
344
|
+
expect(confirmed).toBeGreaterThan(base);
|
|
345
|
+
// And the override really carries the centring declarations.
|
|
346
|
+
const confirmedBlock = scss.slice(confirmed);
|
|
347
|
+
expect(confirmedBlock).toContain("display: flex");
|
|
348
|
+
expect(confirmedBlock).toContain("justify-content: center");
|
|
303
349
|
});
|
|
304
350
|
|
|
305
351
|
it("puts the hint in flow (no absolute hang below the box)", () => {
|
|
@@ -315,7 +361,8 @@ describe("HkSerpentineUnlock styles contract", () => {
|
|
|
315
361
|
// duration/ease tokens. The invented --hk-motion-ease must not return.
|
|
316
362
|
expect(scss).toContain("--ease-standard");
|
|
317
363
|
expect(scss).not.toContain("--hk-motion-ease");
|
|
318
|
-
// spinner
|
|
364
|
+
// The spinner rides the standard HkSpinner component; no local
|
|
365
|
+
// rotation keyframe belongs in this sheet.
|
|
319
366
|
expect(scss.split("@keyframes").length - 1).toBeLessThanOrEqual(1);
|
|
320
367
|
});
|
|
321
368
|
});
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
} from "./serpentineGeometry";
|
|
20
20
|
import "./HkSerpentineUnlock.scss";
|
|
21
21
|
import { onFrame, reportTransition, type AnimationHandle } from "../runtime/animationBus";
|
|
22
|
+
import HkSpinner from "./HkSpinner";
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Deliberate-action gate: drag the handle along a randomly generated
|
|
@@ -335,6 +336,7 @@ const TRACKING_TOLERANCE = 30;
|
|
|
335
336
|
ref={viewport}
|
|
336
337
|
role="group"
|
|
337
338
|
aria-label={props.label}
|
|
339
|
+
aria-busy={confirmed.value || undefined}
|
|
338
340
|
tabindex={props.disabled ? -1 : 0}
|
|
339
341
|
onKeydown={onKeydown}
|
|
340
342
|
onPointerdown={onPointerDown}
|
|
@@ -373,7 +375,13 @@ const TRACKING_TOLERANCE = 30;
|
|
|
373
375
|
</div>
|
|
374
376
|
<span class="hk-serpentine-hint" aria-live="polite">
|
|
375
377
|
{confirmed.value
|
|
376
|
-
|
|
378
|
+
// The walk is done and the parent is acting on it: a busy
|
|
379
|
+
// spinner (2026-11-21 user ruling — the retired "✓" claimed a
|
|
380
|
+
// completion the gate does not know about; it also came back
|
|
381
|
+
// from the #1461 revert looking like a *success* stamp on a
|
|
382
|
+
// deletion still in flight). The standard spinner renders in
|
|
383
|
+
// the hint line and the gate announces busy (aria-busy).
|
|
384
|
+
? <HkSpinner size="xs" />
|
|
377
385
|
: tracking.value || keyboardGrabbed.value
|
|
378
386
|
? props.trackingHint
|
|
379
387
|
: props.grabHint}
|
|
@@ -137,6 +137,17 @@
|
|
|
137
137
|
takes no space, so the option's own content stays exactly centred (a
|
|
138
138
|
reserved lane here was what pushed the auto option off-centre). */
|
|
139
139
|
width: 100%;
|
|
140
|
+
|
|
141
|
+
.hk-supplement-inset-supplement-inner {
|
|
142
|
+
/* Trailing inset inside the collapsing column (so it, too, occupies
|
|
143
|
+
nothing at rest): the cell has no padding of its own and the
|
|
144
|
+
sliding indicator frames the CELL — without a trailing inset the
|
|
145
|
+
revealed action's 20px hit area lands flush on the segment edge
|
|
146
|
+
and the dots glyph hugs the boundary (user report). Matches the
|
|
147
|
+
trigger's own inline padding (var(--space-12)) so the revealed
|
|
148
|
+
action reads as sitting inside the option, same as the label. */
|
|
149
|
+
padding-inline-end: var(--space-12);
|
|
150
|
+
}
|
|
140
151
|
}
|
|
141
152
|
|
|
142
153
|
.hk-supplement-inset-main > .hk-tabs-trigger {
|
|
@@ -1439,3 +1439,78 @@ describe("HkTabs attached trigger actions (2026-11-19)", () => {
|
|
|
1439
1439
|
expect(document.querySelector(".hk-select-popout")).toBeNull();
|
|
1440
1440
|
});
|
|
1441
1441
|
});
|
|
1442
|
+
|
|
1443
|
+
describe("HkTabs supplement trailing inset (2026-11-21)", () => {
|
|
1444
|
+
// User report: the hover/press-revealed ⋯ inside a segmented option sat
|
|
1445
|
+
// flush on the segment's right edge — the cell has no padding of its own
|
|
1446
|
+
// and the sliding indicator frames the CELL, so the action's hit area
|
|
1447
|
+
// landed on the boundary. The fix gives the supplement column a trailing
|
|
1448
|
+
// inset matching the trigger's own inline padding, INSIDE the collapsing
|
|
1449
|
+
// column (at rest it still occupies nothing, so the label stays centred).
|
|
1450
|
+
const scss = readFileSync(join(here, "HkTabs.scss"), "utf8");
|
|
1451
|
+
|
|
1452
|
+
it("pads the supplement column's end inside the option cell", () => {
|
|
1453
|
+
// Brace-walk the `.hk-tabs-cell > .hk-supplement-inset` block itself:
|
|
1454
|
+
// a plain whole-file regex would also match a hoisted top-level rule,
|
|
1455
|
+
// which would leak the inset to every HkSupplementInset consumer.
|
|
1456
|
+
const cellStart = scss.indexOf(".hk-tabs-cell > .hk-supplement-inset");
|
|
1457
|
+
expect(cellStart).toBeGreaterThan(-1);
|
|
1458
|
+
const open = scss.indexOf("{", cellStart);
|
|
1459
|
+
let depth = 0;
|
|
1460
|
+
let end = -1;
|
|
1461
|
+
for (let i = open; i < scss.length; i++) {
|
|
1462
|
+
if (scss[i] === "{") depth++;
|
|
1463
|
+
else if (scss[i] === "}") {
|
|
1464
|
+
depth--;
|
|
1465
|
+
if (depth === 0) {
|
|
1466
|
+
end = i;
|
|
1467
|
+
break;
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
expect(end).toBeGreaterThan(open);
|
|
1472
|
+
const cellBlock = scss.slice(open, end + 1);
|
|
1473
|
+
expect(cellBlock).toContain(".hk-supplement-inset-supplement-inner");
|
|
1474
|
+
expect(cellBlock).toContain("padding-inline-end: var(--space-12)");
|
|
1475
|
+
// And the nested selector really is the inner (not some other child).
|
|
1476
|
+
expect(cellBlock).toMatch(
|
|
1477
|
+
/\.hk-supplement-inset-supplement-inner\s*{[^}]*padding-inline-end:\s*var\(--space-12\)/,
|
|
1478
|
+
);
|
|
1479
|
+
});
|
|
1480
|
+
|
|
1481
|
+
it("mounts the inset cell anatomy an action rides in (structure anchor)", () => {
|
|
1482
|
+
const onSelect = vi.fn();
|
|
1483
|
+
const container = document.createElement("div");
|
|
1484
|
+
document.body.appendChild(container);
|
|
1485
|
+
containers.push(container);
|
|
1486
|
+
const active = ref("a");
|
|
1487
|
+
const Wrapper = defineComponent({
|
|
1488
|
+
setup() {
|
|
1489
|
+
return () =>
|
|
1490
|
+
h(HkTabs, {
|
|
1491
|
+
modelValue: active.value,
|
|
1492
|
+
"onUpdate:modelValue": (v: string) => { active.value = v; },
|
|
1493
|
+
renderPanels: false,
|
|
1494
|
+
variant: "segmented",
|
|
1495
|
+
tabs: [
|
|
1496
|
+
{ key: "a", label: "Auto", actions: [{ key: "dot", label: "Configure", onSelect }] },
|
|
1497
|
+
{ key: "b", label: "Dark" },
|
|
1498
|
+
] as TabItem[],
|
|
1499
|
+
});
|
|
1500
|
+
},
|
|
1501
|
+
});
|
|
1502
|
+
const app = createApp(Wrapper);
|
|
1503
|
+
mounts.push(app);
|
|
1504
|
+
app.mount(container);
|
|
1505
|
+
// cell > inset > (main > trigger, supplement > inner > action): the
|
|
1506
|
+
// stylesheet's descendant inset rule must reach the real supplement.
|
|
1507
|
+
const inner = container.querySelector<HTMLElement>(
|
|
1508
|
+
".hk-tabs-cell > .hk-supplement-inset .hk-supplement-inset-supplement-inner",
|
|
1509
|
+
);
|
|
1510
|
+
expect(inner).toBeTruthy();
|
|
1511
|
+
expect(
|
|
1512
|
+
inner!.querySelector(".hk-tabs-trigger-action"),
|
|
1513
|
+
"the action renders inside the padded inner",
|
|
1514
|
+
).toBeTruthy();
|
|
1515
|
+
});
|
|
1516
|
+
});
|