本文へ移動

Bushu部首

漢字に見える部品を選び、全てを含む漢字を探し、ページに部首選択を追加できます。

「部首」は、漢字を分類する部分です。 名前について(英語)

目次

リファレンス · 標準の部首選択

BushuMount型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

What mountBushu gives back: methods for everything a button does, and destroy.

インポート

import type { BushuMount } from "@johnmorrisdotca/bushu/picker";

定義

type BushuMount = {
    toggle(radical: string): void;
    remove(radical: string): void;
    clear(): void;
    select(kanji: string | null): void;
    chosen(): string[];
    matches(): string[];
    set(options: Partial<Pick<BushuMountOptions, "language" | "limit" | "names" | "strokes">>): void;
    destroy(): void;
};

メンバー

名前型説明
toggle(radical: string): void

Choose a part, by its RADKFILE key or by its shape (氵 for 汁), or take it away if it is chosen. A part that cannot narrow anything, or is not in the index, is left alone.

remove(radical: string): void

Take a part away, by its key or its shape.

clear(): void

Take every part away.

select(kanji: string | null): void

Open the card of a kanji, with its parts; null closes it.

chosen(): string[]

The parts chosen now, in the grid's order.

matches(): string[]

The kanji that match, all of them, in the order drawn.

set(options: Partial<Pick<BushuMountOptions, "language" | "limit" | "names" | "strokes">>): void

Change a setting later: the words, the limit, the names or the strokes.

destroy(): void

例

import { RADKFILE } from "@johnmorrisdotca/bushu/radkfile";
import type { BushuMount } from "@johnmorrisdotca/bushu/picker";
import { mountBushu } from "@johnmorrisdotca/bushu/picker";

const radicals = RADKFILE.radicals;
const host=document.createElement("div");
document.body.append(host);
const picker: BushuMount=mountBushu(host,{radicals,language:"ja"});
picker.toggle("汁");
console.log(picker.chosen(),picker.matches().length);
picker.destroy();

ソースを見るGitHub で編集@johnmorrisdotca/bushu 1.1.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。