リファレンス
ページが自分で登録する旗
import { … } from "@johnmorrisdotca/hata/custom";
最小化と gzip 圧縮をしたサイズは 6.9 kB(読み込むものをすべて含み、esbuild で計測)
リファレンスの説明と例は英語です。見出しと目次は日本語です。
エクスポート
| 名前 | 種類 | 概要 |
|---|---|---|
CUSTOM_GROUP | 定数 | The group a flag is listed under when its record names none. |
customAspect | 関数 | A custom flag's width over its height, from its viewBox, for keeping a box before it is drawn. |
customCreditLine | 関数 | Whose flags are on a page, as one line: each set that is on and holds a flag, with its credit and its licence beside it (and "non-commercial" or "share-alike" where the set says so), in English or Japanese. |
customFlag | 関数 | A registered custom flag's SVG, the checked and rewritten one, with a viewBox and no width or height, like a country's: frame() and toDataUri() from the main entry take it. |
CustomFlagInfo | 型 | A registered flag as a list shows it: the id, the names, the group, the width over the height and the source it came from. |
CustomFlagRecord | 型 | One custom flag a page gives: its id (custom: and a slug), its name, its SVG and, if it likes, a group to be listed under. |
CustomFlagSource | 型 | A set of flags handed in by a page: a records source of the family's data door, whose info says whose they are (id, names, credit, licence, page, day) and whose records() gives the flags. |
customGroups | 関数 | The groups of the flags registered and on, in the order each first appears, with the ids in each: for a picker that shows custom flags beside the built-in ones. |
customId | 関数 | A custom flag's id, from one written loosely (either case, spaces around it) and registered: "custom:harbour-fc". |
customName | 関数 | A custom flag's name, in English or Japanese (any tag that starts ja); the English where no Japanese was given. |
enableFlags | 関数 | Switches a registered set off or on without forgetting it: while off, its flags are not found, listed or credited. |
FlagsRegistered | 型 | What registering a set did: the flags added, the records left out with the reason each was (never drawn), and a way to take the set out again. |
isCustomId | 関数 | True for a string written as a custom flag's id, custom: and a slug; it says nothing of whether such a flag is registered (customFlag does). |
listCustomFlags | 関数 | The flags registered and on, in the order they were added, each as { id, name, group, aspect, source }; only one group's with group. |
MAX_CUSTOM_FLAGS | 定数 | The most custom flags a page may hold at once, over all its sets. |
registerFlags | 関数 | Registers a set of flags a page brings: the source is checked at once (a TypeError for an empty credit, no licence, a bad id, a set id already registered, or a source that is not a records source), its records are read once, and each record is checked on its own. |
removeFlags | 関数 | Takes a registered set out: its flags are no longer found, listed or drawn, and its id can be registered again. |
searchCustomFlags | 関数 | Finds registered flags by a word: in the id's slug, the names (English and Japanese) and the group, ignoring case; the best first (exact, then a start, then anywhere), then in the order added. |
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。