@celestia-island/hikari 0.55.50 → 0.55.51

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celestia-island/hikari",
3
- "version": "0.55.50",
3
+ "version": "0.55.51",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Hikari Vue 3 component library — production-grade UI components based on shittim-chest design system",
@@ -0,0 +1,54 @@
1
+ import { dirname, join, resolve } from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+
4
+ import * as sass from "sass";
5
+ import { describe, expect, it } from "vitest";
6
+
7
+ /**
8
+ * Slot-glyph guard contract (2026-09-23).
9
+ *
10
+ * A raw svg passed as HkButton slot content (the lucide `<Icon size={14}/>`
11
+ * child pattern chest uses in every admin table action cell) is a flex
12
+ * item of the button. Under a squeezed host row, the host reset's
13
+ * `svg { max-width: 100% }` clamps the glyph to the button's SHRUNKEN
14
+ * content box: measured 3.3x14 px slivers in ProvidersView, 10x14 in
15
+ * OAuthProvidersView/DeviceModelsView, 0x14 in WebhooksView/GroupTab —
16
+ * the "行内操作按钮莫名其妙很小" report. `.hk-btn > svg { flex: none }`
17
+ * pins the glyph to its intrinsic size; the button's automatic minimum
18
+ * size then covers the full glyph, so an auto-layout table column or
19
+ * toolbar row grows to fit instead of shrinking the controls into
20
+ * slivers. Verified in a real (headless) browser before/after: 3.3px →
21
+ * 14px glyph width at the same viewport.
22
+ *
23
+ * The guard is asserted against the COMPILED sheet, not the source, so
24
+ * a reformat or a selector rename cannot silently unguard it.
25
+ */
26
+
27
+ const componentsDir = resolve(dirname(fileURLToPath(import.meta.url)));
28
+
29
+ function compileSheet(): string {
30
+ return sass.compile(join(componentsDir, "HkButton.scss"), {
31
+ loadPaths: [
32
+ resolve(componentsDir, ".."),
33
+ resolve(componentsDir, "../styles"),
34
+ resolve(componentsDir, "../styles/theme"),
35
+ ],
36
+ silenceDeprecations: ["import", "global-builtin", "legacy-js-api"],
37
+ }).css;
38
+ }
39
+
40
+ describe("HkButton slot-glyph guard", () => {
41
+ it("pins direct svg slot glyphs against flex squeeze", () => {
42
+ const css = compileSheet();
43
+ const rule = css.match(/\.hk-btn\s*>\s*svg\s*\{[^}]*\}/);
44
+ expect(rule, "compiled HkButton.scss must carry the .hk-btn > svg guard").toBeTruthy();
45
+ expect(rule![0]).toMatch(/flex:\s*none/);
46
+ });
47
+
48
+ it("keeps the icon prop's own fixed boxes flex:none (same contract)", () => {
49
+ const css = compileSheet();
50
+ const block = css.match(/\.hk-btn-icon\s*,\s*\.hk-btn-suffix\s*\{[^}]*\}/);
51
+ expect(block).toBeTruthy();
52
+ expect(block![0]).toMatch(/flex:\s*none/);
53
+ });
54
+ });
@@ -88,6 +88,24 @@
88
88
  }
89
89
  }
90
90
 
91
+ /* ---- Raw slot glyphs ----
92
+ The same fixed-glyph contract covers a raw svg passed as slot content
93
+ (the lucide `<Icon size={14}/>` child pattern): as a flex item of the
94
+ button it inherits flex-shrink:1, and under a squeezed host row the
95
+ host reset's `svg { max-width: 100% }` clamps it to the button's
96
+ SHRUNKEN content box — measured 3.3x14 in a real browser (chest admin
97
+ table action cells, 2026-09-23 user report: 行内操作按钮莫名其妙变成
98
+ 一条小竖线). flex:none pins the glyph to its intrinsic size; the
99
+ button's automatic minimum size then covers the full glyph, so an
100
+ auto-layout table column or toolbar row grows to fit instead of
101
+ shrinking the controls into slivers. Only the DIRECT child needs the
102
+ guard: a glyph wrapped in a span (the .hk-btn-icon box, an inline
103
+ label, …) sits behind a non-replaced flex item whose min-content
104
+ already carries the svg's intrinsic size. */
105
+ .hk-btn > svg {
106
+ flex: none;
107
+ }
108
+
91
109
  /* ---- Icon-only square ---- */
92
110
  /* An icon-only HkButton (glyph, no label) occupies a SQUARE footprint
93
111
  by default: padding collapses fully and width locks to the size