@celestia-island/hikari 0.55.532 → 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.
|
@@ -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
|
@@ -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
|
+
});
|
|
@@ -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" />
|