@celestia-island/hikari 0.55.418 → 0.55.421
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
|
@@ -61,10 +61,24 @@
|
|
|
61
61
|
|
|
62
62
|
.hk-list-row-trailing {
|
|
63
63
|
margin-left: auto;
|
|
64
|
-
flex-shrink: 0;
|
|
65
64
|
display: flex;
|
|
66
65
|
align-items: center;
|
|
67
66
|
gap: var(--space-8, 0.5rem);
|
|
67
|
+
|
|
68
|
+
/* The lane must be able to SHRINK when the row runs out of room (chip
|
|
69
|
+
overflow, 2026-11-18): the old `flex-shrink: 0` plus the default
|
|
70
|
+
`min-width: auto` pinned the lane at its content width, so a wide
|
|
71
|
+
trailing cluster — chips, a picker, widget buttons — pushed PAST the
|
|
72
|
+
row's right edge. With `min-width: 0; flex-shrink: 1` a roomy row is
|
|
73
|
+
pixel-identical (zero deficit ⇒ none of this applies); an overfull
|
|
74
|
+
row distributes the deficit PRO RATA, so the lane starts shrinking
|
|
75
|
+
immediately and wraps the cluster (flex-wrap below) — chips stack
|
|
76
|
+
inside the card and the row may grow taller, instead of the cluster
|
|
77
|
+
spilling out of it. */
|
|
78
|
+
min-width: 0;
|
|
79
|
+
flex-shrink: 1;
|
|
80
|
+
flex-wrap: wrap;
|
|
81
|
+
justify-content: flex-end;
|
|
68
82
|
}
|
|
69
83
|
|
|
70
84
|
/* The touch action lane parks in the same flex line and owns the auto
|
|
@@ -118,6 +118,31 @@ describe("HkSwitch rendering", () => {
|
|
|
118
118
|
const c = mount(h(HkSwitch, { label: "Dark mode" }));
|
|
119
119
|
expect(c.querySelector(".hk-label")!.textContent).toBe("Dark mode");
|
|
120
120
|
});
|
|
121
|
+
|
|
122
|
+
it("names the checkbox for assistive tech (aria-label contract)", () => {
|
|
123
|
+
// The visible caption is a sibling span inside the wrapping label —
|
|
124
|
+
// it does NOT name the checkbox. The input must carry an explicit
|
|
125
|
+
// accessible name, or the switch is announced unnamed.
|
|
126
|
+
const labelled = mount(h(HkSwitch, { label: "Dark mode" }));
|
|
127
|
+
expect(labelled.querySelector("input")!.getAttribute("aria-label")).toBe("Dark mode");
|
|
128
|
+
|
|
129
|
+
const aria = mount(h(HkSwitch, { ariaLabel: "Grid" }));
|
|
130
|
+
expect(aria.querySelector("input")!.getAttribute("aria-label")).toBe("Grid");
|
|
131
|
+
|
|
132
|
+
// No name in, no fabricated name out (consumers may wire their own
|
|
133
|
+
// label element — inventing an empty aria-label would shadow it).
|
|
134
|
+
const bare = mount(h(HkSwitch, {}));
|
|
135
|
+
expect(bare.querySelector("input")!.getAttribute("aria-label")).toBeNull();
|
|
136
|
+
|
|
137
|
+
// Empty-string label must not fabricate aria-label="" (accname
|
|
138
|
+
// ignores it; the contract is "no name in, no name out").
|
|
139
|
+
const empty = mount(h(HkSwitch, { label: "" }));
|
|
140
|
+
expect(empty.querySelector("input")!.getAttribute("aria-label")).toBeNull();
|
|
141
|
+
|
|
142
|
+
// ariaLabel wins over label when both are given.
|
|
143
|
+
const both = mount(h(HkSwitch, { ariaLabel: "Grid", label: "Dark mode" }));
|
|
144
|
+
expect(both.querySelector("input")!.getAttribute("aria-label")).toBe("Grid");
|
|
145
|
+
});
|
|
121
146
|
});
|
|
122
147
|
|
|
123
148
|
describe("HkSwitch toggling", () => {
|
|
@@ -16,6 +16,11 @@ export default defineComponent({
|
|
|
16
16
|
default: "primary",
|
|
17
17
|
},
|
|
18
18
|
label: { type: String, default: undefined },
|
|
19
|
+
/** Explicit accessible name for callers that render no visible
|
|
20
|
+
* caption (switches driven by an external label element or pure
|
|
21
|
+
* icon rows). Falls back to `label`; empty strings never fabricate
|
|
22
|
+
* a name. */
|
|
23
|
+
ariaLabel: { type: String, default: undefined },
|
|
19
24
|
checkedContent: { type: String, default: undefined },
|
|
20
25
|
uncheckedContent: { type: String, default: undefined },
|
|
21
26
|
},
|
|
@@ -43,6 +48,18 @@ export default defineComponent({
|
|
|
43
48
|
type="checkbox"
|
|
44
49
|
checked={props.modelValue}
|
|
45
50
|
disabled={props.disabled}
|
|
51
|
+
// Accessible name (2026-11-18): the wrapping label DOES name the
|
|
52
|
+
// checkbox implicitly via its text content, but that text
|
|
53
|
+
// includes the checked/unchecked content ("ON"/"OFF") and any
|
|
54
|
+
// caller-supplied caption. An explicit aria-label gives the
|
|
55
|
+
// switch a DETERMINISTIC name: `ariaLabel` wins, `label` is the
|
|
56
|
+
// next best, and a bare switch fabricates nothing (callers
|
|
57
|
+
// wiring their own label element keep working — an invented
|
|
58
|
+
// empty name would shadow theirs).
|
|
59
|
+
// Truthiness, not ??: an empty-string `label` must not fabricate
|
|
60
|
+
// an aria-label="" (accname ignores it, but the contract is "no
|
|
61
|
+
// name in, no name out").
|
|
62
|
+
aria-label={props.ariaLabel || props.label || undefined}
|
|
46
63
|
onChange={toggle}
|
|
47
64
|
/>
|
|
48
65
|
<span
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// wasmHighlight.ts — the wasm-backed syntax highlighting engine.
|
|
2
|
-
//
|
|
3
|
-
// Wraps hikari-wasm-highlight (the pest-driven Rust component) and
|
|
4
|
-
// produces hljs-compatible HTML. Unsupported languages return null
|
|
5
|
-
// (callers render escaped plain text).
|
|
6
|
-
|
|
7
|
-
import { highlight as wasmHighlightFn, languages as wasmLanguages } from "../wasm/highlight/hikari_wasm_highlight.js";
|
|
8
|
-
|
|
9
|
-
export type HighlightResult = string | null;
|
|
10
|
-
|
|
11
|
-
/** The set of languages the wasm component currently supports. */
|
|
12
|
-
export function wasmSupportedLanguages(): Set<string> {
|
|
13
|
-
return new Set(wasmLanguages());
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/** Highlight through the wasm component; null when unsupported. */
|
|
17
|
-
export function wasmHighlight(code: string, language: string): HighlightResult {
|
|
18
|
-
const result = wasmHighlightFn(code, language);
|
|
19
|
-
return result?.html ?? null;
|
|
20
|
-
}
|