@celestia-island/hikari 0.55.425 → 0.55.426
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/HkBoard.nodeActions.test.tsx +10 -3
- package/src/components/HkDraggableList.styles.test.ts +5 -1
- package/src/components/HkModalBreadcrumb.motion.contract.test.ts +10 -6
- package/src/components/HkNotificationBell.test.tsx +7 -1
- package/src/components/HkPillToggleGroup.scss +26 -6
- package/src/components/HkPillToggleGroup.test.tsx +112 -0
- package/src/components/HkPillToggleGroup.tsx +9 -2
- package/src/components/HkStatusBar.test.tsx +9 -1
- package/src/components/HkTable.sections.test.tsx +9 -3
- package/src/components/HkTimePicker.scss +2 -0
- package/src/components/HkTimePicker.styles.test.ts +40 -0
- package/src/components/HkTitleBar.test.tsx +4 -1
- package/src/components/minimapDock.styles.test.ts +5 -2
package/package.json
CHANGED
|
@@ -93,9 +93,16 @@ const boardScss = (await import("node:fs")).readFileSync(
|
|
|
93
93
|
describe("HkBoard nodeActions dock styles", () => {
|
|
94
94
|
it("docks the actions to the node's bottom-end corner above the body", () => {
|
|
95
95
|
const block = boardScss.slice(boardScss.indexOf("&-actions {"));
|
|
96
|
+
// Values, not just property names (sweep round-2): the corner dock
|
|
97
|
+
// rides the shared inset token and sits ABOVE the body (z-index 6 —
|
|
98
|
+
// a name-only match let `bottom: auto` / `z-index: 1` stay green).
|
|
96
99
|
expect(block.slice(0, 400)).toMatch(/position:\s*absolute/);
|
|
97
|
-
expect(block.slice(0, 400)).toMatch(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
expect(block.slice(0, 400)).toMatch(
|
|
101
|
+
/inset-inline-end:\s*var\(--hk-board-node-action-inset, 4px\)/,
|
|
102
|
+
);
|
|
103
|
+
expect(block.slice(0, 400)).toMatch(
|
|
104
|
+
/bottom:\s*var\(--hk-board-node-action-inset, 4px\)/,
|
|
105
|
+
);
|
|
106
|
+
expect(block.slice(0, 400)).toMatch(/z-index:\s*6/);
|
|
100
107
|
});
|
|
101
108
|
});
|
|
@@ -93,7 +93,11 @@ describe("HkDraggableList actions-lane sheet", () => {
|
|
|
93
93
|
expect(body).toContain("flex-shrink: 0");
|
|
94
94
|
// Multiple host buttons in one lane need the lane's own gap so they
|
|
95
95
|
// never fuse into one cluster against the row edge.
|
|
96
|
-
expect(body).toContain("gap:");
|
|
96
|
+
expect(body).toContain("gap: var(--space-8, 0.5rem)");
|
|
97
|
+
// Exactly one declaration: a SECOND `gap:` appended after this one
|
|
98
|
+
// would win the cascade while the pinned string stayed present
|
|
99
|
+
// (round-2 review; same shape as HkDockBar's single-declaration pin).
|
|
100
|
+
expect((body ?? "").match(/(?:^|[;{\s])gap\s*:/g) ?? []).toHaveLength(1);
|
|
97
101
|
});
|
|
98
102
|
|
|
99
103
|
// The right-edge pinning is STRUCTURAL, not a margin patch: the item
|
|
@@ -212,12 +212,16 @@ describe("strip surface enter/leave (window choreography)", () => {
|
|
|
212
212
|
CENTERING,
|
|
213
213
|
]);
|
|
214
214
|
|
|
215
|
-
//
|
|
216
|
-
//
|
|
217
|
-
//
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
215
|
+
// Vacuity guard (hikari #1325's first sweep shipped vacuous exactly
|
|
216
|
+
// that way): the sweep's own subject is the centring longhand, so the
|
|
217
|
+
// positive control asserts THAT is present in the base rule — the
|
|
218
|
+
// enter-from/leave-to transforms are value-pinned by the arrive/leave
|
|
219
|
+
// cases above (POSE_FROM/POSE_TO), which supersede the old bare
|
|
220
|
+
// `transform:` probe (2026-11-19 sweep: presence-only, redundant).
|
|
221
|
+
expect(
|
|
222
|
+
topLevelBaseTranslate,
|
|
223
|
+
"the sweep must see the base rule it exists to police",
|
|
224
|
+
).toEqual([CENTERING]);
|
|
221
225
|
});
|
|
222
226
|
|
|
223
227
|
it("has no keyframe animation on the base class (no double entrance)", () => {
|
|
@@ -358,7 +358,13 @@ describe("panel rows", () => {
|
|
|
358
358
|
|
|
359
359
|
// The clear-all affordance announces itself by its glyph (user
|
|
360
360
|
// direction 2026-11-19): a leading icon inside the label button.
|
|
361
|
-
|
|
361
|
+
// Resolved by its LABEL, not by first-match in the foot (2026-11-19
|
|
362
|
+
// sweep): a sibling inserted before Clear all would otherwise
|
|
363
|
+
// satisfy the glyph pin while the trash glyph was deleted.
|
|
364
|
+
const clearBtn = Array.from(
|
|
365
|
+
document.querySelectorAll<HTMLButtonElement>(".hk-notification-center__foot .hk-btn"),
|
|
366
|
+
).find((b) => b.textContent?.includes("Clear all"))!;
|
|
367
|
+
expect(clearBtn, "the clear-all button is in the foot").toBeTruthy();
|
|
362
368
|
expect(clearBtn.querySelector(".hk-btn-icon")).toBeTruthy();
|
|
363
369
|
clearBtn.dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
|
364
370
|
await settle();
|
|
@@ -9,13 +9,32 @@
|
|
|
9
9
|
* STRIP: overflow hides under edge fades (data-h-overflow masks, the
|
|
10
10
|
* HkScrollContainer contract) and pans by wheel / mouse drag / native
|
|
11
11
|
* touch (the machinery lives in useOptionStrip); phones relax back into
|
|
12
|
-
* a wrapping group (media query below — the
|
|
12
|
+
* a wrapping group (media query below — wrap replaces the pan; the hug
|
|
13
|
+
* survives, so a one-line set stays pill-width and only a wrapping set
|
|
14
|
+
* fills the sheet).
|
|
13
15
|
*/
|
|
14
16
|
|
|
15
17
|
@use "../styles/polyfill" as *;
|
|
16
18
|
|
|
17
19
|
.hk-pill-group {
|
|
18
|
-
|
|
20
|
+
/* HUG, DON'T STRETCH (2026-11-19 report: "the group has mysterious
|
|
21
|
+
* padding" — a bordered EMPTY BOX trailing the last pill in a ~148px
|
|
22
|
+
* table cell). The track is a block-level div, so a `display: flex`
|
|
23
|
+
* track filled its container and the chrome framed blank space to the
|
|
24
|
+
* right of a short option set. `inline-flex` + `width: fit-content`
|
|
25
|
+
* makes the track exactly as wide as its pills; the pairing is NOT
|
|
26
|
+
* redundant — a flex item is display-blockified (inline-flex → flex),
|
|
27
|
+
* so only the definite `fit-content` width stops a column flex parent's
|
|
28
|
+
* `align-items: stretch` from re-filling the lane (HkFilterChip's
|
|
29
|
+
* `.hk-filter-chip-body` and the hosts' `flex flex-col` form-field
|
|
30
|
+
* slots are exactly such parents).
|
|
31
|
+
*
|
|
32
|
+
* `max-width: 100%` is what keeps the pannable strip intact: a pill
|
|
33
|
+
* set too wide for the lane still clamps to the lane, so
|
|
34
|
+
* `scrollWidth > clientWidth` (the data-h-overflow fade sensing in
|
|
35
|
+
* useOptionStrip) and the wheel/drag pan behave exactly as before. */
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
width: fit-content;
|
|
19
38
|
flex-wrap: nowrap;
|
|
20
39
|
max-width: 100%;
|
|
21
40
|
gap: var(--space-4, 4px);
|
|
@@ -144,10 +163,11 @@
|
|
|
144
163
|
flex: 0 0 auto;
|
|
145
164
|
}
|
|
146
165
|
|
|
147
|
-
/* Phones: the
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
166
|
+
/* Phones: the wrap replaces the pan (the wowsp filter bar's rule; the
|
|
167
|
+
* fade masks and the grab affordance name interactions the track no
|
|
168
|
+
* longer has). Only wrap/overflow/touch/cursor relax — the hug and the
|
|
169
|
+
* lane clamp survive, so a one-line set stays pill-width and a wrapping
|
|
170
|
+
* set fills the sheet width. */
|
|
151
171
|
@media (max-width: 767px) {
|
|
152
172
|
.hk-pill-group {
|
|
153
173
|
flex-wrap: wrap;
|
|
@@ -277,3 +277,115 @@ describe("HkPillToggleGroup tone channel", () => {
|
|
|
277
277
|
}
|
|
278
278
|
});
|
|
279
279
|
});
|
|
280
|
+
|
|
281
|
+
// ── Track geometry: hug, don't stretch ───────────────────────────────────
|
|
282
|
+
// 2026-11-19 report (shittim-chest GrantListEditor): the 授予/拒绝 state
|
|
283
|
+
// pills in a ~148px table cell sat left-aligned inside a full-width
|
|
284
|
+
// bordered track, so the chrome framed an EMPTY BOX after the last pill
|
|
285
|
+
// ("部分按钮组有莫名其妙的内边距"). The track must size to its pills while
|
|
286
|
+
// keeping the one-line pannable strip intact — happy-dom does no layout, so
|
|
287
|
+
// the contract is pinned over the sheet source (the nativeScrollbar /
|
|
288
|
+
// HkAffixPicker house pattern), never a computed width.
|
|
289
|
+
const scssSource = readFileSync(join(dirname(fileURLToPath(import.meta.url)), "HkPillToggleGroup.scss"), "utf-8");
|
|
290
|
+
|
|
291
|
+
/** Extract ONE balanced `{...}` declaration block following the given
|
|
292
|
+
* selector — `[^}]*` would stop at the first nested `}` and let
|
|
293
|
+
* properties appended after a future nested block evade the pin. */
|
|
294
|
+
function cssBlock(src: string, selector: string): string {
|
|
295
|
+
const at = src.indexOf(selector);
|
|
296
|
+
expect(at, `${selector} block exists`).toBeGreaterThanOrEqual(0);
|
|
297
|
+
const open = src.indexOf("{", at);
|
|
298
|
+
let depth = 0;
|
|
299
|
+
for (let i = open; i < src.length; i++) {
|
|
300
|
+
if (src[i] === "{") depth++;
|
|
301
|
+
else if (src[i] === "}") {
|
|
302
|
+
depth--;
|
|
303
|
+
if (depth === 0) return src.slice(open, i + 1);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return "";
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/** Declarations only: a comment that happens to quote a property must not
|
|
310
|
+
* satisfy a pin (mutating the rule away would otherwise stay green). */
|
|
311
|
+
function stripSassComments(src: string): string {
|
|
312
|
+
return src.replace(/\/\*[\s\S]*?\*\//g, "").replace(/^[ \t]*\/\/.*$/gm, "");
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/** The block's TOP-LEVEL declarations: the slice before the first nested
|
|
316
|
+
* rule (every nested rule in this sheet opens with `&`), then split on
|
|
317
|
+
* `;` — a terminator is a separator, never the next match's anchor, so
|
|
318
|
+
* consecutive declarations are all seen. Values trimmed and lowercased
|
|
319
|
+
* (CSS keywords are ASCII-case-insensitive, so `FLEX` and `flex` are
|
|
320
|
+
* the same declaration). Grouped per property so a LATER duplicate
|
|
321
|
+
* declaration cannot hide behind a passing first one — the pins below
|
|
322
|
+
* assert the FULL value set, not mere presence. */
|
|
323
|
+
function declarations(block: string): Map<string, string[]> {
|
|
324
|
+
const body = block.replace(/^[^{]*\{/, "").replace(/\}[^}]*$/, "");
|
|
325
|
+
const nestedAt = body.search(/(?:^|\n)\s*&/);
|
|
326
|
+
const top = nestedAt === -1 ? body : body.slice(0, nestedAt);
|
|
327
|
+
const out = new Map<string, string[]>();
|
|
328
|
+
for (const fragment of top.split(";")) {
|
|
329
|
+
const m = fragment.match(/^\s*([-a-z]+)\s*:\s*(.+?)\s*$/);
|
|
330
|
+
if (!m) continue;
|
|
331
|
+
const prop = m[1].toLowerCase();
|
|
332
|
+
const value = m[2].toLowerCase();
|
|
333
|
+
out.set(prop, [...(out.get(prop) ?? []), value]);
|
|
334
|
+
}
|
|
335
|
+
return out;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
describe("HkPillToggleGroup track geometry contract", () => {
|
|
339
|
+
const track = stripSassComments(cssBlock(scssSource, ".hk-pill-group {"));
|
|
340
|
+
const trackDecls = declarations(track);
|
|
341
|
+
|
|
342
|
+
it("the track hugs its pills instead of filling the lane", () => {
|
|
343
|
+
// The FULL value sets, not presence: a later `width: 100%` in the same
|
|
344
|
+
// block would cancel the hug while a presence pin stayed green.
|
|
345
|
+
expect(trackDecls.get("display")).toEqual(["inline-flex"]);
|
|
346
|
+
expect(trackDecls.get("width")).toEqual(["fit-content"]);
|
|
347
|
+
expect(trackDecls.get("max-width")).toEqual(["100%"]);
|
|
348
|
+
// The pair is NOT redundant: a flex item is display-blockified
|
|
349
|
+
// (inline-flex → flex), so only a definite width stops a column flex
|
|
350
|
+
// parent's align-items: stretch from re-filling the lane (HkFilterChip's
|
|
351
|
+
// .hk-filter-chip-body column and the hosts' `flex flex-col` form-field
|
|
352
|
+
// slots are exactly such parents — HkTimePicker centers itself with
|
|
353
|
+
// align-self).
|
|
354
|
+
// No !important games: an override ladder inside the block must not be
|
|
355
|
+
// able to resurrect the stretch behind the pins above.
|
|
356
|
+
expect(track, "no important override inside the track block").not.toContain("!important");
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
it("the clamp keeps the one-line pannable strip alive when pills overflow", () => {
|
|
360
|
+
// fit-content + the clamp = shrink-to-fit capped at the lane: the pill
|
|
361
|
+
// set that genuinely overflows still scrolls, and useOptionStrip's
|
|
362
|
+
// scrollWidth-vs-clientWidth fade sensing still sees it. (The clamp
|
|
363
|
+
// value set is asserted above; the scroll machinery is asserted here.)
|
|
364
|
+
expect(track).toMatch(/overflow-x:\s*auto;/);
|
|
365
|
+
expect(track, "nowrap: one pannable line, not a wrap").toMatch(/flex-wrap:\s*nowrap;/);
|
|
366
|
+
// The native-scrollbar suppression pair rides inside this rule block
|
|
367
|
+
// (nativeScrollbar.contract.test.ts group 1 also enforces it).
|
|
368
|
+
expect(track).toMatch(/scrollbar-width:\s*none;/);
|
|
369
|
+
expect(track).toMatch(/&::-webkit-scrollbar\s*\{[^}]*display:\s*none/);
|
|
370
|
+
// Edge-fade masks are keyed off data-h-overflow — the sensing contract
|
|
371
|
+
// they share with HkScrollContainer must survive the hug.
|
|
372
|
+
for (const side of ["start", "end", "both"]) {
|
|
373
|
+
expect(track, `data-h-overflow=${side} fade`).toContain(`&[data-h-overflow="${side}"]`);
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
it("phones still relax the hugging track back into a wrapping group", () => {
|
|
378
|
+
const phone = stripSassComments(
|
|
379
|
+
cssBlock(scssSource.slice(scssSource.indexOf("@media (max-width: 767px)")), ".hk-pill-group {"),
|
|
380
|
+
);
|
|
381
|
+
const phoneDecls = declarations(phone);
|
|
382
|
+
expect(phoneDecls.get("flex-wrap")).toEqual(["wrap"]);
|
|
383
|
+
expect(phoneDecls.get("overflow")).toEqual(["visible"]);
|
|
384
|
+
// The media query relaxes ONLY wrap/overflow/touch/cursor: it must not
|
|
385
|
+
// re-declare display or width (that would restore the stretched track
|
|
386
|
+
// on phones behind the desktop pins).
|
|
387
|
+
expect(phoneDecls.has("display"), "no display in the phone block").toBe(false);
|
|
388
|
+
expect(phoneDecls.has("width"), "no width in the phone block").toBe(false);
|
|
389
|
+
expect(phoneDecls.has("max-width"), "no max-width in the phone block").toBe(false);
|
|
390
|
+
});
|
|
391
|
+
});
|
|
@@ -45,8 +45,15 @@ function resolveIcon(icon: unknown): VNode | null {
|
|
|
45
45
|
* hides under edge fades and pans by wheel / mouse drag / native touch,
|
|
46
46
|
* exactly the 水表 popups' behavior — a wrapping track always measured
|
|
47
47
|
* ONE long line inside HkPopover's max-content panel and ran off-screen
|
|
48
|
-
* (wowsp #667). Phones relax back into a wrapping group (
|
|
49
|
-
*
|
|
48
|
+
* (wowsp #667). Phones relax back into a wrapping group (wrap replaces
|
|
49
|
+
* the pan; the hug survives — a one-line set stays pill-width) via the
|
|
50
|
+
* SCSS media query.
|
|
51
|
+
* The track HUGS its pills (`inline-flex` + `width: fit-content` clamped
|
|
52
|
+
* by `max-width: 100%`), so a two-option state toggle inside a narrow
|
|
53
|
+
* table cell frames its own width instead of framing an empty box to the
|
|
54
|
+
* right of the last pill (2026-11-19 chest GrantListEditor report);
|
|
55
|
+
* the clamp keeps the pannable strip intact whenever the pills really
|
|
56
|
+
* overflow.
|
|
50
57
|
*
|
|
51
58
|
* Deliberately THIN (the host owns the set): `toggle(value)` reports one
|
|
52
59
|
* pill toggled; the optional leading all-pill reports `all()` and the
|
|
@@ -666,8 +666,16 @@ describe("HkStatusBar", () => {
|
|
|
666
666
|
// Reduced-motion users keep the steady tint.
|
|
667
667
|
const scss = readFileSync(resolve(__dirname, "../styles/admin-tokens.scss"), "utf8");
|
|
668
668
|
const rule = /\.s-status-bar-tag-reconnecting\s*\{[^}]*\}/.exec(scss)?.[0] ?? "";
|
|
669
|
-
|
|
669
|
+
// Name + loop term, not a frozen shorthand: the duration/easing may be
|
|
670
|
+
// retuned without breaking the claim, while `animation: none` (the
|
|
671
|
+
// settled-state defect) and a lost `infinite` (one-shot pulse) both fail.
|
|
672
|
+
expect(rule, "reconnecting rule carries the breathe animation").toMatch(
|
|
673
|
+
/animation:\s*s-status-bar-reconnecting-breathe\b[^;]*\binfinite/,
|
|
674
|
+
);
|
|
670
675
|
expect(scss).toContain("@keyframes s-status-bar-reconnecting-breathe");
|
|
676
|
+
// One declaration in the rule: an appended `animation: none` would win
|
|
677
|
+
// the cascade while the pinned shorthand above stayed present.
|
|
678
|
+
expect(rule.match(/(?:^|[;{\s])animation\s*:/g) ?? []).toHaveLength(1);
|
|
671
679
|
expect(scss).toMatch(
|
|
672
680
|
/@media[^{]*prefers-reduced-motion[^{]*\{[^@]*?\.s-status-bar-tag-reconnecting\s*\{[^}]*animation:\s*none/s,
|
|
673
681
|
);
|
|
@@ -726,8 +726,11 @@ describe("HkTable section band stylesheet", () => {
|
|
|
726
726
|
|
|
727
727
|
const cell = ruleBody(".hk-table-section-cell");
|
|
728
728
|
expect(cell).toContain("text-align: start");
|
|
729
|
-
expect(cell).toContain("border-bottom");
|
|
730
|
-
expect(cell).toContain("background:");
|
|
729
|
+
expect(cell).toContain("border-bottom: 1px solid var(--hi-color-border");
|
|
730
|
+
expect(cell).toContain("background: var(--hi-color-bg-subtle");
|
|
731
|
+
// One declaration each — an appended override must not hide.
|
|
732
|
+
expect(cell.match(/(?:^|[;{\s])border-bottom\s*:/g) ?? []).toHaveLength(1);
|
|
733
|
+
expect(cell.match(/(?:^|[;{\s])background\s*:/g) ?? []).toHaveLength(1);
|
|
731
734
|
// The UA's `th { font-weight: bold }` must not leak into slot content.
|
|
732
735
|
expect(cell).toContain("font-weight: inherit");
|
|
733
736
|
expect(cell).not.toMatch(/font-weight:\s*(?:bold|[1-9]\d{2})/);
|
|
@@ -768,7 +771,10 @@ describe("HkTable section band stylesheet", () => {
|
|
|
768
771
|
".hk-table-lg .hk-table-section-cell",
|
|
769
772
|
]) {
|
|
770
773
|
const body = ruleBody(selector);
|
|
771
|
-
|
|
774
|
+
// The VALUE is pinned per rung (sweep round-2): a bare /^padding:/
|
|
775
|
+
// let `padding: 0` keep the sm rung green while the lg pin stayed
|
|
776
|
+
// satisfied by the other rule.
|
|
777
|
+
expect(body.trim()).toMatch(/^padding:\s*var\(--space-/);
|
|
772
778
|
expect(body).not.toContain("font-size");
|
|
773
779
|
expect(body).not.toContain("font-weight");
|
|
774
780
|
}
|
|
@@ -156,6 +156,8 @@
|
|
|
156
156
|
/* The segmented control is hikari's HkPillToggleGroup; only the clock
|
|
157
157
|
* panel's own alignment/icon scale lives here. */
|
|
158
158
|
.hk-tp-period {
|
|
159
|
+
/* The track hugs since HkPillToggleGroup's width change (2026-11-19); center the hugged track in the panel column. */
|
|
160
|
+
align-self: center;
|
|
159
161
|
justify-content: center;
|
|
160
162
|
cursor: default;
|
|
161
163
|
touch-action: manipulation;
|
|
@@ -8,6 +8,33 @@ const here = dirname(fileURLToPath(import.meta.url));
|
|
|
8
8
|
const scss = readFileSync(resolve(here, "HkTimePicker.scss"), "utf8");
|
|
9
9
|
const tsx = readFileSync(resolve(here, "HkTimePicker.tsx"), "utf8");
|
|
10
10
|
|
|
11
|
+
/** The DECLARATIONS of a rule, comments stripped (a comment that names a
|
|
12
|
+
* property must not satisfy a guard about it). */
|
|
13
|
+
function ruleBlock(selector: string): string {
|
|
14
|
+
const escaped = selector.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
15
|
+
const head = new RegExp(`${escaped}\\s*\\{`).exec(scss);
|
|
16
|
+
if (!head) throw new Error(`no rule for ${selector}`);
|
|
17
|
+
// Nested SCSS blocks: walk braces to the matching close.
|
|
18
|
+
const open = head.index + head[0].length - 1;
|
|
19
|
+
let depth = 0;
|
|
20
|
+
let end = open;
|
|
21
|
+
for (; end < scss.length; end++) {
|
|
22
|
+
if (scss[end] === "{") depth += 1;
|
|
23
|
+
else if (scss[end] === "}") {
|
|
24
|
+
depth -= 1;
|
|
25
|
+
if (depth === 0) break;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return scss
|
|
29
|
+
.slice(open + 1, end)
|
|
30
|
+
.split("\n")
|
|
31
|
+
.filter((line) => {
|
|
32
|
+
const t = line.trim();
|
|
33
|
+
return !t.startsWith("*") && !t.startsWith("/*") && !t.startsWith("//");
|
|
34
|
+
})
|
|
35
|
+
.join("\n");
|
|
36
|
+
}
|
|
37
|
+
|
|
11
38
|
/**
|
|
12
39
|
* Source-contract pins: the minute-mode metrics key (the number layer is
|
|
13
40
|
* a sibling of the slider, so `.hk-tp-face.is-minute` can never match —
|
|
@@ -28,4 +55,17 @@ describe("HkTimePicker source contracts", () => {
|
|
|
28
55
|
expect(tsx).toContain("<HkPillToggleGroup");
|
|
29
56
|
expect(scss).not.toContain(".hk-tp-period-btn");
|
|
30
57
|
});
|
|
58
|
+
|
|
59
|
+
it("centers the hugged period track in the panel's column", () => {
|
|
60
|
+
// HkPillToggleGroup's track hugs its pills (inline-flex + fit-content), so
|
|
61
|
+
// it no longer stretches to the panel width and `justify-content` alone
|
|
62
|
+
// cannot center it; the track must center itself against the panel's
|
|
63
|
+
// stretch alignment via `align-self`.
|
|
64
|
+
expect(ruleBlock(".hk-tp-period")).toMatch(/align-self:\s*center/);
|
|
65
|
+
// …and there is exactly ONE such rule: a later duplicate re-declaring
|
|
66
|
+
// `align-self` (or `justify-content`) would override the centering
|
|
67
|
+
// while the pin above stayed green (presence ≠ winner).
|
|
68
|
+
const ruleCount = scss.match(/\.hk-tp-period\s*\{/g)?.length ?? 0;
|
|
69
|
+
expect(ruleCount, "exactly one .hk-tp-period rule block").toBe(1);
|
|
70
|
+
});
|
|
31
71
|
});
|
|
@@ -213,7 +213,10 @@ describe("HkTitleBar stylesheet contract", () => {
|
|
|
213
213
|
|
|
214
214
|
it("keeps the windowed radius var wired to the close button", () => {
|
|
215
215
|
const scss = readFileSync(resolve(componentDir, "HkTitleBar.scss"), "utf8");
|
|
216
|
-
expect(scss).toContain("--hk-tb-radius-close:");
|
|
216
|
+
expect(scss).toContain("--hk-tb-radius-close: 0 var(--radius-md) 0 0;");
|
|
217
|
+
// Declaration + exactly one consumer: a second declaration would override
|
|
218
|
+
// the pinned one while it stayed in the text.
|
|
219
|
+
expect(scss.match(/--hk-tb-radius-close/g) ?? []).toHaveLength(2);
|
|
217
220
|
const body = ruleBody(css, ".hk-titlebar .hk-titlebar-btn-close");
|
|
218
221
|
expect(body).toContain("border-radius: var(--hk-tb-radius-close)");
|
|
219
222
|
});
|
|
@@ -53,8 +53,11 @@ describe("minimap dock stylesheet contract", () => {
|
|
|
53
53
|
expect(canvasCss).toContain(".hk-node-canvas-minimap[data-placement=bottom-right]");
|
|
54
54
|
const dock = ruleFor(boardCss, ".hk-board-minimap");
|
|
55
55
|
expect(dock).toContain("position: absolute");
|
|
56
|
-
expect(dock).toContain("inset-inline-end");
|
|
57
|
-
expect(dock).toContain("bottom");
|
|
56
|
+
expect(dock).toContain("inset-inline-end: var(--space-10)");
|
|
57
|
+
expect(dock).toContain("bottom: var(--space-10)");
|
|
58
|
+
// One declaration per axis — an appended override must not hide.
|
|
59
|
+
expect(dock.match(/(?:^|[;{\s])inset-inline-end\s*:/g) ?? []).toHaveLength(1);
|
|
60
|
+
expect(dock.match(/(?:^|[;{\s])bottom\s*:/g) ?? []).toHaveLength(1);
|
|
58
61
|
});
|
|
59
62
|
|
|
60
63
|
it("the card's self-docking form survives for direct mounts", () => {
|