@johnmorrisdotca/chikyu-earth 0.17.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,70 @@
1
+ // The "my country" sheet: the country's outline, big and thick, its capital marked with a star, a box to draw its flag in and three facts. Pure: a string of SVG measured in millimetres.
2
+ import { geoAzimuthalEqualArea, geoCentroid, geoPath } from "d3-geo";
3
+ import { countryShape } from "./land.js";
4
+ import { thickPath } from "./outline.js";
5
+ import { TITLES, SAY, countryFacts } from "./text.js";
6
+ import { TYPES, esc, factsBlock, haloText, innerMm, labelMm, outlineMm, svgOpen, textWidth, wrap } from "./common.js";
7
+ const GAP = 5;
8
+ /** A five-pointed star centred on `x`, `y`, `outer` from the middle to a point. */
9
+ function star(x, y, outer) {
10
+ const points = [];
11
+ for (let i = 0; i < 10; i += 1) {
12
+ const radius = i % 2 === 0 ? outer : outer * 0.42;
13
+ const angle = (Math.PI / 5) * i - Math.PI / 2;
14
+ points.push(`${(x + radius * Math.cos(angle)).toFixed(2)},${(y + radius * Math.sin(angle)).toFixed(2)}`);
15
+ }
16
+ return points.join(" ");
17
+ }
18
+ /**
19
+ * A "my country" colouring sheet: the country's outline as big as the room allows (an equal-area view centred on the country, with a far territory such as French Guiana left out), its capital as a star when `capital` is given, a box to draw the flag in, and three facts:
20
+ * the continent, the countries it touches, the capital. The flag is a box to fill in, never a picture: the sheet carries no flag.
21
+ * @param alpha2 - The country's two-letter code, such as `JP`.
22
+ * @param options - The room, the language, the type and the capital.
23
+ * @returns The `<svg>` markup, or `undefined` when the package has no outline for the code.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * import { countrySheetSvg } from "@johnmorrisdotca/chikyu-earth/sheets";
28
+ *
29
+ * const svg = countrySheetSvg("JP", { widthMm: 184.6, heightMm: 180, capital: { name: "Tokyo", lon: 139.7, lat: 35.7 } });
30
+ * console.log(svg?.includes("Tokyo"), svg?.includes("Draw the flag!"));
31
+ * ```
32
+ */
33
+ export function countrySheetSvg(alpha2, options) {
34
+ const shape = countryShape(alpha2);
35
+ if (shape === undefined)
36
+ return undefined;
37
+ const { widthMm: w, heightMm: h } = options;
38
+ const lang = options.lang ?? "en";
39
+ const type = options.type ?? "kid";
40
+ const outline = outlineMm(type);
41
+ const flagW = Math.min(58, w * 0.32);
42
+ const factsWidth = w - flagW - 8;
43
+ const capitalName = options.capital === undefined ? undefined : lang === "ja" ? (options.capital.ja ?? options.capital.name) : options.capital.name;
44
+ const facts = factsBlock(countryFacts(shape, capitalName, lang), factsWidth, 0, type);
45
+ const flagH = Math.max(facts.height, 40);
46
+ const strip = Math.max(facts.height, flagH);
47
+ const mapH = h - strip - GAP;
48
+ const centre = geoCentroid(shape.feature);
49
+ const pad = outline + 3;
50
+ const projection = geoAzimuthalEqualArea().rotate([-centre[0], -centre[1]]).fitExtent([[pad, pad], [w - pad, mapH - pad]], shape.feature);
51
+ const path = geoPath(projection);
52
+ const land = thickPath(path(shape.feature) ?? "", outline * 0.3, outline * 1.2);
53
+ let marks = `<path d="${land}" fill="none" stroke="#000" stroke-width="${outline}" stroke-linejoin="round" data-country="${shape.alpha2 ?? ""}"/>`;
54
+ if (options.capital !== undefined) {
55
+ const at = projection([options.capital.lon, options.capital.lat]);
56
+ if (at !== null) {
57
+ const size = labelMm(type);
58
+ const radius = type === "kid" ? 7 : 3.5;
59
+ const toRight = at[0] + radius + 2 + textWidth(capitalName, size) <= w;
60
+ const x = toRight ? at[0] + radius + 2 : at[0] - radius - 2;
61
+ marks += `<polygon points="${star(at[0], at[1], radius)}" fill="#000" stroke="#fff" stroke-width="${innerMm(type)}" stroke-linejoin="round" paint-order="stroke" data-capital=""/>`;
62
+ marks += haloText(x, at[1] + size * 0.34, size, capitalName, ' data-capital-name=""', toRight ? "start" : "end");
63
+ }
64
+ }
65
+ const top = mapH + GAP;
66
+ const left = `<g transform="translate(0 ${top + (strip - facts.height) / 2})">${facts.markup}</g>`;
67
+ const bodyMm = TYPES[type].bodyMm;
68
+ const box = `<g transform="translate(${w - flagW} ${top})"><rect x="${outline / 2}" y="${outline / 2}" width="${flagW - outline}" height="${strip - outline}" rx="3" fill="none" stroke="#000" stroke-width="${innerMm(type)}" data-flag-box=""/>${wrap(SAY[lang].flag, flagW - 2 * outline, bodyMm).map((line, i) => `<text x="${flagW / 2}" y="${outline + bodyMm * (0.9 + 1.2 * i)}" font-size="${bodyMm}" font-weight="700" fill="#000" text-anchor="middle" data-flag-say="">${esc(line)}</text>`).join("")}</g>`;
69
+ return `${svgOpen(w, h, TITLES.country(lang === "ja" ? shape.ja : shape.name, lang), "country")}${marks}${left}${box}</svg>`;
70
+ }
@@ -0,0 +1,50 @@
1
+ import { type GlobeView } from "./text.ts";
2
+ import { type Lang, type TypeName } from "./common.ts";
3
+ /**
4
+ * What a sheet is drawn for: the room in millimetres, the language and the type.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * import { worldMapSvg, type SheetOptions } from "@johnmorrisdotca/chikyu-earth/sheets";
9
+ *
10
+ * const options: SheetOptions = { widthMm: 184.6, heightMm: 170, lang: "ja", type: "kid" };
11
+ * console.log(worldMapSvg(options).includes("たいへいよう"));
12
+ * ```
13
+ */
14
+ export interface SheetOptions {
15
+ widthMm: number;
16
+ heightMm: number;
17
+ lang?: Lang;
18
+ /** `kid` (default): thick lines and big type. `normal`: thin lines and small type. */
19
+ type?: TypeName;
20
+ }
21
+ /**
22
+ * The globe as a colouring sheet: one side of the Earth as a big disc, the continents with thick outlines, the continents' and oceans' names written on them, and three facts under it. A view is the Americas, Europe and Africa, or Asia and Oceania.
23
+ * `widthMm` and `heightMm` are the room it is drawn for, and the viewBox is that room, so a millimetre is a millimetre on paper.
24
+ * @param view - `americas`, `europe-africa` or `asia-oceania`.
25
+ * @param options - The room, the language and the type.
26
+ * @returns The `<svg>` markup.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * import { globeSheetSvg } from "@johnmorrisdotca/chikyu-earth/sheets";
31
+ *
32
+ * const svg = globeSheetSvg("europe-africa", { widthMm: 184.6, heightMm: 180, lang: "en" });
33
+ * console.log(svg.includes("Africa"), svg.includes("Atlantic"));
34
+ * ```
35
+ */
36
+ export declare function globeSheetSvg(view: GlobeView, options: SheetOptions): string;
37
+ /**
38
+ * The world map as a colouring sheet: all the land on one flat map, the continents with thick outlines, the names of the continents and of the five oceans written on it, and three facts.
39
+ * @param options - The room, the language and the type.
40
+ * @returns The `<svg>` markup.
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * import { worldMapSvg } from "@johnmorrisdotca/chikyu-earth/sheets";
45
+ *
46
+ * const svg = worldMapSvg({ widthMm: 184.6, heightMm: 180, lang: "en" });
47
+ * console.log(svg.includes("Pacific"));
48
+ * ```
49
+ */
50
+ export declare function worldMapSvg(options: SheetOptions): string;
@@ -0,0 +1,103 @@
1
+ // The globe sheet and the world map: the continents with thick outlines and their names and the oceans' written where they are, then three facts. Pure: each is a string of SVG measured in millimetres.
2
+ import { geoNaturalEarth1, geoOrthographic, geoPath } from "d3-geo";
3
+ import { continentLines } from "./land.js";
4
+ import { PLACES, VIEW_CENTRES, VIEW_LABELS, earthFacts } from "./text.js";
5
+ import { thickPath } from "./outline.js";
6
+ import { factsBlock, labelMm, nameBlock, outlineMm, svgOpen } from "./common.js";
7
+ import { TITLES } from "./text.js";
8
+ const SPHERE = { type: "Sphere" };
9
+ const GAP = 5;
10
+ /** The smallest island kept before the lines are made simpler. */
11
+ const MIN_ISLAND_SR = 0.0006;
12
+ /** The names written on a picture, each centred where `spot` says (a place with no spot is left out). A name that does not fit `inside` is left out too. */
13
+ function names(projection, lang, type, inside, spot, flat = false) {
14
+ const size = labelMm(type);
15
+ const out = [];
16
+ for (const place of PLACES) {
17
+ const at = spot(place);
18
+ if (at === undefined)
19
+ continue;
20
+ const point = projection([at[0], at[1]]);
21
+ if (point === null)
22
+ continue;
23
+ const lines = flat && place.oneLine === true ? [(lang === "ja" ? place.ja : place.en).join(" ")] : lang === "ja" ? place.ja : place.en;
24
+ const block = nameBlock(lines, point[0], point[1], size, ` data-place="${place.id}"`);
25
+ const box = { x0: point[0] - block.width / 2, x1: point[0] + block.width / 2, y0: point[1] - block.height / 2, y1: point[1] + block.height / 2 };
26
+ if (inside(box))
27
+ out.push(block.markup);
28
+ }
29
+ return out.join("");
30
+ }
31
+ /**
32
+ * The globe as a colouring sheet: one side of the Earth as a big disc, the continents with thick outlines, the continents' and oceans' names written on them, and three facts under it. A view is the Americas, Europe and Africa, or Asia and Oceania.
33
+ * `widthMm` and `heightMm` are the room it is drawn for, and the viewBox is that room, so a millimetre is a millimetre on paper.
34
+ * @param view - `americas`, `europe-africa` or `asia-oceania`.
35
+ * @param options - The room, the language and the type.
36
+ * @returns The `<svg>` markup.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * import { globeSheetSvg } from "@johnmorrisdotca/chikyu-earth/sheets";
41
+ *
42
+ * const svg = globeSheetSvg("europe-africa", { widthMm: 184.6, heightMm: 180, lang: "en" });
43
+ * console.log(svg.includes("Africa"), svg.includes("Atlantic"));
44
+ * ```
45
+ */
46
+ export function globeSheetSvg(view, options) {
47
+ const { widthMm: w, heightMm: h } = options;
48
+ const lang = options.lang ?? "en";
49
+ const type = options.type ?? "kid";
50
+ const outline = outlineMm(type);
51
+ const facts = factsBlock(earthFacts("globe", lang), w, 0, type);
52
+ const free = h - facts.height - GAP;
53
+ const diameter = Math.min(w, free);
54
+ const radius = diameter / 2 - outline / 2;
55
+ const cx = w / 2;
56
+ const cy = free / 2;
57
+ const centre = VIEW_CENTRES[view];
58
+ const projection = geoOrthographic().rotate([-centre[0], -centre[1]]).translate([cx, cy]).scale(radius).clipAngle(90).precision(0.3);
59
+ const path = geoPath(projection);
60
+ const coast = thickPath(path({ type: "MultiLineString", coordinates: continentLines(MIN_ISLAND_SR) }) ?? "", outline * 0.4, outline * 3.5);
61
+ const rim = `<circle cx="${cx}" cy="${cy}" r="${radius}" fill="none" stroke="#000" stroke-width="${outline}" data-rim=""/>`;
62
+ const lines = `<path d="${coast}" fill="none" stroke="#000" stroke-width="${outline}" stroke-linecap="round" stroke-linejoin="round" data-coast=""/>`;
63
+ const inside = (box) => [[box.x0, box.y0], [box.x1, box.y0], [box.x0, box.y1], [box.x1, box.y1]].every(([x, y]) => Math.hypot(x - cx, y - cy) <= radius - outline);
64
+ const words = names(projection, lang, type, inside, (place) => VIEW_LABELS[view][place.id]);
65
+ const label = TITLES.globe(view, lang);
66
+ return `${svgOpen(w, h, label, "globe")}${rim}${lines}${words}<g transform="translate(0 ${h - facts.height})">${facts.markup}</g></svg>`;
67
+ }
68
+ /**
69
+ * The world map as a colouring sheet: all the land on one flat map, the continents with thick outlines, the names of the continents and of the five oceans written on it, and three facts.
70
+ * @param options - The room, the language and the type.
71
+ * @returns The `<svg>` markup.
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * import { worldMapSvg } from "@johnmorrisdotca/chikyu-earth/sheets";
76
+ *
77
+ * const svg = worldMapSvg({ widthMm: 184.6, heightMm: 180, lang: "en" });
78
+ * console.log(svg.includes("Pacific"));
79
+ * ```
80
+ */
81
+ export function worldMapSvg(options) {
82
+ const { widthMm: w, heightMm: h } = options;
83
+ const lang = options.lang ?? "en";
84
+ const type = options.type ?? "kid";
85
+ const outline = outlineMm(type);
86
+ const facts = factsBlock(earthFacts("map", lang), w, 0, type);
87
+ const free = h - facts.height - GAP;
88
+ const projection = geoNaturalEarth1();
89
+ projection.fitWidth(w - outline, SPHERE);
90
+ const [tx, ty] = projection.translate();
91
+ projection.translate([tx + outline / 2, ty + outline / 2]);
92
+ const path = geoPath(projection);
93
+ const bounds = path.bounds(SPHERE);
94
+ const mapH = bounds[1][1] - bounds[0][1] + outline;
95
+ const top = Math.max(0, (free - mapH) / 2);
96
+ const coast = thickPath(path({ type: "MultiLineString", coordinates: continentLines(MIN_ISLAND_SR) }) ?? "", outline * 0.4, outline * 3.5);
97
+ const frame = path(SPHERE) ?? "";
98
+ const inside = (box) => box.x0 >= 0 && box.x1 <= w && box.y0 >= bounds[0][1] && box.y1 <= bounds[1][1] + outline;
99
+ const words = names(projection, lang, type, inside, (place) => place.mapAt ?? place.at, true);
100
+ const label = TITLES.map(lang);
101
+ const picture = `<path d="${frame}" fill="none" stroke="#000" stroke-width="${outline}" stroke-linejoin="round" data-rim=""/><path d="${coast}" fill="none" stroke="#000" stroke-width="${outline}" stroke-linecap="round" stroke-linejoin="round" data-coast=""/>${words}`;
102
+ return `${svgOpen(w, h, label, "map")}<g transform="translate(0 ${top})">${picture}</g><g transform="translate(0 ${h - facts.height})">${facts.markup}</g></svg>`;
103
+ }
@@ -0,0 +1,23 @@
1
+ export interface Bounds {
2
+ x0: number;
3
+ y0: number;
4
+ x1: number;
5
+ y1: number;
6
+ }
7
+ /**
8
+ * Parallel lines, `spacing` apart at `angleDeg`, cut to where `inside(x, y)` is true, as the data of one SVG path (a millimetre of the picture is a millimetre of the paper). Each end is found to a twentieth of a millimetre.
9
+ * @param bounds - The box the lines are laid over.
10
+ * @param spacing - The gap between lines, in millimetres.
11
+ * @param angleDeg - The turn of the lines, in degrees from the x axis.
12
+ * @param inside - Whether a point is in the shaded part.
13
+ * @returns Path data: `M x y L x y` for each stroke.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * import { hatchPath } from "@johnmorrisdotca/chikyu-earth/sheets";
18
+ *
19
+ * const d = hatchPath({ x0: 0, y0: 0, x1: 20, y1: 20 }, 4, 45, (x) => x < 10);
20
+ * console.log(d.startsWith("M"));
21
+ * ```
22
+ */
23
+ export declare function hatchPath(bounds: Bounds, spacing: number, angleDeg: number, inside: (x: number, y: number) => boolean): string;
@@ -0,0 +1,66 @@
1
+ // Shading that prints in black and white: parallel lines, drawn only where a test says so (the night side of the Earth). The lines are plain geometry, not a pattern fill, so they print the same in any browser. Pure.
2
+ const r = (v) => (Math.round(v * 100) / 100).toString();
3
+ /**
4
+ * Parallel lines, `spacing` apart at `angleDeg`, cut to where `inside(x, y)` is true, as the data of one SVG path (a millimetre of the picture is a millimetre of the paper). Each end is found to a twentieth of a millimetre.
5
+ * @param bounds - The box the lines are laid over.
6
+ * @param spacing - The gap between lines, in millimetres.
7
+ * @param angleDeg - The turn of the lines, in degrees from the x axis.
8
+ * @param inside - Whether a point is in the shaded part.
9
+ * @returns Path data: `M x y L x y` for each stroke.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { hatchPath } from "@johnmorrisdotca/chikyu-earth/sheets";
14
+ *
15
+ * const d = hatchPath({ x0: 0, y0: 0, x1: 20, y1: 20 }, 4, 45, (x) => x < 10);
16
+ * console.log(d.startsWith("M"));
17
+ * ```
18
+ */
19
+ export function hatchPath(bounds, spacing, angleDeg, inside) {
20
+ const a = (angleDeg * Math.PI) / 180;
21
+ const ux = Math.cos(a);
22
+ const uy = Math.sin(a);
23
+ const nx = -uy;
24
+ const ny = ux;
25
+ const corners = [[bounds.x0, bounds.y0], [bounds.x1, bounds.y0], [bounds.x0, bounds.y1], [bounds.x1, bounds.y1]];
26
+ const ts = corners.map(([x, y]) => x * nx + y * ny);
27
+ const ss = corners.map(([x, y]) => x * ux + y * uy);
28
+ const tMin = Math.min(...ts);
29
+ const tMax = Math.max(...ts);
30
+ const sMin = Math.min(...ss);
31
+ const sMax = Math.max(...ss);
32
+ const step = 0.4;
33
+ const at = (t, s) => [t * nx + s * ux, t * ny + s * uy];
34
+ /** The place between an outside sample and an inside one where the shading starts or stops. */
35
+ const edge = (t, outside, within) => {
36
+ let lo = outside;
37
+ let hi = within;
38
+ for (let i = 0; i < 4; i += 1) {
39
+ const m = (lo + hi) / 2;
40
+ if (inside(...at(t, m)))
41
+ hi = m;
42
+ else
43
+ lo = m;
44
+ }
45
+ return (lo + hi) / 2;
46
+ };
47
+ const out = [];
48
+ for (let t = tMin + spacing / 2; t <= tMax; t += spacing) {
49
+ let start;
50
+ let previous = sMin;
51
+ for (let s = sMin; s <= sMax + step; s += step) {
52
+ const on = inside(...at(t, s));
53
+ if (on && start === undefined)
54
+ start = s === sMin ? s : edge(t, previous, s);
55
+ if (!on && start !== undefined) {
56
+ const end = edge(t, s, previous);
57
+ const [x0, y0] = at(t, start);
58
+ const [x1, y1] = at(t, end);
59
+ out.push(`M${r(x0)} ${r(y0)}L${r(x1)} ${r(y1)}`);
60
+ start = undefined;
61
+ }
62
+ previous = s;
63
+ }
64
+ }
65
+ return out.join("");
66
+ }
@@ -0,0 +1,7 @@
1
+ export { globeSheetSvg, worldMapSvg, type SheetOptions } from "./earth.ts";
2
+ export { countrySheetSvg, type Capital, type CountryOptions } from "./country.ts";
3
+ export { dayNightSvg, dayNightView, seasonsSvg, terminator } from "./sun.ts";
4
+ export { continentLines, countryCodes, countryShape, landShares, type CountryShape } from "./land.ts";
5
+ export { thickPath } from "./outline.ts";
6
+ export { hatchPath } from "./hatch.ts";
7
+ export { GLOBE_VIEWS, PLACES, SAY, TILT_DEGREES, TITLES, countryFacts, dayNightFacts, earthFacts, seasonsFacts, type GlobeView, type Place } from "./text.ts";
@@ -0,0 +1,9 @@
1
+ // The printable sheets of the Earth for children and everyone: the globe to colour, a world map, a "my country" sheet, day and night, and the seasons. Pure: each is a string of SVG measured in millimetres, to put inside kazoku-ui's print sheet (the demo does),
2
+ // so the page's header, footer and QR code are not made here and the sheets need no browser.
3
+ export { globeSheetSvg, worldMapSvg } from "./earth.js";
4
+ export { countrySheetSvg } from "./country.js";
5
+ export { dayNightSvg, dayNightView, seasonsSvg, terminator } from "./sun.js";
6
+ export { continentLines, countryCodes, countryShape, landShares } from "./land.js";
7
+ export { thickPath } from "./outline.js";
8
+ export { hatchPath } from "./hatch.js";
9
+ export { GLOBE_VIEWS, PLACES, SAY, TILT_DEGREES, TITLES, countryFacts, dayNightFacts, earthFacts, seasonsFacts } from "./text.js";
@@ -0,0 +1,83 @@
1
+ import type { Feature, MultiPolygon } from "geojson";
2
+ export type ContinentId = "africa" | "asia" | "europe" | "north-america" | "south-america" | "oceania" | "antarctica";
3
+ /**
4
+ * The coasts of the continents as lines in longitude and latitude, for a child to colour a whole continent: the line round each continent and between two continents (Europe and Asia), and none between two countries of one continent. Islands under `minAreaSr` steradians are left out
5
+ * (about 80,000 square kilometres at the default, so Great Britain, Japan, Madagascar and New Zealand stay and small islands go, which at a thick line would only be blobs).
6
+ * @param minAreaSr - The smallest island kept, in steradians (the whole sphere is 4 pi).
7
+ * @returns Lines of `[longitude, latitude]` points.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { continentLines } from "@johnmorrisdotca/chikyu-earth/sheets";
12
+ *
13
+ * const lines = continentLines();
14
+ * console.log(lines.length > 5, lines[0]?.length);
15
+ * ```
16
+ */
17
+ export declare function continentLines(minAreaSr?: number): [number, number][][];
18
+ /**
19
+ * How much of the Earth is land, by the package's outlines, in percent, and the share of all the land each continent has.
20
+ * @returns The land's percent of the whole sphere, and each continent's percent of the land.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * import { landShares } from "@johnmorrisdotca/chikyu-earth/sheets";
25
+ *
26
+ * const shares = landShares();
27
+ * console.log(Math.round(shares.landPercent), shares.continents.asia > shares.continents.africa);
28
+ * ```
29
+ */
30
+ export declare function landShares(): {
31
+ landPercent: number;
32
+ continents: Record<ContinentId, number>;
33
+ };
34
+ /**
35
+ * One country as the sheets draw it: its names, its continent, its land as one feature and the names of the countries it touches.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * import { countryShape, type CountryShape } from "@johnmorrisdotca/chikyu-earth/sheets";
40
+ *
41
+ * const spain: CountryShape | undefined = countryShape("ES");
42
+ * console.log(spain?.neighbours.map((one) => one.name));
43
+ * ```
44
+ */
45
+ export interface CountryShape {
46
+ name: string;
47
+ ja: string;
48
+ alpha2: string | null;
49
+ continent: ContinentId;
50
+ /** The main land and the nearby islands as one feature. */
51
+ feature: Feature<MultiPolygon>;
52
+ /** The names of the countries it shares a border with, English and Japanese. */
53
+ neighbours: {
54
+ name: string;
55
+ ja: string;
56
+ }[];
57
+ }
58
+ /**
59
+ * One country by its ISO alpha-2 code, for a "my country" sheet: its main land and the islands near it (a far territory such as French Guiana is left out), the continent it is in and the countries it touches.
60
+ * @param alpha2 - The two-letter code, such as `JP`.
61
+ * @returns The shape, or `undefined` when the package has no outline for the code.
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * import { countryShape } from "@johnmorrisdotca/chikyu-earth/sheets";
66
+ *
67
+ * const france = countryShape("FR");
68
+ * console.log(france?.continent, france?.neighbours.length);
69
+ * ```
70
+ */
71
+ export declare function countryShape(alpha2: string): CountryShape | undefined;
72
+ /**
73
+ * The two-letter codes of the countries that have an outline.
74
+ * @returns The codes, in the order of the outlines.
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * import { countryCodes } from "@johnmorrisdotca/chikyu-earth/sheets";
79
+ *
80
+ * console.log(countryCodes().includes("JP"));
81
+ * ```
82
+ */
83
+ export declare const countryCodes: () => string[];