@nika-js/onlymap 0.11.4 → 0.11.5

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +2 -2
  3. package/dist/{basemap-UE11uf6w.js → basemap-CnjAGLZo.js} +14 -2
  4. package/dist/basemap.d.ts +9 -0
  5. package/dist/elements/om-map.d.ts +31 -1
  6. package/dist/elements/om-overlay.d.ts +0 -14
  7. package/dist/{geoparquet-D7ZKVPDh.js → geoparquet-CHtunmD2.js} +1 -1
  8. package/dist/{globe-view-B7Yn2BbK.js → globe-view-CgQa-07O.js} +1 -1
  9. package/dist/{hillshade-tQaqlPhn.js → hillshade-BgXgVdjg.js} +1 -1
  10. package/dist/{index-DzxpYTfi.js → index-BTTCf4nb.js} +5488 -5305
  11. package/dist/{index-DIoKYXlh.js → index-BTsRqhXB.js} +1 -1
  12. package/dist/{index-DPV7mwIc.js → index-ClLMdW3k.js} +2 -2
  13. package/dist/{index-C09RUa1s.js → index-D4x57ql0.js} +1 -1
  14. package/dist/{index-N5acD4ii.js → index-DjtM8ecq.js} +1 -1
  15. package/dist/{index-CWtaL88w.js → index-DoNtp5Nh.js} +3 -3
  16. package/dist/{index-CFWt9qS0.js → index-NCXX8bDe.js} +1 -1
  17. package/dist/{index-B_L_7lV0.js → index-aOe9cOFs.js} +1 -1
  18. package/dist/{index-C8a3EKM8.js → index-k7l7kqTk.js} +3 -3
  19. package/dist/index.d.ts +1 -1
  20. package/dist/{lerc-BDcZeX07.js → lerc-BtdiMDO7.js} +1 -1
  21. package/dist/onlymap.standalone.js +13650 -13455
  22. package/dist/onlymapjs.js +1 -1
  23. package/dist/{post-process-effect-C1iDE90L.js → post-process-effect-BWrq5IR8.js} +1 -1
  24. package/dist/programmatic.d.ts +10 -1
  25. package/dist/{raster-D4nwLneR.js → raster-iGwPuAgo.js} +3 -3
  26. package/dist/{raster-pipeline-DX-rZjRG.js → raster-pipeline-Dxs9TpD6.js} +1 -1
  27. package/dist/react.js +128 -125
  28. package/dist/runtime-core.d.ts +50 -1
  29. package/dist/selection.d.ts +31 -0
  30. package/dist/{text-on-path-onhHN4AZ.js → text-on-path-C8h_3Snf.js} +1 -1
  31. package/dist/version.d.ts +1 -1
  32. package/dist/viewport-cull.d.ts +15 -0
  33. package/dist/{zarr-CBGaInwF.js → zarr-C1zXD9VD.js} +2 -2
  34. package/docs/cartograph.md +2 -2
  35. package/llms.txt +2 -1
  36. package/package.json +1 -1
  37. package/skills/onlymapjs/SKILL.md +3 -2
  38. package/skills/onlymapjs/references/syntax.md +4 -2
package/CHANGELOG.md CHANGED
@@ -8,6 +8,17 @@ Note: npm collapsed a few closely-spaced releases — the GPX/FlatGeobuf (0.5.4)
8
8
  and GeoParquet (0.5.5) work shipped to npm together as **0.5.6**, so npm's
9
9
  version list jumps 0.5.3 → 0.5.6. Each logical version is listed here regardless.
10
10
 
11
+ ## 0.11.5 — 2026-10-02
12
+
13
+ ### Added
14
+ - **Ask the map what is under the pointer, without editing it.** `mapEl.pickAt([x, y])` returns the feature at a screen point and `mapEl.pickRect({x, y, width, height})` every feature inside a box, so a tool can build box-select or tell an assistant which feature you mean. They don't change the selection or set off your behaviours and tooltips.
15
+ - **A picker can reach every layer for as long as it is open.** Set `mapEl.pickMode = "all"` while your tool is active, and layers you never made `pickable` answer too. Nothing is written into your map, so there is nothing to undo or save.
16
+ - **`mapEl.unproject([x, y])`** turns a screen point into a longitude and latitude, and `mapEl.project([lng, lat])` goes the other way. All of these are on `MapController` as well.
17
+
18
+ ### Fixed
19
+ - **Popups now appear on maps in a projected coordinate system (`crs=`), including projected frames on a print sheet.** Every `<om-overlay>`, including click popups, was hidden there because the map's flat camera was mistaken for one looking away from the point.
20
+ - **Clicking a feature on a projected map reports its longitude and latitude.** The click used to report the map's internal metres, so `zoom-to-feature` and anything else reading the clicked position went to the wrong place.
21
+
11
22
  ## 0.11.4 — 2026-10-01
12
23
 
13
24
  ### Fixed
package/README.md CHANGED
@@ -404,8 +404,8 @@ Two things it gets right that hand-rolled hillshades usually don't. **Tile edges
404
404
 
405
405
  - **`OmMap.*`** — `validate`, `snapshotIR`, `snapshotDescriptorIR`, `resolveImageOverlay`, `registerLayer`, `registerWidget`, `registerAction`, `registerSource`, `registerFormat`, `registerBasemap`, `configureBasemap`, `configureData`, `configureTelemetry`, `configureLicense`, `getLayerSchema`
406
406
  - **`@nika-js/onlymap/deck`** — the bundled deck.gl classes (`CompositeLayer`, `TileLayer`, …) for building custom layer types: shims must extend the same class hierarchy the core renders with, not a second installed deck.gl copy. Recipe: [docs/custom-layers.md](docs/custom-layers.md)
407
- - **On a `<om-map>` element** — `ready` (promise), `flyTo(coords, zoom?)`, `setLayerVisible(id, bool)`, `getLayers()`, `emit(action, payload)`, `snapshot(opts?)` (canvas-only PNG of basemap + layers at device pixels — DOM widgets/overlays and provider attribution are NOT captured, so exports must render credits themselves; `{as: "blob"}` for files, default dataURL); `attributions()` (the basemap's providers as plain text — what an export must credit; the bubbling `om-attributions-changed` event fires when a style loads); the `om-view-changed` event fires once the camera settles (debounced; `detail` = `{longitude, latitude, zoom, pitch, bearing, origin}`, where `origin` is `"user"` for gesture-driven bursts vs `"programmatic"` for API/story moves — the echo-suppression signal for state sync) — the camera-persistence hook; the `om-map-point` event (`detail = {coordinate: [lng,lat]|null, kind: "click"|"hover"}`) fires on every click/hover with the map coordinate, including empty-map clicks picks discard — the hook for custom capture tools the built-in draw widget doesn't cover; the `om-tileset-load` event (`detail = {layerId, tileset}`) surfaces a `Tile3DLayer`'s live deck `Tileset3D` for tools that need the real tileset (e.g. region export), not the IR; `document.querySelector("om-map")` is fully typed
408
- - **`MapController`** — the framework-grade programmatic front-end (typed `LayerDescriptor`s → the same reconcile core, no DOM manifest): `setLayers`, `watch`, `emit`, camera methods, `injectPick`, `ready`, `snapshot`, `setEffects` (deck `Effect` instances, 1:1 — takes precedence over the document's `<om-effect>` chain while set; `null` hands the chain back), `suspend`/`resume`, an `onViewChange(view, origin)` option (the `om-view-changed` twin), plus `onMapPoint` / `onTilesetLoad` options (the `om-map-point` / `om-tileset-load` twins). Active descriptors own reference-counted fetch/poll/socket handles: layer removal, transport-option change, suspend, and destroy release them. Accessor props normally take functions; schema-declared accessors also accept restricted expression strings such as `getPosition: "[$lon, $lat]"`, which makes the descriptor JSON-safe for native/cross-process bridges. `snapshotDescriptorIR(descriptors)` resolves that lane without fetching URL data. The React adapter rides the function form; vanilla/native hosts may use either
407
+ - **On a `<om-map>` element** — `ready` (promise), `flyTo(coords, zoom?)`, `setLayerVisible(id, bool)`, `getLayers()`, `emit(action, payload)`, `snapshot(opts?)` (canvas-only PNG of basemap + layers at device pixels — DOM widgets/overlays and provider attribution are NOT captured, so exports must render credits themselves; `{as: "blob"}` for files, default dataURL); `attributions()` (the basemap's providers as plain text — what an export must credit; the bubbling `om-attributions-changed` event fires when a style loads); the `om-view-changed` event fires once the camera settles (debounced; `detail` = `{longitude, latitude, zoom, pitch, bearing, origin}`, where `origin` is `"user"` for gesture-driven bursts vs `"programmatic"` for API/story moves — the echo-suppression signal for state sync) — the camera-persistence hook; the `om-map-point` event (`detail = {coordinate: [lng,lat]|null, kind: "click"|"hover"}`) fires on every click/hover with the map coordinate, including empty-map clicks picks discard — the hook for custom capture tools the built-in draw widget doesn't cover; the `om-tileset-load` event (`detail = {layerId, tileset}`) surfaces a `Tile3DLayer`'s live deck `Tileset3D` for tools that need the real tileset (e.g. region export), not the IR; `pickAt([x, y])` / `pickRect({x, y, width, height})` ask what is under a pixel or inside a screen rectangle and `unproject([x, y])` / `project([lng, lat])` convert between pixels and coordinates — queries that leave the selection, `om-map-point` and behaviors alone, with a `pickMode` property (`"authored"` | `"all"`) that lets a picker tool reach layers the author did not make `pickable` without editing the document; `document.querySelector("om-map")` is fully typed
408
+ - **`MapController`** — the framework-grade programmatic front-end (typed `LayerDescriptor`s → the same reconcile core, no DOM manifest): `setLayers`, `watch`, `emit`, camera methods, `injectPick`, `ready`, `snapshot`, `setEffects` (deck `Effect` instances, 1:1 — takes precedence over the document's `<om-effect>` chain while set; `null` hands the chain back), `suspend`/`resume`, an `onViewChange(view, origin)` option (the `om-view-changed` twin), plus `onMapPoint` / `onTilesetLoad` options (the `om-map-point` / `om-tileset-load` twins). Active descriptors own reference-counted fetch/poll/socket handles: layer removal, transport-option change, suspend, and destroy release them. Accessor props normally take functions; schema-declared accessors also accept restricted expression strings such as `getPosition: "[$lon, $lat]"`, which makes the descriptor JSON-safe for native/cross-process bridges. `snapshotDescriptorIR(descriptors)` resolves that lane without fetching URL data. The same `pickAt`/`pickRect`/`unproject`/`pickMode` the element has are on the controller. The React adapter rides the function form; vanilla/native hosts may use either
409
409
  - **`getStore(token)`** — the external-store contract: per-token `{subscribe, getSnapshot}` stores (`viewport`/`selection`/`layers`/`data:<id>`) with cached immutable plain-data snapshots and `origin` tagging — directly consumable by `useSyncExternalStore` (the React adapter's own hooks ride it), MobX autoruns, Redux listeners, Zustand mirrors. ~20-line integration-tested recipes for Redux Toolkit, MobX/mobx-keystone, Zustand, and Jotai: [docs/external-stores.md](docs/external-stores.md)
410
410
  - **Testing** — `mountForTest`, and imports are SSR-safe (importing in Node/jsdom never touches browser globals)
411
411
 
@@ -1,5 +1,5 @@
1
- import { aJ as Y_, N as Bu, H as Pd, k as K_, aK as J_, aL as Q_, D as Xf, Z as ey } from "./index-DzxpYTfi.js";
2
- import { a as ty } from "./globe-view-B7Yn2BbK.js";
1
+ import { aJ as Y_, N as Bu, H as Pd, k as K_, aK as J_, aL as Q_, D as Xf, Z as ey } from "./index-BTTCf4nb.js";
2
+ import { a as ty } from "./globe-view-CgQa-07O.js";
3
3
  const iy = {
4
4
  copy: "©",
5
5
  reg: "®",
@@ -25100,6 +25100,14 @@ class xy {
25100
25100
  getOverlayDeckInternal() {
25101
25101
  return this.overlay._deck;
25102
25102
  }
25103
+ /**
25104
+ * Programmatic picking (docs/design/pick-api.md) — the overlay forwards
25105
+ * deck's own pick methods, but asserts its internal Deck exists, so hand it
25106
+ * out only once that Deck does.
25107
+ */
25108
+ getPickerInternal() {
25109
+ return this.getOverlayDeckInternal() ? this.overlay : void 0;
25110
+ }
25103
25111
  /** The MapLibre canvas — the pick-cursor affordance writes its cursor style (issue #33). */
25104
25112
  getCanvasElement() {
25105
25113
  return this.map.getCanvas();
@@ -25292,6 +25300,10 @@ class xy {
25292
25300
  const Ee = Q.project([ge[0], ge[1]]);
25293
25301
  return [Ee.x, Ee.y];
25294
25302
  },
25303
+ unproject: (ge) => {
25304
+ const Ee = Q.unproject([ge[0], ge[1]]);
25305
+ return [Ee.lng, Ee.lat];
25306
+ },
25295
25307
  getBounds: () => {
25296
25308
  const ge = Q.getBounds();
25297
25309
  return [ge.getWest(), ge.getSouth(), ge.getEast(), ge.getNorth()];
package/dist/basemap.d.ts CHANGED
@@ -1,9 +1,12 @@
1
1
  import "maplibre-gl/dist/maplibre-gl.css";
2
+ import { MapboxOverlay } from "@deck.gl/mapbox";
2
3
  import type { DeckProps, Viewport } from "@deck.gl/core";
3
4
  import type { ResolvedBasemap } from "./basemap-registry";
4
5
  import type { ViewOrigin } from "./external-store";
5
6
  export interface ViewportLike {
6
7
  project(xyz: number[]): number[];
8
+ /** Screen pixel → `[lng, lat]` (programmatic picking, docs/design/pick-api.md). */
9
+ unproject(xy: number[]): number[];
7
10
  getBounds(): [number, number, number, number];
8
11
  width: number;
9
12
  height: number;
@@ -69,6 +72,12 @@ export declare class MapLibreBasemapAdapter {
69
72
  private markBusy;
70
73
  /** The overlay's internal Deck instance — the hover-pick gate wraps its pointermove handler (issue #31); same exact-pin `_deck` seam as getDeckLayers below. */
71
74
  getOverlayDeckInternal(): unknown;
75
+ /**
76
+ * Programmatic picking (docs/design/pick-api.md) — the overlay forwards
77
+ * deck's own pick methods, but asserts its internal Deck exists, so hand it
78
+ * out only once that Deck does.
79
+ */
80
+ getPickerInternal(): Pick<MapboxOverlay, "pickObject" | "pickMultipleObjects" | "pickObjects"> | undefined;
72
81
  /** The MapLibre canvas — the pick-cursor affordance writes its cursor style (issue #33). */
73
82
  getCanvasElement(): HTMLElement;
74
83
  /** The overlay deck's live layers — whenSettled's readiness gate (issue #37). */
@@ -8,7 +8,7 @@ import { type WidgetSlot } from "../widget-layout";
8
8
  import { type SnapshotOptions } from "../snapshot";
9
9
  import { type ValidationEntry } from "../validation";
10
10
  import type { LayerIR } from "../ir";
11
- import type { Selection } from "../selection";
11
+ import type { PickAtOptions, PickMode, PickRect, PickRectOptions, Selection } from "../selection";
12
12
  import type { MapViewport } from "../basemap";
13
13
  interface OverlayHost {
14
14
  updatePosition(viewport: MapViewport | undefined, selection: Selection | null, pickType?: "hover" | "click"): void;
@@ -387,6 +387,36 @@ export declare class OmMapElement extends HTMLElementBase {
387
387
  snapshot(opts?: SnapshotOptions): Promise<string | Blob>;
388
388
  /** terrain* attributes → IR, key-substituted like basemap presets; resolution problems log once per apply. */
389
389
  private resolveTerrainAttr;
390
+ private pickModeValue;
391
+ /**
392
+ * `"all"` makes every layer pickable while set — for a picker tool that has
393
+ * to answer for layers the author never made `pickable`. Every pick path
394
+ * sees it, hover and click and `pick-cursor` included, not only the query
395
+ * methods. A property, never an attribute: it is not serialised, never
396
+ * enters undo history, and a headless map ignores it. Restore `"authored"`
397
+ * when the tool disarms.
398
+ */
399
+ get pickMode(): PickMode;
400
+ set pickMode(mode: PickMode);
401
+ /**
402
+ * The object or feature under a screen pixel (CSS px from the map's
403
+ * top-left), or null. A QUERY: it does not change `ctx.selection`, fire
404
+ * `om-map-point`, run behaviors, or open a tooltip. Searches 4px around the
405
+ * point by default; layers that are not `pickable` answer only while
406
+ * `pickMode` is `"all"`. `coordinate` is lng/lat on every map.
407
+ */
408
+ pickAt(pixel: [number, number], options?: PickAtOptions): Selection | null;
409
+ /**
410
+ * Every object inside a screen rectangle, front to back, at most
411
+ * `maxObjects` (default 100). A query, like `pickAt`. Each result's
412
+ * `coordinate` is null — deck reports no per-object position for a
413
+ * rectangle — and raster layers are not sampled.
414
+ */
415
+ pickRect(rect: PickRect, options?: PickRectOptions): Selection[];
416
+ /** Screen pixel → `[lng, lat]` on the ground plane, or null before the map has a viewport. */
417
+ unproject(pixel: [number, number]): [number, number] | null;
418
+ /** `[lng, lat]` → screen pixel (CSS px from the map's top-left), or null before the map has a viewport. */
419
+ project(lngLat: [number, number]): [number, number] | null;
390
420
  /** Projects a lng/lat through the current viewport (harness pixel derivation) — undefined before the viewport resolves. */
391
421
  projectInternal(lngLat: [number, number]): [number, number] | undefined;
392
422
  /** Renderer finished async init — defer to the first reconcile if it hasn't run yet (see the field comment). */
@@ -1,17 +1,3 @@
1
- /**
2
- * <om-overlay> — sparse, rich geo-anchored HTML (spec: "Module Breakdown /
3
- * Overlay Renderer", "Overlay System — Three-Way Split"). Rendered in
4
- * shadow DOM for style isolation, same as <om-widget>. Inline-only by
5
- * design — no `type` resolution, no `registerOverlay` (see spec's own
6
- * rationale: a `<template>` shared across maps, or the future React
7
- * component, already serve reuse).
8
- *
9
- * Positioning is centrally rAF-batched by OmMapElement (one flush handles
10
- * every registered overlay's `viewport.project()` + DOM write per frame,
11
- * "coalescing multiple events per frame into one DOM pass") — this class
12
- * never schedules its own rAF, just exposes `updatePosition()` for the map
13
- * to call.
14
- */
15
1
  import { HTMLElementBase } from "../env";
16
2
  import type { MapViewport } from "../basemap";
17
3
  import type { Selection } from "../selection";
@@ -1,4 +1,4 @@
1
- import { a4 as p, a5 as d } from "./index-DzxpYTfi.js";
1
+ import { a4 as p, a5 as d } from "./index-BTTCf4nb.js";
2
2
  function g(t) {
3
3
  if (t == null) return !0;
4
4
  const e = t, n = e.id?.code;
@@ -1,4 +1,4 @@
1
- import { d as L, j as x, a6 as A, a7 as E, a8 as d, a9 as h, aa as u, ab as z, p as V, W as Z, G as D } from "./index-DzxpYTfi.js";
1
+ import { d as L, j as x, a6 as A, a7 as E, a8 as d, a9 as h, aa as u, ab as z, p as V, W as Z, G as D } from "./index-BTTCf4nb.js";
2
2
  const c = Math.PI / 180, G = 180 / Math.PI;
3
3
  function w(l, t = 0) {
4
4
  const a = Math.min(180, l) * c;
@@ -1,4 +1,4 @@
1
- import { al as P, am as T, an as N, ao as Z, c as B, ap as E, aq as C, ar as b, as as D, at as I, au as O } from "./index-DzxpYTfi.js";
1
+ import { al as P, am as T, an as N, ao as Z, c as B, ap as E, aq as C, ar as b, as as D, at as I, au as O } from "./index-BTTCf4nb.js";
2
2
  import { N as _, c as H } from "./hillshade-apron-Bem3DWyJ.js";
3
3
  import { p as $, h as j, m as A, a as U } from "./hillshade-shader-DI2uLSNU.js";
4
4
  function R(t, e, o) {