@celestia-island/hikari 0.55.424 → 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.
Files changed (31) hide show
  1. package/package.json +1 -1
  2. package/src/components/HkBoard.nodeActions.test.tsx +10 -3
  3. package/src/components/HkDraggableList.styles.test.ts +5 -1
  4. package/src/components/HkModalBreadcrumb.motion.contract.test.ts +10 -6
  5. package/src/components/HkNotificationBell.test.tsx +7 -1
  6. package/src/components/HkPillToggleGroup.scss +26 -6
  7. package/src/components/HkPillToggleGroup.test.tsx +112 -0
  8. package/src/components/HkPillToggleGroup.tsx +9 -2
  9. package/src/components/HkSlideConfirm.scss +137 -0
  10. package/src/components/HkSlideConfirm.test.tsx +418 -0
  11. package/src/components/HkSlideConfirm.tsx +439 -0
  12. package/src/components/HkStatusBar.test.tsx +9 -1
  13. package/src/components/HkTable.sections.test.tsx +9 -3
  14. package/src/components/HkTimePicker.scss +2 -0
  15. package/src/components/HkTimePicker.styles.test.ts +40 -0
  16. package/src/components/HkTitleBar.test.tsx +4 -1
  17. package/src/components/minimapDock.styles.test.ts +5 -2
  18. package/src/components/slideConfirmPath.test.ts +179 -0
  19. package/src/components/slideConfirmPath.ts +192 -0
  20. package/src/i18n/locales/ar/components.json +3 -1
  21. package/src/i18n/locales/de/components.json +3 -1
  22. package/src/i18n/locales/en/components.json +3 -1
  23. package/src/i18n/locales/es/components.json +3 -1
  24. package/src/i18n/locales/fr/components.json +3 -1
  25. package/src/i18n/locales/ja/components.json +3 -1
  26. package/src/i18n/locales/ko/components.json +3 -1
  27. package/src/i18n/locales/pt/components.json +3 -1
  28. package/src/i18n/locales/ru/components.json +3 -1
  29. package/src/i18n/locales/zh-Hans/components.json +3 -1
  30. package/src/i18n/locales/zh-Hant/components.json +3 -1
  31. package/src/index.ts +12 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celestia-island/hikari",
3
- "version": "0.55.424",
3
+ "version": "0.55.426",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Hikari UI library, Vue 3 runtime — one design system for Vue 3 and Rust/WASM applications",
@@ -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(/inset-inline-end/);
98
- expect(block.slice(0, 400)).toMatch(/bottom:/);
99
- expect(block.slice(0, 400)).toMatch(/z-index/);
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
- // Known-positive probe: the sweep is worthless if it matches no rule at
216
- // all (hikari #1325's first sweep shipped vacuous exactly that way), so
217
- // assert the ride rules really are in the compiled sheet.
218
- for (const sel of [".hk-modal-breadcrumb-enter-from", ".hk-modal-breadcrumb-leave-to"]) {
219
- expect(rule(breadcrumb, sel)).toContain("transform:");
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
- const clearBtn = document.querySelector<HTMLButtonElement>(".hk-notification-center__foot .hk-btn")!;
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 sheet carries full width).
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
- display: flex;
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 sheet carries the full width, nothing pans there — the
148
- * strip relaxes back into the wrapping group (the wowsp filter bar's
149
- * rule; the fade masks and the grab affordance name interactions the
150
- * track no longer has). */
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 (the sheet
49
- * carries full width; nothing pans there) via the SCSS media query.
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
@@ -0,0 +1,137 @@
1
+ @use "../styles/polyfill" as *;
2
+
3
+ // HkSlideConfirm (components/HkSlideConfirm.tsx) — the fat slide-to-
4
+ // confirm: a three-standard-row block whose orthogonal lane carries ≥3
5
+ // random right-angle turns; the knob is grabbed and TRACED from the left
6
+ // edge to the right edge; a premature release or a corridor exit snaps it
7
+ // back at once. Tokens follow the house scale (--space-*, --radius-*,
8
+ // rgb(var(--color-*)), --hi-color-*).
9
+ //
10
+ // GEOMETRY: the block's height is THREE standard control rows
11
+ // (calc(var(--space-40, 2.5rem) * 3)) — the 2026-11-19 user direction
12
+ // that makes the confirmation feel deliberate instead of reflexive. The
13
+ // lane svg is inset by the same TRACK_PAD the tsx maps coordinates with;
14
+ // the knob rides the lane's px frame (transform from the track corner,
15
+ // centered by the negative half-margin below).
16
+
17
+ .hk-slide-confirm {
18
+ position: relative;
19
+ height: calc(var(--space-40, 2.5rem) * 3);
20
+ border-radius: var(--radius-lg, 0.75rem);
21
+ background: var(--hi-color-surface, rgba(255, 255, 255, 0.95));
22
+ border: 1px solid rgb(var(--color-border) / 8%);
23
+ overflow: hidden;
24
+ transition: border-color 0.2s ease, background 0.2s ease;
25
+
26
+ &:hover:not(.is-disabled) {
27
+ border-color: rgb(var(--color-border) / 20%);
28
+ }
29
+
30
+ &.is-done {
31
+ border-color: rgb(var(--color-primary) / 35%);
32
+ background: color-mix(in srgb, var(--hi-color-primary, #7aa2f7) 8%, transparent);
33
+ }
34
+
35
+ &.is-disabled {
36
+ opacity: 0.55;
37
+ pointer-events: none;
38
+ }
39
+ }
40
+
41
+ /* The lane: an svg inset by TRACK_PAD (the tsx maps coordinates in the
42
+ * same frame). One polyline, thick round stroke — a corridor to trace,
43
+ * not a line to read. */
44
+ .hk-slide-confirm-lane {
45
+ position: absolute;
46
+ overflow: visible;
47
+ pointer-events: none;
48
+ }
49
+
50
+ .hk-slide-confirm-lane-path {
51
+ fill: none;
52
+ stroke: rgb(var(--color-text) / 14%);
53
+ stroke-width: 1.25rem;
54
+ stroke-linecap: round;
55
+ stroke-linejoin: round;
56
+
57
+ &.is-done {
58
+ stroke: color-mix(in srgb, var(--hi-color-primary, #7aa2f7) 45%, transparent);
59
+ }
60
+ }
61
+
62
+ .hk-slide-confirm-label,
63
+ .hk-slide-confirm-done-label {
64
+ position: absolute;
65
+ inset: 0;
66
+ display: flex;
67
+ align-items: center;
68
+ justify-content: center;
69
+ padding: 0 var(--space-32, 2rem);
70
+ font-size: 0.75rem;
71
+ color: rgb(var(--color-text) / 45%);
72
+ text-align: center;
73
+ pointer-events: none;
74
+ @include user-select(none);
75
+ }
76
+
77
+ .hk-slide-confirm-done-label {
78
+ color: var(--hi-color-primary, #7aa2f7);
79
+ font-weight: 600;
80
+ }
81
+
82
+ /* The knob: a joystick-sized circle, centered on the lane point by the
83
+ * negative half-margin, riding the transform the tsx writes. While
84
+ * snapping it transitions back to the start (the "一下子回去" — the
85
+ * instant return reads as refusal, not as a reset). */
86
+ .hk-slide-confirm-knob {
87
+ position: absolute;
88
+ top: 0;
89
+ left: 0;
90
+ display: flex;
91
+ align-items: center;
92
+ justify-content: center;
93
+ width: 2.4rem;
94
+ height: 2.4rem;
95
+ margin: -1.2rem; /* center the knob on the lane point */
96
+ border-radius: 50%;
97
+ background: var(--hi-color-surface, rgba(255, 255, 255, 0.98));
98
+ border: 1px solid rgb(var(--color-border) / 22%);
99
+ box-shadow: 0 2px 8px rgb(0 0 0 / 22%);
100
+ cursor: grab;
101
+ touch-action: none;
102
+ transition: transform 0.24s cubic-bezier(0.3, 0, 0.5, 1), border-color 0.2s ease;
103
+
104
+ &.is-done {
105
+ cursor: default;
106
+ border-color: var(--hi-color-primary, #7aa2f7);
107
+ background: color-mix(in srgb, var(--hi-color-primary, #7aa2f7) 18%, var(--hi-color-surface, rgba(255, 255, 255, 0.95)));
108
+ }
109
+ }
110
+
111
+ .hk-slide-confirm.is-dragging .hk-slide-confirm-knob {
112
+ cursor: grabbing;
113
+ /* While tracing, the knob follows the pointer 1:1 — no transition (a
114
+ * transitioned follow would lag the hand). Only the snap-back transition
115
+ * above applies, and only once .is-dragging is gone. */
116
+ transition: border-color 0.2s ease;
117
+ }
118
+
119
+ /* The grip: three horizontal pills — the joystick affordance. */
120
+ .hk-slide-confirm-knob-grip {
121
+ width: 0.9rem;
122
+ height: 0.55rem;
123
+ background:
124
+ linear-gradient(to bottom,
125
+ rgb(var(--color-text) / 45%) 0 2px, transparent 2px 4px,
126
+ rgb(var(--color-text) / 45%) 4px 6px, transparent 6px 8px,
127
+ rgb(var(--color-text) / 45%) 8px 10px, transparent 10px);
128
+ border-radius: 1px;
129
+ }
130
+
131
+ /* Reduced motion: the snap-back must SNAP (the whole point of the refusal
132
+ * read), not glide — the transition is the only animated part. */
133
+ @media (prefers-reduced-motion: reduce) {
134
+ .hk-slide-confirm-knob {
135
+ transition: border-color 0.2s ease;
136
+ }
137
+ }