@nika-js/onlymap 0.5.1 → 0.5.2

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.
@@ -19,7 +19,7 @@ async function v(N = {}) {
19
19
  if (n) {
20
20
  const { createRequire: I } = await import(
21
21
  /*webpackIgnore:true*/
22
- "./lerc-C-D0ZLmp.js"
22
+ "./lerc-C_VBg2kh.js"
23
23
  ).then((g) => g._);
24
24
  var O = I(import.meta.url);
25
25
  }
@@ -1,4 +1,4 @@
1
- import { C as ny, L as sy, M as oy, m as ay, c as ka, z as oc, a as Sd, G as sm, V as ly, W as cy, b as uy, g as hy, d as Vu, f as Ed, e as dy, l as py, u as fy, D as Qf, h as my } from "./index-ppCRU8Eb.js";
1
+ import { C as ny, L as sy, M as oy, m as ay, c as ka, z as oc, a as Sd, G as sm, V as ly, W as cy, b as uy, g as hy, d as Vu, f as Ed, e as dy, l as py, u as fy, D as Qf, h as my } from "./index-ytnYzWRW.js";
2
2
  const Cd = Math.PI / 180, gy = 180 / Math.PI;
3
3
  function em(Pe, Q = 0) {
4
4
  const me = Math.min(180, Pe) * Cd;
@@ -1,5 +1,5 @@
1
- import { i as E, j as S, k as R, n as N, o as h, p as w, q as O, s as W, r as x, t as I, v as B, w as _, x as P, y as k, A as $, B as z, E as v, F, H as C, I as U, J as p, K as M } from "./index-ppCRU8Eb.js";
2
- import { N as $e, R as ze, _ as ve, O as Ce, P as Ue, Q as Me, S as je, T as De, U as Je, X as qe, Y as He, Z as Ve, $ as Ge, a0 as Ke, a1 as Qe, a2 as Xe, a3 as Ye, a4 as Ze, a5 as et, a6 as tt, a7 as nt, a8 as rt, a9 as at, aa as st, ab as ot } from "./index-ppCRU8Eb.js";
1
+ import { i as E, j as S, k as R, n as N, o as h, p as w, q as O, s as W, r as x, t as I, v as B, w as _, x as P, y as k, A as $, B as z, E as v, F, H as C, I as U, J as p, K as M } from "./index-ytnYzWRW.js";
2
+ import { N as $e, R as ze, _ as ve, O as Ce, P as Ue, Q as Me, S as je, T as De, U as Je, X as qe, Y as He, Z as Ve, $ as Ge, a0 as Ke, a1 as Qe, a2 as Xe, a3 as Ye, a4 as Ze, a5 as et, a6 as tt, a7 as nt, a8 as rt, a9 as at, aa as st, ab as ot } from "./index-ytnYzWRW.js";
3
3
  import { g as j, i as D } from "./table-accessors-CYWTzpQI.js";
4
4
  async function J(t, e, n = {}, r = {}) {
5
5
  const a = E(t), s = S.getWorkerFarm(n), { source: o } = n, c = { name: a, source: o };
@@ -1,4 +1,4 @@
1
- import { ai as Bt, av as Xt, aw as Yt, ax as Us } from "./index-ppCRU8Eb.js";
1
+ import { ai as Bt, av as Xt, aw as Yt, ax as Us } from "./index-ytnYzWRW.js";
2
2
  import { w as gs, t as Hs, f as Ws, m as Qs } from "./mgrs-BY9bIvp4.js";
3
3
  import { c as Xs } from "./convert-arrow-schema-DrAihRf9.js";
4
4
  import { y as Ys, A as bt, a as Ks, z as Vs, R as Zs } from "./recordbatch-Bpc0uxFn.js";
@@ -1,4 +1,4 @@
1
- import { ac as _t, ad as Ct } from "./index-ppCRU8Eb.js";
1
+ import { ac as _t, ad as Ct } from "./index-ytnYzWRW.js";
2
2
  function Yt(e, r, t = 2, i, o = "xy") {
3
3
  const s = r && r.length, l = s ? r[0] * t : e.length;
4
4
  let c = Ut(e, 0, l, t, !0, i && i[0], o);
@@ -1,4 +1,4 @@
1
- import { ae as Be, af as le, ag as ce, ah as De, ai as Oe, aj as ke } from "./index-ppCRU8Eb.js";
1
+ import { ae as Be, af as le, ag as ce, ah as De, ai as Oe, aj as ke } from "./index-ytnYzWRW.js";
2
2
  import { y as ve, a as he, z as G, R as J, A as ue, C as Fe, F as je, n as xe, S as Ie, E as Ne } from "./recordbatch-Bpc0uxFn.js";
3
3
  import { g as V, a as fe, b as Le, c as Ue, d as Me, e as qe, m as Ve } from "./table-accessors-CYWTzpQI.js";
4
4
  import { c as $e } from "./convert-arrow-schema-DrAihRf9.js";
@@ -66396,7 +66396,7 @@ Xs({
66396
66396
  });
66397
66397
  Xs({
66398
66398
  type: "COGLayer",
66399
- loadClass: () => import("./raster-D43jYSib.js").then((t) => t.r).then((t) => t.OmCOGLayer),
66399
+ loadClass: () => import("./raster-Unx9530f.js").then((t) => t.r).then((t) => t.OmCOGLayer),
66400
66400
  props: [
66401
66401
  { attr: "src", kind: "scalar", deckProp: "geotiff", type: "string", required: !0 },
66402
66402
  { attr: "min", kind: "scalar", deckProp: "rescaleMin", type: "number" },
@@ -66581,7 +66581,7 @@ class gN {
66581
66581
  `[onlymapjs] basemap="${e}" (Mapbox GL) is not implemented yet in this version — falling back to standalone (no basemap). Use a maplibre-* basemap instead (no token required).`
66582
66582
  );
66583
66583
  else {
66584
- this.mode = "basemap", this.basemapAttr = e, import("./basemap-7GQL0KSL.js").then(({ MapLibreBasemapAdapter: s }) => {
66584
+ this.mode = "basemap", this.basemapAttr = e, import("./basemap-DF_rK3Aa.js").then(({ MapLibreBasemapAdapter: s }) => {
66585
66585
  this.destroyed || i !== this.rendererGeneration || (this.basemap = new s(
66586
66586
  this.parent,
66587
66587
  // this.basemapAttr, not the captured param: a style switch that
@@ -67089,7 +67089,7 @@ const Cpe = {
67089
67089
  }, Spe = {
67090
67090
  match: (t, e) => ["csv", "tsv"].includes(xu(t) ?? "") || /text\/(csv|tab-separated-values)/i.test(e ?? ""),
67091
67091
  parse: async (t) => {
67092
- const [e, i, r] = await Promise.all([t.text(), import("./index-ULFXRQAo.js"), import("./index-9W_UXlPB.js")]), n = await r.parse(e, i.CSVLoader, { csv: { shape: "object-row-table" } });
67092
+ const [e, i, r] = await Promise.all([t.text(), import("./index-DcFZsjQm.js"), import("./index-B87QAKKr.js")]), n = await r.parse(e, i.CSVLoader, { csv: { shape: "object-row-table" } });
67093
67093
  return Tpe(n.data) ?? n.data;
67094
67094
  }
67095
67095
  };
@@ -67111,7 +67111,7 @@ const Epe = {
67111
67111
  parse: async (t, e) => {
67112
67112
  t.body?.cancel().catch(() => {
67113
67113
  });
67114
- const [i, r] = await Promise.all([import("./index-9W_UXlPB.js"), import("./index-BKiYWYJz.js")]), n = t.url || e, s = /* @__PURE__ */ new Map(), o = (b) => {
67114
+ const [i, r] = await Promise.all([import("./index-B87QAKKr.js"), import("./index-BYW4X7IK.js")]), n = t.url || e, s = /* @__PURE__ */ new Map(), o = (b) => {
67115
67115
  const v = String(b);
67116
67116
  let w = s.get(v);
67117
67117
  return w || (w = _N(v), s.set(v, w)), w.then((S) => S.clone());
@@ -67124,7 +67124,7 @@ const Epe = {
67124
67124
  }, Rpe = {
67125
67125
  match: (t, e) => xu(t) === "kml" || /application\/vnd\.google-earth\.kml/i.test(e ?? ""),
67126
67126
  parse: async (t) => {
67127
- const [e, i, r] = await Promise.all([t.text(), import("./index-9W_UXlPB.js"), import("./index-7PZgoR0X.js")]);
67127
+ const [e, i, r] = await Promise.all([t.text(), import("./index-B87QAKKr.js"), import("./index-DWXl9Ykk.js")]);
67128
67128
  return X1(await i.parse(e, r.KMLLoader));
67129
67129
  }
67130
67130
  }, Mpe = {
@@ -75019,7 +75019,7 @@ function _n(t, e) {
75019
75019
  }
75020
75020
  Ct("undo", (t, e) => LA(e)?.undo());
75021
75021
  Ct("redo", (t, e) => LA(e)?.redo());
75022
- const O4 = "0.5.1", e_e = "https://om-api.nika.eco/v1/t", nu = { endpoint: e_e };
75022
+ const O4 = "0.5.2", e_e = "https://om-api.nika.eco/v1/t", nu = { endpoint: e_e };
75023
75023
  function t_e(t) {
75024
75024
  for (const e of Object.keys(t))
75025
75025
  nu[e] = t[e];
@@ -78335,7 +78335,7 @@ function j2e() {
78335
78335
  }), go = null, Py = void 0, NA.clear());
78336
78336
  }
78337
78337
  async function $2e() {
78338
- return import("./raster-D43jYSib.js").then((t) => t.r);
78338
+ return import("./raster-Unx9530f.js").then((t) => t.r);
78339
78339
  }
78340
78340
  const wve = {
78341
78341
  registerLayer: Xs,
@@ -1,4 +1,4 @@
1
- import { C as a, D as s } from "./raster-D43jYSib.js";
1
+ import { C as a, D as s } from "./raster-Unx9530f.js";
2
2
  const D = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3
3
  __proto__: null
4
4
  }, Symbol.toStringTag, { value: "Module" }));
@@ -8,7 +8,7 @@ var t;
8
8
  })(t || (t = {}));
9
9
  let l = !1;
10
10
  async function d() {
11
- const e = await import("./LercDecode.es-BNF7PeWz.js");
11
+ const e = await import("./LercDecode.es-ReXBgmrK.js");
12
12
  return l || (await e.load(), l = !0), e;
13
13
  }
14
14
  async function i(e, r) {
@@ -87399,7 +87399,7 @@ function lh(t, e) {
87399
87399
  }
87400
87400
  gn("undo", (t, e) => iB(e)?.undo());
87401
87401
  gn("redo", (t, e) => iB(e)?.redo());
87402
- const Bse = "0.5.1", oYe = "https://om-api.nika.eco/v1/t", SC = { endpoint: oYe };
87402
+ const Bse = "0.5.2", oYe = "https://om-api.nika.eco/v1/t", SC = { endpoint: oYe };
87403
87403
  function aYe(t) {
87404
87404
  for (const e of Object.keys(t))
87405
87405
  SC[e] = t[e];
package/dist/onlymapjs.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ay as e, az as r, aA as o, aB as t, aC as l, aD as b, an as i, aE as n, aF as S, aG as L, aH as T, aI as E, aJ as g, aK as y, aL as A, aM as d, aN as m, aO as p, aP as c, aQ as I, aR as _, aS as D, aT as u, am as O, aU as M, au as f, aV as F, W as C, aW as N, aX as P, aY as B, aZ as R, a_ as h, a$ as x, b0 as G, b1 as W, b2 as v, b3 as w, b4 as H, b5 as U, b6 as Y, b7 as X, b8 as k, b9 as z, ba as J, bb as K, bc as V, bd as j, be as q, bf as Q, bg as Z, bh as $, bi as aa, bj as sa, bk as ea, bl as ra, bm as oa, bn as ta, bo as la, bp as ba, bq as ia, br as na, bs as Sa, bt as La, bu as Ta, bv as Ea, bw as ga, bx as ya, by as Aa, bz as da, bA as ma, bB as pa, bC as ca, bD as Ia, bE as _a, bF as Da, bG as ua, bH as Oa, bI as Ma } from "./index-ppCRU8Eb.js";
1
+ import { ay as e, az as r, aA as o, aB as t, aC as l, aD as b, an as i, aE as n, aF as S, aG as L, aH as T, aI as E, aJ as g, aK as y, aL as A, aM as d, aN as m, aO as p, aP as c, aQ as I, aR as _, aS as D, aT as u, am as O, aU as M, au as f, aV as F, W as C, aW as N, aX as P, aY as B, aZ as R, a_ as h, a$ as x, b0 as G, b1 as W, b2 as v, b3 as w, b4 as H, b5 as U, b6 as Y, b7 as X, b8 as k, b9 as z, ba as J, bb as K, bc as V, bd as j, be as q, bf as Q, bg as Z, bh as $, bi as aa, bj as sa, bk as ea, bl as ra, bm as oa, bn as ta, bo as la, bp as ba, bq as ia, br as na, bs as Sa, bt as La, bu as Ta, bv as Ea, bw as ga, bx as ya, by as Aa, bz as da, bA as ma, bB as pa, bC as ca, bD as Ia, bE as _a, bF as Da, bG as ua, bH as Oa, bI as Ma } from "./index-ytnYzWRW.js";
2
2
  export {
3
3
  e as ALL_POSITION_VALUES,
4
4
  r as AUDIT_EXEMPTIONS,
@@ -1,5 +1,5 @@
1
1
  import Ae from "./index-CW1n5LdO.js";
2
- import { ak as Mt, al as Rt, am as tt, an as nt, ao as zt, b as Ft, ap as Dt, l as Ee, aq as Nt, d as Ut, ar as Bt, as as Gt, at as Kt, au as rt } from "./index-ppCRU8Eb.js";
2
+ import { ak as Mt, al as Rt, am as tt, an as nt, ao as zt, b as Ft, ap as Dt, l as Ee, aq as Nt, d as Ut, ar as Bt, as as Gt, at as Kt, au as rt } from "./index-ytnYzWRW.js";
3
3
  import { w as _t } from "./mgrs-BY9bIvp4.js";
4
4
  function Xt(e, t, n) {
5
5
  const { projectedCorners: r } = t, { topLeft: o, topRight: i, bottomRight: s, bottomLeft: a } = r, l = n(o[0], o[1]), c = n(i[0], i[1]), u = n(s[0], s[1]), h = n(a[0], a[1]), p = [
@@ -2378,7 +2378,7 @@ D.set(P.Zstd, () => import("./zstd-jXobGRcq.js").then((e) => e.decode));
2378
2378
  D.set(P.Jpeg, () => Promise.resolve(Ce));
2379
2379
  D.set(P.Jpeg6, () => Promise.resolve(Ce));
2380
2380
  D.set(P.Webp, () => Promise.resolve(Ce));
2381
- D.set(P.Lerc, () => import("./lerc-C-D0ZLmp.js").then((e) => e.l).then((e) => e.decode));
2381
+ D.set(P.Lerc, () => import("./lerc-C_VBg2kh.js").then((e) => e.l).then((e) => e.decode));
2382
2382
  async function je(e, t, n) {
2383
2383
  const r = D.get(t);
2384
2384
  if (!r)
package/dist/version.d.ts CHANGED
@@ -5,4 +5,4 @@
5
5
  * the build rootDir, and a `define` would need repeating across vite/vitest/
6
6
  * vite-node configs.
7
7
  */
8
- export declare const LIBRARY_VERSION = "0.5.1";
8
+ export declare const LIBRARY_VERSION = "0.5.2";
package/llms.txt CHANGED
@@ -21,6 +21,7 @@ OnlyMapJS is NOT raw deck.gl and NOT generic HTML/JSX. The rules below are the d
21
21
  - `scale()` requires an explicit `domain=`: `get-fill-color="scale($depth, sequential, ['#ffffcc','#800026'], domain=[0,700])"`. A missing domain is a validation error.
22
22
  - `id` is required on every `<om-layer>`. `label` and `color` feed the legend; an explicit `get-fill-color` overrides `color` for rendering (both together is valid and common). The legend widget also reads `get-fill-color` itself: a `sequential`/`diverging` scale renders as a gradient ramp with domain labels, a `threshold` scale as discrete class ranges, and an equality ternary chain (`$f == 'a' ? '#c1' : '#c2'`) as a category palette — write those canonical shapes and the legend describes the symbology automatically.
23
23
  - Full JavaScript in accessor blocks needs the `js` attribute on the layer (`<om-layer js>` + `<script type="om/accessors">`). Without it, blocks are restricted to `export const name = d => <expression>` — no statements, no loops, no nested functions.
24
+ - To capture where the user CLICKS on the map (a measure tool, drop-a-pin, a custom rectangle/circle AOI, snap-to-feature), listen for the `om-map-point` event on `<om-map>`: `mapEl.addEventListener('om-map-point', e => { const { coordinate, kind } = e.detail; })` — `coordinate` is `[lng,lat]` (or `null` off-globe), `kind` is `"click"`|`"hover"`, and it fires on every click/hover including empty-map clicks. Do NOT reach for deck.gl internals (`mapEl.getMap()`, `.deckInstance`, `.deck.viewManager`) or unproject canvas pixels — those are not exposed on `<om-map>` and return nothing. The built-in `draw` widget handles polygon/line/point sketching; `om-map-point` is for tools it doesn't cover.
24
25
 
25
26
  ## Element vocabulary
26
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nika-js/onlymap",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Declarative deck.gl maps for HTML and React — interactive WebGL mapping with GeoJSON/CSV/Arrow data, MapLibre basemaps, widgets, popups, and live streams from a custom-element manifest or typed React components. TypeScript, no build step.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "publishConfig": {
@@ -23,7 +23,7 @@ Use OnlyMapJS as a declarative HTML map library. Write custom elements such as `
23
23
  </script>
24
24
  ```
25
25
 
26
- For no-build CDN pages, use the single-file standalone bundle from a raw-file CDN — `https://unpkg.com/@nika-js/onlymap@0.5.1` (the bare package URL serves `dist/onlymap.standalone.js`) — plus `<link rel="stylesheet" href="https://unpkg.com/@nika-js/onlymap@0.5.1/dist/onlymapjs.css">`. Never a rebundling CDN (esm.sh, skypack): re-bundling duplicates the deck.gl/luma.gl runtime and every layer fails shader compilation.
26
+ For no-build CDN pages, use the single-file standalone bundle from a raw-file CDN — `https://unpkg.com/@nika-js/onlymap@0.5.2` (the bare package URL serves `dist/onlymap.standalone.js`) — plus `<link rel="stylesheet" href="https://unpkg.com/@nika-js/onlymap@0.5.2/dist/onlymapjs.css">`. Never a rebundling CDN (esm.sh, skypack): re-bundling duplicates the deck.gl/luma.gl runtime and every layer fails shader compilation.
27
27
 
28
28
  ## React Projects
29
29
 
@@ -74,6 +74,7 @@ Load the smallest reference needed for the task:
74
74
  - Live entity updates -> `wss://` stream with `key` and optional `source` decoder.
75
75
  - REST snapshot that changes over time -> `refresh="5s"`.
76
76
  - User sketching -> `data="draw:sketch"` layer plus `<om-widget type="draw" target="sketch">`.
77
+ - Capture raw map clicks/hovers yourself (measure distance, drop a pin where the user clicks, a custom rectangle/circle AOI, snap-to-feature) -> listen for the **`om-map-point`** DOM event on `<om-map>`: `mapEl.addEventListener('om-map-point', e => { const { coordinate, kind } = e.detail; /* [lng,lat] or null; kind is "click"|"hover" */ })`. It fires on EVERY click/hover including empty-map clicks. NEVER read deck.gl internals (`getMap()`, `deckInstance`, `deck.viewManager`) or unproject canvas pixels by hand — those are not on `<om-map>` and will silently return nothing. The built-in `draw` widget covers polygon/line/point sketching; `om-map-point` is for tools it doesn't. (`MapController` twin: the `onMapPoint` option. See patterns.md.)
77
78
  - Page may travel as a file (shared, emailed, downloaded) or be embedded -> add an `<om-fallback>` child to `<om-map>`. Chat-app and email previews render HTML with JavaScript disabled (iOS QuickLook), so the map cannot boot there; the fallback is what recipients see instead. It is hidden automatically once the map boots. Good practice on every complete page — without one, the stylesheet shows a generic text-only banner.
78
79
 
79
80
  ## Output Expectations
@@ -192,6 +192,44 @@ Use `PopupLayer` instead of many `<om-overlay>` elements for labels/badges at sc
192
192
  autosave="onlymapjs-sketch"></om-widget>
193
193
  ```
194
194
 
195
+ ## Capture Raw Map Clicks (measure tool, drop-a-pin, custom AOI)
196
+
197
+ For anything the `draw` widget doesn't cover — a distance/area measurer, dropping
198
+ a pin at the clicked coordinate, a custom rectangle/circle AOI — read the
199
+ **`om-map-point`** event. It gives you the map coordinate of every click and
200
+ hover. Do NOT reach into deck.gl (`getMap()`, `deckInstance`, `deck.viewManager`)
201
+ or unproject canvas pixels — none of that is exposed on `<om-map>`.
202
+
203
+ ```html
204
+ <om-map center="[103.8, 1.35]" zoom="11" basemap="positron">
205
+ <!-- The pins the user drops, driven by a draw store you write into. -->
206
+ <om-layer id="pins" type="GeoJsonLayer" data="draw:measure"
207
+ get-fill-color="[239,68,68,220]" point-radius-min-pixels="5"
208
+ get-line-color="[239,68,68,220]" line-width-min-pixels="2"
209
+ stroked filled></om-layer>
210
+ </om-map>
211
+
212
+ <script type="module">
213
+ import "@nika-js/onlymap";
214
+ const map = document.querySelector("om-map");
215
+ const pts = [];
216
+
217
+ map.addEventListener("om-map-point", (e) => {
218
+ const { coordinate, kind } = e.detail; // [lng, lat] | null ; "click" | "hover"
219
+ if (!coordinate || kind !== "click") return;
220
+ pts.push(coordinate);
221
+ // ...compute distance (haversine), update your own panel, etc.
222
+ // Push geometry into the "measure" draw store so it renders as a layer:
223
+ // OmMap.getStore("data:pins") / a draw controller, or your own <om-layer> data.
224
+ });
225
+ </script>
226
+ ```
227
+
228
+ Notes: `coordinate` is `null` when the click lands off the globe; `kind` is
229
+ `"hover"` for the live pointer (use it for a rubber-band segment) and `"click"`
230
+ for a committed point. The programmatic twin is the `MapController` `onMapPoint`
231
+ option; test it headlessly with `h.mapPoint(coordinate, kind)`.
232
+
195
233
  ## Story/Tour
196
234
 
197
235
  ```html
@@ -16,8 +16,8 @@ Vite/npm project:
16
16
  Static CDN page (raw-file CDNs only — unpkg/jsDelivr; never esm.sh or another rebundling CDN, which duplicates the WebGL runtime and breaks layer shaders):
17
17
 
18
18
  ```html
19
- <link rel="stylesheet" href="https://unpkg.com/@nika-js/onlymap@0.5.1/dist/onlymapjs.css">
20
- <script type="module" src="https://unpkg.com/@nika-js/onlymap@0.5.1"></script>
19
+ <link rel="stylesheet" href="https://unpkg.com/@nika-js/onlymap@0.5.2/dist/onlymapjs.css">
20
+ <script type="module" src="https://unpkg.com/@nika-js/onlymap@0.5.2"></script>
21
21
  ```
22
22
 
23
23
  Always include `onlymapjs.css` — it carries the MapLibre basemap styles and the no-JS fallback rules (`<om-fallback>` / default banner). For the fallback to work in script-disabled previews it must load without JavaScript: a real `<link rel="stylesheet">` or inlined `<style>` on no-build pages (a bundler-emitted stylesheet is fine in npm projects).