Reference
Flags a page registers itself
import { … } from "@johnmorrisdotca/hata/custom";
6.9 kB minified and gzipped, with everything it imports (measured with esbuild)
Exports
| Name | Kind | What it is |
|---|---|---|
CUSTOM_GROUP | constant | The group a flag is listed under when its record names none. |
customAspect | function | A custom flag's width over its height, from its viewBox, for keeping a box before it is drawn. |
customCreditLine | function | 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 | function | 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 | type | 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 | type | 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 | type | 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 | function | 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 | function | A custom flag's id, from one written loosely (either case, spaces around it) and registered: "custom:harbour-fc". |
customName | function | A custom flag's name, in English or Japanese (any tag that starts ja); the English where no Japanese was given. |
enableFlags | function | Switches a registered set off or on without forgetting it: while off, its flags are not found, listed or credited. |
FlagsRegistered | type | 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 | function | 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 | function | 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 | constant | The most custom flags a page may hold at once, over all its sets. |
registerFlags | function | 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 | function | Takes a registered set out: its flags are no longer found, listed or drawn, and its id can be registered again. |
searchCustomFlags | function | 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. |