@celestia-island/hikari 0.55.477 → 0.55.478

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.
@@ -32,6 +32,11 @@ export interface HkMenuItem {
32
32
  key: string;
33
33
  label: string;
34
34
  icon?: Component;
35
+ /** Marks the icon as a MARK (dot, bullet, status pip) rather than an
36
+ * illustration: the rail flip still TRAVELS it to its new position but
37
+ * never tweens its size — a dot's size is its meaning, and growing it
38
+ * across the flip reads as a glitch (2026-11-24 user direction). */
39
+ iconNoScale?: boolean;
35
40
  flag?: string;
36
41
  checked?: boolean;
37
42
  disabled?: boolean;
@@ -70,6 +70,16 @@
70
70
  * 4. Non-participating icons (identity blocks, group carets, badge
71
71
  * dots), the pills, and the labels crossfade exactly as before.
72
72
  *
73
+ * 4a. NO-SCALE GLYPHS (2026-11-24 user direction): a MARK — a dot, a
74
+ * bullet, a status pip — is not an illustration that happens to be
75
+ * small; its size IS its meaning, and tweening it reads as a glitch
76
+ * ("the dot balloons, then shrinks back"). Such cells carry
77
+ * `data-flip-noscale`, and the flight then travels the clone at the
78
+ * DESTINATION's size from the first frame — position continues, size
79
+ * never moves. Measured per pair (either end may opt in), because the
80
+ * two generations are different DOM and a row can gain or lose the
81
+ * mark between densities.
82
+ *
73
83
  * TIMING IS TOKEN-DERIVED, NOT HARDCODED (2026-11-02 user direction):
74
84
  * the flight window reads the theme's `--duration-normal` off the swap
75
85
  * host's computed style — the very variable HkCrossfade's dissolve
@@ -102,6 +112,10 @@
102
112
  */
103
113
  /** Row-key attribute on an icon cell that flies across a rail flip. */
104
114
  export declare const RAIL_FLIP_ICON_ATTR = "data-flip-icon";
115
+ /** Marks a flying icon cell whose GLYPH must not tween: it still travels
116
+ * to the destination (the motion is the point) but keeps its own size the
117
+ * whole way. See the "no-scale glyphs" note in the mechanism doc. */
118
+ export declare const RAIL_FLIP_NOSCALE_ATTR = "data-flip-noscale";
105
119
  /** Host attribute marking a flight in progress (drives the hide rule). */
106
120
  export declare const RAIL_FLIP_ACTIVE_ATTR = "data-flipping";
107
121
  /** Per-cell mark stamped on exactly the LEAVING icons that were paired
@@ -203,6 +203,7 @@ export { extOf, isImageFile, isAudioFile, codeLanguage, isCodeFile, isArchiveFil
203
203
  export { useReducedMotion } from "./composables/useReducedMotion";
204
204
  export { useSidebarRail, SIDEBAR_RAIL_PEEK_DELAY, SIDEBAR_RAIL_PEEK_GRACE, SIDEBAR_RAIL_PIN_FALLBACK, SIDEBAR_RAIL_CLIP_SELECTOR, SIDEBAR_RAIL_TOGGLE_BUTTON_SELECTOR, } from "./composables/useSidebarRail";
205
205
  export type { SidebarRailOptions, SidebarRailHandle } from "./composables/useSidebarRail";
206
+ export { RAIL_FLIP_ICON_ATTR, RAIL_FLIP_FLYING_ATTR, RAIL_FLIP_NOSCALE_ATTR, } from "./composables/useRailIconFlight";
206
207
  export { provideMenuGroupState, useMenuGroupState, } from "./composables/useMenuGroupState";
207
208
  export type { MenuGroupState } from "./composables/useMenuGroupState";
208
209
  export { drawnScale, frameMetrics, frameScale, laidOffsetWithin, laidSize, layoutOffset, layoutRect, nearestLaidAncestor, placePoint, } from "./composables/layoutGeometry";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celestia-island/hikari",
3
- "version": "0.55.477",
3
+ "version": "0.55.478",
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",
@@ -7,7 +7,10 @@ import { createApp, h, nextTick, ref, type Ref } from "vue";
7
7
  import { Home, Settings } from "lucide-vue-next";
8
8
 
9
9
  import HkMenu, { type HkMenuItem } from "./HkMenu";
10
- import { RAIL_FLIP_ICON_ATTR } from "../composables/useRailIconFlight";
10
+ import {
11
+ RAIL_FLIP_ICON_ATTR,
12
+ RAIL_FLIP_NOSCALE_ATTR,
13
+ } from "../composables/useRailIconFlight";
11
14
 
12
15
  /**
13
16
  * HkMenu sidebar-variant ICON-RAIL mode (collapsed prop, 2026-10-30):
@@ -447,6 +450,42 @@ describe("HkMenu sidebar icon rail", () => {
447
450
  expect(glyph.textContent).toBe("D");
448
451
  });
449
452
 
453
+ // 2026-11-24 user direction: a MARK (dot/bullet/pip) must not tween its
454
+ // size across the density flip — it travels, it never grows. The host
455
+ // opts a row in through `iconNoScale`; the cell the flight pairs must
456
+ // then carry the no-scale attribute in BOTH densities, or the dot quietly
457
+ // rejoins the size tween.
458
+ // MUT:mut-attr-unstamped — unstamping the cells turns this test RED (this
459
+ // is the very gap the attribute exists to close).
460
+ it("carries iconNoScale onto the rail cell as data-flip-noscale", () => {
461
+ // Ordinary icon: keeps the size tween (no attribute).
462
+ const plain = mountMenu([{ key: "home", label: "Home", icon: Home }], {
463
+ collapsed: true,
464
+ });
465
+ const plainCell = plain.querySelector<HTMLElement>(
466
+ `.hk-menu-item-icon[${RAIL_FLIP_ICON_ATTR}="home"]`,
467
+ );
468
+ expect(plainCell, "the rail row stamps its icon cell").toBeTruthy();
469
+ expect(
470
+ plainCell!.hasAttribute(RAIL_FLIP_NOSCALE_ATTR),
471
+ "an ordinary icon keeps the size tween",
472
+ ).toBe(false);
473
+
474
+ // Mark: opts out of the tween.
475
+ const mark = mountMenu(
476
+ [{ key: "dot", label: "Dot", icon: Home, iconNoScale: true }],
477
+ { collapsed: true },
478
+ );
479
+ const markCell = mark.querySelector<HTMLElement>(
480
+ `.hk-menu-item-icon[${RAIL_FLIP_ICON_ATTR}="dot"]`,
481
+ );
482
+ expect(markCell, "the mark's cell is stamped too").toBeTruthy();
483
+ expect(
484
+ markCell!.hasAttribute(RAIL_FLIP_NOSCALE_ATTR),
485
+ "iconNoScale must reach the cell the flight pairs",
486
+ ).toBe(true);
487
+ });
488
+
450
489
  it("stamps every icon cell with data-flip-icon = the row key, in BOTH densities", () => {
451
490
  // The rail flip's icon flight (useRailIconFlight) pairs the leaving
452
491
  // and entering copies of ONE destination by this attribute; a cell
@@ -54,6 +54,11 @@ export interface HkMenuItem {
54
54
  key: string;
55
55
  label: string;
56
56
  icon?: Component;
57
+ /** Marks the icon as a MARK (dot, bullet, status pip) rather than an
58
+ * illustration: the rail flip still TRAVELS it to its new position but
59
+ * never tweens its size — a dot's size is its meaning, and growing it
60
+ * across the flip reads as a glitch (2026-11-24 user direction). */
61
+ iconNoScale?: boolean;
57
62
  flag?: string;
58
63
  checked?: boolean;
59
64
  disabled?: boolean;
@@ -956,7 +961,11 @@ export default defineComponent({
956
961
  // data-flip-icon: the row key opts this cell into the rail
957
962
  // flip's icon flight (useRailIconFlight) — the flight pairs
958
963
  // the leaving and entering copies of ONE destination by it.
959
- <span class="hk-menu-item-icon" data-flip-icon={item.key}>
964
+ <span
965
+ class="hk-menu-item-icon"
966
+ data-flip-icon={item.key}
967
+ data-flip-noscale={item.iconNoScale ? true : undefined}
968
+ >
960
969
  {h(item.icon, { size: 16 })}
961
970
  </span>
962
971
  )}
@@ -992,7 +1001,9 @@ export default defineComponent({
992
1001
  Still conditional: an icon-less group renders no cell
993
1002
  here, exactly as before. */}
994
1003
  {item.icon && (
995
- <span class="hk-menu-item-icon" data-flip-icon={item.key}>
1004
+ <span class="hk-menu-item-icon" data-flip-icon={item.key}
1005
+ data-flip-noscale={item.iconNoScale ? true : undefined}
1006
+ >
996
1007
  {h(item.icon, { size: 16 })}
997
1008
  </span>
998
1009
  )}
@@ -1067,6 +1078,9 @@ export default defineComponent({
1067
1078
  <span
1068
1079
  class="hk-menu-item-icon"
1069
1080
  data-flip-icon={item.key}
1081
+ // A LETTER fallback is a mark, not an illustration: its size is
1082
+ // its identity, so the flight must not tween it (2026-11-24).
1083
+ data-flip-noscale={item.iconNoScale || !item.icon ? true : undefined}
1070
1084
  data-fallback={item.icon ? undefined : true}
1071
1085
  >
1072
1086
  {item.icon ? h(item.icon, { size: 16 }) : item.label.trim().charAt(0).toUpperCase()}
@@ -1130,7 +1144,11 @@ export default defineComponent({
1130
1144
  {railCaret(expanded, 16)}
1131
1145
  </span>
1132
1146
  {item.icon && (
1133
- <span class="hk-menu-rail-glyph-corner" data-flip-icon={item.key}>
1147
+ <span
1148
+ class="hk-menu-rail-glyph-corner"
1149
+ data-flip-icon={item.key}
1150
+ data-flip-noscale={item.iconNoScale ? true : undefined}
1151
+ >
1134
1152
  {h(item.icon, { size: 10 })}
1135
1153
  </span>
1136
1154
  )}
@@ -6,6 +6,7 @@ import {
6
6
  RAIL_FLIGHT_MS,
7
7
  RAIL_FLIGHT_SWEEP_MARGIN_MS,
8
8
  RAIL_FLIP_ACTIVE_ATTR,
9
+ RAIL_FLIP_NOSCALE_ATTR,
9
10
  RAIL_FLIP_FLYING_ATTR,
10
11
  RAIL_FLIP_ICON_ATTR,
11
12
  RAIL_FLIP_ITEM_ATTR,
@@ -670,4 +671,40 @@ describe("useRailIconFlight", () => {
670
671
  );
671
672
  });
672
673
 
674
+ // 2026-11-24 user direction: a MARK (dot/bullet/pip) keeps its size across
675
+ // the flip — its size IS its meaning, and a tween reads as the dot
676
+ // ballooning then snapping back. Same geometry as the test above, so the
677
+ // ONLY difference is the opt-in attribute.
678
+ it("keeps a no-scale mark's size constant while it travels", async () => {
679
+ const h = mountSwap();
680
+ await h.set(true);
681
+ const { leaving, entering } = dissolvePair(h, true);
682
+ stubRect(h.swap(), rect(0, 0, 240, 400));
683
+ stubIcons(leaving, (key) => rect(32, key === "home" ? 100 : 140, 16, 16));
684
+ stubIcons(entering, (key) =>
685
+ key === "home" ? rect(40, 104, 10, 10) : rect(20, 140, 10, 10),
686
+ );
687
+ // Mark the HOME pair's DESTINATION as a mark; the other pair keeps the
688
+ // tween, so one flip proves both branches at once.
689
+ entering
690
+ .querySelector<HTMLElement>('[data-flip-icon="home"]')!
691
+ .setAttribute(RAIL_FLIP_NOSCALE_ATTR, "");
692
+
693
+ await vi.advanceTimersByTimeAsync(0);
694
+
695
+ const clones = [...flightLayer(h)!.querySelectorAll<HTMLElement>(".hk-sidebar-rail-flight-clone")];
696
+ expect(clones, "both pairs fly").toHaveLength(2);
697
+ const markClone = clones.find((c) => c.textContent === "H")!;
698
+ // Painted at its OWN size from frame 0 (10px, not the 16px it leaves
699
+ // at), centered on the leaving center: 40 − 10/2 = 35.
700
+ expect(markClone.style.width, "the mark is painted at its own size").toBe("10px");
701
+ expect(markClone.style.height).toBe("10px");
702
+ expect(markClone.style.insetInlineStart).toBe("35px");
703
+ const markAnim = animations.find((a) => a.el.textContent === "H")!;
704
+ expect(markAnim.keyframes.at(-1)!.transform).toBe(
705
+ "translate(5px, 1px) scale(1, 1)",
706
+ // The transform still carries the travel; its scale stays identity.
707
+ );
708
+ });
709
+
673
710
  });
@@ -75,6 +75,16 @@ import { releaseMediaQuery, useMediaQuery } from "../runtime/useMediaQuery";
75
75
  * 4. Non-participating icons (identity blocks, group carets, badge
76
76
  * dots), the pills, and the labels crossfade exactly as before.
77
77
  *
78
+ * 4a. NO-SCALE GLYPHS (2026-11-24 user direction): a MARK — a dot, a
79
+ * bullet, a status pip — is not an illustration that happens to be
80
+ * small; its size IS its meaning, and tweening it reads as a glitch
81
+ * ("the dot balloons, then shrinks back"). Such cells carry
82
+ * `data-flip-noscale`, and the flight then travels the clone at the
83
+ * DESTINATION's size from the first frame — position continues, size
84
+ * never moves. Measured per pair (either end may opt in), because the
85
+ * two generations are different DOM and a row can gain or lose the
86
+ * mark between densities.
87
+ *
78
88
  * TIMING IS TOKEN-DERIVED, NOT HARDCODED (2026-11-02 user direction):
79
89
  * the flight window reads the theme's `--duration-normal` off the swap
80
90
  * host's computed style — the very variable HkCrossfade's dissolve
@@ -108,6 +118,11 @@ import { releaseMediaQuery, useMediaQuery } from "../runtime/useMediaQuery";
108
118
 
109
119
  /** Row-key attribute on an icon cell that flies across a rail flip. */
110
120
  export const RAIL_FLIP_ICON_ATTR = "data-flip-icon";
121
+
122
+ /** Marks a flying icon cell whose GLYPH must not tween: it still travels
123
+ * to the destination (the motion is the point) but keeps its own size the
124
+ * whole way. See the "no-scale glyphs" note in the mechanism doc. */
125
+ export const RAIL_FLIP_NOSCALE_ATTR = "data-flip-noscale";
111
126
  /** Host attribute marking a flight in progress (drives the hide rule). */
112
127
  export const RAIL_FLIP_ACTIVE_ATTR = "data-flipping";
113
128
  /** Per-cell mark stamped on exactly the LEAVING icons that were paired
@@ -153,6 +168,8 @@ interface FlightPair {
153
168
  to: DOMRect;
154
169
  color: string;
155
170
  template: HTMLElement;
171
+ /** A MARK (dot/bullet/pip): travels, never changes size (see 4a). */
172
+ noScale: boolean;
156
173
  }
157
174
 
158
175
  /** What one flight needs from the swap: the paired icons. */
@@ -278,6 +295,12 @@ export function useRailIconFlight(
278
295
  to: toRect,
279
296
  color: getComputedStyle(fromEl).color,
280
297
  template: toEl,
298
+ // A MARK keeps its size (see 4a): either end opting in pins the
299
+ // clone to the destination size — a dot's size IS its meaning, and
300
+ // a tween reads as the dot ballooning and snapping back.
301
+ noScale:
302
+ fromEl.hasAttribute(RAIL_FLIP_NOSCALE_ATTR) ||
303
+ toEl.hasAttribute(RAIL_FLIP_NOSCALE_ATTR),
281
304
  });
282
305
  }
283
306
  return { pairs };
@@ -361,9 +384,6 @@ export function useRailIconFlight(
361
384
  // is origin.right − from.right; the sign the other way round
362
385
  // pushed every clone outside the docked edge and the clip ate the
363
386
  // whole flight — 2026-11-02 review).
364
- const inlineOffset = rtl
365
- ? origin.right - pair.from.right
366
- : pair.from.left - origin.left;
367
387
  // CENTER-ALIGNED travel + SIZE TWEEN (2026-11-20 user direction):
368
388
  // a glyph whose density size differs (the rail group's demoted
369
389
  // corner badge) must grow/shrink CONTINUOUSLY. The clone is painted
@@ -377,18 +397,41 @@ export function useRailIconFlight(
377
397
  const toCenterY = pair.to.top + pair.to.height / 2;
378
398
  const dx = (toCenterX - fromCenterX) / scale.x;
379
399
  const dy = (toCenterY - fromCenterY) / scale.y;
380
- const sx = pair.from.width ? pair.to.width / pair.from.width : 1;
381
- const sy = pair.from.height ? pair.to.height / pair.from.height : 1;
400
+ // A no-scale mark is painted at the DESTINATION size from frame 0, so
401
+ // the transform never contains a scale at all (a `scale(1)` would
402
+ // still be a no-op today but leaves the door open for the size tween
403
+ // to creep back in through a later edit).
404
+ const paintedW = pair.noScale ? pair.to.width : pair.from.width;
405
+ const paintedH = pair.noScale ? pair.to.height : pair.from.height;
406
+ const sx = pair.noScale
407
+ ? 1
408
+ : pair.from.width
409
+ ? pair.to.width / pair.from.width
410
+ : 1;
411
+ const sy = pair.noScale
412
+ ? 1
413
+ : pair.from.height
414
+ ? pair.to.height / pair.from.height
415
+ : 1;
382
416
  const clone = pair.template.cloneNode(true) as HTMLElement;
383
417
  // Neutralize identity: the clone must never match a future pairing
384
418
  // query nor the hide rule — it is the flight layer's own citizen.
385
419
  clone.removeAttribute(RAIL_FLIP_ICON_ATTR);
386
420
  clone.removeAttribute(RAIL_FLIP_FLYING_ATTR);
387
421
  clone.className = "hk-sidebar-rail-flight-clone";
388
- clone.style.insetInlineStart = `${inlineOffset / scale.x}px`;
389
- clone.style.insetBlockStart = `${(pair.from.top - origin.top) / scale.y}px`;
390
- clone.style.width = `${pair.from.width / scale.x}px`;
391
- clone.style.height = `${pair.from.height / scale.y}px`;
422
+ // Center-aligned travel for both kinds: the painted box is centered on
423
+ // the LEAVING center and travels to the DESTINATION center, so a
424
+ // constant-size mark and a tweening glyph share one code path — only
425
+ // the scale differs (a mark's is identity).
426
+ const paintLeft = pair.from.left + pair.from.width / 2 - paintedW / 2;
427
+ const paintTop = pair.from.top + pair.from.height / 2 - paintedH / 2;
428
+ const paintInlineOffset = rtl
429
+ ? origin.right - (paintLeft + paintedW)
430
+ : paintLeft - origin.left;
431
+ clone.style.insetInlineStart = `${paintInlineOffset / scale.x}px`;
432
+ clone.style.insetBlockStart = `${(paintTop - origin.top) / scale.y}px`;
433
+ clone.style.width = `${paintedW / scale.x}px`;
434
+ clone.style.height = `${paintedH / scale.y}px`;
392
435
  clone.style.color = pair.color;
393
436
  // Pure travel: full opacity the whole way, `fill: forwards` so a
394
437
  // frame that slips past finish still shows the clone AT the
package/src/index.ts CHANGED
@@ -587,6 +587,15 @@ export {
587
587
  SIDEBAR_RAIL_TOGGLE_BUTTON_SELECTOR,
588
588
  } from "./composables/useSidebarRail";
589
589
  export type { SidebarRailOptions, SidebarRailHandle } from "./composables/useSidebarRail";
590
+ // The rail flip's icon continuations vocabulary: a host that renders its own
591
+ // rail glyph cells (bespoke sidebar markup) stamps these attributes directly.
592
+ // `iconNoScale` on HkMenuItem is the component-level spelling of the same
593
+ // contract for hosts that go through HkMenu.
594
+ export {
595
+ RAIL_FLIP_ICON_ATTR,
596
+ RAIL_FLIP_FLYING_ATTR,
597
+ RAIL_FLIP_NOSCALE_ATTR,
598
+ } from "./composables/useRailIconFlight";
590
599
  // The sidebar GROUP FOLD store (known-live-issues #43). HkFaceShell and
591
600
  // HkSidebar provide one above their rail swap, so slot content THEY own
592
601
  // shares the fold across density generations. A host that defines the