@geolith/globe 0.2.0 → 0.2.1

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.
package/dist/index.d.ts CHANGED
@@ -355,6 +355,57 @@ export declare function districtOpacity(zoom: number): number;
355
355
  * @param dpr - The device pixel ratio the map draws at.
356
356
  */
357
357
  export declare function particleCount(width: number, dpr: number, reducedMotion: boolean): number;
358
+ /** The source layer the area tiles carry. */
359
+ export declare const AREA_SOURCE_LAYER = "areas";
360
+ /**
361
+ * A district feature's own id.
362
+ *
363
+ * The MVT feature id is a tile-local integer; the area's UUID is the `id`
364
+ * property. Reading the integer asks the API for "area=192", which is not an
365
+ * area at all.
366
+ */
367
+ export declare function areaIdOf(properties: Readonly<Record<string, unknown>> | null | undefined): string | null;
368
+ /** The two layers a district source needs: a fill that fades in, and its line. */
369
+ interface DistrictLayerIds {
370
+ readonly sourceId: string;
371
+ readonly fill: string;
372
+ readonly line: string;
373
+ }
374
+ /**
375
+ * Adds a country's area source and its two layers, once per style. The fill
376
+ * fades in on the same ramp the field fades out on; the line keeps a coastline
377
+ * readable over the weather.
378
+ */
379
+ export declare function addDistrictLayers(map: Map, country: string, url: string): DistrictLayerIds;
380
+ /** Reports a district click by the area's own UUID, and the pointer shape. */
381
+ export declare function bindDistrictClicks(map: Map, fill: string, onSelect: (areaId: string) => void): void;
382
+ /**
383
+ * Rain as a field is mostly dry: the ramp's lowest stop is near-white, so a dry
384
+ * cell would paint the planet white. Cells under `minValue` (millimetres) are
385
+ * set to the no-data byte, so rain shows where rain is and nothing elsewhere.
386
+ *
387
+ * Only a rain grid is masked: a temperature cell is never "dry", and a wind
388
+ * component of zero is calm air, not an absence.
389
+ */
390
+ export declare function maskDryRain(frames: readonly Grid[], minValue: number): readonly Grid[];
391
+ /**
392
+ * How much of the particle budget the field may carry.
393
+ *
394
+ * Measured on this Mac (Chromium, SwiftShader, 1440×900, globe at z1.5, the
395
+ * field hidden so only the wind shows): the share of canvas pixels carrying a
396
+ * stroke is 1.1 % at 200 particles, 8.2 % at 4 200, 8.9 % at 8 000, 9.3 % at
397
+ * 14 700 and 9.9 % at 42 000. The curve is flat above ~4 000: 42 000 buys
398
+ * 1.7 points of coverage for ten times the work. `0.15` spends 6 300 at a
399
+ * desktop width and ~1 100 on a phone, just above the knee; the console's own
400
+ * report (a full budget became a white sheet on a phone) is the same finding
401
+ * from the other side. A host that wants more can pass its own count.
402
+ */
403
+ export declare const PARTICLE_DENSITY = 0.15;
404
+ /**
405
+ * Particles for a viewport: the handover budget scaled by the measured density,
406
+ * and none at all for a visitor who prefers reduced motion.
407
+ */
408
+ export declare function particleDensity(width: number, dpr: number, reducedMotion: boolean): number;
358
409
  /**
359
410
  * The field ramps. They are data ramps, not brand colours: a shader needs plain
360
411
  * RGB stops, and these are perceptually spaced so a 1 mm cell never looks like a
@@ -372,4 +423,4 @@ export declare const FIELD_PALETTES: Readonly<Record<'rain' | 'temperature' | 'w
372
423
  * fields the temperature ramp, both wind components the wind ramp.
373
424
  */
374
425
  export declare function paletteFor(field: string): readonly string[];
375
- export { type DistrictLayer, type DistrictSource, type Explored, type FieldIndexDto, _default as GlobeCanvas, type GlobeCanvasProps, type GlobeDataSource, type GlobeDistricts, type GlobeDistrictsInput, type GlobeField, type GlobeFields, type GlobeFieldsInput, type GlobeHover, type GlobeLayer, _default$1 as GlobeLock, type GlobeLockProps, type GlobeLockedClick, type GlobeMap, type GlobeModel, type GlobeParticles, type GlobeParticlesInput, _default$2 as GlobeReadout, type GlobeReadoutProps, type GlobeSelect, type GlobeSelection, _default$3 as GlobeSkeleton, type GlobeState, type GlobeStatus, _default$4 as GlobeTimeSlider, type GlobeTimeSliderProps, type OpeningCamera, type UseGlobeMapInput, type WindPair };
426
+ export { type DistrictLayer, type DistrictLayerIds, type DistrictSource, type Explored, type FieldIndexDto, _default as GlobeCanvas, type GlobeCanvasProps, type GlobeDataSource, type GlobeDistricts, type GlobeDistrictsInput, type GlobeField, type GlobeFields, type GlobeFieldsInput, type GlobeHover, type GlobeLayer, _default$1 as GlobeLock, type GlobeLockProps, type GlobeLockedClick, type GlobeMap, type GlobeModel, type GlobeParticles, type GlobeParticlesInput, _default$2 as GlobeReadout, type GlobeReadoutProps, type GlobeSelect, type GlobeSelection, _default$3 as GlobeSkeleton, type GlobeState, type GlobeStatus, _default$4 as GlobeTimeSlider, type GlobeTimeSliderProps, type OpeningCamera, type UseGlobeMapInput, type WindPair };
package/dist/index.js CHANGED
@@ -880,6 +880,6 @@ function useGlobeDistricts(input) {
880
880
  };
881
881
  return { layerFor };
882
882
  }
883
- export { DISTRICT_FADE, FIELD_FADE, FIELD_PALETTES, _sfc_main as GlobeCanvas, _sfc_main$1 as GlobeLock, _sfc_main$2 as GlobeReadout, _sfc_main$3 as GlobeSkeleton, _sfc_main$4 as GlobeTimeSlider, OPEN_PITCH, OPEN_ZOOM, PARTICLE_CAP, RAIN_RAMP, ROTATE_DEGREES_PER_SECOND, TEMPERATURE_RAMP, WIND_RAMP, WORLD_CENTRE, districtOpacity, fieldOpacity, openingCamera, paletteFor, particleCount, shouldRotate, useGlobeDistricts, useGlobeFields, useGlobeMap, useGlobeParticles, useGlobeState };
883
+ export { AREA_SOURCE_LAYER, DISTRICT_FADE, FIELD_FADE, FIELD_PALETTES, _sfc_main as GlobeCanvas, _sfc_main$1 as GlobeLock, _sfc_main$2 as GlobeReadout, _sfc_main$3 as GlobeSkeleton, _sfc_main$4 as GlobeTimeSlider, OPEN_PITCH, OPEN_ZOOM, PARTICLE_CAP, PARTICLE_DENSITY, RAIN_RAMP, ROTATE_DEGREES_PER_SECOND, TEMPERATURE_RAMP, WIND_RAMP, WORLD_CENTRE, addDistrictLayers, areaIdOf, bindDistrictClicks, districtOpacity, fieldOpacity, maskDryRain, openingCamera, paletteFor, particleCount, particleDensity, shouldRotate, useGlobeDistricts, useGlobeFields, useGlobeMap, useGlobeParticles, useGlobeState };
884
884
 
885
885
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geolith/globe",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "private": false,
5
5
  "description": "One MapLibre globe component: weather fields, wind particles and districts",
6
6
  "keywords": [