FlagRecord型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Where one flag's drawing comes from, under what licence, and why that drawing was chosen.
インポート
import type { FlagRecord } from "@johnmorrisdotca/hata/manifest";
定義
interface FlagRecord {
code: string;
source: FlagSource;
file: string;
page: string;
version: string | null;
wikidata: string;
licence: {
kind: LicenceKind;
name: string;
url: string | null;
};
author: string | null;
credit: string | null;
attributionRequired: boolean;
restrictions: string[];
templates: string[];
uploaded: string | null;
fetched: string;
reference: {
file: string;
page: string;
licence: string;
} | null;
why: string;
sameAs: string | null;
width: number;
height: number;
bytes: number;
gzip: number;
notes: string[];
disputed: boolean;
defaultVariant: string | null;
variants: Variant[];
framings: Record<"4:3" | "1:1" | "round", Framing>;
}
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
code | string | The code, as Kuni writes it: "JP", "JP-13", "CA-ON", "US-TX". |
source | FlagSource | Where the drawing comes from: |
file | string | The file: its name on Commons without "File:", or its path in the flag set ("3x2/YE.svg"). |
page | string | Where to see it: the file's page on Commons, with its licence and history, or the set's file on jsDelivr at its version. |
version | string | null | The flag set's version the drawing is from; null for Commons. |
wikidata | string | The Wikidata item whose flag image (P41) names the file: "Q17". |
licence | { kind: LicenceKind; name: string; url: string | null; } | The licence: its kind, its name ("Public domain", "CC BY 4.0", "MIT") and its address where it has one. |
author | string | null | The author: as Commons' Artist field gives it, in plain text, or the set's copyright line; null where none is named. |
credit | string | null | The credit line Commons gives, in plain text; null where there is none. |
attributionRequired | boolean | True where the licence asks for credit (Commons says so, or the set's MIT notice must travel with it). |
restrictions | string[] | Restrictions Commons notes on the flag apart from copyright, as it spells them: "insignia", "trademarked". |
templates | string[] | The licence and restriction templates on the Commons file's page, without "Template:"; empty for a set's drawing. |
uploaded | string | null | The day the Commons file's current version was uploaded, YYYY-MM-DD; null for a set's drawing. |
fetched | string | The day Wikidata and Commons were read for this package, YYYY-MM-DD. |
reference | { file: string; page: string; licence: string; } | null | Where the drawing is a set's: the Commons file Wikidata names, which it was compared with, and that file's licence. Null for Commons. |
why | string | Why this drawing was chosen over the others, in a sentence or two. |
sameAs | string | null | The code whose picture this is, where two places fly one flag (Bouvet Island flies Norway's); null otherwise. |
width | number | The viewBox's width: the flag's aspect ratio is width / height. |
height | number | The viewBox's height. |
bytes | number | The size of the optimised SVG, in bytes. |
gzip | number | Its size gzipped at level 9, in bytes. |
notes | string[] | Things worth knowing about the picture: text drawn with a font, an embedded raster picture. |
disputed | boolean | True where more than one authority or community claims the place's flag at the same time (Afghanistan, Northern Ireland); this package takes no side, and says why each default was chosen (README). |
defaultVariant | string | null | The |
variants | Variant[] | Every flag of the place in real use, the default's included, each with its status and reason; empty where the place has one flag. See |
framings | Record<"4:3" | "1:1" | "round", Framing> | How the flag is framed at 4:3, square and round by |
例
import { manifest, type FlagRecord } from "@johnmorrisdotca/hata/manifest";
const tokyo: FlagRecord | null = manifest("JP-13");
if (tokyo !== null) console.log(tokyo.page, tokyo.licence.name, tokyo.width / tokyo.height);https://commons.wikimedia.org/wiki/File:Flag_of_Tokyo_Metropolis.svg Public domain 1.5出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。