@celestia-island/hikari 0.55.531 → 0.55.533
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/dist/types/components/HkInput.d.ts +9 -0
- package/package.json +1 -1
- package/src/components/HkInput.affix.test.ts +15 -0
- package/src/components/HkInput.autogrow.test.ts +54 -0
- package/src/components/HkInput.scss +13 -0
- package/src/components/HkInput.tsx +19 -1
- package/src/errorLandingStandalone/error-landing.html +1 -1
|
@@ -86,6 +86,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
86
86
|
type: BooleanConstructor;
|
|
87
87
|
default: boolean;
|
|
88
88
|
};
|
|
89
|
+
autoGrowMax: {
|
|
90
|
+
type: NumberConstructor;
|
|
91
|
+
default: undefined;
|
|
92
|
+
};
|
|
89
93
|
size: {
|
|
90
94
|
type: () => "sm" | "md" | "lg";
|
|
91
95
|
default: string;
|
|
@@ -304,6 +308,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
304
308
|
type: BooleanConstructor;
|
|
305
309
|
default: boolean;
|
|
306
310
|
};
|
|
311
|
+
autoGrowMax: {
|
|
312
|
+
type: NumberConstructor;
|
|
313
|
+
default: undefined;
|
|
314
|
+
};
|
|
307
315
|
size: {
|
|
308
316
|
type: () => "sm" | "md" | "lg";
|
|
309
317
|
default: string;
|
|
@@ -463,6 +471,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
463
471
|
hint: string;
|
|
464
472
|
spellcheck: boolean;
|
|
465
473
|
autoGrow: boolean;
|
|
474
|
+
autoGrowMax: number;
|
|
466
475
|
hideLabel: boolean;
|
|
467
476
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
468
477
|
export default _default;
|
package/package.json
CHANGED
|
@@ -67,6 +67,21 @@ afterEach(() => {
|
|
|
67
67
|
});
|
|
68
68
|
|
|
69
69
|
describe("HkInput affix reservation contract", () => {
|
|
70
|
+
it("the affix's type matches the field element's triple", () => {
|
|
71
|
+
// 2026-12-03 ayane report: an affix carrying TEXT (the registration
|
|
72
|
+
// form's `@domain` suffix) rendered in another family/size than the
|
|
73
|
+
// handle beside it — the affix rule had no font at all, so its text
|
|
74
|
+
// inherited along the OUTER chain while the input element carried
|
|
75
|
+
// hikari's explicit triple. The rule must keep the triple on the
|
|
76
|
+
// affix itself (MUT:affix-type-triple-dropped — deleting any of the
|
|
77
|
+
// three lines reddens this).
|
|
78
|
+
const sheet = readFileSync(join(here, "HkInput.scss"), "utf8");
|
|
79
|
+
const rule = /\.hk-input-affix \{([^}]*)\}/.exec(sheet)?.[1] ?? "";
|
|
80
|
+
expect(rule).toContain("font-family: inherit");
|
|
81
|
+
expect(rule).toContain("font-size: var(--text-base)");
|
|
82
|
+
expect(rule).toContain("line-height: 1.5");
|
|
83
|
+
});
|
|
84
|
+
|
|
70
85
|
it("pins the trailing affix to the right edge", () => {
|
|
71
86
|
const rule = scss.match(/\.hk-input-affix\.hk-input-suffix\s*{[^}]*}/)?.[0] ?? "";
|
|
72
87
|
expect(rule, "suffix rule must exist").toContain("margin-inline-start: auto");
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source contract for the autoGrow ceiling (2026-12-03: the chest chat
|
|
3
|
+
* dock carried a host-side `max-height: 120px` patch on the auto-growing
|
|
4
|
+
* textarea — the inline `height = scrollHeight` growth had no ceiling, so
|
|
5
|
+
* a long paste stretched the field across the whole dock. The prop moves
|
|
6
|
+
* that ceiling into the component.)
|
|
7
|
+
*
|
|
8
|
+
* The resize loop drives real layout (`scrollHeight`), which the test
|
|
9
|
+
* DOM cannot lay out — so this contract reads the SOURCE the way its
|
|
10
|
+
* compilers do (the HkInput.affix.test idiom) and requires the exact
|
|
11
|
+
* statements; a comment spelling them is not a pin (MUT:
|
|
12
|
+
* autogrow-ceiling-comment-only reddened the first cut).
|
|
13
|
+
*/
|
|
14
|
+
import { describe, expect, it } from "vitest";
|
|
15
|
+
import { readFileSync } from "node:fs";
|
|
16
|
+
import { dirname, join } from "node:path";
|
|
17
|
+
import { fileURLToPath } from "node:url";
|
|
18
|
+
|
|
19
|
+
import HkInput from "./HkInput";
|
|
20
|
+
|
|
21
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
22
|
+
const source = readFileSync(join(here, "HkInput.tsx"), "utf8");
|
|
23
|
+
|
|
24
|
+
describe("HkInput autoGrowMax", () => {
|
|
25
|
+
it("the prop exists and is optional", () => {
|
|
26
|
+
expect(
|
|
27
|
+
/autoGrowMax: \{ type: Number, default: undefined \}/.test(source),
|
|
28
|
+
).toBe(true);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("the growth clamps to the ceiling", () => {
|
|
32
|
+
// MUT:autogrow-ceiling-dropped — deleting the Math.min reddens this:
|
|
33
|
+
// the growth would be unbounded again, and the host patch would have
|
|
34
|
+
// to come back.
|
|
35
|
+
expect(
|
|
36
|
+
source.includes(
|
|
37
|
+
"Math.min(ta.scrollHeight, props.autoGrowMax)",
|
|
38
|
+
),
|
|
39
|
+
).toBe(true);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("past the ceiling the field scrolls instead of clipping", () => {
|
|
43
|
+
expect(source.includes('"auto"')).toBe(true);
|
|
44
|
+
expect(/ta\.scrollHeight > props\.autoGrowMax/.test(source)).toBe(true);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// The component itself must still export (a smoke check that the source
|
|
49
|
+
// parse above reads the real module, not a drifted copy).
|
|
50
|
+
describe("HkInput", () => {
|
|
51
|
+
it("is the real component", () => {
|
|
52
|
+
expect(typeof HkInput).toBe("object");
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -166,9 +166,22 @@
|
|
|
166
166
|
resize: none;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
// The affix's type MUST match the field element's triple (the input
|
|
170
|
+
// element itself is font-family inherit / font-size var(--text-base) /
|
|
171
|
+
// line-height 1.5). Without this the affix text inherits along the OUTER
|
|
172
|
+
// chain and renders in another family/size than the handle beside it
|
|
173
|
+
// (2026-12-03 ayane report: the registration form's domain suffix did not
|
|
174
|
+
// match the editable local part next to it). inherit here resolves inside
|
|
175
|
+
// the hikari box, so both sides land on the same family. The triple lives
|
|
176
|
+
// INSIDE the rule — HkInput.affix.test pins it there, and a doc comment
|
|
177
|
+
// inside the braces would satisfy a toContain even with the real lines
|
|
178
|
+
// deleted.
|
|
169
179
|
.hk-input-affix {
|
|
170
180
|
display: flex;
|
|
171
181
|
align-items: center;
|
|
182
|
+
font-family: inherit;
|
|
183
|
+
font-size: var(--text-base);
|
|
184
|
+
line-height: 1.5;
|
|
172
185
|
color: color-mix(in srgb, rgb(var(--color-muted)) 70%, rgb(var(--color-background)));
|
|
173
186
|
flex-shrink: 0;
|
|
174
187
|
position: relative;
|
|
@@ -48,6 +48,13 @@ export default defineComponent({
|
|
|
48
48
|
autocomplete: { type: String, default: undefined },
|
|
49
49
|
rows: { type: Number, default: 3 },
|
|
50
50
|
autoGrow: { type: Boolean, default: false },
|
|
51
|
+
/// The height CEILING for the auto-growing textarea, in px. Without
|
|
52
|
+
/// it the inline `height = scrollHeight` growth is unbounded — a long
|
|
53
|
+
/// paste stretches the field across its whole container (the chest
|
|
54
|
+
/// chat dock carried a host-side `max-height: 120px` patch for
|
|
55
|
+
/// exactly that, standardized here 2026-12-03). When the content
|
|
56
|
+
/// passes the ceiling the field stops growing and scrolls instead.
|
|
57
|
+
autoGrowMax: { type: Number, default: undefined },
|
|
51
58
|
size: { type: String as () => "sm" | "md" | "lg", default: "md" },
|
|
52
59
|
/**
|
|
53
60
|
* Suppress the caption above the control while keeping `label`
|
|
@@ -417,7 +424,18 @@ export default defineComponent({
|
|
|
417
424
|
const ta = inputRef.value as HTMLTextAreaElement | null;
|
|
418
425
|
if (!ta) return;
|
|
419
426
|
ta.style.height = "auto";
|
|
420
|
-
|
|
427
|
+
const next =
|
|
428
|
+
props.autoGrowMax !== undefined
|
|
429
|
+
? Math.min(ta.scrollHeight, props.autoGrowMax)
|
|
430
|
+
: ta.scrollHeight;
|
|
431
|
+
ta.style.height = `${next}px`;
|
|
432
|
+
// At the ceiling the field must SCROLL, not clip: the growth loop
|
|
433
|
+
// sets overflow on the way up and the box's own overflow-y takes
|
|
434
|
+
// over past the cap.
|
|
435
|
+
ta.style.overflowY =
|
|
436
|
+
props.autoGrowMax !== undefined && ta.scrollHeight > props.autoGrowMax
|
|
437
|
+
? "auto"
|
|
438
|
+
: "hidden";
|
|
421
439
|
}
|
|
422
440
|
|
|
423
441
|
watch(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
|
-
<meta name="hk-error-landing" content="v1 0.55.
|
|
4
|
+
<meta name="hk-error-landing" content="v1 0.55.533 <dev>">
|
|
5
5
|
<meta charset="utf-8" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
7
|
<meta name="robots" content="noindex" />
|