@bicharts/chart-host 0.1.12 → 0.1.14

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.
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/geoNaRegions.ts"],
4
- "sourcesContent": ["// What DEFINES the North America basemap: which regions belong on it, how far north it\n// extends, and the pure geometry op that enforces that. No asset imports \u2014 geo.ts statically\n// pulls ~1.3 MB of generated geometry, so anything that only needs these decisions (tests,\n// tooling, future callers) shouldn't have to load the world to read them.\n\n// GREENLAND (\"GRL\") IS DELIBERATELY ABSENT (2026-07-25). It is geographically North\n// American, but it is an enormous and almost always data-less slab, and the NA point-map\n// archetype fitExtent()s to this basemap's FULL extent \u2014 so including it stretched the fit\n// ~40 degrees further east (basemap lon max -12.2 with it, -52.6 without) and squeezed the\n// actual continent. This affects ONLY the basemap: WORLD_110M is untouched, so GRL remains\n// a perfectly good joinable region on the world choropleths, which is where a Greenland\n// data point belongs. Do not \"fix\" this by adding GRL back.\nexport const NA_ISO3 = new Set([\n \"USA\", \"CAN\", \"MEX\", // continental\n \"GTM\", \"BLZ\", \"SLV\", \"HND\", \"NIC\", \"CRI\", \"PAN\", // Central America\n \"CUB\", \"JAM\", \"HTI\", \"DOM\", \"BHS\", \"PRI\", \"TTO\", // Greater Antilles + Bahamas\n]);\n\n// NORTHERN CUTOFF (2026-07-25). Dropping Greenland reclaimed the eastern half of the\n// frame but barely moved the TOP edge \u2014 Canada's Ellesmere/Axel Heiberg islands already reach\n// ~83\u00B0N, so the map still spent its height on empty Arctic. 75\u00B0N keeps every populated region\n// (Alaska's north coast ~71\u00B0N, Canadian mainland ~72\u00B0N) and cuts the uninhabited island bulk.\n// Safe against geoNaturalEarth1 specifically: it is PSEUDOCYLINDRICAL, so parallels project to\n// straight horizontal lines and a constant-latitude cut renders as an exactly straight edge \u2014\n// no densification needed along the seam.\nexport const NA_LAT_MAX = 75;\n\n// Sutherland\u2013Hodgman against the single half-plane lat <= latMax. Exact in lon/lat space\n// (the boundary is a parallel, i.e. a straight line there), so the only approximation is the\n// projection's own, which for this projection family is none along a parallel.\nfunction clipRingToLat(ring: number[][], latMax: number): number[][] {\n const out: number[][] = [];\n const n = ring.length;\n for (let i = 0; i < n; i++) {\n const cur = ring[i];\n const prev = ring[(i + n - 1) % n];\n const curIn = cur[1] <= latMax;\n const prevIn = prev[1] <= latMax;\n if (curIn !== prevIn) {\n // Crossing: emit the point exactly on the parallel.\n const dy = cur[1] - prev[1];\n const t = dy === 0 ? 0 : (latMax - prev[1]) / dy;\n out.push([prev[0] + t * (cur[0] - prev[0]), latMax]);\n }\n if (curIn) out.push(cur);\n }\n if (out.length && (out[0][0] !== out[out.length - 1][0] || out[0][1] !== out[out.length - 1][1])) {\n out.push(out[0]); // keep the ring closed\n }\n return out;\n}\n\n// Returns the feature clipped to lat <= latMax, or null when nothing survives (a region\n// entirely above the cutoff simply leaves the basemap). Non-polygon geometry passes through\n// untouched \u2014 the NA basemap is polygons only, but this must not silently mangle anything else.\nexport function clipFeatureToLat(feature: any, latMax: number): any | null {\n const g = feature && feature.geometry;\n if (!g) return null;\n\n const clipPolygon = (rings: number[][][]): number[][][] | null => {\n const kept = rings\n .map(r => clipRingToLat(r, latMax))\n .filter(r => r.length >= 4); // a closed ring needs 3 distinct points + the repeat\n // If the OUTER ring is gone the whole polygon is gone, holes included.\n return kept.length && kept[0].length >= 4 ? kept : null;\n };\n\n if (g.type === \"Polygon\") {\n const c = clipPolygon(g.coordinates as number[][][]);\n return c ? { ...feature, geometry: { type: \"Polygon\", coordinates: c } } : null;\n }\n if (g.type === \"MultiPolygon\") {\n const polys = (g.coordinates as number[][][][])\n .map(clipPolygon)\n .filter((p): p is number[][][] => p !== null);\n return polys.length ? { ...feature, geometry: { type: \"MultiPolygon\", coordinates: polys } } : null;\n }\n return feature;\n}\n"],
5
- "mappings": ";;;AAYO,IAAM,UAAU,oBAAI,IAAI;AAAA,EAC3B;AAAA,EA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