@nika-js/onlymap 0.2.3 → 0.3.0
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/README.md +29 -7
- package/dist/{basemap-BdvB-SHy.js → basemap-DrK6zcu8.js} +2337 -2273
- package/dist/basemap-registry.d.ts +10 -0
- package/dist/basemap.d.ts +23 -0
- package/dist/color.d.ts +9 -0
- package/dist/deck.d.ts +28 -0
- package/dist/deck.js +16 -0
- package/dist/elements/om-map.d.ts +29 -0
- package/dist/html-data.d.ts +2 -2
- package/dist/{index-CJOMgp8k.js → index-C9tgnPNw.js} +1 -1
- package/dist/{index-CvBHiOGD.js → index-CiuGqS0i.js} +2 -2
- package/dist/{index-BxzDKZpu.js → index-CsicbycJ.js} +16599 -15089
- package/dist/{index-BVQ0s1Zh.js → index-DXoRERAy.js} +1 -1
- package/dist/{index-Vc8QfNEf.js → index-Ztkd30f8.js} +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/ir-snapshot.d.ts +2 -0
- package/dist/ir.d.ts +7 -0
- package/dist/onlymapjs.js +54 -35
- package/dist/onlymapjs.umd.cjs +423 -349
- package/dist/programmatic.d.ts +35 -0
- package/dist/react/om-layer.d.ts +2 -0
- package/dist/react.js +18 -16
- package/dist/runtime-core.d.ts +73 -1
- package/dist/scene-lighting.d.ts +83 -0
- package/dist/selection.d.ts +1 -1
- package/dist/snapshot.d.ts +14 -0
- package/dist/terrain.d.ts +113 -0
- package/dist/version.d.ts +1 -1
- package/docs/custom-layers.md +99 -0
- package/llms.txt +4 -4
- package/onlymapjs.html-data.json +140 -29
- package/package.json +20 -3
- package/skills/onlymapjs/SKILL.md +1 -1
- package/skills/onlymapjs/references/syntax.md +24 -1
|
@@ -23,6 +23,14 @@ export interface BasemapPreset {
|
|
|
23
23
|
}
|
|
24
24
|
/** MapLibre's own official, freely-hosted demo style — the zero-config `basemap="maplibre"` default (back-compat). */
|
|
25
25
|
export declare const MAPLIBRE_DEMO_STYLE = "https://demotiles.maplibre.org/style.json";
|
|
26
|
+
/**
|
|
27
|
+
* Is this `basemap` value a bring-your-own style URL rather than a preset
|
|
28
|
+
* name? Any URL scheme counts, not just http(s) — desktop webviews serve
|
|
29
|
+
* styles over custom protocols (Tauri `asset://` / `nika-file://`, Electron
|
|
30
|
+
* equivalents), and a query string must not defeat the `.json` path form
|
|
31
|
+
* (`nika-file:///styles/dark.json?v=2`).
|
|
32
|
+
*/
|
|
33
|
+
export declare function isStyleUrl(raw: string): boolean;
|
|
26
34
|
export declare function registerBasemap(name: string, preset: BasemapPreset): void;
|
|
27
35
|
export declare function getBasemap(name: string): BasemapPreset | undefined;
|
|
28
36
|
export declare function getAllBasemaps(): ReadonlyMap<string, BasemapPreset>;
|
|
@@ -32,6 +40,8 @@ export declare function configureBasemap(config: {
|
|
|
32
40
|
}): void;
|
|
33
41
|
/** Static-validation support: is a key available for this provider (from configureBasemap)? */
|
|
34
42
|
export declare function hasConfiguredKey(provider: "maptiler"): boolean;
|
|
43
|
+
/** The configured key itself — terrain presets substitute it the way resolveBasemapStyle does (publishable client key, internal use). */
|
|
44
|
+
export declare function getConfiguredKey(provider: "maptiler"): string | undefined;
|
|
35
45
|
export interface ResolvedBasemap {
|
|
36
46
|
style: BasemapStyle;
|
|
37
47
|
attribution?: string;
|
package/dist/basemap.d.ts
CHANGED
|
@@ -46,11 +46,34 @@ export declare class MapLibreBasemapAdapter {
|
|
|
46
46
|
pitch?: number;
|
|
47
47
|
bearing?: number;
|
|
48
48
|
}, deckProps: DeckProps, showAttribution?: boolean);
|
|
49
|
+
/** Snapshot capture queue for the overlay's deck canvas — see captureComposite. */
|
|
50
|
+
private deckCaptures;
|
|
51
|
+
/** In-flight captureComposite rejects — destroy() settles them so a caller never hangs on a torn-down renderer. */
|
|
52
|
+
private pendingCaptureRejects;
|
|
53
|
+
private drainDeckCaptures;
|
|
54
|
+
/**
|
|
55
|
+
* Scene snapshot (spec: "Snapshot API") — one composite canvas of the
|
|
56
|
+
* basemap + deck canvases at device pixels. Neither context keeps its
|
|
57
|
+
* drawing buffer, so each canvas is copied synchronously inside its own
|
|
58
|
+
* post-render callback after a forced repaint: the basemap via
|
|
59
|
+
* `map.once("render")` + triggerRepaint, the deck canvas via the
|
|
60
|
+
* overlay's onAfterRender (forced through the overlay's internal Deck —
|
|
61
|
+
* private-by-underscore, but it's OUR bundled deck, `redraw(reason)` is
|
|
62
|
+
* public Deck API, and the access is optional-chained).
|
|
63
|
+
*/
|
|
64
|
+
captureComposite(): Promise<HTMLCanvasElement>;
|
|
49
65
|
private markInitialized;
|
|
50
66
|
onLoad(cb: () => void): void;
|
|
51
67
|
/** Fires continuously during pan/zoom/rotate — MapLibre's own camera-change event, standing in for deck's onViewStateChange (which doesn't apply — deck isn't driving the camera). */
|
|
52
68
|
onMove(cb: () => void): void;
|
|
53
69
|
setLayers(layers: DeckProps["layers"]): void;
|
|
70
|
+
/**
|
|
71
|
+
* Scene lighting (spec: "Scene Lighting") — MapboxOverlay accepts full
|
|
72
|
+
* DeckProps, effects included. An effects-only setProps doesn't mark the
|
|
73
|
+
* basemap frame dirty, so nudge a repaint; the overlay redraws with the
|
|
74
|
+
* map's render pass.
|
|
75
|
+
*/
|
|
76
|
+
setEffects(effects: DeckProps["effects"]): void;
|
|
54
77
|
/**
|
|
55
78
|
* Live basemap switch (spec: "Basemap presets & switching"). Deck layers
|
|
56
79
|
* survive BY CONSTRUCTION: the MapboxOverlay is a map control, not style
|
package/dist/color.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS color string → deck.gl RGB(A) array. Shared by attribute coercion
|
|
3
|
+
* (color-typed scalar attributes, `color` shorthands) and the expression
|
|
4
|
+
* compiler (color-shaped accessors returning strings — the documented
|
|
5
|
+
* "hex color string" output form). Extracted from attribute-resolution.ts
|
|
6
|
+
* so the expr module can use it without an import cycle.
|
|
7
|
+
*/
|
|
8
|
+
export declare function hexToRgb(raw: string): number[] | undefined;
|
|
9
|
+
export declare function cssColorToRgb(raw: string): number[] | undefined;
|
package/dist/deck.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @nika-js/onlymap/deck — the bundled deck.gl escape hatch.
|
|
3
|
+
*
|
|
4
|
+
* OnlyMapJS bundles deck.gl (zero runtime deps). A custom layer registered
|
|
5
|
+
* with `OmMap.registerLayer({ deckClass })` is constructed by the BUNDLED
|
|
6
|
+
* Deck — if that class extends a consumer-installed `@deck.gl/*` copy, it
|
|
7
|
+
* belongs to a different class hierarchy (two `Layer` base classes, two
|
|
8
|
+
* luma.gl runtimes) and breaks inside the core's LayerManager. Build shims
|
|
9
|
+
* on THESE re-exports instead: they are the same class objects the core
|
|
10
|
+
* renders with.
|
|
11
|
+
*
|
|
12
|
+
* The values come from the root entry through a package self-reference
|
|
13
|
+
* (external in the dist build, the react-subpath pattern), so the consumer's
|
|
14
|
+
* bundler shares one core instance between both entries — class identity is
|
|
15
|
+
* structural, not luck. Types re-exported from @deck.gl/core are erased at
|
|
16
|
+
* build; consumers who typecheck against them need @deck.gl/core installed
|
|
17
|
+
* (dev-only), same as the core's own published .d.ts files.
|
|
18
|
+
*
|
|
19
|
+
* import { CompositeLayer, TileLayer, BitmapLayer } from "@nika-js/onlymap/deck";
|
|
20
|
+
* class MyRasterLayer extends CompositeLayer { ... }
|
|
21
|
+
* OmMap.registerLayer({ type: "MyRasterLayer", deckClass: MyRasterLayer, props: [...] });
|
|
22
|
+
*
|
|
23
|
+
* Register before inserting the manifest (module top level): registering a
|
|
24
|
+
* type after mount does not retrigger reconciles — an unknown-type layer is
|
|
25
|
+
* warn-skipped until the next DOM mutation.
|
|
26
|
+
*/
|
|
27
|
+
export { Layer, CompositeLayer, LayerExtension, WebMercatorViewport, COORDINATE_SYSTEM, GeoJsonLayer, ScatterplotLayer, IconLayer, BitmapLayer, TileLayer, Tile3DLayer, SimpleMeshLayer, ScenegraphLayer, } from "@nika-js/onlymap";
|
|
28
|
+
export type { LayerProps, CompositeLayerProps, DefaultProps, UpdateParameters, PickingInfo, LayersList } from "@deck.gl/core";
|
package/dist/deck.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BitmapLayer as a, COORDINATE_SYSTEM as o, CompositeLayer as y, GeoJsonLayer as L, IconLayer as t, Layer as i, LayerExtension as p, ScatterplotLayer as n, ScenegraphLayer as S, SimpleMeshLayer as c, Tile3DLayer as l, TileLayer as m, WebMercatorViewport as s } from "@nika-js/onlymap";
|
|
2
|
+
export {
|
|
3
|
+
a as BitmapLayer,
|
|
4
|
+
o as COORDINATE_SYSTEM,
|
|
5
|
+
y as CompositeLayer,
|
|
6
|
+
L as GeoJsonLayer,
|
|
7
|
+
t as IconLayer,
|
|
8
|
+
i as Layer,
|
|
9
|
+
p as LayerExtension,
|
|
10
|
+
n as ScatterplotLayer,
|
|
11
|
+
S as ScenegraphLayer,
|
|
12
|
+
c as SimpleMeshLayer,
|
|
13
|
+
l as Tile3DLayer,
|
|
14
|
+
m as TileLayer,
|
|
15
|
+
s as WebMercatorViewport
|
|
16
|
+
};
|
|
@@ -19,6 +19,9 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import { HTMLElementBase } from "../env";
|
|
21
21
|
import { type RuntimeContext } from "../ctx";
|
|
22
|
+
import { type LightingIR } from "../scene-lighting";
|
|
23
|
+
import { type TerrainIR } from "../terrain";
|
|
24
|
+
import { type SnapshotOptions } from "../snapshot";
|
|
22
25
|
import type { LayerIR } from "../ir";
|
|
23
26
|
import type { Selection } from "../selection";
|
|
24
27
|
import type { MapViewport } from "../basemap";
|
|
@@ -44,11 +47,14 @@ export declare class OmMapElement extends HTMLElementBase {
|
|
|
44
47
|
private readyFired;
|
|
45
48
|
private resolveReady;
|
|
46
49
|
readonly ready: Promise<void>;
|
|
50
|
+
private viewChangedTimer;
|
|
47
51
|
private firstReconcileDone;
|
|
48
52
|
private rendererLoadPending;
|
|
49
53
|
private loadDispatched;
|
|
50
54
|
connectedCallback(): void;
|
|
51
55
|
disconnectedCallback(): void;
|
|
56
|
+
/** Trailing-debounced `om-view-changed` dispatch — see the field's doc comment. */
|
|
57
|
+
private scheduleViewChangedEvent;
|
|
52
58
|
registerWidgetInternal(el: Element, watch: string[], notify: (ctx: RuntimeContext) => void): void;
|
|
53
59
|
unregisterWidgetInternal(el: Element): void;
|
|
54
60
|
registerOverlayInternal(overlay: OverlayHost): void;
|
|
@@ -125,6 +131,19 @@ export declare class OmMapElement extends HTMLElementBase {
|
|
|
125
131
|
pitch: number;
|
|
126
132
|
bearing: number;
|
|
127
133
|
} | undefined;
|
|
134
|
+
/** Resolved scene-lighting IR (headless test inspection) — null = deck default lights. */
|
|
135
|
+
getLightingInternal(): LightingIR | null;
|
|
136
|
+
/** Resolved terrain IR (headless test inspection) — null = no surface. */
|
|
137
|
+
getTerrainInternal(): TerrainIR | null;
|
|
138
|
+
/**
|
|
139
|
+
* Canvas-only scene snapshot (spec: "Snapshot API") — basemap + deck
|
|
140
|
+
* composited at device pixels. DOM widgets/overlays/badge/attribution are
|
|
141
|
+
* NOT captured: consumers exporting imagery must render provider credits
|
|
142
|
+
* themselves. Await `ready` first; headless maps reject.
|
|
143
|
+
*/
|
|
144
|
+
snapshot(opts?: SnapshotOptions): Promise<string | Blob>;
|
|
145
|
+
/** terrain* attributes → IR, key-substituted like basemap presets; resolution problems log once per apply. */
|
|
146
|
+
private resolveTerrainAttr;
|
|
128
147
|
/** Projects a lng/lat through the current viewport (harness pixel derivation) — undefined before the viewport resolves. */
|
|
129
148
|
projectInternal(lngLat: [number, number]): [number, number] | undefined;
|
|
130
149
|
/** Renderer finished async init — defer to the first reconcile if it hasn't run yet (see the field comment). */
|
|
@@ -165,5 +184,15 @@ declare global {
|
|
|
165
184
|
interface HTMLElementTagNameMap {
|
|
166
185
|
"om-map": OmMapElement;
|
|
167
186
|
}
|
|
187
|
+
interface HTMLElementEventMap {
|
|
188
|
+
/** Camera settled (trailing-debounced) — detail is the full camera state. */
|
|
189
|
+
"om-view-changed": CustomEvent<{
|
|
190
|
+
longitude: number;
|
|
191
|
+
latitude: number;
|
|
192
|
+
zoom: number;
|
|
193
|
+
pitch: number;
|
|
194
|
+
bearing: number;
|
|
195
|
+
}>;
|
|
196
|
+
}
|
|
168
197
|
}
|
|
169
198
|
export {};
|
package/dist/html-data.d.ts
CHANGED
|
@@ -15,9 +15,9 @@ interface TagData {
|
|
|
15
15
|
}[];
|
|
16
16
|
}
|
|
17
17
|
/** Hand-authored action list — validated against hasAction() in html-data.test.ts. */
|
|
18
|
-
export declare const BUILTIN_ACTIONS: readonly ["toggle-layer", "zoom-in", "zoom-out", "filter-layer", "highlight-feature", "fade", "pulse", "populate", "trace", "story-play", "story-pause", "story-seek", "fly-to", "zoom-to-feature", "show-overlay", "hide-overlay", "show-tooltip", "hide-tooltip", "draw-mode", "draw-commit", "draw-cancel", "draw-delete", "draw-clear", "draw-config", "draw-save", "set-basemap", "undo", "redo"];
|
|
18
|
+
export declare const BUILTIN_ACTIONS: readonly ["toggle-layer", "zoom-in", "zoom-out", "filter-layer", "highlight-feature", "fade", "pulse", "populate", "trace", "story-play", "story-pause", "story-seek", "fly-to", "zoom-to-feature", "show-overlay", "hide-overlay", "show-tooltip", "hide-tooltip", "draw-mode", "draw-commit", "draw-cancel", "draw-delete", "draw-clear", "draw-config", "draw-save", "set-basemap", "set-lighting", "set-terrain", "undo", "redo"];
|
|
19
19
|
/** Hand-authored widget types — validated against the widget registry in html-data.test.ts. */
|
|
20
|
-
export declare const BUILTIN_WIDGETS: readonly ["legend", "layer-switcher", "zoom-controls", "scale-bar", "attribution", "filter", "vega-lite", "player", "draw", "basemap-switcher", "undo-redo"];
|
|
20
|
+
export declare const BUILTIN_WIDGETS: readonly ["legend", "layer-switcher", "zoom-controls", "scale-bar", "attribution", "filter", "vega-lite", "player", "draw", "basemap-switcher", "lighting", "undo-redo"];
|
|
21
21
|
export declare function buildHtmlCustomData(): {
|
|
22
22
|
version: number;
|
|
23
23
|
tags: TagData[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var R = Object.defineProperty;
|
|
2
2
|
var N = (t, e, r) => e in t ? R(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
3
|
var u = (t, e, r) => N(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
-
import { c as W, W as x, d as O, e as _, f as m, h as g, j as P, s as z, n as I, k as B, m as k, o as $, p as C, q as F, r as M, u as U, v as D, w as L, x as j, y as v, z as T, A as J } from "./index-
|
|
5
|
-
import { F as Ue, R as De, _ as je, B as ve, C as Je, D as qe, E as Ve, G as Ge, H as He, I as Ke, J as Qe, K as Xe, L as Ye, M as Ze, N as er, O as rr, P as tr, Q as nr, S as ar, T as sr, U as cr, V as or, X as ir, Y as ur, Z as fr } from "./index-
|
|
4
|
+
import { c as W, W as x, d as O, e as _, f as m, h as g, j as P, s as z, n as I, k as B, m as k, o as $, p as C, q as F, r as M, u as U, v as D, w as L, x as j, y as v, z as T, A as J } from "./index-CsicbycJ.js";
|
|
5
|
+
import { F as Ue, R as De, _ as je, B as ve, C as Je, D as qe, E as Ve, G as Ge, H as He, I as Ke, J as Qe, K as Xe, L as Ye, M as Ze, N as er, O as rr, P as tr, Q as nr, S as ar, T as sr, U as cr, V as or, X as ir, Y as ur, Z as fr } from "./index-CsicbycJ.js";
|
|
6
6
|
import { g as q, i as V } from "./table-accessors-DBjWgN0C.js";
|
|
7
7
|
async function G(t, e, r = {}, n = {}) {
|
|
8
8
|
const a = W(t), s = x.getWorkerFarm(r), { source: c } = r, o = { name: a, source: c };
|