Skip to the content

Bushu部首

Choose the parts you can see in a kanji, intersect their matches, and add a radical picker to your page.

Bushu is the Japanese word 部首 for a kanji radical. About the name

Contents

Reference

Native radical picker

import { … } from "@johnmorrisdotca/bushu/picker";

89.7 kB minified and gzipped, with everything it imports (measured with esbuild)

The radical picker for a page: mountBushu draws the grid of parts by stroke count and the kanji that hold the parts chosen into any element, loadBushuData fetches the data it shows, and the words (BUSHU_STRINGS) and the style (BUSHU_STYLE) are here to read or replace. A separate entry (@johnmorrisdotca/bushu/picker), so a server never loads any of it.

Exports

NameKindWhat it is
BUSHU_RESULT_LIMITconstantThe most matches a picker draws unless limit says.
BUSHU_STRINGSconstantNative English and Japanese radical-picker controls, results and accessible announcements.
BUSHU_STYLEconstantTHE STYLE a Bushu picker wears (mountBushu, <bushu-picker>): its colours as custom properties on .bushu, its boxes, its tiles and its chips.
BushuEventDetailtypeWhat a picker tells of itself, in bushu-change and bushu-pick events and to the callbacks.
BushuLanguagetypeTHE WORDS BUSHU SAYS, in English and Japanese: what the picker's buttons and lines of words say, and what a screen reader hears.
bushuLanguageOffunctionThe language a lang attribute asks for: Japanese for any ja, English for everything else.
BushuMounttypeWhat mountBushu gives back: methods for everything a button does, and destroy.
BushuMountOptionstypeThe native radical data, optional names/strokes, language, result limit, initial selection and host callbacks.
BushuNameEntrytypeThe names a picker shows beside a radical: what radicalNameEntry from /names returns.
bushuSayfunctionA line in a language, with its {name} values filled in, and its One form when n is 1.
ensureBushuStylefunctionPuts the picker's style in the page once.
loadBushuDatafunctionLoads the data a picker shows, each module at the moment it is asked for, so that a page which never opens a picker never loads it: the radicals, the Japanese names and the strokes of a kanji.
mountBushufunctionNative interface, settings and words for host code.

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/bushu 1.1.0.