@nika-js/onlymap 0.2.3 → 0.3.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.
Files changed (62) hide show
  1. package/.vscode/onlymap.code-snippets +13 -0
  2. package/LICENSE.md +4 -0
  3. package/README.md +30 -7
  4. package/THIRD-PARTY-LICENSES.md +7874 -0
  5. package/dist/{Arrow.dom-7AXne1TU.js → Arrow.dom-BNjbQ9jb.js} +23 -23
  6. package/dist/LercDecode.es-CVmNpXBp.js +303 -0
  7. package/dist/assets/LercDecode.es-BJb2dZu5.js +305 -0
  8. package/dist/assets/__vite-browser-external-DDArsqdc.js +29 -0
  9. package/dist/assets/lerc-wasm.wasm +0 -0
  10. package/dist/assets/lzw-BY5a_5nb.js +83 -0
  11. package/dist/assets/worker-DtIrTJB7.js +305 -0
  12. package/dist/assets/zstd-QGAv3PMm.js +383 -0
  13. package/dist/{basemap-BdvB-SHy.js → basemap-BSb-g03Z.js} +5729 -5684
  14. package/dist/basemap-registry.d.ts +10 -0
  15. package/dist/basemap.d.ts +23 -0
  16. package/dist/color.d.ts +9 -0
  17. package/dist/{convert-arrow-schema-CvZ3cT5m.js → convert-arrow-schema-DrAihRf9.js} +31 -31
  18. package/dist/ctx.d.ts +3 -0
  19. package/dist/deck.d.ts +28 -0
  20. package/dist/deck.js +16 -0
  21. package/dist/elements/om-map.d.ts +29 -0
  22. package/dist/html-data.d.ts +2 -2
  23. package/dist/index-CIEkseeV.js +3108 -0
  24. package/dist/index-D67FynN5.js +594 -0
  25. package/dist/{index-CJOMgp8k.js → index-QSkZjzIL.js} +4 -4
  26. package/dist/index-WeMwLoaQ.js +1446 -0
  27. package/dist/{index-BxzDKZpu.js → index-lV5eG2Xt.js} +22439 -21347
  28. package/dist/index.d.ts +13 -0
  29. package/dist/ir-snapshot.d.ts +2 -0
  30. package/dist/ir.d.ts +10 -0
  31. package/dist/layer-registry.d.ts +15 -1
  32. package/dist/legend-spec.d.ts +66 -0
  33. package/dist/lerc-DJzRIT6z.js +30 -0
  34. package/dist/lerc-wasm.wasm +0 -0
  35. package/dist/lzw-BY5a_5nb.js +83 -0
  36. package/dist/mgrs-BY9bIvp4.js +799 -0
  37. package/dist/onlymapjs.css +1 -1
  38. package/dist/onlymapjs.js +55 -35
  39. package/dist/programmatic.d.ts +35 -0
  40. package/dist/raster-BKf1dx54.js +8843 -0
  41. package/dist/raster.d.ts +61 -0
  42. package/dist/react/om-layer.d.ts +2 -0
  43. package/dist/react.js +18 -16
  44. package/dist/{recordbatch-HRu0SMKp.js → recordbatch-Bpc0uxFn.js} +200 -200
  45. package/dist/runtime-core.d.ts +73 -1
  46. package/dist/scene-lighting.d.ts +83 -0
  47. package/dist/selection.d.ts +1 -1
  48. package/dist/snapshot.d.ts +14 -0
  49. package/dist/{table-accessors-DBjWgN0C.js → table-accessors-CYWTzpQI.js} +71 -76
  50. package/dist/terrain.d.ts +113 -0
  51. package/dist/version.d.ts +1 -1
  52. package/dist/zstd-jXobGRcq.js +14 -0
  53. package/docs/custom-layers.md +99 -0
  54. package/llms.txt +5 -5
  55. package/onlymapjs.html-data.json +163 -29
  56. package/package.json +35 -15
  57. package/skills/onlymapjs/SKILL.md +3 -1
  58. package/skills/onlymapjs/references/syntax.md +53 -3
  59. package/dist/index-BVQ0s1Zh.js +0 -1457
  60. package/dist/index-CvBHiOGD.js +0 -605
  61. package/dist/index-Vc8QfNEf.js +0 -3907
  62. package/dist/onlymapjs.umd.cjs +0 -8634
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Native COG/GeoTIFF raster layer (spec: "Raster / GeoTIFF — native COG
3
+ * layer"). A LAZY chunk — dynamically imported the first time a manifest
4
+ * uses `type="COGLayer"` (see layer-registry's `loadClass` seam), so the
5
+ * eager bundle stays raster-free.
6
+ *
7
+ * Built on `@developmentseed/deck.gl-geotiff` + `deck.gl-raster` (MIT),
8
+ * compiled INSIDE the library so their `@deck.gl/*` imports resolve to the
9
+ * bundled deck — the class-identity requirement that rules out consuming
10
+ * these packages from a consumer's own node_modules.
11
+ *
12
+ * Two render paths, chosen per instance:
13
+ * - UNSTYLED (no min/max/colormap/nodata authored): COGLayer's own inferred
14
+ * default pipeline — correct for plain 8-bit RGB/gray COGs, zero config.
15
+ * - STYLED: a Float32-aware getTileData/renderTile pair (ported from a
16
+ * production consumer): tile pixels upload as r32float / rgba32float
17
+ * textures, then FilterNoDataVal (raw values, BEFORE rescale) →
18
+ * LinearRescale (min/max → [0,1]) → Colormap (single-band only, sampled
19
+ * from the bundled sprite). Restretch/recolor = uniform updates on a new
20
+ * layer instance; the tile cache survives because `getTileData` is a
21
+ * module-level stable reference.
22
+ */
23
+ import type { Texture } from "@luma.gl/core";
24
+ import { COGLayer } from "@developmentseed/deck.gl-geotiff";
25
+ /** The styled path's per-tile payload (satisfies MinimalTileData + ours). */
26
+ type OmTileData = {
27
+ width: number;
28
+ height: number;
29
+ byteLength: number;
30
+ texture: Texture;
31
+ colormapTexture: Texture;
32
+ bandCount: number;
33
+ nodata: number | null;
34
+ };
35
+ export interface OmCOGLayerExtraProps {
36
+ /** Rescale window; both default to the 8-bit range when absent. */
37
+ rescaleMin?: number | null;
38
+ rescaleMax?: number | null;
39
+ /** Sprite colormap name (single-band sources only). Unknown names warn + fall back to gray. */
40
+ colormap?: string | null;
41
+ /** Overrides the source's own nodata sentinel. */
42
+ nodataOverride?: number | null;
43
+ }
44
+ type AnyProps = Record<string, unknown>;
45
+ declare const OmCOGLayer_base: new (...props: AnyProps[]) => InstanceType<typeof COGLayer>;
46
+ /**
47
+ * The manifest-facing class behind `<om-layer type="COGLayer">`. Styling
48
+ * attributes present → the Float32 pipeline above; none → the upstream
49
+ * inferred default pipeline (plain RGB COGs render correctly untouched).
50
+ */
51
+ export declare class OmCOGLayer extends OmCOGLayer_base {
52
+ static layerName: string;
53
+ static defaultProps: {
54
+ rescaleMin: null;
55
+ rescaleMax: null;
56
+ colormap: null;
57
+ nodataOverride: null;
58
+ };
59
+ constructor(props: AnyProps);
60
+ }
61
+ export type { OmTileData };
@@ -26,6 +26,8 @@ export interface OmLayerProps {
26
26
  flush?: string;
27
27
  /** Polling interval for REST snapshot URLs, e.g. "5s". */
28
28
  refresh?: string;
29
+ /** Behavior under active map terrain; absent uses the layer type's default. */
30
+ terrain?: "drape" | "offset" | "off";
29
31
  /** deck.gl updateTriggers — supply a changing value when an accessor's OUTPUT changes (deck ignores function identity). */
30
32
  updateTriggers?: Record<string, unknown>;
31
33
  /** Click pick on this layer (object flattened/materialized, same as ctx.selection). */
package/dist/react.js CHANGED
@@ -1,7 +1,7 @@
1
1
  var J = Object.defineProperty;
2
2
  var Q = (e, t, n) => t in e ? J(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var A = (e, t, n) => Q(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { jsxs as U, jsx as x } from "react/jsx-runtime";
4
+ import { jsxs as U, jsx as C } from "react/jsx-runtime";
5
5
  import { createContext as X, useContext as Y, forwardRef as Z, useRef as f, useState as k, useCallback as ee, useMemo as I, useLayoutEffect as te, useEffect as g, useImperativeHandle as re } from "react";
6
6
  import { MapController as ne } from "@nika-js/onlymap";
7
7
  import { createPortal as B } from "react-dom";
@@ -53,7 +53,7 @@ function ie(e, t) {
53
53
  return Object.entries(t).some(([n, r]) => r !== void 0 && e[n] !== r);
54
54
  }
55
55
  const he = Z(function(t, n) {
56
- const { center: r, zoom: l, pitch: a, bearing: u, basemap: i, basemapKey: c, attribution: y, headless: m, className: O, style: z, children: R } = t, d = f(null), [o, T] = k(null), [C, M] = k(null), [j, L] = k({
56
+ const { center: r, zoom: l, pitch: a, bearing: u, basemap: i, basemapKey: c, attribution: y, headless: m, className: O, style: z, children: R } = t, d = f(null), [o, T] = k(null), [p, M] = k(null), [j, L] = k({
57
57
  "top-left": null,
58
58
  "top-right": null,
59
59
  "bottom-left": null,
@@ -65,7 +65,7 @@ const he = Z(function(t, n) {
65
65
  q.map((s) => [
66
66
  s,
67
67
  (h) => {
68
- L((p) => p[s] === h ? p : { ...p, [s]: h });
68
+ L((x) => x[s] === h ? x : { ...x, [s]: h });
69
69
  }
70
70
  ])
71
71
  ),
@@ -100,12 +100,12 @@ const he = Z(function(t, n) {
100
100
  }
101
101
  });
102
102
  T(h);
103
- let p = !0;
103
+ let x = !0;
104
104
  return h.ready.then(() => {
105
105
  var F;
106
- p && ((F = b.current) == null || F.call(b));
106
+ x && ((F = b.current) == null || F.call(b));
107
107
  }), () => {
108
- p = !1, T(null), h.destroy();
108
+ x = !1, T(null), h.destroy();
109
109
  };
110
110
  }, [G]), g(() => {
111
111
  !o || V.current === i || (V.current = i, o.setBasemap(i ?? null));
@@ -121,19 +121,19 @@ const he = Z(function(t, n) {
121
121
  });
122
122
  }, [o]);
123
123
  const W = I(() => o ? new se(o) : null, [o]), _ = I(
124
- () => o && W && C ? { controller: o, layers: W, overlayPane: C, corners: j } : null,
125
- [o, W, C, j]
124
+ () => o && W && p ? { controller: o, layers: W, overlayPane: p, corners: j } : null,
125
+ [o, W, p, j]
126
126
  );
127
127
  return /* @__PURE__ */ U("div", { className: O, style: { position: "relative", overflow: "hidden", ...z }, children: [
128
- /* @__PURE__ */ x("div", { ref: d, style: { position: "absolute", inset: 0 } }),
129
- /* @__PURE__ */ x(
128
+ /* @__PURE__ */ C("div", { ref: d, style: { position: "absolute", inset: 0 } }),
129
+ /* @__PURE__ */ C(
130
130
  "div",
131
131
  {
132
132
  ref: v,
133
133
  style: { position: "absolute", top: 0, left: 0, zIndex: 10, pointerEvents: "none" }
134
134
  }
135
135
  ),
136
- q.map((s) => /* @__PURE__ */ x(
136
+ q.map((s) => /* @__PURE__ */ C(
137
137
  "div",
138
138
  {
139
139
  "data-om-widget-corner": s,
@@ -142,7 +142,7 @@ const he = Z(function(t, n) {
142
142
  },
143
143
  s
144
144
  )),
145
- _ && /* @__PURE__ */ x(H.Provider, { value: _, children: R })
145
+ _ && /* @__PURE__ */ C(H.Provider, { value: _, children: R })
146
146
  ] });
147
147
  }), ae = /* @__PURE__ */ new Set([
148
148
  "id",
@@ -159,6 +159,7 @@ const he = Z(function(t, n) {
159
159
  "streamKey",
160
160
  "flush",
161
161
  "refresh",
162
+ "terrain",
162
163
  "updateTriggers",
163
164
  "onClick",
164
165
  "onHover"
@@ -182,6 +183,7 @@ function ge(e) {
182
183
  key: e.streamKey,
183
184
  flush: e.flush,
184
185
  refresh: e.refresh,
186
+ terrain: e.terrain,
185
187
  updateTriggers: e.updateTriggers,
186
188
  props: l
187
189
  };
@@ -206,7 +208,7 @@ function ge(e) {
206
208
  function ve({ position: e = "top-left", className: t, style: n, children: r }) {
207
209
  const { corners: l } = K("OmWidget"), a = l[e];
208
210
  return a ? B(
209
- /* @__PURE__ */ x("div", { className: t, style: { pointerEvents: "auto", ...n }, children: r }),
211
+ /* @__PURE__ */ C("div", { className: t, style: { pointerEvents: "auto", ...n }, children: r }),
210
212
  a
211
213
  ) : null;
212
214
  }
@@ -227,9 +229,9 @@ function be(e) {
227
229
  () => t.registerOverlay((R, d) => {
228
230
  const o = r.current;
229
231
  if (!o) return;
230
- const { anchor: T, anchorFrom: C, layer: M, visible: j = !0, anchorOffset: L } = i.current;
232
+ const { anchor: T, anchorFrom: p, layer: M, visible: j = !0, anchorOffset: L } = i.current;
231
233
  let v;
232
- if (C === "selection" ? ((!M || (d == null ? void 0 : d.layerId) === M) && (l.current = (d == null ? void 0 : d.coordinate) ?? void 0, u(d)), v = l.current) : v = T, !j || !v || !R) {
234
+ if (p === "selection" ? ((!M || (d == null ? void 0 : d.layerId) === M) && (l.current = (d == null ? void 0 : d.coordinate) ?? void 0, u(d)), v = l.current) : v = T, !j || !v || !R) {
233
235
  o.style.visibility = "hidden";
234
236
  return;
235
237
  }
@@ -246,7 +248,7 @@ function be(e) {
246
248
  });
247
249
  const { children: c, className: y, style: m, interactive: O = !0 } = e, z = typeof c == "function" ? c(a) : c;
248
250
  return B(
249
- /* @__PURE__ */ x(
251
+ /* @__PURE__ */ C(
250
252
  "div",
251
253
  {
252
254
  ref: r,